277 """
278 Main function to be executed when starting the code.
279 """
280
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' )
290
291 args = parser.parse_args()
292
293
294
295 ROOT.gROOT.SetBatch()
296
297 ROOT.gROOT.LoadMacro("./AtlasStyle.C")
298 ROOT.TH1.SetDefaultSumw2(ROOT.kTRUE)
299
301
302 LABELS = []
303 if args.labels is '':
304 LABELS = [ 'Ref','Test' ]
305 if args.test2 is not '':
306 LABELS.append( 'Test2' )
307 else:
308 LABELS = args.labels.split(",")
309
310
311
312
313
314
315 validator =
Validator( args.structDirs, args.exclude, SameHist, args.normalize )
316 if args.test2 == '':
317 allFiles = [ os.path.abspath(args.reference), os.path.abspath(args.test) ]
318 else:
319 allFiles = [ os.path.abspath(args.reference), os.path.abspath(args.test), os.path.abspath(args.test2) ]
320
321