Commit ac46485d7d20fab8ba6df1fed3dcfe2ed2bf3b69

Authored by Josh Cardenzana
Committed by Jürgen Knödlseder
1 parent 785434a3

Add handling of energy limits (#2713)

src/ctfindvar/ctfindvar.cpp
... ... @@ -639,6 +639,10 @@ void ctfindvar::get_parameters(void)
639 639 (*this)["histtype"].string();
640 640 }
641 641  
  642 + // Get the energy limits
  643 + m_emin = GEnergy((*this)["emin"].real(), "TeV");
  644 + m_emax = GEnergy((*this)["emax"].real(), "TeV");
  645 +
642 646 // Write parameters into logger
643 647 log_parameters(TERSE);
644 648  
... ... @@ -681,16 +685,28 @@ void ctfindvar::fill_cube(GCTAObservation* obs)
681 685 // Initialise binning statistics
682 686 int num_outside_roi = 0;
683 687 int num_invalid_wcs = 0;
  688 + int num_outside_ecut = 0;
684 689 int num_outside_map = 0;
685 690 int num_outside_time = 0;
686 691 int num_in_map = 0;
687 692  
  693 + // Specify whether we are cutting on energy or not
  694 + bool cut_emin = (m_emin.TeV() > 0.0) ? true : false;
  695 + bool cut_emax = (m_emax.TeV() > 0.0) ? true : false;
  696 +
688 697 // Fill counts sky map
689 698 for (int i = 0; i < events->size(); ++i) {
690 699  
691 700 // Get event
692 701 const GCTAEventAtom* event = (*events)[i];
693 702  
  703 + // Check that the energy is valid
  704 + if ((cut_emin && event->energy() < m_emin) ||
  705 + (cut_emax && event->energy() > m_emax)) {
  706 + num_outside_ecut++;
  707 + continue;
  708 + }
  709 +
694 710 // Determine event time
695 711 GTime evnt_time = event->time();
696 712 int time_indx = time2inx(evnt_time);
... ...
src/ctfindvar/ctfindvar.hpp
... ... @@ -94,6 +94,8 @@ protected:
94 94 GNdarray m_pixsigmax; //!< Store distribution for pixel with max significance
95 95 GTime m_tstart; //!< Start time for variability study
96 96 GTime m_tstop; //!< Stop time for variability study
  97 + GEnergy m_emin; //!< Minimum energy for events
  98 + GEnergy m_emax; //!< Maximum energy for events
97 99  
98 100  
99 101 };
... ...
src/ctfindvar/ctfindvar.par
... ... @@ -21,8 +21,8 @@ inmodel, f, h, NONE,,, &quot;Input model definition file for extracting source pos
21 21 histtype, s, a, FITS,CSV|FITS,, "File type for storing the individual source histograms"
22 22 prefix, s, a, findvar_,,, "Prefix for output files"
23 23 minoff, r, h, 0,,, "Minimum required events in off bin for computing Noff and alpha"
24   -emin, r, a, 0.1,,, "Lower energy limit (TeV)"
25   -emax, r, a, 100.0,,, "Upper energy limit (TeV)"
  24 +emin, r, a, 0,,, "Lower energy limit (units of TeV; 0 => no cut)"
  25 +emax, r, a, 0,,, "Upper energy limit (units of TeV; 0 => no cut)"
26 26 smoothkrnl, s, h, NONE, GAUSSIAN|DISK|NONE,, "Smoothing kernel for counts maps"
27 27 smoothpar, r, h, 0.05,,, "Parameter for the smoothing kernel"
28 28  
... ...