126 int n1x =
h1 -> GetNbinsX();
127 int n2x = h2 -> GetNbinsX();
128 int n1y =
h1 -> GetNbinsY();
129 int n2y = h2 -> GetNbinsY();
131 if(n1x != n2x || n1y != n2y)
132 ERROR(
"Histograms with different bining. The objects: " <<
h1 -> GetName() <<
" can not be compared." << endl);
134 if(
h1->Integral()==0 || h2->Integral()==0)
135 ERROR(
"Empty histogram: " <<
h1 -> GetName() <<
" can not be compared." << endl);
137 double s1 = 1./
h1->Integral();
138 double s2 = 1./h2->Integral();
140 TH2D* h3 = (TH2D*)
h1->Clone(
h1->GetName()==h2->GetName() ?
147 double ew1, ew2, w1 = 0, w2 = 0;
149 for (
int i = 1; i <= n1x; ++i){
150 for (
int j = 1;
j <= n1y; ++
j){
151 ew1 =
h1->GetBinError(i,
j);
152 ew2 = h2->GetBinError(i,
j);
158 double esum1 = 0, esum2 = 0;
167 if (afunc2 && afunc1) {
168 ERROR(
"Errors are zero for both histograms\n");
171 double c1 = 0, c2 = 0;
174 for (
int i=1 ; i<=n1x ; ++i){
175 for (
int j=1 ;
j<=n1y ; ++
j){
176 c1 += s1*
h1->GetBinContent(i,
j);
177 c2 += s2*h2->GetBinContent(i,
j);
178 double d = TMath::Abs(c1-c2)*TMath::Sqrt(esum1*esum2/(esum1+esum2));
180 dmax1 = TMath::Max(dmax1,TMath::Abs(c1-c2));
187 for (
int j=1 ;
j<=n1y ; ++
j){
188 for (
int i=1 ; i<=n1x ; ++i){
189 c1 += s1*
h1->GetBinContent(i,
j);
190 c2 += s2*h2->GetBinContent(i,
j);
191 double d = TMath::Abs(c1-c2)*TMath::Sqrt(esum1*esum2/(esum1+esum2));
193 dmax1 = TMath::Max(dmax2,TMath::Abs(c1-c2));
197 double dmax = 0.5*(dmax1+dmax2);
201 z = dmax*TMath::Sqrt(esum2);
203 z = dmax*TMath::Sqrt(esum1);
205 z = dmax*TMath::Sqrt(esum1*esum2/(esum1+esum2));
207 double pValue = TMath::KolmogorovProb(z);
209 for (
int i=1 ; i<=n1x ; ++i){
210 for (
int j=1 ;
j<=n1y ; ++
j){
211 h3->SetBinContent(i,
j,TMath::KolmogorovProb(0.5 * h3->GetBinContent(i,
j)));
215 (pValue < threshold ? r.
passed =
false : r.
passed =
true);
218 " HA: " <<
h1->GetUniqueID() <<
" " <<
h1->GetName() <<
219 " HB: " << h2->GetUniqueID() <<
" " << h2->GetName() <<
220 " Threshold: " << threshold <<
" Result: " << pValue <<
" " << (r.
passed ?
"PASSED" :
"FAILED"));
225 h3->SetTitle(title.getTitle().c_str());
#define MAKE_CSTRING(A)
Make C-string.
then for HISTOGRAM in h0 h1
#define MAKE_STRING(A)
Make string.
then print_variable DETECTOR INPUT_FILE INTERMEDIATE_FILE check_input_file $DETECTOR $INPUT_FILE check_output_file $INTERMEDIATE_FILE $OUTPUT_FILE JMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
TCanvas * c1
Global variables to handle mouse events.
std::string to_string(const T &value)
Convert value to string.