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):
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, separateMonitoring=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 
289  if separateMonitoring:
290  alg = CompFactory.CaloClusterMaker(
291  name,
292  ClustersOutputName=recordable(clustersKey),
293  ClusterCellLinkOutputName = clustersKey+"_links",
294  ClusterMakerTools = [ topoMaker, topoSplitter, topoMoments],
295  ClusterCorrectionTools = listClusterCorrectionTools,
296  SaveUncalibratedSignalState = True,
297  WriteTriggerSpecificInfo = True)
298  else:
299  alg = CompFactory.TrigCaloClusterMaker(
300  name,
301  Cells=cells,
302  CaloClusters=recordable(clustersKey),
303  CellLinks = clustersKey+"_links",
304  ClusterMakerTools = [ topoMaker, topoSplitter, topoMoments], # moments are missing yet
305  ClusterCorrectionTools = listClusterCorrectionTools,
306  MonCells = doMonCells,
307  MonTool = trigCaloClusterMonitoringTool(flags, doMonCells) )
308 
309  from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
310  acc.merge(CaloNoiseCondAlgCfg(flags))
311  acc.addEventAlgo(alg, primary=True)
312  if separateMonitoring:
313  monitor = CompFactory.TrigCaloClusterMonitor(name + 'Monitoring',
314  CellsName = cells,
315  ClustersName = clustersKey,
316  MonitorCells = doMonCells,
317  MonitoringTool = trigCaloClusterMonitoringTool(flags, doMonCells))
318  acc.addEventAlgo(monitor, primary=False)
319  return acc
320 
321 
322 
323 def hltCaloTopoClusterCalibratorCfg(flags, name, clustersin, clustersout, **kwargs):
324  """ Create the LC calibrator """
325  from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
326 
327  # We need the electronic noise for the LC weights
328  acc = ComponentAccumulator()
329  acc.merge(CaloNoiseCondAlgCfg(flags, noisetype="electronicNoise"))
330 
331  from CaloRec.CaloTopoClusterConfig import caloTopoCoolFolderCfg
332  acc.merge(caloTopoCoolFolderCfg(flags))
333 
334  calibrator = CompFactory.TrigCaloClusterCalibrator(
335  name, InputClusters=clustersin, OutputClusters=clustersout,
336  **kwargs
337  #OutputCellLinks = clustersout+"_cellLinks", **kwargs
338  )
339 
340  calibrator.ClusterCorrectionTools = [ hltCaloLocalCalib(flags), hltCaloOOCalib(flags),
341  hltCaloOOCPi0Calib(flags), hltCaloDMCalib(flags) ]
342  #NB: Could we take these from CaloRec.CaloTopoClusterConfig.getTopoClusterLocalCalibTools?
343 
344  # Monitoring
345  monTool = GenericMonitoringTool(flags, "MonTool")
346  monTool.defineHistogram('Et', path='EXPERT', type='TH1F',
347  title="Cluster E_T; E_T [ MeV ] ; Number of Clusters",
348  xbins=135, xmin=-200.0, xmax=2500.0)
349  monTool.defineHistogram('Eta', path='EXPERT', type='TH1F',
350  title="Cluster #eta; #eta ; Number of Clusters",
351  xbins=100, xmin=-2.5, xmax=2.5)
352  monTool.defineHistogram('Phi', path='EXPERT', type='TH1F',
353  title="Cluster #phi; #phi ; Number of Clusters",
354  xbins=64, xmin=-3.2, xmax=3.2)
355  monTool.defineHistogram('Eta,Phi', path='EXPERT', type='TH2F',
356  title="Number of Clusters; #eta ; #phi ; Number of Clusters",
357  xbins=100, xmin=-2.5, xmax=2.5, ybins=128, ymin=-3.2, ymax=3.2)
358  calibrator.MonTool = monTool
359 
360  acc.addEventAlgo(calibrator, primary=True)
361  return acc
362 
363 
364 from TriggerMenuMT.HLT.Egamma.TrigEgammaKeys import getTrigEgammaKeys
365 
366 
368  flags, namePrefix=None,nameSuffix=None, CellsName=None, monitorCells=False, roisKey="UNSPECIFIED",clustersKey=None, doLCFS=False, doTau = False):
369  if doTau:
370  CellsName = "CaloCellsLC"
371  clustersKeyFromName = "HLT_TopoCaloClustersLC"
372  elif nameSuffix == "FS":
373  clustersKeyFromName = em_clusters
374  else:
375  TrigEgammaKeys = getTrigEgammaKeys(flags)
376  clustersKeyFromName = TrigEgammaKeys.precisionTopoClusterContainer
377 
378  clusters = clustersKeyFromName if clustersKey is None else clustersKey
379  acc = ComponentAccumulator()
380  acc.merge(
381  hltCaloCellMakerCfg(flags, namePrefix + "HLTCaloCellMaker"+nameSuffix, roisKey=roisKey, CellsName=CellsName, monitorCells=monitorCells, doTau = doTau)
382  )
383 
384  clustermakername = namePrefix + "HLTCaloClusterMaker"+nameSuffix
385 
386  # TODO - Don't use hasFlag here, use another concrete flag instead
387  if flags.hasFlag("CaloRecGPU.GlobalFlags.UseCaloRecGPU") and flags.CaloRecGPU.GlobalFlags.UseCaloRecGPU and not doTau and "FS" in clustermakername:
388  flags = flags.cloneAndReplace("CaloRecGPU.ActiveConfig", "Trigger.CaloRecGPU.Default", True)
389  from CaloRecGPU.CaloRecGPUConfig import GPUCaloTopoClusterCfg
390 
391 
392  GPUKernelSvc = CompFactory.GPUKernelSizeOptimizerSvc()
393  acc.addService(GPUKernelSvc)
394 
395  monitorCells = "FS" in clustermakername
396 
397  gpuhyb = GPUCaloTopoClusterCfg(flags,
398  True,
399  CellsName,
400  clustersname = recordable(clusters),
401  name = clustermakername,
402  MonitorTool = trigCaloClusterMonitoringTool(flags, monitorCells),
403  MonitorCells = monitorCells,
404  ReallyUseGPUTools = not flags.CaloRecGPU.GlobalFlags.UseCPUToolsInstead)
405 
406  acc.merge(gpuhyb)
407  else :
408  calt=hltTopoClusterMakerCfg(flags, clustermakername, cellsKey=CellsName, clustersKey=clusters, doLC=doTau)
409  acc.merge(calt)
410  if doLCFS:
412  flags,
413  "HLTCaloClusterCalibratorLCFS",
414  clustersin=em_clusters,
415  clustersout=lc_clusters,
416  OutputCellLinks=lc_clusters + "_cellLinks",
417  )
418  )
419  return acc
420 
421 
422 @AccumulatorCache
423 def egammaTopoClusteringCfg(flags, RoIs):
424  cfg = hltCaloTopoClusteringCfg(flags, namePrefix="", nameSuffix="RoI", CellsName="CaloCells", monitorCells=True, roisKey=RoIs)
425  return cfg
426 
427 
428 @AccumulatorCache
430  TrigEgammaKeys_LRT = getTrigEgammaKeys(flags, name = '_LRT')
431  cfg = hltCaloTopoClusteringCfg(flags, namePrefix="", nameSuffix="RoI_LRT", CellsName="CaloCells", monitorCells=True, roisKey=RoIs, clustersKey= TrigEgammaKeys_LRT.precisionTopoClusterContainer)
432  return cfg
433 
434 
435 
436 @AccumulatorCache
437 def jetmetTopoClusteringCfg(flags, RoIs):
438  cfg = hltCaloTopoClusteringCfg(flags, namePrefix="", nameSuffix="FS", CellsName="CaloCellsFS", monitorCells=False, roisKey=RoIs)
439  return cfg
440 
441 @AccumulatorCache
442 def jetmetTopoClusteringCfg_LC(flags, RoIs):
443  cfg = hltCaloTopoClusteringCfg(flags, namePrefix="", nameSuffix="FS", CellsName="CaloCellsFS", monitorCells=False, roisKey=RoIs, doLCFS=True)
444  return cfg
445 
446 
447 @AccumulatorCache
448 def tauTopoClusteringCfg(flags, RoIs):
449  cfg = hltCaloTopoClusteringCfg(flags, namePrefix="Tau", nameSuffix="", CellsName="CaloCellsLC", monitorCells=False, roisKey=RoIs, clustersKey="HLT_TopoCaloClustersLC", doTau= True)
450  return cfg
451 
452 @AccumulatorCache
454  flags, CellsName=None, roisKey="UNSPECIFIED", doLC=False,algSuffix='HIRoI', ion=True):
455  TrigEgammaKeys = getTrigEgammaKeys(flags, ion=ion)
456  eventShape = TrigEgammaKeys.egEventShape
457  clustersKey = TrigEgammaKeys.precisionTopoClusterContainer
458  acc = ComponentAccumulator()
459  acc.merge(hltCaloCellMakerCfg(flags, "HLTCaloCellMaker"+algSuffix, roisKey=roisKey, CellsName=CellsName, monitorCells=True))
460  acc.merge(hltCaloCellCorrectorCfg(flags,name='HLTRoICaloCellCorrector', inputEDM='CaloCells', outputEDM='CorrectedRoICaloCells', eventShape=eventShape))
461  acc.merge(hltTopoClusterMakerCfg(flags, "TrigCaloClusterMaker_topo"+algSuffix, clustersKey=clustersKey,cellsKey="CorrectedRoICaloCells"))
462  return acc
463 
464 @AccumulatorCache
465 def hltHICaloTowerMakerCfg(flags, name, towersKey, cellsKey="CaloCellsFS", RoIs=""):
466  acc = ComponentAccumulator()
467  larcmbtwrbldr = CompFactory.LArTowerBuilderTool("LArCmbTwrBldr",
468  CellContainerName = cellsKey,
469  IncludedCalos = [ "LAREM", "LARHEC" ]
470  )
471 
472  fcalcmbtwrbldr = CompFactory.LArFCalTowerBuilderTool("FCalCmbTwrBldr",
473  CellContainerName = cellsKey,
474  MinimumEt = 0.*MeV
475  )
476 
477  #input to TileTowerBuilder: cells in TILE
478  tilecmbtwrbldr = CompFactory.TileTowerBuilderTool("TileCmbTwrBldr",
479  CellContainerName = cellsKey,
480  # debugging aid, keep for convenience
481  #DumpTowers = False,
482  #DumpWeightMap = False
483  )
484 
485 
486 
487  alg = CompFactory.TrigCaloTowerMaker(name,
488  Cells=cellsKey,
489  CaloTowers=towersKey,
490  NumberOfPhiTowers=64,
491  NumberOfEtaTowers=100,
492  EtaMin=-5.0,
493  EtaMax=5.0,
494  DeltaEta=1.2,
495  DeltaPhi=1.2,
496  RoIs=RoIs,
497  TowerMakerTools = [ tilecmbtwrbldr, larcmbtwrbldr, fcalcmbtwrbldr ]
498  )
499  from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
500  acc.merge(CaloNoiseCondAlgCfg(flags))
501  acc.addEventAlgo(alg, primary=True)
502  return acc
503 
504 @AccumulatorCache
505 def hltHICaloClusterMakerCfg(flags, name, towersKey, cellsKey, clustersKey) :
506  """Function to equip HLT HI cluster builder from towers and cells, adds to output AOD stream"""
507  acc = ComponentAccumulator()
508 
509 
510  alg=CompFactory.HIClusterMaker(name,
511  InputTowerKey=towersKey,
512  CaloCellContainerKey=cellsKey,
513  OutputContainerKey=clustersKey
514  )
515  acc.addEventAlgo(alg, primary=True)
516  return acc
517 
518 @AccumulatorCache
519 def HICaloTowerCfg(flags):
520  """ Create the towers for heavy ion """
521  acc = ComponentAccumulator()
522  acc.merge(
523  hltCaloCellMakerCfg(flags, "HLTCaloCellMakerFS", roisKey='')
524  )
525  # Then build the towers
526  acc.merge(
528  flags,
529  "HLTHICaloTowerMakerFS",
530  towersKey=fs_towers,
531  cellsKey=fs_cells,
532  )
533  )
534  # Then build the clusters
535  acc.merge(
537  flags,
538  "HLTHICaloClusterMakerFS",
539  towersKey=fs_towers,
540  cellsKey=fs_cells,
541  clustersKey = "HLT_HICaloClustersFS"
542  )
543  )
544 
545  return acc
546 
547 
548 if __name__ == "__main__":
549  from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
550  from AthenaConfiguration.AllConfigFlags import initConfigFlags
551 
552  flags = initConfigFlags()
553  flags.Input.Files = defaultTestFiles.RAW_RUN3
554  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
555  flags.IOVDb.GlobalTag = "CONDBR2-ES1PA-2022-07"
556  flags.Common.isOnline = True
557  outputContainers = ["CaloCellContainer#SeedLessFS",
558  "xAOD::EventInfo#EventInfo",
559  "xAOD::TrigEMClusterContainer#CaloClustersGlobal",
560  "xAOD::TrigEMClusterAuxContainer#CaloClustersGlobalAux.",
561  "xAOD::TrigRingerRingsContainer#RingerGlobal",
562  "xAOD::TrigRingerRingsAuxContainer#RingerGlobalAux."]
563  flags.Output.ESDFileName='TrigCaloRecCheck'
564 
565  flags.fillFromArgs()
566  flags.dump()
567  flags.lock()
568  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
569  cfg = MainServicesCfg(flags)
570 
571  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
572  cfg.merge(LArGMCfg(flags))
573  from TileGeoModel.TileGMConfig import TileGMCfg
574  cfg.merge(TileGMCfg(flags))
575 
576  from DetDescrCnvSvc.DetDescrCnvSvcConfig import DetDescrCnvSvcCfg
577  cfg.merge(DetDescrCnvSvcCfg(flags))
578 
579  from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
580  cfg.merge(ByteStreamReadCfg(flags))
581  cfg.getService("ByteStreamCnvSvc").ROD2ROBmap=["-1"]
582 
583  storeGateSvc = cfg.getService("StoreGateSvc")
584  storeGateSvc.Dump=True
585  theL0CaloGlobalRoIBuilderCfg = L0CaloGlobalRoIBuilderCfg(flags)
586  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
587 
588  CAs = [hltCaloCellSeedlessMakerCfg(flags,roisKey=''),
589  theL0CaloGlobalRoIBuilderCfg,
590  hltCaloCellMakerCfg(flags, "SthFS",roisKey=''),
591  OutputStreamCfg(flags,flags.Output.ESDFileName,ItemList=outputContainers)]
592  #hltTopoClusterMakerCfg(flags, "TrigCaloClusterMaker_topoFS")]
593 
594  for ca in CAs:
595  ca.printConfig(withDetails=True, summariseProps=True)
596  #ca.wasMerged()
597  cfg.merge(ca)
598 
599 
600  cfg.run(50)
TrigCaloRecConfig.jetmetTopoClusteringCfg
def jetmetTopoClusteringCfg(flags, RoIs)
JetMetSpecific TopoClustering####################################.
Definition: TrigCaloRecConfig.py:437
TrigCaloRecConfig.hltCaloTopoClusterCalibratorCfg
def hltCaloTopoClusterCalibratorCfg(flags, name, clustersin, clustersout, **kwargs)
Definition: TrigCaloRecConfig.py:323
SystemOfUnits
TrigCaloRecConfig.hltTopoClusterMakerCfg
def hltTopoClusterMakerCfg(flags, name, clustersKey="HLT_TopoCaloClustersFS", cellsKey=None, doLC=False, separateMonitoring=False)
Definition: TrigCaloRecConfig.py:218
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.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.hltCaloTopoClusteringCfg
def hltCaloTopoClusteringCfg(flags, namePrefix=None, nameSuffix=None, CellsName=None, monitorCells=False, roisKey="UNSPECIFIED", clustersKey=None, doLCFS=False, doTau=False)
Definition: TrigCaloRecConfig.py:367
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.trigCaloClusterMonitoringTool
def trigCaloClusterMonitoringTool(flags, doMonCells=False)
Definition: TrigCaloRecConfig.py:16
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:260
TrigCaloRecConfig.egammaTopoClusteringCfg
def egammaTopoClusteringCfg(flags, RoIs)
EgammaSpecific TopoClustering####################################.
Definition: TrigCaloRecConfig.py:423
TrigCaloDataAccessConfig.trigCaloDataAccessSvcCfg
def trigCaloDataAccessSvcCfg(flags)
Definition: TrigCaloDataAccessConfig.py:40
TrigCaloRecConfig.HICaloTowerCfg
def HICaloTowerCfg(flags)
Definition: TrigCaloRecConfig.py:519
python.CaloTopoClusterConfig.CaloTopoClusterSplitterToolCfg
def CaloTopoClusterSplitterToolCfg(flags)
Definition: CaloTopoClusterConfig.py:289
TrigCaloRecConfig.hltHICaloTowerMakerCfg
def hltHICaloTowerMakerCfg(flags, name, towersKey, cellsKey="CaloCellsFS", RoIs="")
Definition: TrigCaloRecConfig.py:465
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:442
GenericMonitoringTool
Definition: GenericMonitoringTool.py:1
TrigCaloRecConfig.egammaTopoClusteringCfg_LRT
def egammaTopoClusteringCfg_LRT(flags, RoIs)
Definition: TrigCaloRecConfig.py:429
TrigCaloRecConfig.hltCaloTopoClusteringHICfg
def hltCaloTopoClusteringHICfg(flags, CellsName=None, roisKey="UNSPECIFIED", doLC=False, algSuffix='HIRoI', ion=True)
Definition: TrigCaloRecConfig.py:453
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:34
TrigCaloRecConfig.tauTopoClusteringCfg
def tauTopoClusteringCfg(flags, RoIs)
TauSpecific TopoClustering####################################.
Definition: TrigCaloRecConfig.py:448
TrigCaloRecConfig.hltHICaloClusterMakerCfg
def hltHICaloClusterMakerCfg(flags, name, towersKey, cellsKey, clustersKey)
Definition: TrigCaloRecConfig.py:505
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