ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEgammaMonitorAlgorithm.py
Go to the documentation of this file.
2# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3#
4
5'''@file TrigEgammaMonitorAlgorithm.py
6@author J. Pinto (jodafons)
7@author D. Maximov
8@author E. Bergeaas Kuutmann
9@author T. Bold
10@date 2019-06-28
11@brief Egamma trigger python configuration for the Run III AthenaMonitoring package, based on the example by E. Bergeaas Kuutmann
12'''
13from AthenaCommon.Logging import logging
14log_trigeg = logging.getLogger( 'TrigEgammaMonitorAlgorithm' )
15
16
17def TrigEgammaMonConfig(inputFlags, emulator=None, onlyHLT = False):
18 '''Function to configures some algorithms in the monitoring system.'''
19
20 # The following class will make a sequence, configure algorithms, and link
21 from AthenaMonitoring import AthMonitorCfgHelper
22 helper = AthMonitorCfgHelper(inputFlags,'TrigEgammaAthMonitorCfg')
23
24 from TrigConfigSvc.TriggerConfigAccess import getHLTMonitoringAccess
25 moniAccess=getHLTMonitoringAccess(inputFlags)
26
27 if emulator: # add emulator as public
28 acc = helper.resobj
29 acc.addPublicTool(emulator.core())
30
31 # configure alg and ana tools
32 from TrigEgammaMonitoring.TrigEgammaMonitoringConfig import TrigEgammaMonAlgBuilder
33 monAlgCfg = TrigEgammaMonAlgBuilder( helper, '2018', moniAccess, detailedHistograms=False, emulator=emulator, onlyHLT = onlyHLT, ComputeEffLH = inputFlags.Trigger.egamma.monitorEffLH, ComputeEffDNN = inputFlags.Trigger.egamma.monitorEffDNN ) # Using 2018 e/g tunings
34 # build monitor and book histograms
35 monAlgCfg.configure()
36
37 # Finalize. The return value should be a tuple of the ComponentAccumulator
38 # and the sequence containing the created algorithms. If we haven't called
39 # any configuration other than the AthMonitorCfgHelper here, then we can
40 # just return directly (and not create "result" above)
41 # return the componenet accumulator to the main call
42 return helper.result()
43
44
45
46if __name__=='__main__':
47
48 # Set the Athena configuration flags
49 from AthenaConfiguration.AllConfigFlags import initConfigFlags
50
51 path = '/afs/cern.ch/work/j/jodafons/public/valid_sampleA/valid1.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.recon.AOD.e5112_s3214_d1731_r13252_tid27512952_00'
52 path+='/AOD.27512952._000185.pool.root.1'
53 flags = initConfigFlags()
54 flags.Input.Files = [path]
55 flags.Input.isMC = True
56 flags.Output.HISTFileName = 'TrigEgammaMonitorOutput.root'
57
58 flags.lock()
59
60 # Initialize configuration object, add accumulator, merge, and run.
61 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
62 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
63 cfg = MainServicesCfg(flags)
64 cfg.merge(PoolReadCfg(flags))
65
66 trigEgammaMonitorAcc = TrigEgammaMonConfig(flags)
67 cfg.merge(trigEgammaMonitorAcc)
68
69
70
71 # If you want to turn on more detailed messages ...
72 #trigEgammaMonitorAcc.getEventAlgo('TrigEgammaMonAlg').OutputLevel = 2 # DEBUG
73 cfg.printConfig(withDetails=False) # set True for exhaustive info
74
75 cfg.run(20) #use cfg.run(20) to only run on first 20 events
TrigEgammaMonConfig(inputFlags, emulator=None, onlyHLT=False)