ATLAS Offline Software
TrigTauMonitorAlgorithm.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2 
3 def TrigTauMonConfig(flags):
4  '''Function to configures some algorithms in the monitoring system.'''
5  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 
8  # We need the TauID inference to run first
9  from AthenaCommon.CFElements import seqAND
10  seq_name = 'TrigTauMonitoringSeq'
11  acc.addSequence(seqAND(seq_name))
12 
13 
14  # Schedule the offline GNTau inference when running from AOD (GNTau is now transiently available in RAWtoALL)
15  if flags.DQ.Environment == 'AOD':
16  TauContainerCopy = 'TTMTauJets'
17 
18  from tauRec.TauToolHolder import TauVertexedClusterDecoratorCfg, TauGNNEvaluatorCfg, TauWPDecoratorGNNCfg
19  tool_accs = [
21  TauGNNEvaluatorCfg(flags, 0, tauContainerName=TauContainerCopy),
22  TauWPDecoratorGNNCfg(flags, 0, TauContainerCopy),
23  ]
24 
25  tools = []
26  for tool_acc in tool_accs:
27  tools.append(tool_acc.popPrivateTools())
28  tools[-1].inAOD = True
29  acc.merge(tool_acc, seq_name)
30  acc.addPublicTool(tools[-1])
31 
32  from AthenaConfiguration.ComponentFactory import CompFactory
33  acc.addEventAlgo(CompFactory.TauAODRunnerAlg(
34  name='TrigTauMonitoring_TauJets_TauIDDecorator',
35  Key_tauContainer='TauJets',
36  Key_pi0ClusterInputContainer='',
37  Key_tauOutputContainer=TauContainerCopy,
38  Key_pi0OutputContainer='',
39  Key_neutralPFOOutputContainer='',
40  Key_chargedPFOOutputContainer='',
41  Key_hadronicPFOOutputContainer='',
42  Key_tauTrackOutputContainer='',
43  Key_vertexOutputContainer='',
44  officialTools=tools,
45  ), sequenceName=seq_name)
46 
47 
48  # The following class will make a sequence, configure the base monitoring infrastructure
49  # and algorithms, and link them to GenericMonitoringTools
50  from AthenaMonitoring import AthMonitorCfgHelper
51  helper = AthMonitorCfgHelper(flags, 'TrigTauAthMonitorCfg')
52 
53  # Configure the actual TrigTauMonitoring algorithm(s)
54  from TrigTauMonitoring.TrigTauMonitoringConfig import TrigTauMonAlgBuilder
55  monAlgCfg = TrigTauMonAlgBuilder(helper)
56  if flags.DQ.Environment == 'AOD':
57  monAlgCfg.offline_taujets = 'TTMTauJets'
58  else:
59  monAlgCfg.offline_taujets = 'TauJets'
60  monAlgCfg.offline_GNTau_WP = flags.Tau.GNTauDecorWPNames[0][2]
61  monAlgCfg.configure()
62  acc.merge(helper.result(), seq_name)
63 
64  return acc
65 
66 
67 if __name__=='__main__':
68  # Setup logs
69  from AthenaCommon.Logging import log
70  from AthenaCommon.Constants import DEBUG
71  log.setLevel(DEBUG)
72 
73  # Set the Athena configuration flags
74  from AthenaConfiguration.AllConfigFlags import initConfigFlags
75  nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/'
76  file = 'data22/AOD/data22_13p6TeV.00431906.physics_Main.merge.AOD.r13928_p5279/1000events.AOD.30220215._001367.pool.root.1'
77  flags = initConfigFlags()
78  flags.Input.Files = [nightly+file]
79  flags.Input.isMC = False
80  flags.Output.HISTFileName = 'TrigTauMonitorOutput.root'
81 
82  flags.lock()
83 
84  # Initialize configuration object, add accumulator, merge, and run.
85  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
86  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
87  cfg = MainServicesCfg(flags)
88  cfg.merge(PoolReadCfg(flags))
89 
90  trigTauMonitorAcc = TrigTauMonConfig(flags)
91  cfg.merge(trigTauMonitorAcc)
92 
93  # If you want to turn on more detailed messages ...
94  #trigJetMonitorAcc.getEventAlgo('TrigTauMonAlg').OutputLevel = 2 # DEBUG
95  cfg.printConfig(withDetails=True) # set True for exhaustive info
96 
97  sc = cfg.run() #use cfg.run(20) to only run on first 20 events
98  if not sc.isSuccess():
99  import sys
100  sys.exit("Execution failed")
101 
102 
TauToolHolder.TauVertexedClusterDecoratorCfg
def TauVertexedClusterDecoratorCfg(flags)
Definition: TauToolHolder.py:132
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TauToolHolder.TauGNNEvaluatorCfg
def TauGNNEvaluatorCfg(flags, version=0, applyLooseTrackSel=False, applyTightTrackSel=False, tauContainerName="")
Definition: TauToolHolder.py:741
TauToolHolder.TauWPDecoratorGNNCfg
def TauWPDecoratorGNNCfg(flags, version, tauContainerName="")
Definition: TauToolHolder.py:770
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:312
Constants
some useful constants -------------------------------------------------—
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.CFElements.seqAND
def seqAND(name, subs=[], invert=False)
Definition: CFElements.py:27
python.TrigTauMonitorAlgorithm.TrigTauMonConfig
def TrigTauMonConfig(flags)
Definition: TrigTauMonitorAlgorithm.py:3
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:71