1#ifndef __JCOMPAREHISTOGRAMS__JTESTCHI2__
2#define __JCOMPAREHISTOGRAMS__JTESTCHI2__
36 JTest_t(
"Chi2",
"p-Value(chi2)")
51 const TH1* h1 =
dynamic_cast<const TH1*
>(o1);
52 const TH1* h2 =
dynamic_cast<const TH1*
>(o2);
54 if (h1 == NULL || h2 == NULL) {
60 const double chi2 = h1->Chi2Test(h2 ,
options.c_str(), &residuals[0]);
62 TH1* h3 = (TH1*) h1->Clone(h1->GetName() == h2->GetName() ?
68 for (
int i = 0; i < h1->GetNcells(); ++i) {
69 h3->SetBinContent(i+1, residuals[i]);
72 const bool passed = (
options.find(
"CHI2") != string::npos ?
78 h3->SetTitle(title.
getTitle().c_str());
80 const int Ndims = h3->GetDimension();
84 }
else if (Ndims == 2) {
103 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.
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 the Chi2 test for ROOT histograms.
double threshold
Threshold p-value or chi2-value to decide if test is passed.
void test(const TObject *o1, const TObject *o2) override
Applies Chi2 test for two ROOT TH1 histograms.
std::string options
Options for the ROOT chi2 test.
JTestChi2()
Default constructor.
std::istream & read(std::istream &in) override
Read test parameters from input.
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.