ATLAS Offline Software
Loading...
Searching...
No Matches
RunTrigEgammaMonitoring.py
Go to the documentation of this file.
1#!/usr/bin/env python
2#
3# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4#
5
6if __name__=='__main__':
7
8 import argparse
9 import sys,os
10
11
12 parser = argparse.ArgumentParser(description = '', add_help = False)
13 parser = argparse.ArgumentParser()
14
15 #
16 # File configuration
17 #
18
19 parser.add_argument('-i','--inputFiles', action='store', dest='inputFiles', required = False,
20 help = "Comma-separated list of input files (alias for --filesInput)")
21
22 parser.add_argument('-o','--outputFile', action='store', dest='outputFile', required = False,
23 default = 'TrigEgammaMonitorOutput.root',
24 help = "Histogram output.")
25
26 parser.add_argument('--nov','--numberOfEvents', action='store', dest='numberOfEvents', required = False,
27 type=int, default=-1,
28 help = "The number of events to run.")
29
30 #
31 # Selector calib paths
32 #
33
34 parser.add_argument('--pidConfigPath', action='store', required = False,
35 type=str, default='ElectronPhotonSelectorTools/trigger/rel22_20210611',
36 help = "Electron Likelihood and Photon CB config path to use in emulated precision step.")
37
38 parser.add_argument('--dnnConfigPath', action='store', required = False,
39 type=str, default='ElectronPhotonSelectorTools/offline/mc16_20210430',
40 help = "Electron DNN config path to use in emulated precision step.")
41
42 parser.add_argument('--ringerConfigPath', action='store', required = False,
43 type=str, default='RingerSelectorTools/TrigL2_20210702_r4',
44 help = "Electron ringer config path to use in emulated fast calo step.")
45
46
47
48 parser.add_argument('--preExec', help='Code to execute before locking configs', default=None)
49 parser.add_argument('--postExec', help='Code to execute after setup', default=None)
50 parser.add_argument('--emulate', help='emulate the HLT e/g sequence', action='store_true')
51 parser.add_argument('--debug', help='debug mode', action='store_true')
52 parser.add_argument('--onlyHLT',help='compute final HLT decision', action='store_true', dest='onlyHLT')
53
54 if len(sys.argv)==1:
55 parser.print_help()
56 sys.exit(1)
57
58 args = parser.parse_args()
59
60 # Set the Athena configuration flags
61 from AthenaConfiguration.AllConfigFlags import initConfigFlags
62 flags = initConfigFlags()
63
64
65 from AthenaConfiguration.AutoConfigFlags import GetFileMD
66 if args.inputFiles is not None:
67 flags.Input.Files = args.inputFiles.split(',')
68 flags.Input.isMC = "IS_SIMULATION" in GetFileMD(flags.Input.Files).get("eventTypes", [])
69 flags.Output.HISTFileName = args.outputFile
70
71
72 if args.preExec:
73 # bring things into scope
74 from AthenaMonitoring.DQConfigFlags import allSteeringFlagsOff
75 exec(args.preExec)
76
77 flags.lock()
78
79
80 # Initialize configuration object, add accumulator, merge, and run.
81 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
82 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
83 cfg = MainServicesCfg(flags)
84 cfg.merge(PoolReadCfg(flags))
85
86 emulator=None
87 if args.emulate:
88 # create and configure emulator tool
89 from TrigEgammaEmulationTool.TrigEgammaEmulationToolConfigMT import TrigEgammaEmulationToolConfig
90 emulator = TrigEgammaEmulationToolConfig(flags, "EgammaEmulation")
91
92 # configure all selectors
93 emulator.PhotonCBConfigFilePath = args.pidConfigPath # Cut-based
94 emulator.ElectronLHConfigFilePath = args.pidConfigPath # LH
95 emulator.ElectronCBConfigFilePath = args.pidConfigPath # Cut-based
96 emulator.ElectronDNNConfigFilePath = args.dnnConfigPath # DNN
97 emulator.FastCaloConfigFilePath = args.ringerConfigPath # NN
98 emulator.configure()
99
100
101
102 # create the e/g monitoring tool and add into the component accumulator
103 from TrigEgammaMonitoring.TrigEgammaMonitorAlgorithm import TrigEgammaMonConfig
104 trigEgammaMonitorAcc = TrigEgammaMonConfig(flags, emulator=emulator, onlyHLT = args.onlyHLT)
105 cfg.merge(trigEgammaMonitorAcc)
106
107
108 # any last things to do?
109 if args.postExec:
110 exec(args.postExec)
111
112 # If you want to turn on more detailed messages ...
113 #if args.debug:
114 # trigEgammaMonitorAcc.getEventAlgo('TrigEgammaMonitorTagAndProbeAlgorithm_Zeeg').OutputLevel = 2 # DEBUG
115
116
117
118 cfg.printConfig(withDetails=True) # set True for exhaustive info
119 sc = cfg.run(args.numberOfEvents) #use cfg
120
121 sys.exit(0 if sc.isSuccess() else 1)
122
123
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132