ATLAS Offline Software
Loading...
Searching...
No Matches
MonitorChainConfiguration.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, InEventRecoCA
9from AthenaConfiguration.ComponentFactory import CompFactory
10from TrigGenericAlgs.TrigGenericAlgsConfig import TimeBurnerCfg, TimeBurnerHypoToolGen, L1CorrelationAlgCfg
11from L1TopoOnlineMonitoring import L1TopoOnlineMonitoringConfig as TopoMonConfig
12from L1TopoSimulation import L1TopoSimulationConfig as TopoSimConfig
13from TrigHypoCommonTools.TrigHypoCommonTools import TrigGenericHypoToolFromDict
14from TrigEDMConfig.TriggerEDM import recordable
15from AthenaCommon.CFElements import seqAND
16from TriggerMenuMT.HLT.CommonSequences.RejectSequences import RejectSequence
17#----------------------------------------------------------------
18# fragments generating configuration will be functions in New JO,
19# so let's make them functions already now
20#----------------------------------------------------------------
21def timeBurnerCfg(flags):
22 # Input maker - required by the framework, but inputs don't matter for TimeBurner
23 inputMaker = CompFactory.InputMakerForRoI("IM_TimeBurner",
24 RoITool=CompFactory.ViewCreatorInitialROITool(),
25 RoIs="TimeBurnerInputRoIs",
26 )
27 reco = InEventRecoCA('TimeBurner_reco',inputMaker=inputMaker)
28 # TimeBurner alg works as a reject-all hypo
29 selAcc = SelectionCA('TimeBurnerSequence')
30 selAcc.mergeReco(reco)
31 selAcc.addHypoAlgo(
32 TimeBurnerCfg(flags,
33 name="TimeBurnerHypo",
34 SleepTimeMillisec=200
35 )
36 )
37
38 msca = MenuSequence(flags, selAcc,
39 HypoToolGen=TimeBurnerHypoToolGen)
40 return msca
41
42
44 # Variant of TimeBurner for dataflow tests: Landau-distributed CPU burn with non-zero AcceptFraction
45 inputMaker = CompFactory.InputMakerForRoI("IM_TimeBurnerProcessing",
46 RoITool=CompFactory.ViewCreatorInitialROITool(),
47 RoIs="TimeBurnerProcessingInputRoIs",
48 )
49 reco = InEventRecoCA('TimeBurnerProcessing_reco',inputMaker=inputMaker)
50 selAcc = SelectionCA('TimeBurnerProcessingSequence')
51 selAcc.mergeReco(reco)
52 selAcc.addHypoAlgo(
53 TimeBurnerCfg(flags,
54 name="TimeBurnerProcessingHypo",
55 TimeDistribution="landau",
56 LandauMPV=105.0,
57 LandauSigma=66.0,
58 BurnCPU=True,
59 AcceptFraction=0.10,
60 MaxTimeMs=450000.0,
61 )
62 )
63
64 msca = MenuSequence(flags, selAcc,
65 HypoToolGen=TimeBurnerHypoToolGen)
66 return msca
67
68
69#----------------------------------------------------------------
70def LArSuperCellMonitoringGenCfg(flags,appendName=""):
71 from LArMonitoring.LArSuperCellMonAlg import LArSuperCellMonConfigHLT
72 # Input maker - required by the framework, but inputs don't matter for LArSuperCell
73 inputMaker = CompFactory.InputMakerForRoI("IM_LArSuperCellMon"+appendName,
74 RoITool=CompFactory.ViewCreatorInitialROITool(),
75 RoIs="LArSuperCellMonRoIs"+appendName,
76 )
77 reco = InEventRecoCA('LArSuperCellMonitoring'+appendName,inputMaker=inputMaker)
78 reco.merge( LArSuperCellMonConfigHLT(flags,name="LArSuperCellMonConfigHLT"+appendName) )
79 selAcc = SelectionCA('LArSuperCellMonitoringSequence'+appendName)
80 selAcc.mergeReco(reco)
81 HypoName = "LArSuperCellMonHypoConfig"+appendName
82 msca = RejectSequence(flags, HypoName, selAcc)
83 return msca
84
86
87 # Input maker for FS initial RoI
88 inputMaker = CompFactory.InputMakerForRoI("IM_L1TopoOnlineMonitor")
89 inputMaker.RoITool = CompFactory.ViewCreatorInitialROITool()
90 inputMaker.RoIs="L1TopoOnlineMonitorInputRoIs"
91
92 reco = InEventRecoCA('L1TopoPhase1OnlineMonitor_reco',inputMaker=inputMaker)
93
94 readMuCTPI_local=True
95 if flags.Trigger.doLVL1:
96 readMuCTPI_local=False
97
98 reco.addSequence(seqAND('L1TopoSimSeq'))
99 reco.merge(TopoSimConfig.L1TopoSimulationCfg(flags,doMonitoring=True,readMuCTPI=readMuCTPI_local,name="L1OnlineTopoSimulation"), sequenceName='L1TopoSimSeq')
100
101 selAcc = SelectionCA("L1TopoOnlineMonitorSequence")
102 selAcc.mergeReco(reco)
103
104 hypoAlg = TopoMonConfig.getL1TopoOnlineMonitorHypo(flags)
105 selAcc.addHypoAlgo(hypoAlg)
106
107 return MenuSequence(flags, selAcc,
108 HypoToolGen = TopoMonConfig.L1TopoOnlineMonitorHypoToolGen)
109
110
112 inputMaker = CompFactory.InputMakerForRoI("IM_MistimeMon",
113 RoITool = CompFactory.ViewCreatorInitialROITool(),
114 RoIs="MistimeMonInputRoIs",
115 )
116
117 outputName = recordable("HLT_TrigCompositeMistimeJ400")
118 reco = InEventRecoCA('Mistime_reco',inputMaker=inputMaker)
119 recoAlg = L1CorrelationAlgCfg(flags, "MistimeMonj400", ItemList=['L1_J400','L1_gJ400p0ETA25'],
120 TrigCompositeWriteHandleKey=outputName, trigCompPassKey=outputName+".pass",
121 l1AKey=outputName+".l1a_type", otherTypeKey=outputName+".other_type",
122 beforeAfterKey=outputName+".beforeafterflag",
123 otherTypeBeforeKey=outputName+".other_type_before",
124 otherTypeAfterKey=outputName+".other_type_after",
125 beforeOffsetKey=outputName+".offset_before",
126 afterOffsetKey=outputName+".offset_after")
127 reco.addRecoAlgo(recoAlg)
128 selAcc = SelectionCA("MistimeMonSequence")
129 selAcc.mergeReco(reco)
130
131 # Hypo to select on trig composite pass flag
132 hypoAlg = CompFactory.TrigGenericHypoAlg("MistimeMonJ400HypoAlg", TrigCompositeContainer=outputName)
133 selAcc.addHypoAlgo(hypoAlg)
134
135 return MenuSequence(flags, selAcc,
136 HypoToolGen = TrigGenericHypoToolFromDict)
137
138def CaloClusterMonitorCfg(flags, suffix = ""):
139 from TrigCaloRec.TrigCaloRecConfig import hltCaloTopoClusteringCfg
140
141 reco = InEventRecoCA('CaloClusterMonitoring' + suffix)
142
143 reco.merge( hltCaloTopoClusteringCfg(flags, namePrefix="CaloMon", nameSuffix="FS" + suffix, CellsName="CaloCellsFS" + suffix, monitorCells=False, clustersKey="HLT_MonitoringCaloClusters" + suffix) )
144
145 selAcc = SelectionCA('CaloClusterMonitoringSequence' + suffix)
146
147 selAcc.mergeReco(reco)
148
149 HypoName = "CaloClusterMonHypoConfig"+ suffix
150 msca = RejectSequence(flags, HypoName, selAcc)
151
152 return msca
153
154
155#----------------------------------------------------------------
156# Class to configure chain
157#----------------------------------------------------------------
158class MonitorChainConfiguration(ChainConfigurationBase):
159
160 def __init__(self, chainDict):
161 ChainConfigurationBase.__init__(self,chainDict)
162
163 # ----------------------
164 # Assemble the chain depending on information from chainName
165 # ----------------------
166 def assembleChainImpl(self, flags):
167 chainSteps = []
168 log.debug("Assembling chain for %s", self.chainName)
169
170 monTypeList = self.chainPart.get('monType')
171 if not monTypeList:
172 raise RuntimeError('No monType defined in chain ' + self.chainName)
173 if len(monTypeList) > 1:
174 raise RuntimeError('Multiple monType values defined in chain ' + self.chainName)
175 monType = monTypeList[0]
176
177 if monType == 'timeburner':
178 chainSteps.append(self.getTimeBurnerStep(flags))
179 elif monType == 'timeburnerprocessing':
180 chainSteps.append(self.getTimeBurnerProcessingStep(flags))
181 elif monType == 'larsupercellmon':
182 chainSteps.append(self.getLArSuperCellMonitoringGenCfg(flags))
183 elif monType == 'l1topoPh1debug':
184 chainSteps.append(self.getL1TopoOnlineMonitorStep(flags))
185 elif monType == 'mistimemonj400':
186 chainSteps.append(self.getMistimeMonStep(flags))
187 elif monType == 'caloclustermon':
188 chainSteps.append(self.getCaloClusterMonitorCfg(flags))
189 else:
190 raise RuntimeError('Unexpected monType '+monType+' in MonitorChainConfiguration')
191
192 return self.buildChain(chainSteps)
193
194 # --------------------
195 # TimeBurner configuration
196 # --------------------
197 def getTimeBurnerStep(self, flags):
198 return self.getStep(flags, 'TimeBurner',[timeBurnerCfg])
199
200 # --------------------
201 # TimeBurnerProcessing configuration
202 # --------------------
204 return self.getStep(flags, 'TimeBurnerProcessing',[timeBurnerProcessingCfg])
205
206 # --------------------
207 # LArSuperCellMon configuration
208 # --------------------
210 appendName=""
211 if ( "_FILLED" in self.chainL1Item ):
212 appendName="_filled"
213 elif ( "_EMPTY" in self.chainL1Item ):
214 appendName="_empty"
215 elif ( "_FIRSTEMPTY" in self.chainL1Item ):
216 appendName="_firstempty"
217 else :
218 appendName="_dummy"
219 return self.getStep(flags, 'larsupercellmon'+appendName,[LArSuperCellMonitoringGenCfg],appendName=appendName)
220
221 # --------------------
222 # L1TopoOnlineMonitor configuration
223 # --------------------
225
226 sequenceCfg = L1TopoOnlineMonitorSequenceCfg
227 return self.getStep(flags, 'L1TopoOnlineMonitor',[sequenceCfg])
228
229 # --------------------
230 # MistTimeMon configuration
231 # --------------------
232 def getMistimeMonStep(self, flags):
233 return self.getStep(flags, 'MistimeMon',[MistimeMonSequenceCfg])
234
235 # --------------------
236 # CaloClusterMonitor configuration
237 # --------------------
238 def getCaloClusterMonitorCfg(self, flags):
239 this_suffix = ""
240 if "_FILLED" in self.chainL1Item:
241 this_suffix = "_filled"
242 elif "_EMPTY" in self.chainL1Item:
243 this_suffix = "_empty"
244 elif "_FIRSTEMPTY" in self.chainL1Item:
245 this_suffix = "_firstempty"
246 return self.getStep(flags, 'caloclustermon' + this_suffix, [CaloClusterMonitorCfg], suffix = this_suffix)
247
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132