Commit 8830ee7cbf946f40a5a898d9194dd65012f22c14
1 parent
9b7acde8
Adapt to new GCTARoi and GCTAInstDir interface.
The GCTARoi::contains() method is now used to check for ROI containment.
Showing
3 changed files
with
8 additions
and
16 deletions
src/ctobssim/ctobssim.cpp
| ... | ... | @@ -548,11 +548,7 @@ void ctobssim::set_list(GCTAObservation* obs) |
| 548 | 548 | pnt.dir(skydir); |
| 549 | 549 | |
| 550 | 550 | // Set ROI |
| 551 | - GCTARoi roi; | |
| 552 | - GCTAInstDir instdir; | |
| 553 | - instdir.radec_deg(m_ra, m_dec); | |
| 554 | - roi.centre(instdir); | |
| 555 | - roi.radius(m_rad); | |
| 551 | + GCTARoi roi(GCTAInstDir(skydir), m_rad); | |
| 556 | 552 | |
| 557 | 553 | // Set GTI |
| 558 | 554 | GGti gti(m_cta_ref); |
| ... | ... | @@ -747,9 +743,9 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, |
| 747 | 743 | *obs, |
| 748 | 744 | ran); |
| 749 | 745 | if (event != NULL) { |
| 746 | + | |
| 750 | 747 | // Use event only if it falls within ROI |
| 751 | - if (event->dir().dist_deg(events->roi().centre().dir()) <= | |
| 752 | - events->roi().radius()) { | |
| 748 | + if (events->roi().contains(*event)) { | |
| 753 | 749 | event->event_id(m_event_id); |
| 754 | 750 | events->append(*event); |
| 755 | 751 | m_event_id++; |
| ... | ... | @@ -898,8 +894,7 @@ void ctobssim::simulate_background(GCTAObservation* obs, |
| 898 | 894 | GCTAEventAtom* event = (*list)[k]; |
| 899 | 895 | |
| 900 | 896 | // Use event only if it falls within ROI |
| 901 | - if (event->dir().dist_deg(events->roi().centre().dir()) <= | |
| 902 | - events->roi().radius()) { | |
| 897 | + if (events->roi().contains(*event)) { | |
| 903 | 898 | |
| 904 | 899 | // Set event identifier |
| 905 | 900 | event->event_id(m_event_id); | ... | ... |
src/ctselect/ctselect.cpp
| ... | ... | @@ -505,7 +505,7 @@ void ctselect::select_events(GCTAObservation* obs, const std::string& filename) |
| 505 | 505 | double dec = m_dec; |
| 506 | 506 | if (m_usepnt) { |
| 507 | 507 | const GCTAPointing *pnt = obs->pointing(); |
| 508 | - ra = pnt->dir().ra_deg(); | |
| 508 | + ra = pnt->dir().ra_deg(); | |
| 509 | 509 | dec = pnt->dir().dec_deg(); |
| 510 | 510 | } |
| 511 | 511 | |
| ... | ... | @@ -644,12 +644,9 @@ void ctselect::select_events(GCTAObservation* obs, const std::string& filename) |
| 644 | 644 | static_cast<GCTAEventList*>(const_cast<GEvents*>(obs->events())); |
| 645 | 645 | |
| 646 | 646 | // Set ROI |
| 647 | - GCTARoi roi; | |
| 648 | 647 | GCTAInstDir instdir; |
| 649 | - instdir.radec_deg(ra, dec); | |
| 650 | - roi.centre(instdir); | |
| 651 | - roi.radius(m_rad); | |
| 652 | - list->roi(roi); | |
| 648 | + instdir.dir().radec_deg(ra, dec); | |
| 649 | + list->roi(GCTARoi(instdir, m_rad)); | |
| 653 | 650 | |
| 654 | 651 | // Set GTI |
| 655 | 652 | list->gti(gti); | ... | ... |