1#ifndef __JCOMPAREHISTOGRAMS__JTESTZERO__
2#define __JCOMPAREHISTOGRAMS__JTESTZERO__
9#include "Math/ProbFuncMathCore.h"
10#include "Math/SpecFuncMathCore.h"
53 JTest_t(
"Zero",
"failure_fraction")
68 const TH1* h1 =
dynamic_cast<const TH1*
>(o1);
69 const TH1* h2 =
dynamic_cast<const TH1*
>(o2);
71 if (h1 == NULL || h2 == NULL) {
75 const int nx1 = h1->GetNbinsX();
76 const int nx2 = h2->GetNbinsX();
77 const int ny1 = h1->GetNbinsY();
78 const int ny2 = h2->GetNbinsY();
79 const int nz1 = h1->GetNbinsZ();
80 const int nz2 = h2->GetNbinsZ();
82 if(nx1 != nx2 || ny1 != ny2 || nz1 != nz2) {
84 h1->GetName() <<
" and " << h2->GetName() <<
" can not be compared." << endl);
87 TH1* h3 = (TH1*) h1->Clone(h1->GetName() == h2->GetName() ?
95 for (
int i=1 ; i<nx1+1 ; ++i) {
96 for (
int j=1 ; j<ny1+1 ; ++j) {
97 for (
int k=1 ; k<nz1+1 ; ++k) {
99 const int Nbin = h3->GetBin(i,j,k);
101 const double m = h1->GetBinContent(i,j,k);
102 const double n = h2->GetBinContent(i,j,k);
104 const double p1 = 1 - ROOT::Math::poisson_cdf(m,1);
105 const double p2 = 1 - ROOT::Math::poisson_cdf(n,1);
110 failures+=1./(nx1*ny1);
121 h3->SetTitle(title.
getTitle().c_str());
123 const int Ndims = h3->GetDimension();
127 }
else if (Ndims == 2) {
146 std::istream&
read(std::istream& in)
override
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
#define MAKE_CSTRING(A)
Make C-string.
#define MAKE_STRING(A)
Make string.
Auxiliary class to define a range between two values.
Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived c...
std::string getTitle() const
Returns a standard string to be used as title of a graphical root object.
Implementation of a bin-by-bin compatibility test for histograms with low bin contents.
void test(const TObject *o1, const TObject *o2) override
Bin-by-bin comparison for ROOT histograms, of compatibility with a Poisson pdf of parameter 1.
std::istream & read(std::istream &in) override
Read test parameters from input.
JTestZero()
Default constructor.
double outliersThreshold
Fraction of bins allowed to fail.
double threshold
threshold p-value to decide if test is passed.
Interface to read input and write output for TObject tests.
const std::string resultType
test result type
const std::string testName
test name
Auxiliary class to handle file name, ROOT directory and object name.
Exception for accessing a value in a collection that is outside of its range.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Structure containing the result of the test.