ATLAS Offline Software
RunTriggerMatchingConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 # Configure the RunTriggerMatching algorithm
3 # For guidelines on writing configuration scripts see the following pages:
4 # https://atlassoftwaredocs.web.cern.ch/guides/ca_configuration/
5 
6 # Imports of the configuration machinery
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9 
11  '''Method to configure the ReadTriggerDecision algorithm'''
12  acc = ComponentAccumulator()
13 
14  # Trigger decision tool configuration
15  # https://twiki.cern.ch/twiki/bin/viewauth/Atlas/TrigDecisionTool
16  from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg
17  tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags))
18 
19  # Trigger matching configuration
20  # https://twiki.cern.ch/twiki/bin/view/Atlas/R22TriggerAnalysis
21  r3MatchingTool = CompFactory.Trig.R3MatchingTool("R3MatchingTool")
22  r3MatchingTool.TrigDecisionTool = tdt
23 
24  # Configure the algorithm.... note that the tool from above is passed
25  # add the algorithm to the accumulator
26  acc.addEventAlgo(CompFactory.RunTriggerMatching(name = "RunTriggerMatching",
27  TriggerDecisionTool = tdt,
28  R3MatchingTool = r3MatchingTool,
29  TriggerString = "HLT_mu24.*",
30  ContainerName = "Muons"))
31  return acc
32 
33 # Lines to allow the script to be run stand-alone via python
34 if __name__ == "__main__":
35 
36  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
37  from AthenaConfiguration.AllConfigFlags import initConfigFlags
38  import sys
39  # Configuration flags
40  flags = initConfigFlags()
41  # Obtain default test files (user can provide their own as well)
42  from AthenaConfiguration.TestDefaults import defaultTestFiles
43 
44  # Set the input file - can also use command line via --files
45  flags.Input.Files = defaultTestFiles.AOD_RUN3_MC
46 
47  # Number of events to process
48  flags.Exec.MaxEvents = 1000
49  flags.fillFromArgs()
50  flags.lock()
51 
52  # Configure the file reading machinery
53  cfg = MainServicesCfg(flags)
54  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
55  cfg.merge(PoolReadCfg(flags))
56 
57  # Run the job
58  cfg.merge(RunTriggerMatchingCfg(flags))
59  sys.exit(cfg.run().isFailure())
60 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.TriggerInterface.TrigDecisionToolCfg
def TrigDecisionToolCfg(flags)
Definition: TriggerInterface.py:14
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
RunTriggerMatchingConfig.RunTriggerMatchingCfg
def RunTriggerMatchingCfg(flags)
Definition: RunTriggerMatchingConfig.py:10
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69