31 for x
in range(refHist.GetNbinsX()):
32 for y
in range(refHist.GetNbinsY()):
33 for z
in range(refHist.GetNbinsZ()):
34 if refHist.GetBinContent(x,y,z) != testHist.GetBinContent(x,y,z):
return False
38 for x
in range(refHist.GetNbinsX()):
39 for y
in range(refHist.GetNbinsY()):
40 for z
in range(refHist.GetNbinsZ()):
41 if abs(refHist.GetBinContent(x,y,z) - testHist.GetBinContent(x,y,z)) > 0.01:
return False
278 Main function to be executed when starting the code.
281 parser = argparse.ArgumentParser( description = 'Distribution Plotter' )
282 parser.add_argument( '-s', '--structDirs', default = True, action = "store_true", help = ' if true, it creates directories following the same structure as in the root file to store the pdf plots')
283 parser.add_argument( '-r', '--reference', help = 'The reference' )
284 parser.add_argument( '-t', '--test', help = 'The test' )
285 parser.add_argument( '-t2', '--test2', default ='', help = 'The additional test' )
286 parser.add_argument( '-d', '--directory', default = "/", help = 'Print cutflow fror systematic variations' )
287 parser.add_argument( '-e', '--exclude', default = "_bin_", help = 'histograms whose names contain the provided strings are not examined')
288 parser.add_argument( '-n', '--normalize', default = False, action = "store_true", help = 'normalize histograms with larger stats for better comparison')
289 parser.add_argument( '-l', '--labels', default ='', help = 'Add text to legend for ref/test/test2, split with commas' )
291 args = parser.parse_args()
294 #ROOT.gROOT.Macro("rootlogon.C")
295 ROOT.gROOT.SetBatch()
296 #ROOT.gROOT.LoadMacro("./AtlasUtils.C")
297 ROOT.gROOT.LoadMacro("./AtlasStyle.C")
298 ROOT.TH1.SetDefaultSumw2(ROOT.kTRUE)
303 if args.labels is '':
304 LABELS = [ 'Ref','Test' ]
305 if args.test2 is not '':
306 LABELS.append( 'Test2' )
308 LABELS = args.labels.split(",")
311 # if you want to pass labels to legend directly from the file name...:
312 #LABELS.append( args.test.split('.')[2]+' '+args.test.split('.')[3] )
315 validator = Validator( args.structDirs, args.exclude, SameHist, args.normalize )
317 allFiles = [ os.path.abspath(args.reference), os.path.abspath(args.test) ]
319 allFiles = [ os.path.abspath(args.reference), os.path.abspath(args.test), os.path.abspath(args.test2) ]
320 #======================================================================