1 #ifndef __JCOMPAREHISTOGRAMS__JTESTZERO_T__
2 #define __JCOMPAREHISTOGRAMS__JTESTZERO_T__
10 #include "Math/Error.h"
11 #include "Math/ProbFuncMathCore.h"
12 #include "Math/SpecFuncMathCore.h"
21 namespace JCOMPAREHISTOGRAMS {
54 JTestResult JTestZero_2D(TH2* h1, TH2* h2,
double outliersThreshold,
double threshold, std::string testName, std::string parameterName) {
59 int nx1 = h1->GetNbinsX();
60 int nx2 = h2->GetNbinsX();
61 int ny1 = h1->GetNbinsY();
62 int ny2 = h2->GetNbinsY();
64 if(nx1 != nx2 || ny1 != ny2)
65 ERROR(
"Histograms with different binning. The objects: " << h1->GetName() <<
" can not be compared." << endl);
67 TH2D* h3 = (TH2D*)h1->Clone(h1->GetName()==h2->GetName() ?
74 for (
int i=1 ; i<nx1+1 ; ++i){
75 for (
int j=1 ;
j<ny1+1 ; ++
j){
77 double m = h1 -> GetBinContent(i,
j);
78 double n = h2 -> GetBinContent(i,
j);
80 double p1 = 1 - ROOT::Math::poisson_cdf(m,1);
81 double p2 = 1 - ROOT::Math::poisson_cdf(n,1);
83 if ((p1 > threshold && p2 < threshold) ||
84 (p1 < threshold && p2 > threshold)){
93 (
failures > outliersThreshold ? passed =
false : passed =
true);
97 h3->SetTitle(title.
getTitle().c_str());
102 parameterName,
failures, threshold, h3, passed);
then usage $script< detector file > minrun maxrun report nIn case of failures
Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived c...
JTestZero_t()
Default constructor.
#define MAKE_CSTRING(A)
Make C-string.
Auxiliary class to handle file name, ROOT directory and object name.
#define MAKE_STRING(A)
Make string.
Implementation of the Zeros test for histograms with expected low bin contents.
JTestResult JTestZero_2D(TH2 *h1, TH2 *h2, double outliersThreshold, double threshold, std::string testName, std::string parameterName)
Bin-by-Bin test for 2D histograms where a very low number of entries is expected. ...
std::string to_string(const T &value)
Convert value to string.
Structure containing the result of the test.
std::string getTitle()
Returns a standard string to be used as title of a graphical root object.