Commit e3a8d38e19eb09fa48c6c76901ad235b4265273e
Committed by
Jürgen Knödlseder
1 parent
bac73c21
Add requirement for minimum number of events in a time bin for background consideration (#2713)
Showing
2 changed files
with
15 additions
and
3 deletions
src/ctfindvar/ctfindvar.cpp
| ... | ... | @@ -421,11 +421,19 @@ void ctfindvar::get_variability_sig(const int& pix_number, |
| 421 | 421 | for (int i=0; i< nbins; i++) //looping over all the GTIs of the pixel |
| 422 | 422 | { |
| 423 | 423 | alpha=0; |
| 424 | - if (accepted_bin_bckg_vector[i]==0) continue; //the GTI is discared from bckg calculation and not checked again. | |
| 424 | + //the GTI is discared from bckg calculation and not checked again. | |
| 425 | + if (accepted_bin_bckg_vector[i]==0) { | |
| 426 | + continue; | |
| 427 | + } | |
| 428 | + // Check if bin fails minoff check | |
| 429 | + else if (m_counts(pix_number, i) < m_minoff) { | |
| 430 | + accepted_bin_bckg_vector[i]=0; | |
| 431 | + continue; | |
| 432 | + } | |
| 425 | 433 | int background_count=0; |
| 426 | 434 | for (int j=0;j<nbins;j++) // for one GTI selected (i), looping over all the others (j). |
| 427 | 435 | { |
| 428 | - if (j!=i &&accepted_bin_bckg_vector[j]==1) | |
| 436 | + if (j!=i && accepted_bin_bckg_vector[j]==1) | |
| 429 | 437 | { |
| 430 | 438 | background_count+= m_counts(pix_number, j); |
| 431 | 439 | alpha++; |
| ... | ... | @@ -436,7 +444,7 @@ void ctfindvar::get_variability_sig(const int& pix_number, |
| 436 | 444 | non = m_counts(pix_number, i); |
| 437 | 445 | noff = background_bin_array[i]; |
| 438 | 446 | alpha = (1./alpha); |
| 439 | - | |
| 447 | + | |
| 440 | 448 | ///////////////////////////////////////////////////////////////////////////////// |
| 441 | 449 | // Compute sensitivity in Gaussian sigma |
| 442 | 450 | double alpha1 = alpha + 1.0; |
| ... | ... | @@ -643,6 +651,9 @@ void ctfindvar::get_parameters(void) |
| 643 | 651 | m_emin = GEnergy((*this)["emin"].real(), "TeV"); |
| 644 | 652 | m_emax = GEnergy((*this)["emax"].real(), "TeV"); |
| 645 | 653 | |
| 654 | + // Get minimum counts for a bin to be considered in Noff calculation | |
| 655 | + m_minoff = (*this)["minoff"].real(); | |
| 656 | + | |
| 646 | 657 | // Write parameters into logger |
| 647 | 658 | log_parameters(TERSE); |
| 648 | 659 | ... | ... |
src/ctfindvar/ctfindvar.hpp
| ... | ... | @@ -89,6 +89,7 @@ protected: |
| 89 | 89 | GSkyMap m_counts; //!< Counts for each time interval |
| 90 | 90 | GGti m_gti; //!< List of time intervals |
| 91 | 91 | GModels m_inmodel; //!< List of models for source positions |
| 92 | + double m_minoff; //!< Minimum counts for use in significance calculation | |
| 92 | 93 | GSkyMap m_peaksigmap; //!< Skymap holding the maximum significance |
| 93 | 94 | GNdarray m_pixsigsrc; //!< Store distributions of the source significances |
| 94 | 95 | GNdarray m_pixsigmax; //!< Store distribution for pixel with max significance | ... | ... |