ATLAS Offline Software
TrigEgammaMonitorAlgorithm.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 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 '''
13 from AthenaCommon.Logging import logging
14 log_trigeg = logging.getLogger( 'TrigEgammaMonitorAlgorithm' )
15 
16 
17 def TrigEgammaMonConfig(inputFlags, emulator=None):
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 ) # 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 
46 if __name__=='__main__':
47 
48  # ATR-11839 to fix the egammaPid import
49  from PyUtils.Helpers import ROOT6Setup
50  ROOT6Setup()
51 
52  # Set the Athena configuration flags
53  from AthenaConfiguration.AllConfigFlags import initConfigFlags
54 
55  path = '/afs/cern.ch/work/j/jodafons/public/valid_sampleA/valid1.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.recon.AOD.e5112_s3214_d1731_r13252_tid27512952_00'
56  path+='/AOD.27512952._000185.pool.root.1'
57  flags = initConfigFlags()
58  flags.Input.Files = [path]
59  flags.Input.isMC = True
60  flags.Output.HISTFileName = 'TrigEgammaMonitorOutput.root'
61 
62  flags.lock()
63 
64  # Initialize configuration object, add accumulator, merge, and run.
65  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
66  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
67  cfg = MainServicesCfg(flags)
68  cfg.merge(PoolReadCfg(flags))
69 
70  trigEgammaMonitorAcc = TrigEgammaMonConfig(flags)
71  cfg.merge(trigEgammaMonitorAcc)
72 
73 
74 
75  # If you want to turn on more detailed messages ...
76  #trigEgammaMonitorAcc.getEventAlgo('TrigEgammaMonAlg').OutputLevel = 2 # DEBUG
77  cfg.printConfig(withDetails=False) # set True for exhaustive info
78 
79  cfg.run(20) #use cfg.run(20) to only run on first 20 events
python.TriggerConfigAccess.getHLTMonitoringAccess
HLTMonitoringAccess getHLTMonitoringAccess(flags=None)
Definition: TriggerConfigAccess.py:256
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
python.Helpers.ROOT6Setup
def ROOT6Setup(batch=False)
Definition: Tools/PyUtils/python/Helpers.py:19
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.TrigEgammaMonitorAlgorithm.TrigEgammaMonConfig
def TrigEgammaMonConfig(inputFlags, emulator=None)
Definition: TrigEgammaMonitorAlgorithm.py:17
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69