ATLAS Offline Software
Loading...
Searching...
No Matches
CalibChainConfiguration.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3from AthenaCommon.Logging import logging
4logging.getLogger().info("Importing %s",__name__)
5log = logging.getLogger(__name__)
6
7from TriggerMenuMT.HLT.Config.ChainConfigurationBase import ChainConfigurationBase
8from TriggerMenuMT.HLT.Config.MenuComponents import MenuSequence, SelectionCA, InViewRecoCA, InEventRecoCA
9from AthenaConfiguration.ComponentFactory import CompFactory
10from TrigT2CaloCommon.CaloDef import fastCaloRecoSequenceCfg
11from TrigGenericAlgs.TrigGenericAlgsConfig import TimeBurnerCfg, TimeBurnerHypoToolGen
12from AthenaConfiguration.AccumulatorCache import AccumulatorCache
13
14from TrigTrackingHypo.IDCalibHypoConfig import IDCalibHypoToolFromDict, createIDCalibHypoAlg
15from ..CommonSequences.FullScanInDetConfig import commonInDetFullScanCfg
16from TriggerMenuMT.HLT.Jet.JetMenuSequencesConfig import getTrackingInputMaker
17
18from TrigCaloRec.TrigCaloRecConfig import hltCaloCellMakerCfg
19from TrigCaloHypo.TrigCaloHypoConfig import TrigLArNoiseBurstRecoAlgCfg
20from TrigCaloHypo.TrigCaloHypoConfig import TrigLArNoiseBurstHypoToolGen
21from TrigT2CaloCommon.CaloDef import clusterFSInputMaker
22
23
25 acc = InEventRecoCA("LArNoiseBurstRecoSequence", inputMaker=clusterFSInputMaker())
26 cells_name = 'CaloCellsFS'
27 acc.mergeReco(hltCaloCellMakerCfg(flags=flags, name="HLTCaloCellMakerFS", roisKey=''))
28 acc.mergeReco(TrigLArNoiseBurstRecoAlgCfg(flags, cells_name))
29 return acc
30
31
32# --------------------
33# LArNoiseBurst configuration
34# --------------------
35@AccumulatorCache
37
38 hypoAlg = CompFactory.TrigLArNoiseBurstAlg("NoiseBurstAlg")
39 InEventReco = InEventRecoCA("LArNoiseBurstRecoSequence", inputMaker=clusterFSInputMaker())
40
41 noiseBurstRecoSeq = getLArNoiseBurstRecoCfg(flags)
42
43 InEventReco.mergeReco(noiseBurstRecoSeq)
44 selAcc = SelectionCA("LArNoiseBurstMenuSequence")
45 selAcc.mergeReco(InEventReco)
46 selAcc.addHypoAlgo(hypoAlg)
47
48 return MenuSequence(flags,selAcc,HypoToolGen=TrigLArNoiseBurstHypoToolGen)
49
50
51# --------------------
52# LArPS Noise Detection EM configuration
53# --------------------
54@AccumulatorCache
55def getCaloAllEMLayersPSSequenceGenCfg(flags,doAllorAllEM=False):
56
57 from TrigT2CaloCommon.CaloDef import fastCaloVDVCfg
58 nameselAcc = "LArPSSequence_All"
59 namerecoAcc = "fastCaloInViewSequenceAllEM"
60 hypoAlgName = "TrigL2CaloLayersAlg_AllEM"
61 output = "HLT_LArPS_AllCaloEMClusters"
62 if doAllorAllEM :
63 nameselAcc = "LArPSSequence_AllEM"
64 namerecoAcc = "fastCaloInViewSequenceAll"
65 hypoAlgName = "TrigL2CaloLayersAlg_All"
66 output = "HLT_LArPS_AllCaloClusters"
67 selAcc = SelectionCA(nameselAcc)
68 InViewRoIs="EMCaloRoIs"
69 reco = InViewRecoCA(namerecoAcc,InViewRoIs=InViewRoIs)
70 reco.mergeReco(fastCaloVDVCfg(flags,InViewRoIs=InViewRoIs))
71 reco.mergeReco(fastCaloRecoSequenceCfg(flags, inputEDM=InViewRoIs,ClustersName=output,doAllEm=not doAllorAllEM,doAll=doAllorAllEM))
72
73 selAcc.mergeReco(reco)
74
75 from TrigCaloHypo.TrigCaloHypoConfig import TrigL2CaloLayersHypoToolGen
76 TrigL2CaloLayersAlg = CompFactory.TrigL2CaloLayersAlg(hypoAlgName)
77 TrigL2CaloLayersAlg.TrigClusterContainerKey = output
78 selAcc.addHypoAlgo(TrigL2CaloLayersAlg)
79 return MenuSequence(flags,selAcc,HypoToolGen=TrigL2CaloLayersHypoToolGen)
80
81
82#----------------------------------------------------------------
83
84class CalibChainConfiguration(ChainConfigurationBase):
85
86 def __init__(self, chainDict):
87 ChainConfigurationBase.__init__(self,chainDict)
88
89 # ----------------------
90 # Assemble the chain depending on information from chainName
91 # ----------------------
92 def assembleChainImpl(self, flags):
93
94 chainSteps = []
95 log.debug("Assembling chain for %s", self.chainName)
96
97 stepDictionary = self.getStepDictionary()
98
99 if 'acceptedevts' in self.chainPart['purpose']:
100 steps=stepDictionary['AcceptedEvents']
101 elif self.chainPart['purpose'][0] == 'larnoiseburst':
102 steps=stepDictionary['LArNoiseBurst']
103 elif self.chainPart['purpose'][0] == 'larpsallem':
104 steps=stepDictionary['LArPSAllEM']
105 elif self.chainPart['purpose'][0] == 'larpsall':
106 steps=stepDictionary['LArPSAll']
107 elif self.chainPart['purpose'][0] == 'idcalib':
108 steps=stepDictionary['IDCalib']
109 for i, step in enumerate(steps):
110 chainstep = getattr(self, step)(flags, i)
111 chainSteps+=[chainstep]
112
113 myChain = self.buildChain(chainSteps)
114 return myChain
115
116
118 # --------------------
119 # define here the names of the steps and obtain the chainStep configuration
120 # --------------------
121 stepDictionary = {
122 "AcceptedEvents": ['getAcceptedEventsStep'],
123 "LArNoiseBurst": ['getAllTEStep'],
124 "LArPSAllEM" : ['getCaloAllEMStep'],
125 "LArPSAll" : ['getCaloAllStep'],
126 "IDCalib": ['getIDCalibEmpty', 'getIDCalibEmpty', 'getIDCalibFTFReco', 'getIDCalibTrigger']
127 }
128 return stepDictionary
129
130
131 def getAcceptedEventsStep(self, flags, i):
132 return self.getStep(flags, 'AcceptedEvents', [acceptedEventsSequenceGenCfg])
133
134 def getAllTEStep(self, flags, i):
135 return self.getStep(flags, 'LArNoiseBurst', [getLArNoiseBurstSequenceGenCfg])
136
137 def getCaloAllEMStep(self, flags, i):
138 return self.getStep(flags, 'LArPSALLEM', [getCaloAllEMLayersPSSequenceGenCfg], doAllorAllEM=False)
139
140 def getCaloAllStep(self, flags, i):
141 return self.getStep(flags, 'LArPSALL', [getCaloAllEMLayersPSSequenceGenCfg], doAllorAllEM=True)
142
143 def getIDCalibEmpty(self, flags, i):
144 return self.getEmptyStep('IDCalibEmptyStep')
145
146 def getIDCalibFTFReco(self, flags, i):
147 return self.getStep(flags, 'IDCalibFTFCfg',[IDCalibFTFSequenceGenCfg])
148
149 def getIDCalibTrigger(self, flags, i):
150 return self.getStep(flags, 'IDCalibTriggerCfg',[IDCalibTriggerSequenceGenCfg])
151
152#----------------------------------------------------------------
153
154# --------------------
155# IDCalib trigger configurations
156# --------------------
157
158@AccumulatorCache
160 DummyInputMakerAlg = CompFactory.InputMakerForRoI( "IM_IDCalib_HypoOnlyStep" )
161 DummyInputMakerAlg.RoITool = CompFactory.ViewCreatorInitialROITool()
162
163 reco = InEventRecoCA('IDCalibEmptySeq_reco',inputMaker=DummyInputMakerAlg)
164
165 theHypoAlg = createIDCalibHypoAlg(flags, "IDCalibHypo")
166 theHypoAlg.tracksKey = flags.Trigger.InDetTracking.fullScan.tracks_FTF
167
168 selAcc = SelectionCA('IDCalibEmptySeq_sel')
169 selAcc.mergeReco(reco)
170 selAcc.addHypoAlgo(theHypoAlg)
171
172 msca = MenuSequence(
173 flags, selAcc,
174 HypoToolGen=IDCalibHypoToolFromDict,
175 )
176 return msca
177
178
179# --------------------
180
181@AccumulatorCache
183 reco = InEventRecoCA('IDCalibTrkrecoSeq_reco',inputMaker=getTrackingInputMaker(flags, "ftf"))
184 reco.mergeReco(commonInDetFullScanCfg(flags))
185
186 selAcc = SelectionCA('IDCalibTrkrecoSeq')
187 selAcc.mergeReco(reco)
188 selAcc.addHypoAlgo(CompFactory.TrigStreamerHypoAlg("IDCalibTrkDummyStream"))
189
190 msca = MenuSequence(
191 flags, selAcc,
192 HypoToolGen = lambda flags, chainDict: CompFactory.TrigStreamerHypoTool(chainDict['chainName'])
193 )
194 return msca
195
196
197#----------------------------------------------------------------
198
199# --------------------
200# HLT step for the AcceptedEvents chains
201# --------------------
202@AccumulatorCache
204 '''
205 Return MenuSequence for an HLT step used by the AcceptedEvents chains. This step is a trivial
206 always-reject hypo with no reco. The step itself should be noop as only the HLTSeeding and the
207 end-of-event sequence parts of AcceptedEvents chains are actually used.
208 '''
209 # Implementation identical to the timeburner chain but with zero sleep time
210
211 inputMaker = CompFactory.InputMakerForRoI(
212 "IM_AcceptedEvents",
213 RoITool = CompFactory.ViewCreatorInitialROITool(),
214 RoIs="AcceptedEventsRoIs",
215 )
216 reco = InEventRecoCA('AcceptedEvents_reco',inputMaker=inputMaker)
217 # TimeBurner alg works as a reject-all hypo
218 selAcc = SelectionCA('AcceptedEventsSequence')
219 selAcc.mergeReco(reco)
220 selAcc.addHypoAlgo(
221 TimeBurnerCfg(
222 flags,
223 name="AcceptedEventsHypo",
224 SleepTimeMillisec = 0,
225 )
226 )
227
228 msca = MenuSequence(
229 flags, selAcc,
230 HypoToolGen=TimeBurnerHypoToolGen
231 )
232 return msca
233