ATLAS Offline Software
Loading...
Searching...
No Matches
TrigDecisionMakerConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5from 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 tdm.UseEDMxAOD = flags.Trigger.CTP.UseEDMxAOD
77 if flags.Input.Format is not Format.BS:
78 # Construct trigger bits from HLTNav_summary instead of reading from BS
79 tdm.BitsMakerTool = CompFactory.TriggerBitsMakerTool()
80 acc.addEventAlgo( tdm )
81
82 # Validate that the output of the TrigDecisionMakerMT is sensible.
83 if flags.Trigger.DecisionMakerValidation.Execute:
84 tdmv = CompFactory.TrigDec.TrigDecisionMakerValidator()
85 tdmv.doL1 = flags.Trigger.L1.doCTP
86 tdmv.doHLT = flags.Trigger.decodeHLT
87 tdmv.samplingFrequency = 1
88 tdmv.errorOnFailure = flags.Trigger.DecisionMakerValidation.ErrorMode
89 tdmv.EDMVersion = flags.Trigger.EDMVersion
90 from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg, getRun3NavigationContainerFromInput
91 tdmv.TrigDecisionTool = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags))
92 tdmv.NavigationKey = getRun3NavigationContainerFromInput(flags)
93 acc.addEventAlgo( tdmv )
94
95 return acc