5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
8 from AthenaCommon.Logging
import logging
9 log = logging.getLogger(
"NavConverterConfig")
13 """Configures Run 1/2 to Run 3 navigation conversion algorithm for all triggers"""
14 if len(chainsList) == 0:
15 log.info(
"Chains list is empty, the conversion will happen for all chains, but no validation will be performed")
16 log.info(
"The later is enabled when an explicit chain list is provided")
20 if flags.Trigger.EDMVersion >= 3:
23 if not flags.Trigger.doEDMVersionConversion:
26 from TrigDecisionTool.TrigDecisionToolConfig
import TrigDecisionToolCfg, getRun3NavigationContainerFromInput
31 cnvAlg = CompFactory.Run2ToRun3TrigNavConverterV2(
"TrigRun2ToRun3NavConverter")
32 cnvAlg.TrigDecisionTool = tdt
33 cnvAlg.TrigNavReadKey =
""
34 cnvAlg.TrigConfigSvc = tdt.TrigConfigSvc
35 cnvAlg.OutputNavKey = r2ToR3OutputName
36 from OutputStreamAthenaPool.OutputStreamConfig
import addToAOD, addToESD
37 collections = [f
"xAOD::TrigCompositeContainer#{r2ToR3OutputName}", f
"xAOD::TrigCompositeAuxContainer#{r2ToR3OutputName}Aux."]
38 acc.merge(
addToAOD(flags, collections))
39 acc.merge(
addToESD(flags, collections))
41 cnvAlg.Rois = [
"initialRoI",
"forID",
"forID1",
"forID2",
"forMS",
"forSA",
"forTB",
"forMT",
"forCB"]
43 from TrigEDMConfig.TriggerEDM
import getTriggerEDMList
46 def cleanKey(type, name):
47 return name.replace(
"HLT_",
"", 1).
replace(type.replace(
"::",
"__"),
"", 1).
replace(
"_",
"", 1)
49 for type, keys
in edm.items():
52 types.append(type+
"#"+cleanKey(type, key))
54 log.info(
"Assuming these collections are relevant for trigger: %s",
" ".
join(types))
55 cnvAlg.Collections = types
56 cnvAlg.Chains = chainsList
57 cnvAlg.doCompression =
True
58 acc.addEventAlgo(cnvAlg)
61 checker = CompFactory.Trig.NavigationTesterAlg(FailOnDifference =
False, TrigDecisionTool = tdt)
62 checker.RetrievalToolRun2Nav = CompFactory.Trig.IParticleRetrievalTool()
65 run3tdt = CompFactory.Trig.TrigDecisionTool(
"Run3TrigDecisionTool",
66 HLTSummary = r2ToR3OutputName,
67 NavigationFormat =
'TrigComposite',
68 AcceptMultipleInstance=
True,
69 TrigConfigSvc = tdt.TrigConfigSvc)
70 acc.addPublicTool(run3tdt)
71 checker.RetrievalToolRun3Nav = CompFactory.Trig.R3IParticleRetrievalTool(TrigDecisionTool = run3tdt)
72 checker.Chains = chainsList
73 checker.TrigDecisionToolRun3 = run3tdt
74 checker.TrigDecisionToolRun2 = tdt
76 acc.addEventAlgo(checker)
81 if __name__ ==
"__main__":
83 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
84 from AthenaConfiguration.TestDefaults
import defaultTestFiles
86 flags.Input.Files = defaultTestFiles.AOD_RUN2_DATA
87 flags.Trigger.doEDMVersionConversion =
True
91 acc.printConfig(withDetails=
True, summariseProps=
True)