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