Runs test for sliced 2D histograms.
123 if(slice ==
'x' || slice ==
'X'){
125 int nSlices1 = h1->GetNbinsX();
126 int nSlices2 = h2->GetNbinsX();
128 TH1* h3 = h1->ProjectionX(
MAKE_CSTRING(h1->GetName() <<
"_VS_" <<
129 h2->GetName() <<
"_RunsTestSliceX"));
131 if (nSlices1 != nSlices2) {
132 ERROR(
"Histograms with different binning. The objects: " << h1->GetName() <<
" and " << h2->GetName() <<
" can not be compared." << endl);
135 for (
int i=1 ; i<=nSlices1 ; ++i){
139 TH1D* s1 = h1->ProjectionY (sliceName.c_str(),i,i);
140 TH1D* s2 = h2->ProjectionY (sliceName.c_str(),i,i);
142 if (!(s1->GetSumOfWeights() > 0 && s2->GetSumOfWeights() > 0)) {
continue; }
144 double R = s1->Integral();
145 double T = s2->Integral();
151 bool a = ((T/
R)*s1->GetBinContent(1) - s2->GetBinContent(1)) < 0;
155 for (
int i = 2 ; i<s1->GetNbinsX() ; ++i){
157 bool b = ((T/
R)*s1->GetBinContent(i) - s2->GetBinContent(i)) < 0;
167 double N = 1 + 2*p*q/(p+q) ;
168 double s = sqrt( 2*p*q*(2*p*q-p-q)/(p+q)/(p+q)/(p+q-1) );
171 bool passed = (fabs(d) > threshold ?
false :
true);
173 if (!passed) nFailures++;
175 h3->SetBinContent(i,fabs(d));
179 bool passed = (nFailures/nSlices1 > failuresThreshold ?
false :
true);
181 JResultTitle title(testName, parameterName, passed , nFailures);
183 h3->SetTitle(title.getTitle().c_str());
185 r = JTestResult(testName,
186 JRootObjectID(
MAKE_STRING(h1->GetDirectory()->GetPath() << h1->GetName())),
187 JRootObjectID(
MAKE_STRING(h2->GetDirectory()->GetPath() << h1->GetName())),
188 parameterName, nFailures, failuresThreshold, h3, passed);
190 }
else if (slice ==
'y' || slice ==
'Y'){
192 int nSlices1 = h1->GetNbinsX();
193 int nSlices2 = h2->GetNbinsX();
195 TH1* h3 = h1->ProjectionY(h1->GetName()==h2->GetName() ?
199 if(nSlices1 != nSlices2) {
200 ERROR(
"Histograms with different binning. The objects: " << h1->GetName() <<
" and " << h2->GetName() <<
" can not be compared." << endl);
203 for (
int i=1 ; i<=nSlices1 ; ++i){
207 TH1D* s1 = h1->ProjectionX (sliceName.c_str(),i,i);
208 TH1D* s2 = h2->ProjectionX (sliceName.c_str(),i,i);
210 if (!(s1->GetSumOfWeights() > 0 && s2->GetSumOfWeights() > 0)) {
continue; }
212 double R = s1->Integral();
213 double T = s2->Integral();
219 bool a = ((T/
R)*s1->GetBinContent(1) - s2->GetBinContent(1)) < 0;
223 for (
int i = 2 ; i<s1->GetNbinsX() ; ++i){
225 bool b = ((T/
R)*s1->GetBinContent(i) - s2->GetBinContent(i)) < 0;
235 double N = 1 + 2*p*q/(p+q) ;
236 double s = sqrt( 2*p*q*(2*p*q-p-q)/(p+q)/(p+q)/(p+q-1) );
239 bool passed = (fabs(d) > threshold ?
false :
true);
241 if (!passed) nFailures++;
243 h3->SetBinContent(i,fabs(d));
247 bool passed = (nFailures/nSlices1 > failuresThreshold ?
false :
true);
249 JResultTitle title(testName, parameterName, passed , nFailures);
251 h3->SetTitle(title.getTitle().c_str());
253 r = JTestResult (testName,
254 JRootObjectID(
MAKE_STRING(h1->GetDirectory()->GetPath() << h1->GetName())),
255 JRootObjectID(
MAKE_STRING(h2->GetDirectory()->GetPath() << h1->GetName())),
256 parameterName, nFailures, failuresThreshold, h3, passed);
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
#define MAKE_CSTRING(A)
Make C-string.
#define MAKE_STRING(A)
Make string.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then usage $script[distance] fi case set_variable R
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
std::string to_string(const T &value)
Convert value to string.