6 if __name__==
'__main__':
8 from argparse
import ArgumentParser
9 parser = ArgumentParser()
10 parser.add_argument(
'--chain', default=
'HLT_mu50_L1MU20', type=str, help=
'Chain Group for which to plot the navigation graphs')
11 parser.add_argument(
'--excludeFailedHypoNodes', action=
'store_true', help=
'By default Hypo nodes are included which fail for a given chain, but there can be many, e.g. for jet. This excludes these nodes.')
12 parser.add_argument(
'--collection', type=str, help=
'Optional, restrict to nodes in a given collection, e.g. if the file contains multiple slim levels ')
13 parser.add_argument(
'--doTDTDump', action=
'store_true', help=
'Optional extra dump of TrigDecisionTool information for supplied chain')
14 parser.add_argument(
'--doNavDump', action=
'store_true', help=
'Optional extra dump of trigger navigation data to terminal (caution: large)')
15 parser.add_argument(
'--maxEvents', type=int, default=20, help=
'Maximum number of events to process')
16 parser.add_argument(
'--skipEvents', type=int, help=
'Number of events to skip')
17 parser.add_argument(
'--loglevel', type=int, default=3, help=
'Verbosity level')
18 parser.add_argument(
'flags', nargs=
'*', help=
'Config flag overrides')
19 args = parser.parse_args()
21 from AthenaCommon.Logging
import logging
22 log = logging.getLogger(
"generateTrigNavGraph.py")
23 log.info(
"Generating NavGraphs for :" + args.chain)
25 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
29 flags.Input.Files = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art//TrigAnalysisTest/AthenaTrigAOD_TrigEDMandTDTCheck_LS2_v1_chain/AOD.pool.root"]
31 flags.Exec.MaxEvents = args.maxEvents
32 if args.skipEvents
is not None:
33 flags.Exec.SkipEvents = args.skipEvents
36 flags.fillFromArgs(args.flags)
40 if flags.Trigger.EDMVersion != 3:
41 log.error(
"Can only run over a Run 3 AOD or ESD file")
45 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
46 from AthenaConfiguration.ComponentFactory
import CompFactory
48 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
52 from TrigDecisionTool.TrigDecisionToolConfig
import TrigDecisionToolCfg
54 tdt = tdt_ca.getPrimary()
55 tdt.OutputLevel = args.loglevel
58 checker = CompFactory.TrigEDMChecker()
59 checker.doDumpAll =
False
60 checker.OutputLevel = args.loglevel
61 checker.TriggerDecisionTool = tdt
62 checker.DumpNavigationForChain = args.chain
63 checker.dumpTrigCompositeContainers = [args.collection]
if args.collection
is not None else []
64 checker.doDumpTrigCompsiteNavigation =
True
65 checker.excludeFailedHypoNodes = args.excludeFailedHypoNodes
67 checker.doDumpAllTrigComposite = args.doNavDump
69 from Gaudi.Configuration
import DEBUG
70 checker.OutputLevel = DEBUG
71 checker.doTDTCheck = args.doTDTDump
72 cfg.addEventAlgo(checker)
76 log.info(
"Converting .dot files to .dot.pdf")
78 from subprocess
import check_call
79 for f
in os.listdir(
'.'):
80 if "NavGraph_" in f
and not ".dot.pdf" in f:
81 check_call([
'dot',
'-Tpdf',f,
'-o',f+
'.pdf'])
83 sys.exit(0
if sc.isSuccess()
else 1)