ATLAS Offline Software
TrigDecisionMakerConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaConfiguration.Enums import Format
6 
7 
9  """Configures HLTNavigation(tool) -> xAODNavigation and TrigDec::TrigDecision -> xAOD::TrigDecision """
10  acc = ComponentAccumulator()
11  doL1=flags.Trigger.L1.doCTP
12  doL2=flags.Trigger.decodeHLT
13  doEF=flags.Trigger.decodeHLT
14  doHLT=flags.Trigger.decodeHLT
15 
16 
17  if 'HLT' not in flags.Trigger.availableRecoMetadata:
18  doL2=False
19  doEF=False
20  doHLT=False
21 
22  if 'L1' not in flags.Trigger.availableRecoMetadata:
23  doL1=False
24 
25  if flags.Trigger.EDMVersion == 1: # Run-1 has L2 and EF result
26  doHLT = False
27  else:
28  doL2 = False
29  doEF = False
30 
31  L1ResultKey = "" if flags.Input.Format is Format.BS else "Lvl1Result"
32 
33  decMaker = CompFactory.TrigDec.TrigDecisionMaker( 'TrigDecMaker',
34  doL1 = doL1,
35  doL2 = doL2,
36  doEF = doEF,
37  doHLT = doHLT,
38  L1ResultKey = L1ResultKey)
39  acc.addEventAlgo(decMaker)
40 
41 
42  from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg
43  acc.merge(TrigDecisionToolCfg(flags))
44 
45  from TrigConfxAOD.TrigConfxAODConfig import getxAODConfigSvc
46  cnvTool = CompFactory.xAODMaker.TrigDecisionCnvTool('TrigDecisionCnvTool',
47  TrigConfigSvc = acc.getPrimaryAndMerge( getxAODConfigSvc( flags )) )
48 
49 
50  decCnv = CompFactory.xAODMaker.TrigDecisionCnvAlg(CnvTool = cnvTool)
51  if "EventInfo#EventInfo" not in flags.Input.TypedCollections:
52  decCnv.EventInfoKey=""
53 
54  acc.addEventAlgo(decCnv)
55  if doHLT or doEF:
56  # TrigNavigationCnvAlg runs on the original HLTResult in the bytestream as it used
57  # to be in serial athena, i.e. it does not run on the modified HLTResult created by
58  # TrigBSExtraction. See also ATLASRECTS-6453.
59  from SGComps.AddressRemappingConfig import InputRenameCfg
60 
61  # Even for Run-1, we only convert the EF result:
62  aodKey = "HLTResult_HLT" if doHLT else "HLTResult_EF"
63 
64  acc.merge(InputRenameCfg("HLT::HLTResult", aodKey, aodKey+"_BS"))
65  acc.addEventAlgo( CompFactory.xAODMaker.TrigNavigationCnvAlg('TrigNavigationCnvAlg',
66  AODKey = aodKey,
67  xAODKey = "TrigNavigation") )
68 
69  return acc
70 
72  acc = ComponentAccumulator()
73  tdm = CompFactory.TrigDec.TrigDecisionMakerMT()
74  tdm.doL1 = flags.Trigger.L1.doCTP
75  tdm.doHLT = flags.Trigger.decodeHLT
76  if flags.Input.Format is not Format.BS:
77  # Construct trigger bits from HLTNav_summary instead of reading from BS
78  tdm.BitsMakerTool = CompFactory.TriggerBitsMakerTool()
79  acc.addEventAlgo( tdm )
80 
81  # Validate that the output of the TrigDecisionMakerMT is sensible.
82  if flags.Trigger.DecisionMakerValidation.Execute:
83  tdmv = CompFactory.TrigDec.TrigDecisionMakerValidator()
84  tdmv.doL1 = flags.Trigger.L1.doCTP
85  tdmv.doHLT = flags.Trigger.decodeHLT
86  tdmv.samplingFrequency = 1
87  tdmv.errorOnFailure = flags.Trigger.DecisionMakerValidation.ErrorMode
88  tdmv.EDMVersion = flags.Trigger.EDMVersion
89  from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg, getRun3NavigationContainerFromInput
90  tdmv.TrigDecisionTool = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags))
91  tdmv.NavigationKey = getRun3NavigationContainerFromInput(flags)
92  acc.addEventAlgo( tdmv )
93 
94  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TrigDecisionMakerConfig.Run3DecisionMakerCfg
def Run3DecisionMakerCfg(flags)
Definition: TrigDecisionMakerConfig.py:71
TrigConfxAODConfig.getxAODConfigSvc
def getxAODConfigSvc(flags)
Definition: TrigConfxAODConfig.py:5
python.TrigDecisionToolConfig.getRun3NavigationContainerFromInput
def getRun3NavigationContainerFromInput(flags)
Definition: TrigDecisionToolConfig.py:75
python.TriggerInterface.TrigDecisionToolCfg
def TrigDecisionToolCfg(flags)
Definition: TriggerInterface.py:14
python.TrigDecisionMakerConfig.Run1Run2DecisionMakerCfg
def Run1Run2DecisionMakerCfg(flags)
Definition: TrigDecisionMakerConfig.py:8
AddressRemappingConfig.InputRenameCfg
def InputRenameCfg(type, from_name, to_name)
Definition: AddressRemappingConfig.py:28