Commit a3189c0f8f7649986572c5b890756d8a59652661
Committed by
Jürgen Knödlseder
1 parent
43bfc270
Modify m_gti to be a vector of GGti's instead of a single GGti object (#2713)
This is to reduce computation time by reducing the number of GGti objects that need to be created during execution
Showing
2 changed files
with
6 additions
and
6 deletions
src/ctfindvar/ctfindvar.cpp
| ... | ... | @@ -514,10 +514,9 @@ void ctfindvar::fill_alpha_vector(const int& pix_number, |
| 514 | 514 | |
| 515 | 515 | // Loop over all time bins |
| 516 | 516 | for (int j=0; j<m_gti.size(); j++) { |
| 517 | - GGti gti(m_gti.tstart(j), m_gti.tstop(j)); | |
| 518 | 517 | |
| 519 | 518 | // Make sure observation overlaps with this time interval |
| 520 | - double exposure = gti_overlap(gti, obs_gti); | |
| 519 | + double exposure = gti_overlap(m_gti[j], obs_gti); | |
| 521 | 520 | if (exposure > 0.0) { |
| 522 | 521 | |
| 523 | 522 | // Get IRF response |
| ... | ... | @@ -572,7 +571,7 @@ int ctfindvar::time2inx(const GTime& time) |
| 572 | 571 | // Loop over all GTIs |
| 573 | 572 | for (int i=0; i<m_gti.size(); i++) { |
| 574 | 573 | // Check if interval contains the time |
| 575 | - if (m_gti.tstart(i) < time && m_gti.tstop(i) > time) { | |
| 574 | + if (m_gti[i].contains(time)) { | |
| 576 | 575 | map_index = i; |
| 577 | 576 | break; |
| 578 | 577 | } |
| ... | ... | @@ -593,7 +592,7 @@ GGti ctfindvar::inx2gti(const int& index) |
| 593 | 592 | "'index' parameter out of range"); |
| 594 | 593 | } |
| 595 | 594 | |
| 596 | - return GGti(m_gti.tstart(index), m_gti.tstop(index)); | |
| 595 | + return m_gti[index]; | |
| 597 | 596 | } |
| 598 | 597 | |
| 599 | 598 | |
| ... | ... | @@ -923,6 +922,7 @@ void ctfindvar::init_gtis(void) |
| 923 | 922 | double tstart_sec = m_tstart.secs(); |
| 924 | 923 | double tstop_sec = m_tstop.secs(); |
| 925 | 924 | int bins = (tstop_sec - tstart_sec) / tinterval + 0.5; |
| 925 | + | |
| 926 | 926 | // Log information |
| 927 | 927 | log_value(NORMAL, "treference (mjd)", m_tstart.reference().mjdref()); |
| 928 | 928 | log_value(NORMAL, "tstart (sec)", tstart_sec); |
| ... | ... | @@ -954,7 +954,7 @@ void ctfindvar::init_gtis(void) |
| 954 | 954 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[o]); |
| 955 | 955 | |
| 956 | 956 | if (gti_overlap(obs->gti(), next_gti) > 0.0) { |
| 957 | - m_gti.extend(next_gti); | |
| 957 | + m_gti.push_back(next_gti); | |
| 958 | 958 | break; |
| 959 | 959 | } |
| 960 | 960 | } | ... | ... |
src/ctfindvar/ctfindvar.hpp
| ... | ... | @@ -91,7 +91,7 @@ protected: |
| 91 | 91 | |
| 92 | 92 | // Protected members |
| 93 | 93 | GSkyMap m_counts; //!< Counts for each time interval |
| 94 | - GGti m_gti; //!< List of time intervals | |
| 94 | + std::vector<GGti> m_gti; //!< List of time intervals | |
| 95 | 95 | GModels m_inmodel; //!< List of models for source positions |
| 96 | 96 | GSkyDir m_max_sig_dir; //!< Sky direction associated with maximum significance |
| 97 | 97 | double m_minoff; //!< Minimum counts for use in significance calculation | ... | ... |