ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfxAOD
scripts
checkTriggerConfig.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
4
#
5
# $Id: checkTriggerConfig.py 657274 2015-03-27 10:15:06Z krasznaa $
6
#
7
# This is a script to conveniently print the trigger configuration of
8
# an xAOD file.
9
#
10
11
12
def
main
():
13
14
# Set up the command line option parser:
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
# Get the file name(s):
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
# Set up the environment for xAOD access:
41
import
ROOT
42
ROOT.gROOT.Macro(
"$ROOTCOREDIR/scripts/load_packages.C"
)
43
44
# Set up a TChain with the input file(s):
45
chain = ROOT.TChain(
"CollectionTree"
)
46
for
fname
in
fileNames:
47
chain.Add( fname )
48
pass
49
50
# And create the objects used to read this chain:
51
tree = ROOT.xAOD.MakeTransientTree( chain, ROOT.xAOD.TEvent.kBranchAccess )
52
from
xAODRootAccess.TPyStore
import
TPyStore
53
store = TPyStore()
54
55
# Set up the tool used in the printout:
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
# The keys of the configuration printed last:
62
smk = 0
63
l1psk = 0
64
hltpsk = 0
65
66
# Loop over the events of the file, to encounter all configurations in it:
67
for
entry
in
xrange
( tree.GetEntries() ):
68
# Load the event:
69
if
tree.GetEntry( entry ) < 0:
70
print
(
"ERROR Failed to load entry %i from the input"
% entry )
71
return
1
72
# Always print the configuration for the first event, or when the
73
# configuration changes:
74
if
( ( entry == 0 )
or
75
( smk != tool.masterKey() )
or
76
( l1psk != tool.lvl1PrescaleKey() )
or
77
( hltpsk != tool.hltPrescaleKey() ) ):
78
# Remember the keys:
79
smk = tool.masterKey()
80
l1psk = tool.lvl1PrescaleKey()
81
hltpsk = tool.hltPrescaleKey()
82
# Print the basic info:
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
# Return gracefully:
96
return
0
97
98
# Run the main() function:
99
if
__name__ ==
"__main__"
:
100
import
sys
101
sys.exit(
main
() )
if
if(pathvar)
Definition
SealSharedLib.cxx:168
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
menu
make the sidebar many part of the config
Definition
hcg.cxx:554
set
STL class.
xrange
void xrange(TH1 *h, bool symmetric)
Definition
computils.cxx:518
checkTriggerConfig.main
main()
C/C++ style main function.
Definition
checkTriggerConfig.py:12
Generated on
for ATLAS Offline Software by
1.17.0