C/C++ style main function.
13
14
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()
24
25
26 fileNames = []
27 if len( args ) > 0:
28 fileNames = [ arg for arg in args if arg[ 0 ] != "-" ]
29 pass
30 if options.fileName != "":
31 import os.path
32 fileNames.append(
33 os.path.expandvars( os.path.expanduser( options.fileName ) ) )
34 pass
35 if len( fileNames ) == 0:
36 parser.print_help()
37 return 1
38 fileNames =
set( fileNames )
39
40
41 import ROOT
42 ROOT.gROOT.Macro( "$ROOTCOREDIR/scripts/load_packages.C" )
43
44
45 chain = ROOT.TChain( "CollectionTree" )
46 for fname in fileNames:
47 chain.Add( fname )
48 pass
49
50
51 tree = ROOT.xAOD.MakeTransientTree( chain, ROOT.xAOD.TEvent.kBranchAccess )
52 from xAODRootAccess.TPyStore import TPyStore
53 store = TPyStore()
54
55
56 tool = ROOT.TrigConf.xAODConfigTool( "xAODConfigTool" )
57 if tool.initialize().isFailure():
58 print(
"ERROR Couldn't initialise the trigger configuration tool" )
59 return 1
60
61
62 smk = 0
63 l1psk = 0
64 hltpsk = 0
65
66
67 for entry
in xrange( tree.GetEntries() ):
68
69 if tree.GetEntry( entry ) < 0:
70 print(
"ERROR Failed to load entry %i from the input" % entry )
71 return 1
72
73
75 ( smk != tool.masterKey() ) or
76 ( l1psk != tool.lvl1PrescaleKey() ) or
77 ( hltpsk != tool.hltPrescaleKey() ) ):
78
79 smk = tool.masterKey()
80 l1psk = tool.lvl1PrescaleKey()
81 hltpsk = tool.hltPrescaleKey()
82
83 print(
"Configuration for SMK: %i, L1PSK: %i, HLTPSK: %i" % \
84 ( smk, l1psk, hltpsk ) )
85 detailLevel = 1
86 if options.chainsDetail:
87 detailLevel = 3
88 pass
89 getattr( tool.ctpConfig().
menu(),
"print" )(
"", detailLevel )
90 getattr( tool.chains(), "print" )( "", detailLevel )
91
92 pass
93 pass
94
95
96 return 0
97
98
void print(char *figname, TCanvas *c1)
void xrange(TH1 *h, bool symmetric)