Skip to content

Commit a4e4475

Browse files
Benedikt Volkelchiarazampolli
authored andcommitted
Add bin content check for identical histos
1 parent 8c20c6a commit a4e4475

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

RelVal/ReleaseValidation.C

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,25 @@ bool PotentiallySameHistograms(TH1* hA, TH1* hB)
206206
// different number of entries --> obvious
207207
return false;
208208
}
209-
return (!PotentiallySameAxes(hA->GetXaxis(), hB->GetXaxis()) || !PotentiallySameAxes(hA->GetYaxis(), hB->GetYaxis()) || !PotentiallySameAxes(hA->GetZaxis(), hB->GetZaxis()));
209+
210+
if (!PotentiallySameAxes(hA->GetXaxis(), hB->GetXaxis()) || !PotentiallySameAxes(hA->GetYaxis(), hB->GetYaxis()) || !PotentiallySameAxes(hA->GetZaxis(), hB->GetZaxis())) {
211+
// some axes are different
212+
return false;
213+
}
214+
215+
// if still in the game, check bin contents of all bins
216+
for (int ix = 1; ix <= hA->GetNbinsX(); ix++) {
217+
for (int iy = 1; iy <= hA->GetNbinsY(); iy++) {
218+
for (int iz = 1; iz <= hA->GetNbinsZ(); iz++) {
219+
if (!areSufficientlyEqualNumbers(hA->GetBinContent(ix, iy, iz), hB->GetBinContent(ix, iy, iz))) {
220+
return false;
221+
}
222+
}
223+
}
224+
}
225+
226+
// appear to be the same
227+
return true;
210228
}
211229

212230
// writing a TObject to a TDirectory

0 commit comments

Comments
 (0)