Commit bbef48c77c157da895973a550001fa8df6741b91
1 parent
5eb3da0b
Replaced observed parameters by GEvent in irf_ptsrc(), irf_extended() and irf_diffuse() methods.
Showing
3 changed files
with
27 additions
and
51 deletions
include/GResponse.hpp
| ... | ... | @@ -90,23 +90,17 @@ public: |
| 90 | 90 | const GEnergy& srcEng, |
| 91 | 91 | const GTime& srcTime, |
| 92 | 92 | const GObservation& obs) const; |
| 93 | - virtual double irf_ptsrc(const GInstDir& obsDir, | |
| 94 | - const GEnergy& obsEng, | |
| 95 | - const GTime& obsTime, | |
| 93 | + virtual double irf_ptsrc(const GEvent& event, | |
| 96 | 94 | const GModelPointSource& model, |
| 97 | 95 | const GEnergy& srcEng, |
| 98 | 96 | const GTime& srcTime, |
| 99 | - const GObservation& obs) const; | |
| 100 | - virtual double irf_extended(const GInstDir& obsDir, | |
| 101 | - const GEnergy& obsEng, | |
| 102 | - const GTime& obsTime, | |
| 97 | + const GObservation& obs) const; | |
| 98 | + virtual double irf_extended(const GEvent& event, | |
| 103 | 99 | const GModelExtendedSource& model, |
| 104 | 100 | const GEnergy& srcEng, |
| 105 | 101 | const GTime& srcTime, |
| 106 | 102 | const GObservation& obs) const; |
| 107 | - virtual double irf_diffuse(const GInstDir& obsDir, | |
| 108 | - const GEnergy& obsEng, | |
| 109 | - const GTime& obsTime, | |
| 103 | + virtual double irf_diffuse(const GEvent& event, | |
| 110 | 104 | const GModelDiffuseSource& model, |
| 111 | 105 | const GEnergy& srcEng, |
| 112 | 106 | const GTime& srcTime, | ... | ... |
pyext/GResponse.i
| ... | ... | @@ -60,23 +60,17 @@ public: |
| 60 | 60 | const GEnergy& srcEng, |
| 61 | 61 | const GTime& srcTime, |
| 62 | 62 | const GObservation& obs) const; |
| 63 | - virtual double irf_ptsrc(const GInstDir& obsDir, | |
| 64 | - const GEnergy& obsEng, | |
| 65 | - const GTime& obsTime, | |
| 63 | + virtual double irf_ptsrc(const GEvent& event, | |
| 66 | 64 | const GModelPointSource& model, |
| 67 | 65 | const GEnergy& srcEng, |
| 68 | 66 | const GTime& srcTime, |
| 69 | 67 | const GObservation& obs) const; |
| 70 | - virtual double irf_extended(const GInstDir& obsDir, | |
| 71 | - const GEnergy& obsEng, | |
| 72 | - const GTime& obsTime, | |
| 68 | + virtual double irf_extended(const GEvent& event, | |
| 73 | 69 | const GModelExtendedSource& model, |
| 74 | 70 | const GEnergy& srcEng, |
| 75 | 71 | const GTime& srcTime, |
| 76 | 72 | const GObservation& obs) const; |
| 77 | - virtual double irf_diffuse(const GInstDir& obsDir, | |
| 78 | - const GEnergy& obsEng, | |
| 79 | - const GTime& obsTime, | |
| 73 | + virtual double irf_diffuse(const GEvent& event, | |
| 80 | 74 | const GModelDiffuseSource& model, |
| 81 | 75 | const GEnergy& srcEng, |
| 82 | 76 | const GTime& srcTime, | ... | ... |
src/obs/GResponse.cpp
| ... | ... | @@ -179,16 +179,13 @@ double GResponse::irf(const GEvent& event, |
| 179 | 179 | |
| 180 | 180 | // Call model dependent method |
| 181 | 181 | if (ptsrc != NULL) { |
| 182 | - irf = irf_ptsrc(event.dir(), event.energy(), event.time(), | |
| 183 | - *ptsrc, srcEng, srcTime, obs); | |
| 182 | + irf = irf_ptsrc(event, *ptsrc, srcEng, srcTime, obs); | |
| 184 | 183 | } |
| 185 | 184 | else if (extsrc != NULL) { |
| 186 | - irf = irf_extended(event.dir(), event.energy(), event.time(), | |
| 187 | - *extsrc, srcEng, srcTime, obs); | |
| 185 | + irf = irf_extended(event, *extsrc, srcEng, srcTime, obs); | |
| 188 | 186 | } |
| 189 | 187 | else if (difsrc != NULL) { |
| 190 | - irf = irf_diffuse(event.dir(), event.energy(), event.time(), | |
| 191 | - *difsrc, srcEng, srcTime, obs); | |
| 188 | + irf = irf_diffuse(event, *difsrc, srcEng, srcTime, obs); | |
| 192 | 189 | } |
| 193 | 190 | |
| 194 | 191 | // Apply deadtime correction |
| ... | ... | @@ -202,27 +199,23 @@ double GResponse::irf(const GEvent& event, |
| 202 | 199 | /***********************************************************************//** |
| 203 | 200 | * @brief Return value of point source instrument response function |
| 204 | 201 | * |
| 205 | - * @param[in] obsDir Observed photon direction. | |
| 206 | - * @param[in] obsEng Observed energy of photon. | |
| 207 | - * @param[in] obsTime Observed photon arrival time. | |
| 202 | + * @param[in] event Observed event. | |
| 208 | 203 | * @param[in] model Point source model. |
| 209 | 204 | * @param[in] srcEng True energy of photon. |
| 210 | 205 | * @param[in] srcTime True photon arrival time. |
| 211 | 206 | * @param[in] obs Observation. |
| 212 | 207 | ***************************************************************************/ |
| 213 | -double GResponse::irf_ptsrc(const GInstDir& obsDir, | |
| 214 | - const GEnergy& obsEng, | |
| 215 | - const GTime& obsTime, | |
| 208 | +double GResponse::irf_ptsrc(const GEvent& event, | |
| 216 | 209 | const GModelPointSource& model, |
| 217 | 210 | const GEnergy& srcEng, |
| 218 | 211 | const GTime& srcTime, |
| 219 | 212 | const GObservation& obs) const |
| 220 | 213 | { |
| 221 | - // Get point source location | |
| 222 | - GSkyDir srcDir = model.dir(); | |
| 223 | - | |
| 214 | + // Set Photon | |
| 215 | + GPhoton photon(model.dir(), srcEng, srcTime); | |
| 216 | + | |
| 224 | 217 | // Compute IRF |
| 225 | - double irf = this->irf(obsDir, obsEng, obsTime, srcDir, srcEng, srcTime, obs); | |
| 218 | + double irf = this->irf(event, photon, obs); | |
| 226 | 219 | |
| 227 | 220 | // Return IRF |
| 228 | 221 | return irf; |
| ... | ... | @@ -232,9 +225,7 @@ double GResponse::irf_ptsrc(const GInstDir& obsDir, |
| 232 | 225 | /***********************************************************************//** |
| 233 | 226 | * @brief Return value of extended source instrument response function |
| 234 | 227 | * |
| 235 | - * @param[in] obsDir Observed photon direction. | |
| 236 | - * @param[in] obsEng Observed energy of photon. | |
| 237 | - * @param[in] obsTime Observed photon arrival time. | |
| 228 | + * @param[in] event Observed event. | |
| 238 | 229 | * @param[in] model Exteded source model. |
| 239 | 230 | * @param[in] srcEng True energy of photon. |
| 240 | 231 | * @param[in] srcTime True photon arrival time. |
| ... | ... | @@ -242,9 +233,7 @@ double GResponse::irf_ptsrc(const GInstDir& obsDir, |
| 242 | 233 | * |
| 243 | 234 | * @todo Generic method is not yet implemented. |
| 244 | 235 | ***************************************************************************/ |
| 245 | -double GResponse::irf_extended(const GInstDir& obsDir, | |
| 246 | - const GEnergy& obsEng, | |
| 247 | - const GTime& obsTime, | |
| 236 | +double GResponse::irf_extended(const GEvent& event, | |
| 248 | 237 | const GModelExtendedSource& model, |
| 249 | 238 | const GEnergy& srcEng, |
| 250 | 239 | const GTime& srcTime, |
| ... | ... | @@ -262,9 +251,7 @@ double GResponse::irf_extended(const GInstDir& obsDir, |
| 262 | 251 | /***********************************************************************//** |
| 263 | 252 | * @brief Return value of diffuse source instrument response function |
| 264 | 253 | * |
| 265 | - * @param[in] obsDir Observed photon direction. | |
| 266 | - * @param[in] obsEng Observed energy of photon. | |
| 267 | - * @param[in] obsTime Observed photon arrival time. | |
| 254 | + * @param[in] event Observed event. | |
| 268 | 255 | * @param[in] model Diffuse source model. |
| 269 | 256 | * @param[in] srcEng True energy of photon. |
| 270 | 257 | * @param[in] srcTime True photon arrival time. |
| ... | ... | @@ -272,9 +259,7 @@ double GResponse::irf_extended(const GInstDir& obsDir, |
| 272 | 259 | * |
| 273 | 260 | * @todo Generic method is not yet implemented. |
| 274 | 261 | ***************************************************************************/ |
| 275 | -double GResponse::irf_diffuse(const GInstDir& obsDir, | |
| 276 | - const GEnergy& obsEng, | |
| 277 | - const GTime& obsTime, | |
| 262 | +double GResponse::irf_diffuse(const GEvent& event, | |
| 278 | 263 | const GModelDiffuseSource& model, |
| 279 | 264 | const GEnergy& srcEng, |
| 280 | 265 | const GTime& srcTime, |
| ... | ... | @@ -352,11 +337,11 @@ double GResponse::npred_ptsrc(const GModelPointSource& model, |
| 352 | 337 | const GTime& srcTime, |
| 353 | 338 | const GObservation& obs) const |
| 354 | 339 | { |
| 355 | - // Get point source location | |
| 356 | - GSkyDir srcDir = model.dir(); | |
| 340 | + // Set photon | |
| 341 | + GPhoton photon(model.dir(), srcEng, srcTime); | |
| 357 | 342 | |
| 358 | 343 | // Compute Npred |
| 359 | - double npred = this->npred(srcDir, srcEng, srcTime, obs); | |
| 344 | + double npred = this->npred(photon, obs); | |
| 360 | 345 | |
| 361 | 346 | // Return Npred |
| 362 | 347 | return npred; |
| ... | ... | @@ -565,8 +550,11 @@ double GResponse::npred_kern_phi::eval(double phi) |
| 565 | 550 | GSkyDir srcDir; |
| 566 | 551 | srcDir.celvector(cel); |
| 567 | 552 | |
| 553 | + // Set photon | |
| 554 | + GPhoton photon(srcDir, *m_srcEng, *m_srcTime); | |
| 555 | + | |
| 568 | 556 | // Compute Npred for this sky direction |
| 569 | - double npred = m_rsp->npred(srcDir, *m_srcEng, *m_srcTime, *m_obs); | |
| 557 | + double npred = m_rsp->npred(photon, *m_obs); | |
| 570 | 558 | |
| 571 | 559 | // Debug: Check for NaN |
| 572 | 560 | #if defined(G_NAN_CHECK) | ... | ... |