1#ifndef __JCOMPAREHISTOGRAMS__JTESTKOLMOGOROV_1D__
2#define __JCOMPAREHISTOGRAMS__JTESTKOLMOGOROV_1D__
56 const TH1* h1 =
dynamic_cast<const TH1*
>(
o1);
57 const TH1* h2 =
dynamic_cast<const TH1*
>(
o2);
59 if (h1->GetDimension() != 1 || h2->GetDimension() != 1) {
67 THROW(
JValueOutOfRange,
"JTestKolmogorov_1D::test(): Histograms with different bining. The objects: " <<
68 h1->GetName() <<
" and " << h2->GetName() <<
" can not be compared." <<
endl);
71 TH1*
h3 = (
TH1*) h1->Clone(h1->GetName() == h2->GetName() ?
75 const double s1 = 1./h1->Integral();
76 const double s2 = 1./h2->Integral();
78 double ew1,
ew2, w1 = 0, w2 = 0;
81 ew1 = h1->GetBinError(
bin);
82 ew2 = h2->GetBinError(
bin);
108 double dmax = 0,
c1 = 0,
c2 = 0;
112 c1 +=
s1*h1->GetBinContent(
bin);
113 c2 +=
s2*h2->GetBinContent(
bin);
116 double p = TMath::KolmogorovProb(d);
118 dmax = TMath::Max(dmax,TMath::Abs(
c1-
c2));
120 h3->SetBinContent(
bin,p);
126 z = dmax*TMath::Sqrt(
esum2);
128 z = dmax*TMath::Sqrt(
esum1);
133 const double pValue = TMath::KolmogorovProb(z);
157 std::istream&
read(std::istream& in)
override
TCanvas * c1
Global variables to handle mouse events.
#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 Kolmogorov test for 1D histograms.
double threshold
threshold p-value to decide if test is passed.
std::istream & read(std::istream &in) override
Read test parameters from input.
void test(const TObject *o1, const TObject *o2) override
Applies Kolmogorov test for two ROOT TH1 histograms.
JTestKolmogorov_1D()
Default constructor.
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.
Template definition of a multi-dimensional oscillation probability interpolation table.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Structure containing the result of the test.