Commit 1d494a9632a8a38e4913e4af89f679033f38ee2c
1 parent
490fa5bc
Add skymap overlap check to PSF and Edisp cubes (#1980)
Add a check in GCTACubePsf and GCTACubeEdisp for whether an observation overlaps with the cube before attempting to fill it into the skymap.
Showing
2 changed files
with
28 additions
and
0 deletions
inst/cta/src/GCTACubeEdisp.cpp
| ... | ... | @@ -866,6 +866,20 @@ void GCTACubeEdisp::fill_cube(const GCTAObservation& obs, |
| 866 | 866 | "to specify an RoI for this observation."; |
| 867 | 867 | throw GException::invalid_value(G_FILL_CUBE, msg); |
| 868 | 868 | } |
| 869 | + | |
| 870 | + // Make sure the observation falls within the bounds of the cube | |
| 871 | + GSkyRegionCircle obs_reg(roi.centre().dir(), roi.radius()); | |
| 872 | + if (!m_cube.overlaps(obs_reg)) { | |
| 873 | + if (log != NULL) { | |
| 874 | + *log << "Skipping unbinned "; | |
| 875 | + *log << obs.instrument(); | |
| 876 | + *log << " observation "; | |
| 877 | + *log << "\"" << obs.name() << "\""; | |
| 878 | + *log << " (id=" << obs.id() << ") which does not overlap Edisp cube."; | |
| 879 | + *log << std::endl; | |
| 880 | + } | |
| 881 | + return; | |
| 882 | + } | |
| 869 | 883 | |
| 870 | 884 | // Extract response from observation |
| 871 | 885 | const GCTAResponseIrf* rsp = dynamic_cast<const GCTAResponseIrf*> | ... | ... |
inst/cta/src/GCTACubePsf.cpp
| ... | ... | @@ -787,6 +787,20 @@ void GCTACubePsf::fill_cube(const GCTAObservation& obs, |
| 787 | 787 | throw GException::invalid_value(G_FILL_CUBE, msg); |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | + // Make sure the observation falls within the bounds of the cube | |
| 791 | + GSkyRegionCircle obs_reg(roi.centre().dir(), roi.radius()); | |
| 792 | + if (!m_cube.overlaps(obs_reg)) { | |
| 793 | + if (log != NULL) { | |
| 794 | + *log << "Skipping unbinned "; | |
| 795 | + *log << obs.instrument(); | |
| 796 | + *log << " observation "; | |
| 797 | + *log << "\"" << obs.name() << "\""; | |
| 798 | + *log << " (id=" << obs.id() << ") which does not overlap PSF cube."; | |
| 799 | + *log << std::endl; | |
| 800 | + } | |
| 801 | + return; | |
| 802 | + } | |
| 803 | + | |
| 790 | 804 | // Extract response from observation |
| 791 | 805 | const GCTAResponseIrf* rsp = dynamic_cast<const GCTAResponseIrf*> |
| 792 | 806 | (obs.response()); | ... | ... |