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,11 +421,19 @@ void ctfindvar::get_variability_sig(const int& pix_number, | ||
| 421 | for (int i=0; i< nbins; i++) //looping over all the GTIs of the pixel | 421 | for (int i=0; i< nbins; i++) //looping over all the GTIs of the pixel |
| 422 | { | 422 | { |
| 423 | alpha=0; | 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 | int background_count=0; | 433 | int background_count=0; |
| 426 | for (int j=0;j<nbins;j++) // for one GTI selected (i), looping over all the others (j). | 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 | background_count+= m_counts(pix_number, j); | 438 | background_count+= m_counts(pix_number, j); |
| 431 | alpha++; | 439 | alpha++; |
| @@ -436,7 +444,7 @@ void ctfindvar::get_variability_sig(const int& pix_number, | @@ -436,7 +444,7 @@ void ctfindvar::get_variability_sig(const int& pix_number, | ||
| 436 | non = m_counts(pix_number, i); | 444 | non = m_counts(pix_number, i); |
| 437 | noff = background_bin_array[i]; | 445 | noff = background_bin_array[i]; |
| 438 | alpha = (1./alpha); | 446 | alpha = (1./alpha); |
| 439 | - | 447 | + |
| 440 | ///////////////////////////////////////////////////////////////////////////////// | 448 | ///////////////////////////////////////////////////////////////////////////////// |
| 441 | // Compute sensitivity in Gaussian sigma | 449 | // Compute sensitivity in Gaussian sigma |
| 442 | double alpha1 = alpha + 1.0; | 450 | double alpha1 = alpha + 1.0; |
| @@ -643,6 +651,9 @@ void ctfindvar::get_parameters(void) | @@ -643,6 +651,9 @@ void ctfindvar::get_parameters(void) | ||
| 643 | m_emin = GEnergy((*this)["emin"].real(), "TeV"); | 651 | m_emin = GEnergy((*this)["emin"].real(), "TeV"); |
| 644 | m_emax = GEnergy((*this)["emax"].real(), "TeV"); | 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 | // Write parameters into logger | 657 | // Write parameters into logger |
| 647 | log_parameters(TERSE); | 658 | log_parameters(TERSE); |
| 648 | 659 |
src/ctfindvar/ctfindvar.hpp
| @@ -89,6 +89,7 @@ protected: | @@ -89,6 +89,7 @@ protected: | ||
| 89 | GSkyMap m_counts; //!< Counts for each time interval | 89 | GSkyMap m_counts; //!< Counts for each time interval |
| 90 | GGti m_gti; //!< List of time intervals | 90 | GGti m_gti; //!< List of time intervals |
| 91 | GModels m_inmodel; //!< List of models for source positions | 91 | GModels m_inmodel; //!< List of models for source positions |
| 92 | + double m_minoff; //!< Minimum counts for use in significance calculation | ||
| 92 | GSkyMap m_peaksigmap; //!< Skymap holding the maximum significance | 93 | GSkyMap m_peaksigmap; //!< Skymap holding the maximum significance |
| 93 | GNdarray m_pixsigsrc; //!< Store distributions of the source significances | 94 | GNdarray m_pixsigsrc; //!< Store distributions of the source significances |
| 94 | GNdarray m_pixsigmax; //!< Store distribution for pixel with max significance | 95 | GNdarray m_pixsigmax; //!< Store distribution for pixel with max significance |