ATLAS Offline Software
TrigCaloRecConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaCommon.SystemOfUnits import MeV, deg
4 from AthenaCommon.Logging import logging
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
8 from AthenaConfiguration.AccumulatorCache import AccumulatorCache
9 from TriggerMenuMT.HLT.CommonSequences.FullScanDefs import em_clusters, lc_clusters, fs_towers, fs_cells
10 
11 from TrigEDMConfig.TriggerEDM import recordable
12 
13 mlog = logging.getLogger ('TrigCaloRecConfig')
14 
15 
16 def trigCaloClusterMonitoringTool(flags, doMonCells = False, isFullScan = None):
17  """Monitoring tool for TrigCaloClusterMaker"""
18 
19  monTool = GenericMonitoringTool(flags, 'MonTool')
20 
21  if isFullScan is None:
22  isFullScan = doMonCells
23 
24  maxNumberOfClusters = 1200 if isFullScan else 50
25 
26  monTool.defineHistogram('container_size', path='EXPERT', type='TH1F', title="Container Size; Number of Clusters; Number of Events", xbins=50, xmin=0.0, xmax=maxNumberOfClusters)
27  monTool.defineHistogram('container_size_by_mu', path='EXPERT', type='TH1F', title="Container Size; Number of Clusters; Number of Events", xbins=50, xmin=0.0, xmax=maxNumberOfClusters/60)
28  monTool.defineHistogram('Et', path='EXPERT', type='TH1F', title="Cluster E_T; E_T [ MeV ] ; Number of Clusters", xbins=135, xmin=-200.0, xmax=2500.0)
29  monTool.defineHistogram('Eta', path='EXPERT', type='TH1F', title="Cluster #eta; #eta ; Number of Clusters", xbins=100, xmin=-2.5, xmax=2.5)
30  monTool.defineHistogram('Phi', path='EXPERT', type='TH1F', title="Cluster #phi; #phi ; Number of Clusters", xbins=64, xmin=-3.2, xmax=3.2)
31  monTool.defineHistogram('Eta,Phi', path='EXPERT', type='TH2F', title="Number of Clusters; #eta ; #phi ; Number of Clusters", xbins=100, xmin=-2.5, xmax=2.5, ybins=128, ymin=-3.2, ymax=3.2)
32  monTool.defineHistogram('clusterSize', path='EXPERT', type='TH1F', title="Cluster Type; Type ; Number of Clusters", xbins=13, xmin=0.5, xmax=13.5)
33  monTool.defineHistogram('signalState', path='EXPERT', type='TH1F', title="Signal State; Signal State ; Number of Clusters", xbins=4, xmin=-1.5, xmax=2.5)
34  monTool.defineHistogram('size', path='EXPERT', type='TH1F', title="Cluster Size; Size [Cells] ; Number of Clusters", xbins=125, xmin=0.0, xmax=250.0)
35  monTool.defineHistogram('N_BAD_CELLS', path='EXPERT', type='TH1F', title="N_BAD_CELLS; N_BAD_CELLS ; Number of Clusters", xbins=250, xmin=0.5, xmax=250.5)
36  monTool.defineHistogram('ENG_FRAC_MAX', path='EXPERT', type='TH1F', title="ENG_FRAC_MAX; ENG_FRAC_MAX ; Number of Clusters", xbins=50, xmin=0.0, xmax=1.1)
37  monTool.defineHistogram('mu', path='EXPERT', type='TH1F', title="mu; mu; Number of Events", xbins=50, xmin=0.0, xmax=100)
38  monTool.defineHistogram('mu,container_size', path='EXPERT', type='TH2F', title="Container Size versus #mu; #mu; cluster container size", xbins=50, xmin=20.0, xmax=70, ybins=50, ymin=0.0, ymax=maxNumberOfClusters)
39 
40  if doMonCells:
41  monTool.defineHistogram('count_1thrsigma', path='EXPERT', type='TH1F', title="count_1thrsigma; count_1thresigma; Number of Events", xbins=60, xmin=0.0, xmax=12e3)
42  monTool.defineHistogram('count_2thrsigma', path='EXPERT', type='TH1F', title="count_2thrsigma; count_2thresigma; Number of Events", xbins=60, xmin=0.0, xmax=6e3)
43  monTool.defineHistogram('count_1thrsigma_by_mu2', path='EXPERT', type='TH1F', title="count_1thrsigma_by_mu2; count_1thresigma_by_mu2; Number of Events", xbins=50, xmin=0.0, xmax=10)
44  monTool.defineHistogram('count_2thrsigma_by_mu2', path='EXPERT', type='TH1F', title="count_2thrsigma_by_mu2; count_2thresigma_by_mu2; Number of Events", xbins=50, xmin=0.0, xmax=5)
45  monTool.defineHistogram('mu,count_1thrsigma', path='EXPERT', type='TH2F', title="nCells above 1st thr versus #mu; #mu; nCells", xbins=50, xmin=20.0, xmax=70, ybins=60, ymin=0.0, ymax=12e3)
46  monTool.defineHistogram('mu,count_2thrsigma', path='EXPERT', type='TH2F', title="nCells above 2nd thr versus #mu; #mu; nCells", xbins=50, xmin=20.0, xmax=70, ybins=60, ymin=0.0, ymax=6e3)
47 
48  return monTool
49 
50 
51 @AccumulatorCache
52 def hltCaloCellMakerCfg(flags, name=None, roisKey='UNSPECIFIED', CellsName=None, monitorCells=False, doTau=False,sequenceName=None):
53  acc = ComponentAccumulator()
54  from TrigT2CaloCommon.TrigCaloDataAccessConfig import trigCaloDataAccessSvcCfg, CaloDataAccessSvcDependencies
55  acc.merge(trigCaloDataAccessSvcCfg(flags))
56  #choose RoI for fullscan
57  if (roisKey == 'UNSPECIFIED'):
58  from HLTSeeding.HLTSeedingConfig import mapThresholdToL1RoICollection
59  roisKey = mapThresholdToL1RoICollection("FSNOSEED")
60  # choose cells name given parameters
61  cellsFromName = 'CaloCellsFS' if "FS" in name else "CaloCells"
62  cells = cellsFromName if CellsName is None else CellsName
63 
64  from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
65  monTool = GenericMonitoringTool(flags, 'MonTool')
66  monTool.defineHistogram('Cells_N', path='EXPERT', type='TH1F', title="Cells N; NCells; events",
67  xbins=40, xmin=0, xmax=1600 if monitorCells else 240000)
68  monTool.defineHistogram('TIME_exec', path='EXPERT', type='TH1F', title="Cells time; time [ us ] ; Nruns",
69  xbins=80, xmin=0, xmax=800 if monitorCells else 160000)
70  if monitorCells:
71  monTool.defineHistogram('Cells_eT', path='EXPERT', type='TH1F', title="Cells E_T; E_T [ GeV ] ; Nclusters",
72  xbins=100, xmin=0.0, xmax=100.0)
73  monTool.defineHistogram('Cells_eta', path='EXPERT', type='TH1F', title="Cells #eta; #eta ; Nclusters",
74  xbins=100, xmin=-2.5, xmax=2.5)
75  monTool.defineHistogram('Cells_phi', path='EXPERT', type='TH1F', title="Cells #phi; #phi ; Nclusters",
76  xbins=128, xmin=-3.2, xmax=3.2)
77 
78  if sequenceName is not None:
79  from AthenaCommon.CFElements import parOR
80  acc.merge(ComponentAccumulator(parOR(sequenceName)))
81  cellMaker = CompFactory.HLTCaloCellMaker(name,
82  CellsName = cells,
83  TrigDataAccessMT = acc.getService('TrigCaloDataAccessSvc'),
84  ExtraInputs = CaloDataAccessSvcDependencies,
85  RoIs=roisKey,
86  monitorCells = monitorCells,
87  MonTool = monTool,
88  TileCellsInROI = False if not doTau else True)
89  acc.addEventAlgo(cellMaker, primary=True,sequenceName=sequenceName)
90  return acc
91 
92 @AccumulatorCache
93 def hltCaloCellCorrectorCfg(flags,name='HLTCaloCellCorrector', inputEDM='CellsClusters', outputEDM='CorrectedCellsClusters', eventShape='HIEventShape'):
94  acc = ComponentAccumulator()
95  cellCorrector = CompFactory.HLTCaloCellCorrector(name = name,
96  EventShapeCollection = eventShape,
97  InputCellKey = inputEDM,
98  OutputCellKey = outputEDM)
99  acc.addEventAlgo(cellCorrector)
100  return acc
101 
102 
103 @AccumulatorCache
104 def hltCaloCellSeedlessMakerCfg(flags, roisKey='UNSPECIFIED',sequenceName=None):
105  acc = ComponentAccumulator()
106  hltCaloCellMakerAcc = hltCaloCellMakerCfg(flags, "CaloCellSeedLessFS",
107  roisKey = roisKey,
108  CellsName ="SeedLessFS",
109  monitorCells=False)
110 
111  acc.merge(hltCaloCellMakerAcc,sequenceName=sequenceName)
112 
113  from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
114  acc.merge(CaloNoiseCondAlgCfg(flags, noisetype="electronicNoise"))
115  acc.addCondAlgo(CompFactory.CaloNoiseSigmaDiffCondAlg())
116 
117  return acc
118 
119 
120 @AccumulatorCache
121 def L0CaloGlobalRoIBuilderCfg(flags,DoNoiseThrRings=True):
122  acc = ComponentAccumulator()
123  from TrigT2CaloEgamma.TrigT2CaloEgammaConfig import RingerReFexConfig
124  nameTool='RingerGlobalFex'
125  nameAlgo='L0CaloGlobalRoIBuilder'
126  nameContCalo='CaloClustersGlobal'
127  nameContRinger='RingerGlobal'
128  if ( DoNoiseThrRings ):
129  nameTool='RingerGlobal2sigFex'
130  nameAlgo='L0CaloGlobalRoI2sigBuilder'
131  nameContCalo='CaloClusters2sigGlobal'
132  nameContRinger='Ringer2sigGlobal'
133  ringer = RingerReFexConfig(flags,name=nameTool,RingerKey='NOTNEEDED',
134  ClustersName=nameContCalo,DoNoiseThrRings=DoNoiseThrRings)
135  from AthenaCommon.CFElements import parOR
136  accSeq = ComponentAccumulator(parOR("HLTBeginSeq"))
137  L0CaloGlobalRoIBuilderAlg = CompFactory.CaloGlobalRoIBuilder(name=nameAlgo,
138  Cells ="SeedLessFS", ClustersName=nameContCalo,
139  RingerKey=nameContRinger,
140  RingerTool=ringer )
141  accSeq.addEventAlgo(L0CaloGlobalRoIBuilderAlg, sequenceName="HLTBeginSeq")
142 
143  from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
144  acc.merge(CaloNoiseCondAlgCfg(flags))
145  acc.merge(accSeq)
146 
147  return acc
148 
149 def CaloL0RingerPreCfg(flags,DoNoiseThrRings=True):
150  flags.Trigger.ExtraEDMList+= CaloL0RingerPrepareList(DoNoiseThrRings)
151 
152 def CaloL0RingerPrepareList(DoNoiseThrRings=True):
153  extraEDMList=[]
154  if DoNoiseThrRings :
155  extraEDMList+=[('xAOD::TrigRingerRingsContainer#Ringer2sigGlobal', 'BS ESD AODFULL', 'Calo'), ('xAOD::TrigRingerRingsAuxContainer#Ringer2sigGlobalAux.', 'BS ESD AODFULL', 'Calo'), ('xAOD::TrigEMClusterContainer#CaloClusters2sigGlobal', 'BS ESD AODFULL', 'Calo'), ('xAOD::TrigEMClusterAuxContainer#CaloClusters2sigGlobalAux.', 'BS ESD AODFULL', 'Calo')]
156  else :
157  extraEDMList+=[('xAOD::TrigRingerRingsContainer#RingerGlobal', 'BS ESD AODFULL', 'Calo'), ('xAOD::TrigRingerRingsAuxContainer#RingerGlobalAux.', 'BS ESD AODFULL', 'Calo'), ('xAOD::TrigEMClusterContainer#CaloClustersGlobal', 'BS ESD AODFULL', 'Calo'), ('xAOD::TrigEMClusterAuxContainer#CaloClustersGlobalAux.', 'BS ESD AODFULL', 'Calo')]
158  return extraEDMList
159 
160 def CaloL0RingerCfg(flags,DoNoiseThrRings=True):
161  from OutputStreamAthenaPool.OutputStreamConfig import addToESD,addToAOD
162  extraContent=CaloL0RingerPrepareList(DoNoiseThrRings)
163  acc = ComponentAccumulator()
164  from AthenaCommon.CFElements import parOR
165  if (flags.Output.doWriteRDO):
166  accSeq = ComponentAccumulator(parOR("HLTBeginSeq"))
167  accSeq.merge(hltCaloCellSeedlessMakerCfg(flags, sequenceName="HLTBeginSeq"))
168  accSeq.merge(L0CaloGlobalRoIBuilderCfg(flags,DoNoiseThrRings=DoNoiseThrRings))
169  acc.merge(accSeq)
170 
171  if (flags.Output.doWriteESD or flags.Output.doWriteAOD):
172  if ( flags.Output.doWriteESD ):
173  acc.merge(addToESD(flags, extraContent))
174  if ( flags.Output.doWriteAOD ):
175  acc.merge(addToAOD(flags, extraContent))
176  return acc
177 
178 
179 
180 def hltCaloLocalCalib(flags, name = "TrigLocalCalib"):
181  det_version_is_rome = flags.GeoModel.AtlasVersion.startswith("Rome")
182  localCalibTool = CompFactory.CaloLCWeightTool("TrigLCWeight",
183  CorrectionKey="H1ClusterCellWeights",
184  SignalOverNoiseCut=2.0, UseHadProbability=True)
185  trigLCClassify = CompFactory.CaloLCClassificationTool("TrigLCClassify",
186  ClassificationKey="EMFracClassify",
187  UseSpread=False, MaxProbability=0.85 if det_version_is_rome else 0.5,
188  UseNormalizedEnergyDensity=not det_version_is_rome,
189  StoreClassificationProbabilityInAOD=True)
190  tool = CompFactory.CaloClusterLocalCalib( name,
191  ClusterRecoStatus=[1, 2], ClusterClassificationTool=[ trigLCClassify ],
192  LocalCalibTools=[ localCalibTool ])
193  return tool
194 
195 
196 def hltCaloOOCalib(flags, name = "TrigOOCCalib"):
197  localCalibTool = CompFactory.CaloLCOutOfClusterTool("TrigLCOut",
198  CorrectionKey="OOCCorrection",UseEmProbability=False,
199  UseHadProbability=True)
200  tool = CompFactory.CaloClusterLocalCalib( name,
201  ClusterRecoStatus=[1, 2],
202  LocalCalibTools=[ localCalibTool ] )
203  return tool
204 
205 def hltCaloOOCPi0Calib(flags, name = "TrigOOCPi0Calib" ):
206  localCalibTool = CompFactory.CaloLCOutOfClusterTool("TrigLCOutPi0",
207  CorrectionKey="OOCPi0Correction", UseEmProbability=True,
208  UseHadProbability=False)
209  tool = CompFactory.CaloClusterLocalCalib( name,
210  ClusterRecoStatus=[1, 2],
211  LocalCalibTools=[ localCalibTool ] )
212  return tool
213 
214 def hltCaloDMCalib(flags, name = "TrigDMCalib" ):
215  localCalibTool = CompFactory.CaloLCDeadMaterialTool("TrigLCDeadMaterial",
216  HadDMCoeffKey="HadDMCoeff2", ClusterRecoStatus=0,
217  WeightModeDM=2,UseHadProbability=True)
218  tool = CompFactory.CaloClusterLocalCalib( name,
219  ClusterRecoStatus=[1, 2],
220  LocalCalibTools=[ localCalibTool ] )
221  return tool
222 
223 
224 
225 @AccumulatorCache
226 def hltTopoClusterMakerCfg(flags, name, clustersKey="HLT_TopoCaloClustersFS", cellsKey=None, doLC=False, suffix=''):
227  acc = ComponentAccumulator()
228  cellsFromName = 'CaloCellsFS' if "FS" in clustersKey else "CaloCells"
229  cells = cellsFromName if cellsKey is None else cellsKey
230 
231  from CaloRec.CaloTopoClusterConfig import (
232  CaloTopoClusterToolCfg,
233  CaloTopoClusterSplitterToolCfg,
234  )
235 
236  topoMaker = acc.popToolsAndMerge(CaloTopoClusterToolCfg(flags, cellsname=cells))
237  topoMaker.RestrictPSNeighbors = False
238  listClusterCorrectionTools = []
239  if doLC :
240  from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
241  # We need the electronic noise for the LC weights
242  acc.merge(CaloNoiseCondAlgCfg(flags, noisetype="electronicNoise"))
243  from CaloRec.CaloTopoClusterConfig import caloTopoCoolFolderCfg
244  acc.merge(caloTopoCoolFolderCfg(flags))
245  listClusterCorrectionTools = [ hltCaloLocalCalib(flags), hltCaloOOCalib(flags),
246  hltCaloOOCPi0Calib(flags), hltCaloDMCalib(flags) ]
247 
248  #timing
249  topoMaker.SeedCutsInT = flags.Trigger.Calo.TopoCluster.doTimeCut
250  topoMaker.CutOOTseed = flags.Trigger.Calo.TopoCluster.extendTimeCut and flags.Trigger.Calo.TopoCluster.doTimeCut
251  topoMaker.UseTimeCutUpperLimit = flags.Trigger.Calo.TopoCluster.useUpperLimitForTimeCut
252  topoMaker.TimeCutUpperLimit = flags.Trigger.Calo.TopoCluster.timeCutUpperLimit
253 
254  topoSplitter = acc.popToolsAndMerge(CaloTopoClusterSplitterToolCfg(flags))
255 
256  topoMoments = CompFactory.CaloClusterMomentsMaker ('TrigTopoMoments')
257  topoMoments.MaxAxisAngle = 20*deg
258  topoMoments.TwoGaussianNoise = flags.Calo.TopoCluster.doTwoGaussianNoise
259  topoMoments.MinBadLArQuality = 4000
260  topoMoments.MomentsNames = ['FIRST_PHI',
261  'FIRST_ETA',
262  'SECOND_R' ,
263  'SECOND_LAMBDA',
264  'DELTA_PHI',
265  'DELTA_THETA',
266  'DELTA_ALPHA' ,
267  'CENTER_X',
268  'CENTER_Y',
269  'CENTER_Z',
270  'CENTER_MAG',
271  'CENTER_LAMBDA',
272  'LATERAL',
273  'LONGITUDINAL',
274  'FIRST_ENG_DENS',
275  'ENG_FRAC_EM',
276  'ENG_FRAC_MAX',
277  'ENG_FRAC_CORE' ,
278  'FIRST_ENG_DENS',
279  'SECOND_ENG_DENS',
280  'ISOLATION',
281  'ENG_BAD_CELLS',
282  'N_BAD_CELLS',
283  'N_BAD_CELLS_CORR',
284  'BAD_CELLS_CORR_E',
285  'BADLARQ_FRAC',
286  'ENG_POS',
287  'SIGNIFICANCE',
288  'CELL_SIGNIFICANCE',
289  'CELL_SIG_SAMPLING',
290  'AVG_LAR_Q',
291  'AVG_TILE_Q'
292  ]
293 
294  clustermakername = name + suffix
295  doMonCells = "FS" in clustermakername
296 
297  alg = CompFactory.CaloClusterMaker(
298  clustermakername,
299  ClustersOutputName=clustersKey if "CaloMon" in clustermakername else recordable(clustersKey),
300  ClusterCellLinkOutputName = clustersKey+"_links",
301  ClusterMakerTools = [ topoMaker, topoSplitter, topoMoments],
302  ClusterCorrectionTools = listClusterCorrectionTools,
303  SaveUncalibratedSignalState = True,
304  WriteTriggerSpecificInfo = True)
305 
306  from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
307  acc.merge(CaloNoiseCondAlgCfg(flags))
308  acc.addEventAlgo(alg, primary=True)
309  monitor = CompFactory.TrigCaloClusterMonitor(name + 'Monitoring' + suffix,
310  CellsName = cells,
311  ClustersName = clustersKey,
312  MonitorCells = doMonCells,
313  MonitoringTool = trigCaloClusterMonitoringTool(flags, doMonCells))
314  acc.addEventAlgo(monitor, primary=False)
315  return acc
316 
317 
318 
319 def hltCaloTopoClusterCalibratorCfg(flags, name, clustersin, clustersout, **kwargs):
320  """ Create the LC calibrator """
321  from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
322 
323  # We need the electronic noise for the LC weights
324  acc = ComponentAccumulator()
325  acc.merge(CaloNoiseCondAlgCfg(flags, noisetype="electronicNoise"))
326 
327  from CaloRec.CaloTopoClusterConfig import caloTopoCoolFolderCfg
328  acc.merge(caloTopoCoolFolderCfg(flags))
329 
330  calibrator = CompFactory.TrigCaloClusterCalibrator(
331  name, InputClusters=clustersin, OutputClusters=clustersout,
332  **kwargs
333  #OutputCellLinks = clustersout+"_cellLinks", **kwargs
334  )
335 
336  calibrator.ClusterCorrectionTools = [ hltCaloLocalCalib(flags), hltCaloOOCalib(flags),
337  hltCaloOOCPi0Calib(flags), hltCaloDMCalib(flags) ]
338  #NB: Could we take these from CaloRec.CaloTopoClusterConfig.getTopoClusterLocalCalibTools?
339 
340  # Monitoring
341  monTool = GenericMonitoringTool(flags, "MonTool")
342  monTool.defineHistogram('Et', path='EXPERT', type='TH1F',
343  title="Cluster E_T; E_T [ MeV ] ; Number of Clusters",
344  xbins=135, xmin=-200.0, xmax=2500.0)
345  monTool.defineHistogram('Eta', path='EXPERT', type='TH1F',
346  title="Cluster #eta; #eta ; Number of Clusters",
347  xbins=100, xmin=-2.5, xmax=2.5)
348  monTool.defineHistogram('Phi', path='EXPERT', type='TH1F',
349  title="Cluster #phi; #phi ; Number of Clusters",
350  xbins=64, xmin=-3.2, xmax=3.2)
351  monTool.defineHistogram('Eta,Phi', path='EXPERT', type='TH2F',
352  title="Number of Clusters; #eta ; #phi ; Number of Clusters",
353  xbins=100, xmin=-2.5, xmax=2.5, ybins=128, ymin=-3.2, ymax=3.2)
354  calibrator.MonTool = monTool
355 
356  acc.addEventAlgo(calibrator, primary=True)
357  return acc
358 
359 
360 from TriggerMenuMT.HLT.Egamma.TrigEgammaKeys import getTrigEgammaKeys
361 
362 
364  flags, namePrefix=None,nameSuffix=None, CellsName=None, monitorCells=False, roisKey="UNSPECIFIED",clustersKey=None, doLCFS=False, doTau = False):
365  if doTau:
366  CellsName = "CaloCellsLC"
367  clustersKeyFromName = "HLT_TopoCaloClustersLC"
368  elif nameSuffix == "FS":
369  clustersKeyFromName = em_clusters
370  else:
371  TrigEgammaKeys = getTrigEgammaKeys(flags)
372  clustersKeyFromName = TrigEgammaKeys.precisionTopoClusterContainer
373 
374  clusters = clustersKeyFromName if clustersKey is None else clustersKey
375  acc = ComponentAccumulator()
376  acc.merge(
377  hltCaloCellMakerCfg(flags, namePrefix + "HLTCaloCellMaker"+nameSuffix, roisKey=roisKey, CellsName=CellsName, monitorCells=monitorCells, doTau = doTau)
378  )
379 
380  clustermakername_nosuffix = namePrefix + "HLTCaloClusterMaker"
381 
382  clustermakername = clustermakername_nosuffix + nameSuffix
383 
384  # TODO - Don't use hasFlag here, use another concrete flag instead
385  if flags.hasFlag("CaloRecGPU.GlobalFlags.UseCaloRecGPU") and flags.CaloRecGPU.GlobalFlags.UseCaloRecGPU and "FS" in clustermakername:
386  flags = flags.cloneAndReplace("CaloRecGPU.ActiveConfig", "Trigger.CaloRecGPU.Default", True)
387  from CaloRecGPU.CaloRecGPUConfig import GPUCaloTopoClusterCfg
388 
389 
390  GPUKernelSvc = CompFactory.GPUKernelSizeOptimizerSvc()
391  acc.addService(GPUKernelSvc)
392 
393  gpuhyb = GPUCaloTopoClusterCfg(flags,
394  True,
395  CellsName,
396  clustersname = clusters if "CaloMon" in clustermakername else recordable(clusters),
397  name = clustermakername,
398  ReallyUseGPUTools = not flags.CaloRecGPU.GlobalFlags.UseCPUToolsInstead)
399 
400  acc.merge(gpuhyb)
401 
402  monitorCells = "FS" in clustermakername
403 
404  monitor = CompFactory.TrigCaloClusterMonitor(clustermakername_nosuffix + 'Monitoring' + nameSuffix,
405  CellsName = CellsName,
406  ClustersName = clusters,
407  MonitorCells = monitorCells,
408  MonitoringTool = trigCaloClusterMonitoringTool(flags, monitorCells))
409  acc.addEventAlgo(monitor, primary=False)
410 
411  else :
412  calt=hltTopoClusterMakerCfg(flags, clustermakername_nosuffix, cellsKey=CellsName, clustersKey=clusters, doLC=doTau, suffix = nameSuffix)
413  acc.merge(calt)
414  if doLCFS:
416  flags,
417  "HLTCaloClusterCalibratorLCFS",
418  clustersin=em_clusters,
419  clustersout=lc_clusters,
420  OutputCellLinks=lc_clusters + "_cellLinks",
421  )
422  )
423  return acc
424 
425 
426 @AccumulatorCache
427 def egammaTopoClusteringCfg(flags, RoIs):
428  cfg = hltCaloTopoClusteringCfg(flags, namePrefix="", nameSuffix="RoI", CellsName="CaloCells", monitorCells=True, roisKey=RoIs)
429  return cfg
430 
431 
432 @AccumulatorCache
434  TrigEgammaKeys_LRT = getTrigEgammaKeys(flags, name = '_LRT')
435  cfg = hltCaloTopoClusteringCfg(flags, namePrefix="", nameSuffix="RoI_LRT", CellsName="CaloCells", monitorCells=True, roisKey=RoIs, clustersKey= TrigEgammaKeys_LRT.precisionTopoClusterContainer)
436  return cfg
437 
438 
439 
440 @AccumulatorCache
441 def jetmetTopoClusteringCfg(flags, RoIs):
442  cfg = hltCaloTopoClusteringCfg(flags, namePrefix="", nameSuffix="FS", CellsName="CaloCellsFS", monitorCells=False, roisKey=RoIs)
443  return cfg
444 
445 @AccumulatorCache
446 def jetmetTopoClusteringCfg_LC(flags, RoIs):
447  cfg = hltCaloTopoClusteringCfg(flags, namePrefix="", nameSuffix="FS", CellsName="CaloCellsFS", monitorCells=False, roisKey=RoIs, doLCFS=True)
448  return cfg
449 
450 
451 @AccumulatorCache
452 def tauTopoClusteringCfg(flags, RoIs):
453  cfg = hltCaloTopoClusteringCfg(flags, namePrefix="Tau", nameSuffix="", CellsName="CaloCellsLC", monitorCells=False, roisKey=RoIs, clustersKey="HLT_TopoCaloClustersLC", doTau= True)
454  return cfg
455 
456 @AccumulatorCache
458  flags, CellsName=None, roisKey="UNSPECIFIED", doLC=False,algSuffix='HIRoI', ion=True):
459  TrigEgammaKeys = getTrigEgammaKeys(flags, ion=ion)
460  eventShape = TrigEgammaKeys.egEventShape
461  clustersKey = TrigEgammaKeys.precisionTopoClusterContainer
462  acc = ComponentAccumulator()
463  acc.merge(hltCaloCellMakerCfg(flags, "HLTCaloCellMaker"+algSuffix, roisKey=roisKey, CellsName=CellsName, monitorCells=True))
464  acc.merge(hltCaloCellCorrectorCfg(flags,name='HLTRoICaloCellCorrector', inputEDM='CaloCells', outputEDM='CorrectedRoICaloCells', eventShape=eventShape))
465  acc.merge(hltTopoClusterMakerCfg(flags, "TrigCaloClusterMaker_topo"+algSuffix, clustersKey=clustersKey,cellsKey="CorrectedRoICaloCells"))
466  return acc
467 
468 @AccumulatorCache
469 def hltHICaloTowerMakerCfg(flags, name, towersKey, cellsKey="CaloCellsFS", RoIs=""):
470  acc = ComponentAccumulator()
471  larcmbtwrbldr = CompFactory.LArTowerBuilderTool("LArCmbTwrBldr",
472  CellContainerName = cellsKey,
473  IncludedCalos = [ "LAREM", "LARHEC" ]
474  )
475 
476  fcalcmbtwrbldr = CompFactory.LArFCalTowerBuilderTool("FCalCmbTwrBldr",
477  CellContainerName = cellsKey,
478  MinimumEt = 0.*MeV
479  )
480 
481  #input to TileTowerBuilder: cells in TILE
482  tilecmbtwrbldr = CompFactory.TileTowerBuilderTool("TileCmbTwrBldr",
483  CellContainerName = cellsKey,
484  # debugging aid, keep for convenience
485  #DumpTowers = False,
486  #DumpWeightMap = False
487  )
488 
489 
490 
491  alg = CompFactory.TrigCaloTowerMaker(name,
492  Cells=cellsKey,
493  CaloTowers=towersKey,
494  NumberOfPhiTowers=64,
495  NumberOfEtaTowers=100,
496  EtaMin=-5.0,
497  EtaMax=5.0,
498  DeltaEta=1.2,
499  DeltaPhi=1.2,
500  RoIs=RoIs,
501  TowerMakerTools = [ tilecmbtwrbldr, larcmbtwrbldr, fcalcmbtwrbldr ]
502  )
503  from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
504  acc.merge(CaloNoiseCondAlgCfg(flags))
505  acc.addEventAlgo(alg, primary=True)
506  return acc
507 
508 @AccumulatorCache
509 def hltHICaloClusterMakerCfg(flags, name, towersKey, cellsKey, clustersKey) :
510  """Function to equip HLT HI cluster builder from towers and cells, adds to output AOD stream"""
511  acc = ComponentAccumulator()
512 
513 
514  alg=CompFactory.HIClusterMaker(name,
515  InputTowerKey=towersKey,
516  CaloCellContainerKey=cellsKey,
517  OutputContainerKey=clustersKey
518  )
519  acc.addEventAlgo(alg, primary=True)
520  return acc
521 
522 @AccumulatorCache
523 def HICaloTowerCfg(flags):
524  """ Create the towers for heavy ion """
525  acc = ComponentAccumulator()
526  acc.merge(
527  hltCaloCellMakerCfg(flags, "HLTCaloCellMakerFS", roisKey='')
528  )
529  # Then build the towers
530  acc.merge(
532  flags,
533  "HLTHICaloTowerMakerFS",
534  towersKey=fs_towers,
535  cellsKey=fs_cells,
536  )
537  )
538  # Then build the clusters
539  acc.merge(
541  flags,
542  "HLTHICaloClusterMakerFS",
543  towersKey=fs_towers,
544  cellsKey=fs_cells,
545  clustersKey = "HLT_HICaloClustersFS"
546  )
547  )
548 
549  return acc
550 
551 
552 if __name__ == "__main__":
553  from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
554  from AthenaConfiguration.AllConfigFlags import initConfigFlags
555 
556  flags = initConfigFlags()
557  flags.Input.Files = defaultTestFiles.RAW_RUN3
558  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
559  flags.IOVDb.GlobalTag = "CONDBR2-ES1PA-2022-07"
560  flags.Common.isOnline = True
561  outputContainers = ["CaloCellContainer#SeedLessFS",
562  "xAOD::EventInfo#EventInfo",
563  "xAOD::TrigEMClusterContainer#CaloClustersGlobal",
564  "xAOD::TrigEMClusterAuxContainer#CaloClustersGlobalAux.",
565  "xAOD::TrigRingerRingsContainer#RingerGlobal",
566  "xAOD::TrigRingerRingsAuxContainer#RingerGlobalAux."]
567  flags.Output.ESDFileName='TrigCaloRecCheck'
568 
569  flags.fillFromArgs()
570  flags.dump()
571  flags.lock()
572  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
573  cfg = MainServicesCfg(flags)
574 
575  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
576  cfg.merge(LArGMCfg(flags))
577  from TileGeoModel.TileGMConfig import TileGMCfg
578  cfg.merge(TileGMCfg(flags))
579 
580  from DetDescrCnvSvc.DetDescrCnvSvcConfig import DetDescrCnvSvcCfg
581  cfg.merge(DetDescrCnvSvcCfg(flags))
582 
583  from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
584  cfg.merge(ByteStreamReadCfg(flags))
585  cfg.getService("ByteStreamCnvSvc").ROD2ROBmap=["-1"]
586 
587  storeGateSvc = cfg.getService("StoreGateSvc")
588  storeGateSvc.Dump=True
589  theL0CaloGlobalRoIBuilderCfg = L0CaloGlobalRoIBuilderCfg(flags)
590  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
591 
592  from AthenaCommon.CFElements import parOR
593  cfg.addSequence(parOR("HLTBeginSeq"),parentName="AthMasterSeq")
594 
595  CAs = [hltCaloCellSeedlessMakerCfg(flags,roisKey=''),
596  theL0CaloGlobalRoIBuilderCfg,
597  hltCaloCellMakerCfg(flags, "SthFS",roisKey=''),
598  OutputStreamCfg(flags,flags.Output.ESDFileName,ItemList=outputContainers)]
599  #hltTopoClusterMakerCfg(flags, "TrigCaloClusterMaker_topoFS")]
600 
601  for ca in CAs:
602  ca.printConfig(withDetails=True, summariseProps=True)
603  #ca.wasMerged()
604  cfg.merge(ca)
605 
606 
607  cfg.run(50)
TrigCaloRecConfig.jetmetTopoClusteringCfg
def jetmetTopoClusteringCfg(flags, RoIs)
JetMetSpecific TopoClustering####################################.
Definition: TrigCaloRecConfig.py:441
TrigCaloRecConfig.hltCaloTopoClusterCalibratorCfg
def hltCaloTopoClusterCalibratorCfg(flags, name, clustersin, clustersout, **kwargs)
Definition: TrigCaloRecConfig.py:319
SystemOfUnits
python.CaloTopoClusterConfig.caloTopoCoolFolderCfg
def caloTopoCoolFolderCfg(flags)
Definition: CaloTopoClusterConfig.py:7
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.CaloTopoClusterConfig.CaloTopoClusterToolCfg
def CaloTopoClusterToolCfg(flags, cellsname)
Definition: CaloTopoClusterConfig.py:230
TrigCaloRecConfig.CaloL0RingerPreCfg
def CaloL0RingerPreCfg(flags, DoNoiseThrRings=True)
Definition: TrigCaloRecConfig.py:149
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, keepProvenanceTagsRegEx=None, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:16
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
TrigCaloRecConfig.hltCaloTopoClusteringCfg
def hltCaloTopoClusteringCfg(flags, namePrefix=None, nameSuffix=None, CellsName=None, monitorCells=False, roisKey="UNSPECIFIED", clustersKey=None, doLCFS=False, doTau=False)
Definition: TrigCaloRecConfig.py:363
TrigCaloRecConfig.hltCaloLocalCalib
def hltCaloLocalCalib(flags, name="TrigLocalCalib")
Definition: TrigCaloRecConfig.py:180
TrigCaloRecConfig.hltCaloCellCorrectorCfg
def hltCaloCellCorrectorCfg(flags, name='HLTCaloCellCorrector', inputEDM='CellsClusters', outputEDM='CorrectedCellsClusters', eventShape='HIEventShape')
Definition: TrigCaloRecConfig.py:93
TrigCaloRecConfig.hltCaloDMCalib
def hltCaloDMCalib(flags, name="TrigDMCalib")
Definition: TrigCaloRecConfig.py:214
TrigCaloRecConfig.CaloL0RingerPrepareList
def CaloL0RingerPrepareList(DoNoiseThrRings=True)
Definition: TrigCaloRecConfig.py:152
TrigCaloRecConfig.L0CaloGlobalRoIBuilderCfg
def L0CaloGlobalRoIBuilderCfg(flags, DoNoiseThrRings=True)
Definition: TrigCaloRecConfig.py:121
python.DetDescrCnvSvcConfig.DetDescrCnvSvcCfg
def DetDescrCnvSvcCfg(flags, **kwargs)
Definition: DetDescrCnvSvcConfig.py:6
CaloRecGPUConfig.GPUCaloTopoClusterCfg
def GPUCaloTopoClusterCfg(flags, instantiateForTrigger, cellsname, clustersname=None, clustersnapname="CaloTopoClusters", name="HybridClusterProcessor", PlotterTool=None, addAsPrimary=True, ReallyUseGPUTools=True)
Definition: CaloRecGPUConfig.py:485
python.JetAnalysisCommon.parOR
parOR
Definition: JetAnalysisCommon.py:271
python.CaloNoiseCondAlgConfig.CaloNoiseCondAlgCfg
def CaloNoiseCondAlgCfg(flags, noisetype="totalNoise")
Definition: CaloNoiseCondAlgConfig.py:11
TrigCaloRecConfig.hltCaloOOCPi0Calib
def hltCaloOOCPi0Calib(flags, name="TrigOOCPi0Calib")
Definition: TrigCaloRecConfig.py:205
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:312
TrigCaloRecConfig.hltCaloCellSeedlessMakerCfg
def hltCaloCellSeedlessMakerCfg(flags, roisKey='UNSPECIFIED', sequenceName=None)
Definition: TrigCaloRecConfig.py:104
TrigCaloRecConfig.egammaTopoClusteringCfg
def egammaTopoClusteringCfg(flags, RoIs)
EgammaSpecific TopoClustering####################################.
Definition: TrigCaloRecConfig.py:427
TrigCaloDataAccessConfig.trigCaloDataAccessSvcCfg
def trigCaloDataAccessSvcCfg(flags)
Definition: TrigCaloDataAccessConfig.py:47
TrigCaloRecConfig.HICaloTowerCfg
def HICaloTowerCfg(flags)
Definition: TrigCaloRecConfig.py:523
python.CaloTopoClusterConfig.CaloTopoClusterSplitterToolCfg
def CaloTopoClusterSplitterToolCfg(flags)
Definition: CaloTopoClusterConfig.py:289
TrigCaloRecConfig.hltHICaloTowerMakerCfg
def hltHICaloTowerMakerCfg(flags, name, towersKey, cellsKey="CaloCellsFS", RoIs="")
Definition: TrigCaloRecConfig.py:469
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
TrigCaloRecConfig.hltCaloOOCalib
def hltCaloOOCalib(flags, name="TrigOOCCalib")
Definition: TrigCaloRecConfig.py:196
python.OutputStreamConfig.addToESD
def addToESD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:135
TrigCaloRecConfig.hltCaloCellMakerCfg
def hltCaloCellMakerCfg(flags, name=None, roisKey='UNSPECIFIED', CellsName=None, monitorCells=False, doTau=False, sequenceName=None)
Definition: TrigCaloRecConfig.py:52
TrigCaloRecConfig.jetmetTopoClusteringCfg_LC
def jetmetTopoClusteringCfg_LC(flags, RoIs)
Definition: TrigCaloRecConfig.py:446
GenericMonitoringTool
Definition: GenericMonitoringTool.py:1
TrigCaloRecConfig.trigCaloClusterMonitoringTool
def trigCaloClusterMonitoringTool(flags, doMonCells=False, isFullScan=None)
Definition: TrigCaloRecConfig.py:16
TrigCaloRecConfig.egammaTopoClusteringCfg_LRT
def egammaTopoClusteringCfg_LRT(flags, RoIs)
Definition: TrigCaloRecConfig.py:433
TrigCaloRecConfig.hltCaloTopoClusteringHICfg
def hltCaloTopoClusteringHICfg(flags, CellsName=None, roisKey="UNSPECIFIED", doLC=False, algSuffix='HIRoI', ion=True)
Definition: TrigCaloRecConfig.py:457
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
TrigCaloRecConfig.CaloL0RingerCfg
def CaloL0RingerCfg(flags, DoNoiseThrRings=True)
Definition: TrigCaloRecConfig.py:160
python.OutputStreamConfig.addToAOD
def addToAOD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:150
python.TrigT2CaloEgammaConfig.RingerReFexConfig
def RingerReFexConfig(flags, name="RingerReMaker", RingerKey="FastCaloRings", ClustersName="HLT_FastCaloEMClusters", **kwargs)
Definition: TrigT2CaloEgammaConfig.py:27
HLTSeedingConfig.mapThresholdToL1RoICollection
def mapThresholdToL1RoICollection(threshold)
Definition: HLTSeedingConfig.py:91
python.TriggerEDM.recordable
def recordable(arg, runVersion=3)
Definition: TriggerEDM.py:37
TrigCaloRecConfig.tauTopoClusteringCfg
def tauTopoClusteringCfg(flags, RoIs)
TauSpecific TopoClustering####################################.
Definition: TrigCaloRecConfig.py:452
TrigCaloRecConfig.hltHICaloClusterMakerCfg
def hltHICaloClusterMakerCfg(flags, name, towersKey, cellsKey, clustersKey)
Definition: TrigCaloRecConfig.py:509
python.HLT.Egamma.TrigEgammaKeys.getTrigEgammaKeys
def getTrigEgammaKeys(AthConfigFlags flags, name='', ion=False)
Definition: TrigEgammaKeys.py:138
TrigCaloRecConfig.hltTopoClusterMakerCfg
def hltTopoClusterMakerCfg(flags, name, clustersKey="HLT_TopoCaloClustersFS", cellsKey=None, doLC=False, suffix='')
Definition: TrigCaloRecConfig.py:226
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7