9 ROOT.gROOT.ProcessLine(
'.L Loader.C+')
 
   22     nEvents = tree.GetEntries()
 
   26     sys.stdout.write(
"Process: [%s]" % (
" " * toolbar_width))
 
   28     sys.stdout.write(
"\b" * (toolbar_width+1)) 
 
   30     nEvents = tree.GetEntries()
 
   31     nEventsForUpdate = 
int(nEvents/toolbar_width)
 
   33     for (nevent,event) 
in enumerate(tree):
 
   34         if (nevent %nEventsForUpdate) == 0:
 
   38         if not eventanalyzer.processEvent(event):
 
   43     sys.stdout.write(
"\n")
 
   45     print 'Total events:', nEvents
 
   46     print 'Total bad events:', nBadOnes
 
   48     eventanalyzer.finalize()
 
   51 if __name__==
'__main__':
 
   52     '''Helper function to quickly inspect the NTUP_TRUTH file, created from the EVGEN file. 
   53     Before processing it through the entire simulation, digitization and reconstruction chain, 
   54     it is wise to make sure the EVGEN file is as intended. 
   57     parser = optparse.OptionParser()
 
   58     parser.add_option(
'-f', 
'--file',           dest=
'file_in',                               help=
'path to NTUP_TRUTH file to inspect' )
 
   59     parser.add_option(
'-t', 
'--tree',           dest=
'tree_name',                  default=
'truth',       help=
'Name of tree in NTUP_TRUTH file'    )
 
   60     parser.add_option(
'-n', 
'--nDarkPhotons',   dest=
'nDarkPhotons',   type=
'int', default=1,             help=
'Number of dark photons'    )
 
   61     parser.add_option(
'-o', 
'--outputhistfile', dest=
'outputhistfile',             default=
'histControl', help=
'name of ROOT file with histograms'  )
 
   63     (options, args) = parser.parse_args()
 
   65     if not options.file_in:
 
   66         print 'ERROR: input file (./inspect_truth_file.py -f <path to NTUP_TRUTH file>) needed' 
   70     ntup_file = ROOT.TFile.Open(options.file_in, 
'r')
 
   72         print 'Path provided to NTUP_TRUTH file is incorrect. Or something is wrong with the file.' 
   75     truth_tree = ROOT.TTree()
 
   78         ntup_file.GetObject(options.tree_name, truth_tree)
 
   81         print 'ERROR: ', options.tree_name, 
'is not a TTree in', options.file_in
 
   82         print 'ERROR: ', 
'provide the correct TTree name using (-t)' 
   83         print 'ERROR: ', 
'Stuff inside', options.file_in
 
   87     EventLoop(truth_tree, options.outputhistfile, options.nDarkPhotons)