Chi2 test for sliced 2D histograms.
120 if(slice ==
'x' || slice ==
'X'){
122 int nSlices1 =
h1->GetNbinsX();
123 int nSlices2 = h2->GetNbinsX();
125 TH1* h3 =
h1->ProjectionX(
h1->GetName()==h2->GetName() ?
129 if(nSlices1 != nSlices2)
130 ERROR(
"Histograms with different binning. The objects: " <<
h1->GetName() <<
" and " << h2->GetName() <<
" can not be compared." << endl);
132 for (
int i=1 ; i<=nSlices1 ; ++i){
136 TH1D* s1 =
h1->ProjectionY (sliceName.c_str(),i,i);
137 TH1D* s2 = h2->ProjectionY (sliceName.c_str(),i,i);
139 double chi2 = s1 -> Chi2Test (s2 ,
options.c_str());
143 if (
options.find(
"CHI2") != std::string::npos) {
144 (chi2 > threshold ? passed =
false : passed =
true);
146 (chi2 < threshold ? passed =
false : passed =
true);
149 if (!passed) nFailures++;
151 h3->SetBinContent(i,chi2);
157 (nFailures/nSlices1 > failuresThreshold ? passed =
false : passed =
true);
159 JResultTitle title(testName, parameterName, passed , nFailures);
161 h3->SetTitle(title.getTitle().c_str());
164 string (
h1->GetDirectory()->GetPath()).append(
h1->GetName()),
165 string (h2->GetDirectory()->GetPath()).append(h2->GetName()),
166 h1->GetDirectory()->GetFile()->GetName(),
167 h2->GetDirectory()->GetFile()->GetName(),
168 parameterName, nFailures, failuresThreshold, h3, passed);
170 }
else if (slice ==
'y' || slice ==
'Y'){
172 int nSlices1 =
h1->GetNbinsY();
173 int nSlices2 = h2->GetNbinsY();
175 TH1* h3 =
h1->ProjectionY(
h1->GetName()==h2->GetName() ?
179 if(nSlices1 != nSlices2)
180 ERROR(
"Histograms with different binning. The objects: " <<
h1->GetName() <<
" can not be compared." << endl);
182 for (
int i=1 ; i<=nSlices1 ; ++i){
186 TH1D* s1 =
h1->ProjectionX (sliceName.c_str(),i,i);
187 TH1D* s2 = h2->ProjectionX (sliceName.c_str(),i,i);
189 double chi2 = s1 -> Chi2Test (s2 ,
options.c_str());
193 if (
options.find(
"CHI2") != std::string::npos) {
194 (chi2 > threshold ? passed =
false : passed =
true);
196 (chi2 < threshold ? passed =
false : passed =
true);
199 if (!passed) nFailures++;
201 h3->SetBinContent(i,chi2);
206 (nFailures/nSlices1 > failuresThreshold ? passed =
false : passed =
true);
208 JResultTitle title(testName, parameterName, passed , nFailures);
210 h3->SetTitle(title.getTitle().c_str());
213 string (
h1->GetDirectory()->GetPath()).append(
h1->GetName()),
214 string (h2->GetDirectory()->GetPath()).append(h2->GetName()),
215 h1->GetDirectory()->GetFile()->GetName(),
216 h2->GetDirectory()->GetFile()->GetName(),
217 parameterName, nFailures, failuresThreshold, h3, passed);
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.
#define MAKE_STRING(A)
Make string.
then usage $script[port]< option > nPossible options
std::string to_string(const T &value)
Convert value to string.