From f349fd81b4ec7d9625aeaaa14f8bd945cfebc838 Mon Sep 17 00:00:00 2001 From: Simon Bonnefoy Date: Tue, 6 Nov 2018 12:46:13 +0100 Subject: [PATCH] fix the get_variability_sig in ctfindvar and the src/Makefile.am (#2713) --- src/Makefile.am | 1 - src/ctfindvar/ctfindvar.cpp | 25 +++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 6b7388a..d4abd35 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -60,7 +60,6 @@ pkginclude_HEADERS = ctools.hpp lib_LTLIBRARIES = libctools.la libctools_la_SOURCES = libctools_la_LIBADD = support/libsupport.la \ - ctfindvar/libctfindvar.la \ ctbin/libctbin.la \ ctlike/libctlike.la \ ctmodel/libctmodel.la \ diff --git a/src/ctfindvar/ctfindvar.cpp b/src/ctfindvar/ctfindvar.cpp index 09b4c1d..37fd500 100644 --- a/src/ctfindvar/ctfindvar.cpp +++ b/src/ctfindvar/ctfindvar.cpp @@ -31,6 +31,7 @@ #include "ctfindvar.hpp" #include "GammaLib.hpp" #include "GCTALib.hpp" +#include /* __ OpenMP section _____________________________________________________ */ //#ifdef _OPENMP @@ -233,7 +234,7 @@ void ctfindvar::run(void) // GNdarray GNdarray_temp(NBINS); // for (int i=0, iGetNbinsX(); //const int nbins = VECTOR.size() - //const int nbins = GSKYMAP.maps(); + //const int nbins = m_counts.maps(); + std::vector accepted_bin_bckg_vector; + std::vector excess_bin_vector; int background_bin_array[nbins]; bool background_validated=false; int non, noff; @@ -283,7 +286,7 @@ void ctfindvar::get_variability_sig(const int& pix_number, const int& nbins, GNd { //background_count+=hist->GetBinContent(j+1); //background_count+=VECTOR(j+1).first(pix_number); - background_count+=GSKYMAP(pix_number, j); + background_count+= m_counts(pix_number, j); alpha++; } } @@ -291,10 +294,20 @@ void ctfindvar::get_variability_sig(const int& pix_number, const int& nbins, GNd background_bin_array[i] = background_count; //The background is averaged on the number of bins -1 //non = hist->GetBinContent(i+1); //non = VECTOR(i+1).first(pix_number); - non = GSKYMAP(pix_number, i); + non = m_counts(pix_number, i); noff = background_bin_array[i]; alpha = (1./alpha); - sig = Utilities::Statistics::Significance(non,noff,alpha); + + ///////////////////////////////////////////////////////////////////////////////// + // Compute sensitivity in Gaussian sigma + double alpha1 = alpha + 1.0; + double ntotal = non+noff; + double arg1 = non/ntotal; + double arg2 = noff/ntotal; + double term1 = non * std::log((alpha1/alpha)*arg1); + double term2 = noff * std::log(alpha1*arg2); + sig = sqrt(2.0 * (term1 + term2)); + ///////////////////////////////////////////////// //sig_bin_vector[i]=sig; sig_histogram(i)=sig; excess_bin_vector[i]=non - alpha*noff; @@ -451,4 +464,4 @@ void ctfindvar::init_gtis(void) // ToDO: This is wrong only making 1 bin m_gti = GGti(tstart, tstop); -} \ No newline at end of file +} -- libgit2 0.21.4