ATLAS Offline Software
Loading...
Searching...
No Matches
python.HLT.CommonSequences.EventBuildingSequences Namespace Reference

Functions

 addEventBuildingSequence (flags, chain, eventBuildType, chainDict)
 pebInfoWriterToolCfg (flags, name, eventBuildType)
 getPEBBuildSuffix (chain, eventBuildType)
 pebInputMaker (flags, chain, eventBuildType)
 pebMenuSequenceGenCfg (flags, chain, eventBuildType, chainDict)
 findEventBuildingStep (chainConfig)
 alignEventBuildingSteps (chain_configs, chain_dicts)
 isFullScan (chain)
 isNoAlg (chain)

Variables

 log = logging.getLogger(__name__)
 flags = initConfigFlags()
 Files
 AtlasVersion
int failures = 0
 tool = None
 cfg = pebInfoWriterToolCfg(flags, 'TestTool_'+eb_identifier, eb_identifier)
 isRoIBasedPEB = EventBuildingInfo.isRoIBasedPEB(eb_identifier)
str robs = 'StaticPEBInfoWriterTool' else tool.ExtraROBs
str dets = 'StaticPEBInfoWriterTool' else tool.ExtraSubDets
bool robs_check_passed = True
bool is_data_scouting = False
 rob_sid = SourceIdentifier(rob_id)
 rob_det_id = rob_sid.subdetector_id()
 always_present_rob = SourceIdentifier(SubDetector.TDAQ_CTP, 0)

Function Documentation

◆ addEventBuildingSequence()

python.HLT.CommonSequences.EventBuildingSequences.addEventBuildingSequence ( flags,
chain,
eventBuildType,
chainDict )
Add an extra ChainStep to a Chain object with a PEBInfoWriter sequence configured for the eventBuildType

Definition at line 19 of file EventBuildingSequences.py.

19def addEventBuildingSequence(flags, chain, eventBuildType, chainDict):
20 '''
21 Add an extra ChainStep to a Chain object with a PEBInfoWriter sequence configured for the eventBuildType
22 '''
23 if not eventBuildType:
24 log.error('No eventBuildType specified')
25 return
26 if eventBuildType not in EventBuildingInfo.getAllEventBuildingIdentifiers():
27 log.error('eventBuildType \'%s\' not found in the allowed Event Building identifiers', eventBuildType)
28 return
29
30 seq = functools.partial(pebMenuSequenceGenCfg, flags, chain=chain, eventBuildType=eventBuildType, chainDict=chainDict)
31
32 if len(chain.steps)==0:
33 # noalg PEB chain
34 step_name = 'PEBInfoWriter_{:s}'.format( eventBuildType)
35 step = ChainStep(name=step_name,
36 SequenceGens=[seq],
37 chainDicts=[chainDict])
38 else:
39 # standard PEB chain
40 prevStep = chain.steps[-1]
41 step_name = 'EventBuild_{:s}_PEBInfoWriter_{:s}'.format(prevStep.name, eventBuildType)
42 step = ChainStep(name=step_name,
43 SequenceGens=[seq for _ in range(prevStep.nLegs)],
44 chainDicts=prevStep.stepDicts)
45
46 chain.steps.append(step)
47

◆ alignEventBuildingSteps()

python.HLT.CommonSequences.EventBuildingSequences.alignEventBuildingSteps ( chain_configs,
chain_dicts )

Definition at line 320 of file EventBuildingSequences.py.

320def alignEventBuildingSteps(chain_configs, chain_dicts):
321
322 all_peb_chain_configs = [ch for ch in chain_configs if len(chain_dicts[ch.name]['eventBuildType'])>0]
323
324 def getPebStepPosition(chainConfig):
325 pebStep = findEventBuildingStep(chainConfig)
326 return chainConfig.steps.index(pebStep) + 1
327
328 # First loop to find the maximal PEB step positions to which we need to align
329 maxPebStepPosition = {} # {eventBuildType: N}
330 for chain in all_peb_chain_configs:
331 pebStepPosition = getPebStepPosition(chain)
332 ebt = chain_dicts[chain.name]['eventBuildType']
333 if ebt not in maxPebStepPosition or pebStepPosition > maxPebStepPosition[ebt]:
334 maxPebStepPosition[ebt] = pebStepPosition
335
336 # Second loop to insert empty steps before the PEB steps where needed
337 for chain in all_peb_chain_configs:
338 pebStepPosition = getPebStepPosition(chain)
339 ebt = chain_dicts[chain.name]['eventBuildType']
340 if pebStepPosition < maxPebStepPosition[ebt]:
341 numStepsNeeded = maxPebStepPosition[ebt] - pebStepPosition
342 log.debug('Aligning PEB step for chain %s by adding %d empty steps', chain.name, numStepsNeeded)
343 chain.insertEmptySteps('EmptyPEBAlign', numStepsNeeded, pebStepPosition-1)
344 chain.numberAllSteps()
345
346

◆ findEventBuildingStep()

python.HLT.CommonSequences.EventBuildingSequences.findEventBuildingStep ( chainConfig)

Definition at line 311 of file EventBuildingSequences.py.

311def findEventBuildingStep(chainConfig):
312 pebSteps = [s for s in chainConfig.steps if 'PEBInfoWriter' in s.name and 'EmptyPEBAlign' not in s.name]
313 if len(pebSteps) == 0:
314 return None
315 elif len(pebSteps) > 1:
316 raise RuntimeError('Multiple Event Building steps in one chain are not supported but found in chain ' + chainConfig.name)
317 return pebSteps[0]
318
319

◆ getPEBBuildSuffix()

python.HLT.CommonSequences.EventBuildingSequences.getPEBBuildSuffix ( chain,
eventBuildType )
Define suffix for unique configurations - prevents config clashes.

Definition at line 243 of file EventBuildingSequences.py.

243def getPEBBuildSuffix(chain, eventBuildType):
244 '''
245 Define suffix for unique configurations - prevents config clashes.
246 '''
247
248 suffix=''
249
250 _isFullscan = isFullScan(chain)
251 _isRoIBasedPEB = EventBuildingInfo.isRoIBasedPEB(eventBuildType)
252 _isNoalg = isNoAlg(chain)
253
254 if _isNoalg or not _isRoIBasedPEB: suffix+='_noSeed'
255 if _isFullscan and _isRoIBasedPEB: suffix+='_RoIBasedFS'
256
257 return suffix
258

◆ isFullScan()

python.HLT.CommonSequences.EventBuildingSequences.isFullScan ( chain)
Helper function to determine if chain is full scan

Definition at line 347 of file EventBuildingSequences.py.

347def isFullScan(chain):
348 '''Helper function to determine if chain is full scan'''
349 # Check if we are configuring a chain with at least one full-scan leg
350 return (mapThresholdToL1DecisionCollection('FSNOSEED') in chain.L1decisions)
351
352

◆ isNoAlg()

python.HLT.CommonSequences.EventBuildingSequences.isNoAlg ( chain)
Helper function to determine if chain has HLT reco

Definition at line 353 of file EventBuildingSequences.py.

353def isNoAlg(chain):
354 '''Helper function to determine if chain has HLT reco'''
355 return (len(chain.steps) == 1 and "PEBInfoWriter" in chain.steps[0].name)
356
357
358# Unit test

◆ pebInfoWriterToolCfg()

python.HLT.CommonSequences.EventBuildingSequences.pebInfoWriterToolCfg ( flags,
name,
eventBuildType )
Create PEBInfoWriterTool configuration for the eventBuildType

Definition at line 48 of file EventBuildingSequences.py.

48def pebInfoWriterToolCfg(flags, name, eventBuildType):
49 """Create PEBInfoWriterTool configuration for the eventBuildType"""
50
51 # Main HLTResult ROB:
52 HLT_ROB = SourceIdentifier(SubDetector.TDAQ_HLT, DataScoutingInfo.getFullHLTResultID())
53
54 acc = None
55 if 'BeamSpotPEB' == eventBuildType:
56 acc = StaticPEBInfoWriterToolCfg(
57 flags, name,
58 subDets = [SubDetector.PIXEL_BARREL,
59 SubDetector.PIXEL_DISK_SIDE, # note different name in C++, ADHI-4753
60 SubDetector.PIXEL_B_LAYER,
61 SubDetector.PIXEL_IBL,
62 SubDetector.SCT_BARREL_A_SIDE,
63 SubDetector.SCT_BARREL_C_SIDE,
64 SubDetector.SCT_ENDCAP_A_SIDE,
65 SubDetector.SCT_ENDCAP_C_SIDE,
66 SubDetector.TDAQ_CTP] )
67
68 elif 'MuonTrkPEB' == eventBuildType:
69 acc = RoIPEBInfoWriterToolCfg(
70 flags, name,
71 regSelDets = ['Pixel', 'SCT', 'TRT', 'MDT', 'RPC', 'TGC', 'CSC', 'MM', 'sTGC'],
72 MaxRoIs = 99,
73 EtaWidth = 0.75, # values from run2 check later
74 PhiWidth = 0.75, # values from run2 check later
75 subDets = [SubDetector.TDAQ_CTP], # add full CTP data to the output
76 ROBs = [HLT_ROB] )
77
78 elif 'IDCalibPEB' == eventBuildType:
79 acc = RoIPEBInfoWriterToolCfg(
80 flags, name,
81 regSelDets = ['Pixel', 'SCT', 'TRT'],
82 EtaWidth = 0.1,
83 PhiWidth = 0.1,
84 subDets = [SubDetector.TDAQ_CTP] )
85
86 elif 'LArPEBCalib' == eventBuildType:
87 acc = StaticPEBInfoWriterToolCfg(
88 flags, name,
89 subDets = [SubDetector.LAR_EM_BARREL_A_SIDE,
90 SubDetector.LAR_EM_BARREL_C_SIDE,
91 SubDetector.LAR_EM_ENDCAP_A_SIDE,
92 SubDetector.LAR_EM_ENDCAP_C_SIDE,
93 SubDetector.LAR_HAD_ENDCAP_A_SIDE,
94 SubDetector.LAR_HAD_ENDCAP_C_SIDE,
95 SubDetector.LAR_FCAL_A_SIDE,
96 SubDetector.LAR_FCAL_C_SIDE,
97 SubDetector.LAR_EM_BARREL_ENDCAP_A_SIDE,
98 SubDetector.LAR_EM_BARREL_ENDCAP_C_SIDE,
99 SubDetector.LAR_EM_HAD_ENDCAP_A_SIDE,
100 SubDetector.LAR_EM_HAD_ENDCAP_C_SIDE,
101 SubDetector.TDAQ_CTP] )
102
103 elif eventBuildType in ('LArPEBHLT', 'LArPEB'):
104 acc = RoIPEBInfoWriterToolCfg(
105 flags, name,
106 regSelDets = ['Pixel', 'SCT', 'TRT', 'TTEM', 'TTHEC', 'FCALEM', 'FCALHAD'],
107 MaxRoIs = 5,
108 ROBs = [HLT_ROB] + LATOMESourceIDs, # add full-scan LATOME data
109 subDets = [SubDetector.TDAQ_CTP] )
110
111 elif 'LATOMEPEB' == eventBuildType:
112 acc = StaticPEBInfoWriterToolCfg(
113 flags, name,
114 ROBs = LATOMESourceIDs + FEXSourceIDs, # add full-scan LATOME and FEX data
115 subDets = [SubDetector.TDAQ_CTP] )
116
117 elif 'SCTPEB' == eventBuildType:
118 acc = StaticPEBInfoWriterToolCfg(
119 flags, name,
120 subDets = [SubDetector.SCT_BARREL_A_SIDE,
121 SubDetector.SCT_BARREL_C_SIDE,
122 SubDetector.SCT_ENDCAP_A_SIDE,
123 SubDetector.SCT_ENDCAP_C_SIDE,
124 SubDetector.TDAQ_CTP] )
125
126 elif 'TilePEB' == eventBuildType:
127 acc = StaticPEBInfoWriterToolCfg(
128 flags, name,
129 subDets = [SubDetector.TILECAL_LASER_CRATE,
130 SubDetector.TILECAL_BARREL_A_SIDE,
131 SubDetector.TILECAL_BARREL_C_SIDE,
132 SubDetector.TILECAL_EXT_A_SIDE,
133 SubDetector.TILECAL_EXT_C_SIDE,
134 SubDetector.TDAQ_CTP,
135 SubDetector.TDAQ_CALO_PREPROC, # = 0x71
136 SubDetector.TDAQ_CALO_CLUSTER_PROC_DAQ, # = 0x72
137 SubDetector.TDAQ_CALO_CLUSTER_PROC_ROI, # = 0x73
138 SubDetector.TDAQ_CALO_JET_PROC_DAQ, # = 0x74
139 SubDetector.TDAQ_CALO_JET_PROC_ROI # = 0x75
140 ],
141 MatchTriggerType = [0x31, 0x32, 0x34] if '_L1CALREQ' in name else [] )
142
143 elif 'LArPEBNoise' == eventBuildType:
144 acc = RoIPEBInfoWriterToolCfg(
145 flags, name,
146 regSelDets = ['Pixel', 'SCT', 'TRT', 'TTEM', 'TTHEC', 'FCALEM', 'FCALHAD'],
147 MaxRoIs = 5,
148 ROBs = [HLT_ROB] + LATOMESourceIDs,
149 subDets = [SubDetector.MUON_MMEGA_ENDCAP_A_SIDE,
150 SubDetector.MUON_MMEGA_ENDCAP_C_SIDE,
151 SubDetector.MUON_STGC_ENDCAP_A_SIDE,
152 SubDetector.MUON_STGC_ENDCAP_C_SIDE,
153 SubDetector.TDAQ_CTP] )
154
155 elif 'ZDCPEB' == eventBuildType:
156 acc = StaticPEBInfoWriterToolCfg(
157 flags, name,
158 subDets = [SubDetector.FORWARD_ZDC,
159 SubDetector.TDAQ_CTP],
160 MatchTriggerType = [0x69, 0x6a, 0x6c] if '_L1CALREQ' in name else [] )
161
162 elif 'AFPPEB' == eventBuildType:
163 acc = StaticPEBInfoWriterToolCfg(
164 flags, name,
165 subDets = [SubDetector.FORWARD_AFP,
166 SubDetector.TDAQ_CTP] )
167
168 elif 'LumiPEB' == eventBuildType:
169 acc = StaticPEBInfoWriterToolCfg(
170 flags, name,
171 ROBs = [HLT_ROB],
172 subDets = [SubDetector.PIXEL_IBL,
173 SubDetector.PIXEL_BARREL,
174 SubDetector.PIXEL_DISK_SIDE,
175 SubDetector.PIXEL_B_LAYER,
176 SubDetector.SCT_BARREL_A_SIDE,
177 SubDetector.SCT_BARREL_C_SIDE,
178 SubDetector.SCT_ENDCAP_A_SIDE,
179 SubDetector.SCT_ENDCAP_C_SIDE,
180 SubDetector.PIXEL_DBM,
181 SubDetector.TDAQ_CTP] )
182
183 elif 'Lvl1CaloPEB' == eventBuildType:
184 acc = StaticPEBInfoWriterToolCfg(
185 flags, name,
186 ROBs = [HLT_ROB],
187 MaxRoIs = 1,
188 subDets = [SubDetector.TDAQ_CALO_PREPROC,
189 SubDetector.TDAQ_CALO_CLUSTER_PROC_DAQ,
190 SubDetector.TDAQ_CALO_CLUSTER_PROC_ROI,
191 SubDetector.TDAQ_CALO_JET_PROC_DAQ,
192 SubDetector.TDAQ_CALO_JET_PROC_ROI,
193 SubDetector.TDAQ_CTP] )
194
195 elif 'DarkJetPEBTLA' == eventBuildType:
196 acc = RoIPEBInfoWriterToolCfg(
197 flags, name,
198 # Add subdetectors within a ROI for PEB
199 regSelDets = ['Pixel', 'SCT', 'TRT', 'TTEM', 'TTHEC', 'FCALEM', 'FCALHAD', 'TILE', 'MDT', 'RPC', 'TGC', 'CSC', 'MM', 'STGC'],
200 # DS HLT result
201 ROBs = [SourceIdentifier(SubDetector.TDAQ_HLT,
202 DataScoutingInfo.getDataScoutingResultID(eventBuildType))],
203 EtaWidth = 0.6, # half-width (the RoI is between etaJet-EtaWidth and etaJet+EtaWidth)
204 PhiWidth = 0.6,
205 MaxRoIs = 3 )
206
207 elif 'EgammaPEBTLA' == eventBuildType:
208 acc = RoIPEBInfoWriterToolCfg(
209 flags, name,
210 # Add subdetectors within a ROI for PEB
211 regSelDets = ['Pixel', 'SCT', 'TRT', 'TTEM', 'TTHEC', 'FCALEM', 'FCALHAD', 'TILE'],
212 # DS HLT result
213 ROBs = [SourceIdentifier(SubDetector.TDAQ_HLT,
214 DataScoutingInfo.getDataScoutingResultID(eventBuildType))],
215 EtaWidth = 0.4, # half-width (the RoI is between etaJet-EtaWidth and etaJet+EtaWidth)
216 PhiWidth = 0.4,
217 MaxRoIs = 6 )
218 elif 'FTagPEBTLA' == eventBuildType:
219 acc = RoIPEBInfoWriterToolCfg(
220 flags, name,
221 # Add subdetectors within a ROI for PEB
222 regSelDets = ['Pixel', 'SCT'],
223 # DS HLT result
224 ROBs = [SourceIdentifier(SubDetector.TDAQ_HLT,
225 DataScoutingInfo.getDataScoutingResultID(eventBuildType))],
226 EtaWidth = 0.4, # half-width (the RoI is between etaJet-EtaWidth and etaJet+EtaWidth)
227 PhiWidth = 0.4,
228 MaxRoIs = 6 )
229
230 elif eventBuildType in DataScoutingInfo.getAllDataScoutingIdentifiers():
231 # Pure DataScouting configuration
232 acc = StaticPEBInfoWriterToolCfg(
233 flags, name,
234 ROBs = [SourceIdentifier(SubDetector.TDAQ_HLT,
235 DataScoutingInfo.getDataScoutingResultID(eventBuildType))] )
236
237 # Name not matched
238 if acc is None:
239 log.error('PEBInfoWriterTool configuration is missing for event building identifier \'%s\'', eventBuildType)
240
241 return acc
242

◆ pebInputMaker()

python.HLT.CommonSequences.EventBuildingSequences.pebInputMaker ( flags,
chain,
eventBuildType )

Definition at line 259 of file EventBuildingSequences.py.

259def pebInputMaker(flags, chain, eventBuildType):
260
261 suffix= getPEBBuildSuffix(chain, eventBuildType)
262
263 # Check if we are configuring a chain with at least one full-scan leg
264 isFullscan = isFullScan(chain)
265 # Check if we are configuring RoI-based PEB
266 _isRoIBasedPEB = EventBuildingInfo.isRoIBasedPEB(eventBuildType)
267 _isNoalg = isNoAlg(chain)
268
269 # Configure the InputMaker
270 maker = CompFactory.InputMakerForRoI("IMpeb_" + eventBuildType + suffix)
271 maker.RoIs = "pebInputRoI_" + eventBuildType + suffix
272 # Allow more than one feature per input RoI if we care about RoIs, and have at least one Step
273 maker.mergeUsingFeature = _isRoIBasedPEB and not _isNoalg
274
275 # Configure the InputMaker RoI tool
276 if _isNoalg or not _isRoIBasedPEB:
277 # Streamers or static PEB: use initial RoI
278 maker.RoITool = CompFactory.ViewCreatorInitialROITool()
279 elif isFullscan and _isRoIBasedPEB:
280 # Full-scan chains with RoI-based PEB: create RoI around feature IParticle
281 maker.RoITool = CompFactory.ViewCreatorCentredOnIParticleROITool()
282 maker.RoITool.RoisWriteHandleKey = recordable("HLT_Roi_" + eventBuildType)
283 else:
284 # Other chains: use previous RoI
285 maker.RoITool = CompFactory.ViewCreatorPreviousROITool()
286
287 return maker
288
289

◆ pebMenuSequenceGenCfg()

python.HLT.CommonSequences.EventBuildingSequences.pebMenuSequenceGenCfg ( flags,
chain,
eventBuildType,
chainDict )
Return the MenuSequence for the PEB input maker for this chain.

Definition at line 290 of file EventBuildingSequences.py.

290def pebMenuSequenceGenCfg(flags, chain, eventBuildType, chainDict):
291 '''
292 Return the MenuSequence for the PEB input maker for this chain.
293 '''
294
295 def pebInfoWriterToolGenerator(flags, chainDict):
296 return pebInfoWriterToolCfg(flags, chainDict['chainName'], eventBuildType)
297
298 suffix = getPEBBuildSuffix(chain, eventBuildType)
299
300 inputMaker = pebInputMaker(flags, chain, eventBuildType)
301 recoAcc = InEventRecoCA("pebSequence_"+eventBuildType, inputMaker=inputMaker)
302 selAcc = SelectionCA("pebMainSeq_"+eventBuildType+suffix)
303 selAcc.mergeReco(recoAcc)
304 selAcc.addHypoAlgo(CompFactory.PEBInfoWriterAlg('PEBInfoWriterAlg_' + eventBuildType+suffix))
305
306 return MenuSequence(flags,
307 selAcc,
308 HypoToolGen = pebInfoWriterToolGenerator)
309
310

Variable Documentation

◆ always_present_rob

python.HLT.CommonSequences.EventBuildingSequences.always_present_rob = SourceIdentifier(SubDetector.TDAQ_CTP, 0)

Definition at line 422 of file EventBuildingSequences.py.

◆ AtlasVersion

python.HLT.CommonSequences.EventBuildingSequences.AtlasVersion

Definition at line 364 of file EventBuildingSequences.py.

◆ cfg

python.HLT.CommonSequences.EventBuildingSequences.cfg = pebInfoWriterToolCfg(flags, 'TestTool_'+eb_identifier, eb_identifier)

Definition at line 376 of file EventBuildingSequences.py.

◆ dets

str python.HLT.CommonSequences.EventBuildingSequences.dets = 'StaticPEBInfoWriterTool' else tool.ExtraSubDets

Definition at line 403 of file EventBuildingSequences.py.

◆ failures

int python.HLT.CommonSequences.EventBuildingSequences.failures = 0

Definition at line 371 of file EventBuildingSequences.py.

◆ Files

python.HLT.CommonSequences.EventBuildingSequences.Files

Definition at line 363 of file EventBuildingSequences.py.

◆ flags

python.HLT.CommonSequences.EventBuildingSequences.flags = initConfigFlags()

Definition at line 362 of file EventBuildingSequences.py.

◆ is_data_scouting

bool python.HLT.CommonSequences.EventBuildingSequences.is_data_scouting = False

Definition at line 405 of file EventBuildingSequences.py.

◆ isRoIBasedPEB

python.HLT.CommonSequences.EventBuildingSequences.isRoIBasedPEB = EventBuildingInfo.isRoIBasedPEB(eb_identifier)

Definition at line 395 of file EventBuildingSequences.py.

◆ log

python.HLT.CommonSequences.EventBuildingSequences.log = logging.getLogger(__name__)

Definition at line 16 of file EventBuildingSequences.py.

◆ rob_det_id

python.HLT.CommonSequences.EventBuildingSequences.rob_det_id = rob_sid.subdetector_id()

Definition at line 408 of file EventBuildingSequences.py.

◆ rob_sid

python.HLT.CommonSequences.EventBuildingSequences.rob_sid = SourceIdentifier(rob_id)

Definition at line 407 of file EventBuildingSequences.py.

◆ robs

str python.HLT.CommonSequences.EventBuildingSequences.robs = 'StaticPEBInfoWriterTool' else tool.ExtraROBs

Definition at line 402 of file EventBuildingSequences.py.

◆ robs_check_passed

bool python.HLT.CommonSequences.EventBuildingSequences.robs_check_passed = True

Definition at line 404 of file EventBuildingSequences.py.

◆ tool

python.HLT.CommonSequences.EventBuildingSequences.tool = None

Definition at line 374 of file EventBuildingSequences.py.