Applies Chi2 test for two ROOT TH1 histograms.
47 {
50
51 const TH1* h1 = dynamic_cast<const TH1*>(o1);
52 const TH1* h2 = dynamic_cast<const TH1*>(o2);
53
54 if (h1 == NULL || h2 == NULL) {
56 }
57
59
60 const double chi2 = h1->Chi2Test(h2 ,
options.c_str(), &residuals[0]);
61
62 TH1* h3 = (TH1*) h1->Clone(h1->GetName() == h2->GetName() ?
65
66 h3->Reset();
67
68 for (int i = 0; i < h1->GetNcells(); ++i) {
69 h3->SetBinContent(i+1, residuals[i]);
70 }
71
72 const bool passed = (
options.find(
"CHI2") != string::npos ?
75
77
78 h3->SetTitle(title.getTitle().c_str());
79
80 const int Ndims = h3->GetDimension();
81
82 if (Ndims == 1) {
84 } else if (Ndims == 2) {
86 }
87
92
93 this->push_back(r);
94 }
#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.
Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived c...
double threshold
Threshold p-value or chi2-value to decide if test is passed.
std::string options
Options for the ROOT chi2 test.
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.