C/C++ style main function.
15 from optparse
import OptionParser
16 parser = OptionParser( usage =
"%prog [options] [-f] xAOD.pool.root" )
17 parser.add_option(
"-f",
"--file", dest =
"fileName",
18 action =
"store", type =
"string", default =
"",
19 help =
"Path to the file to check" )
20 parser.add_option(
"-d",
"--chainsdetail", dest =
"chainsDetail",
21 action =
"store_true",
22 help =
"Print detailed chain definitions" )
23 ( options, args ) = parser.parse_args()
28 fileNames = [ arg
for arg
in args
if arg[ 0 ] !=
"-" ]
30 if options.fileName !=
"":
33 os.path.expandvars( os.path.expanduser( options.fileName ) ) )
35 if len( fileNames ) == 0:
38 fileNames =
set( fileNames )
42 ROOT.gROOT.Macro(
"$ROOTCOREDIR/scripts/load_packages.C" )
45 chain = ROOT.TChain(
"CollectionTree" )
46 for fname
in fileNames:
51 tree = ROOT.xAOD.MakeTransientTree( chain, ROOT.xAOD.TEvent.kBranchAccess )
52 from xAODRootAccess.TPyStore
import TPyStore
56 tool = ROOT.TrigConf.xAODConfigTool(
"xAODConfigTool" )
57 if tool.initialize().isFailure():
58 print(
"ERROR Couldn't initialise the trigger configuration tool" )
67 for entry
in xrange( tree.GetEntries() ):
69 if tree.GetEntry( entry ) < 0:
70 print(
"ERROR Failed to load entry %i from the input" % entry )
75 ( smk != tool.masterKey() )
or
76 ( l1psk != tool.lvl1PrescaleKey() )
or
77 ( hltpsk != tool.hltPrescaleKey() ) ):
79 smk = tool.masterKey()
80 l1psk = tool.lvl1PrescaleKey()
81 hltpsk = tool.hltPrescaleKey()
83 print(
"Configuration for SMK: %i, L1PSK: %i, HLTPSK: %i" % \
84 ( smk, l1psk, hltpsk ) )
86 if options.chainsDetail:
89 getattr( tool.ctpConfig().
menu(),
"print" )(
"", detailLevel )
90 getattr( tool.chains(),
"print" )(
"", detailLevel )