1 #ifndef __JTESTZERO_T__
2 #define __JTESTZERO_T__
8 #include "Math/Error.h"
9 #include "Math/ProbFuncMathCore.h"
10 #include "Math/SpecFuncMathCore.h"
46 JTestResult JTestZero_2D(TH2*
h1, TH2* h2,
double outliersThreshold,
double threshold, std::string testName, std::string parameterName) {
51 int nx1 = h1->GetNbinsX();
52 int nx2 = h2->GetNbinsX();
53 int ny1 = h1->GetNbinsY();
54 int ny2 = h2->GetNbinsY();
56 if(nx1 != nx2 || ny1 != ny2)
57 ERROR(
"Histograms with different binning. The objects: " << h1->GetName() <<
" can not be compared." << endl);
59 TH2D* h3 = (TH2D*)h1->Clone(h1->GetName()==h2->GetName() ?
66 for (
int i=1 ; i<nx1+1 ; ++i){
67 for (
int j=1 ;
j<ny1+1 ; ++
j){
69 double m = h1 -> GetBinContent(i,
j);
70 double n = h2 -> GetBinContent(i,
j);
72 double p1 = 1 - ROOT::Math::poisson_cdf(m,1);
73 double p2 = 1 - ROOT::Math::poisson_cdf(n,1);
75 if ((p1 > threshold && p2 < threshold) ||
76 (p1 < threshold && p2 > threshold)){
78 failures+=1./(nx1*ny1);
85 (failures > outliersThreshold ? passed =
false : passed =
true);
87 JResultTitle title(testName, parameterName, passed , failures);
89 h3->SetTitle(title.
getTitle().c_str());
92 string (h1->GetDirectory()->GetPath()).append(h1->GetName()),
93 string (h2->GetDirectory()->GetPath()).append(h2->GetName()),
94 h1->GetDirectory()->GetFile()->GetName(),
95 h2->GetDirectory()->GetFile()->GetName(),
96 parameterName, failures, threshold, h3, passed);
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. ...
Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived c...
#define MAKE_CSTRING(A)
Make C-string.
then for HISTOGRAM in h0 h1
Structure containing the result of the test.
Implementation of the Zeros test for histograms with expected low bin contents.
std::string getTitle()
Returns a standard string to be used as title of a graphical root object.
JTestZero_t()
Default constructor.
alias put_queue eval echo n
std::string to_string(const T &value)
Convert value to string.