ATLAS Offline Software
CaloTopoClusterConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaCommon.SystemOfUnits import MeV
6 
8  result=ComponentAccumulator()
9  from IOVDbSvc.IOVDbSvcConfig import addFolders
10  # rely on global tag for both MC and data; do not specify folder tags
11  # use CALO_OFL only for GEO>=18
12  hadCalibFolders = [
13  "HadCalibration2/CaloEMFrac",
14  "HadCalibration2/H1ClusterCellWeights",
15  "HadCalibration2/CaloOutOfCluster",
16  "HadCalibration2/CaloOutOfClusterPi0",
17  "HadCalibration2/CaloDMCorr2"
18  ]
19  hadCalibPrefix = "/CALO/"
20  hadCalibDB = "CALO_ONL"
21  if flags.Input.isMC:
22  hadCalibPrefix = "/CALO/Ofl/"
23  hadCalibDB = "CALO_OFL"
24  hadCalibFolders = [ hadCalibPrefix + foldername for foldername in hadCalibFolders ]
25  result.merge(addFolders(flags, hadCalibFolders, hadCalibDB, className="CaloLocalHadCoeff"))
26 
27  return result
28 
30  CaloLCClassificationTool, CaloLCWeightTool, CaloLCOutOfClusterTool, CaloLCDeadMaterialTool=CompFactory.getComps("CaloLCClassificationTool","CaloLCWeightTool","CaloLCOutOfClusterTool","CaloLCDeadMaterialTool",)
31  CaloClusterLocalCalib=CompFactory.CaloClusterLocalCalib
32  # Local cell weights
33  LCClassify = CaloLCClassificationTool("LCClassify")
34  LCClassify.ClassificationKey = "EMFracClassify"
35  LCClassify.UseSpread = False
36  LCClassify.MaxProbability = 0.5
37  # add the moments EM_PROBABILITY, HAD_WEIGHT, OOC_WEIGHT, DM_WEIGHT to the AOD:
38  LCClassify.StoreClassificationProbabilityInAOD = True
39  LCClassify.WeightingOfNegClusters = flags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute
40 
41  LCWeight = CaloLCWeightTool("LCWeight")
42  LCWeight.CorrectionKey = "H1ClusterCellWeights"
43  LCWeight.SignalOverNoiseCut = 2.0
44  # *****
45  LCWeight.UseHadProbability = True
46 
47  LocalCalib = CaloClusterLocalCalib ("LocalCalib")
48  LocalCalib.ClusterClassificationTool = [LCClassify]
49  LocalCalib.ClusterRecoStatus = [1,2]
50  LocalCalib.LocalCalibTools = [LCWeight]
51  LocalCalib.WeightingOfNegClusters = flags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute
52 
53  # Out-of-cluster corrections
54  LCOut = CaloLCOutOfClusterTool("LCOut")
55  LCOut.CorrectionKey = "OOCCorrection"
56  LCOut.UseEmProbability = False
57  LCOut.UseHadProbability = True
58 
59  OOCCalib = CaloClusterLocalCalib ("OOCCalib")
60  OOCCalib.ClusterRecoStatus = [1,2]
61  OOCCalib.LocalCalibTools = [LCOut]
62  OOCCalib.WeightingOfNegClusters = flags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute
63 
64  LCOutPi0 = CaloLCOutOfClusterTool("LCOutPi0")
65  LCOutPi0.CorrectionKey = "OOCPi0Correction"
66  LCOutPi0.UseEmProbability = True
67  LCOutPi0.UseHadProbability = False
68 
69  OOCPi0Calib = CaloClusterLocalCalib ("OOCPi0Calib")
70  OOCPi0Calib.ClusterRecoStatus = [1,2]
71  OOCPi0Calib.LocalCalibTools = [LCOutPi0]
72 
73  OOCPi0Calib.WeightingOfNegClusters = flags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute
74 
75  # Dead material corrections
76  LCDeadMaterial = CaloLCDeadMaterialTool("LCDeadMaterial")
77  LCDeadMaterial.HadDMCoeffKey = "HadDMCoeff2"
78  LCDeadMaterial.ClusterRecoStatus = 0
79  LCDeadMaterial.WeightModeDM = 2
80  LCDeadMaterial.UseHadProbability = True
81  LCDeadMaterial.WeightingOfNegClusters = flags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute
82 
83  DMCalib = CaloClusterLocalCalib ("DMCalib")
84  DMCalib.ClusterRecoStatus = [1,2]
85  DMCalib.LocalCalibTools = [LCDeadMaterial]
86 
87  DMCalib.WeightingOfNegClusters = flags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute
88 
89  lccalibtools = [
90  LocalCalib,
91  OOCCalib,
92  OOCPi0Calib,
93  DMCalib]
94  return lccalibtools
95 
96 def getTopoMoments(flags):
97  result=ComponentAccumulator()
98  CaloClusterMomentsMaker=CompFactory.CaloClusterMomentsMaker
99  TopoMoments = CaloClusterMomentsMaker ("TopoMoments")
100  TopoMoments.WeightingOfNegClusters = flags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute
101  from AthenaCommon.SystemOfUnits import deg
102  TopoMoments.MaxAxisAngle = 20*deg
103  TopoMoments.TwoGaussianNoise = flags.Calo.TopoCluster.doTwoGaussianNoise
104  TopoMoments.MinBadLArQuality = 4000
105  TopoMoments.MomentsNames = ["FIRST_PHI"
106  ,"FIRST_ETA"
107  ,"SECOND_R"
108  ,"SECOND_LAMBDA"
109  ,"DELTA_PHI"
110  ,"DELTA_THETA"
111  ,"DELTA_ALPHA"
112  ,"CENTER_X"
113  ,"CENTER_Y"
114  ,"CENTER_Z"
115  ,"CENTER_MAG"
116  ,"CENTER_LAMBDA"
117  ,"LATERAL"
118  ,"LONGITUDINAL"
119  ,"FIRST_ENG_DENS"
120  ,"ENG_FRAC_EM"
121  ,"ENG_FRAC_MAX"
122  ,"ENG_FRAC_CORE"
123  ,"FIRST_ENG_DENS"
124  ,"SECOND_ENG_DENS"
125  ,"ISOLATION"
126  ,"ENG_BAD_CELLS"
127  ,"N_BAD_CELLS"
128  ,"N_BAD_CELLS_CORR"
129  ,"BAD_CELLS_CORR_E"
130  ,"BADLARQ_FRAC"
131  ,"ENG_POS"
132  ,"SIGNIFICANCE"
133  ,"CELL_SIGNIFICANCE"
134  ,"CELL_SIG_SAMPLING"
135  ,"AVG_LAR_Q"
136  ,"AVG_TILE_Q"
137  ,"PTD"
138  ,"MASS"
139  ,"SECOND_TIME"
140  ,"NCELL_SAMPLING"
141  ]
142 
143 
144  if not flags.Common.isOnline:
145  from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg
146  result.merge(LArElecCalibDBCfg(flags,["HVScaleCorr"]))
147  if flags.Input.isMC:
148  TopoMoments.LArHVFraction=CompFactory.LArHVFraction(HVScaleCorrKey="LArHVScaleCorr")
149  else:
150  TopoMoments.LArHVFraction=CompFactory.LArHVFraction(HVScaleCorrKey="LArHVScaleCorrRecomputed")
151  TopoMoments.MomentsNames += ["ENG_BAD_HV_CELLS"
152  ,"N_BAD_HV_CELLS"
153  ]
154 
155  TopoMoments.UseGPUCriteria = flags.Calo.TopoCluster.UseGPUCompatibleCriteria
156 
157  result.setPrivateTools(TopoMoments)
158  return result
159 
160 # a.k.a. DigiTruth
162  CaloClusterMomentsMaker_DigiHSTruth=CompFactory.CaloClusterMomentsMaker_DigiHSTruth
163  TopoMoments_Truth = CaloClusterMomentsMaker_DigiHSTruth ("TopoMoments_Truth")
164  TopoMoments_Truth.WeightingOfNegClusters = flags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute
165  from AthenaCommon.SystemOfUnits import deg
166  TopoMoments_Truth.MaxAxisAngle = 20*deg
167  TopoMoments_Truth.TwoGaussianNoise = flags.Calo.TopoCluster.doTwoGaussianNoise
168  TopoMoments_Truth.MinBadLArQuality = 4000
169  TopoMoments_Truth.MomentsNames = ["FIRST_PHI_DigiHSTruth"
170  ,"FIRST_ETA_DigiHSTruth"
171  ,"SECOND_R_DigiHSTruth"
172  ,"SECOND_LAMBDA_DigiHSTruth"
173  ,"DELTA_PHI_DigiHSTruth"
174  ,"DELTA_THETA_DigiHSTruth"
175  ,"DELTA_ALPHA_DigiHSTruth"
176  ,"CENTER_X_DigiHSTruth"
177  ,"CENTER_Y_DigiHSTruth"
178  ,"CENTER_Z_DigiHSTruth"
179  ,"CENTER_MAG_DigiHSTruth"
180  ,"CENTER_LAMBDA_DigiHSTruth"
181  ,"LATERAL_DigiHSTruth"
182  ,"LONGITUDINAL_DigiHSTruth"
183  ,"ENG_FRAC_CORE_DigiHSTruth"
184  ,"FIRST_ENG_DENS_DigiHSTruth"
185  ,"SECOND_ENG_DENS_DigiHSTruth"
186  ,"ISOLATION_DigiHSTruth"
187  ,"BAD_CELLS_CORR_E_DigiHSTruth"
188  ,"ENG_POS_DigiHSTruth"
189  ,"SIGNIFICANCE_DigiHSTruth"
190  ,"CELL_SIGNIFICANCE_DigiHSTruth"
191  ,"CELL_SIG_SAMPLING_DigiHSTruth"
192  ,"AVG_LAR_Q_DigiHSTruth"
193  ,"AVG_TILE_Q_DigiHSTruth"
194  ,"ENERGY_DigiHSTruth"
195  ,"PHI_DigiHSTruth"
196  ,"ETA_DigiHSTruth"
197  ]
198  return TopoMoments_Truth
199 
201  CaloCalibClusterMomentsMaker2=CompFactory.CaloCalibClusterMomentsMaker2
202  TopoCalibMoments = CaloCalibClusterMomentsMaker2 ("TopoCalibMoments")
203  TopoCalibMoments.MomentsNames = ["ENG_CALIB_TOT"
204  ,"ENG_CALIB_OUT_L"
205  ,"ENG_CALIB_OUT_T"
206  ,"ENG_CALIB_EMB0"
207  ,"ENG_CALIB_EME0"
208  ,"ENG_CALIB_TILEG3"
209  ,"ENG_CALIB_DEAD_TOT"
210  ,"ENG_CALIB_DEAD_EMB0"
211  ,"ENG_CALIB_DEAD_TILE0"
212  ,"ENG_CALIB_DEAD_TILEG3"
213  ,"ENG_CALIB_DEAD_EME0"
214  ,"ENG_CALIB_DEAD_HEC0"
215  ,"ENG_CALIB_DEAD_FCAL"
216  ,"ENG_CALIB_DEAD_LEAKAGE"
217  ,"ENG_CALIB_DEAD_UNCLASS"
218  ,"ENG_CALIB_FRAC_EM"
219  ,"ENG_CALIB_FRAC_HAD"
220  ,"ENG_CALIB_FRAC_REST"]
221 
222  TopoCalibMoments.CalibrationHitContainerNames = ["LArCalibrationHitInactive"
223  ,"LArCalibrationHitActive"
224  ,"TileCalibHitActiveCell"
225  ,"TileCalibHitInactiveCell"]
226  TopoCalibMoments.DMCalibrationHitContainerNames = ["LArCalibrationHitDeadMaterial"
227  ,"TileCalibHitDeadMaterial"]
228  return TopoCalibMoments
229 
230 def CaloTopoClusterToolCfg(flags, cellsname):
231  result=ComponentAccumulator()
232  # maker tools
233  TopoMaker = CompFactory.CaloTopoClusterMaker("TopoMaker")
234 
235  TopoMaker.CellsName = cellsname
236  TopoMaker.CalorimeterNames=["LAREM",
237  "LARHEC",
238  "LARFCAL",
239  "TILE"]
240  # cells from the following samplings will be able to form
241  # seeds. By default no sampling is excluded
242  TopoMaker.SeedSamplingNames = ["PreSamplerB", "EMB1", "EMB2", "EMB3",
243  "PreSamplerE", "EME1", "EME2", "EME3",
244  "HEC0", "HEC1","HEC2", "HEC3",
245  "TileBar0", "TileBar1", "TileBar2",
246  "TileExt0", "TileExt1", "TileExt2",
247  "TileGap1", "TileGap2", "TileGap3",
248  "FCAL0", "FCAL1", "FCAL2"]
249  TopoMaker.NeighborOption = "super3D"
250  TopoMaker.RestrictHECIWandFCalNeighbors = False
251  TopoMaker.RestrictPSNeighbors = True
252  TopoMaker.CellThresholdOnEorAbsEinSigma = 0.0
253  TopoMaker.NeighborThresholdOnEorAbsEinSigma = 2.0
254  TopoMaker.SeedThresholdOnEorAbsEinSigma = 4.0
255 
256  #timing
257  TopoMaker.SeedCutsInT = flags.Calo.TopoCluster.doTimeCut
258  TopoMaker.CutOOTseed = flags.Calo.TopoCluster.extendTimeCut and flags.Calo.TopoCluster.doTimeCut
259  TopoMaker.UseTimeCutUpperLimit = flags.Calo.TopoCluster.useUpperLimitForTimeCut
260  TopoMaker.TimeCutUpperLimit = flags.Calo.TopoCluster.timeCutUpperLimit
261  TopoMaker.XTalkEM2 = flags.Calo.TopoCluster.xtalkEM2
262  TopoMaker.XTalkEM2D = flags.Calo.TopoCluster.xtalkEM2D
263  TopoMaker.XTalkEM2n = flags.Calo.TopoCluster.xtalkEM2n
264  TopoMaker.XTalkEM3 = flags.Calo.TopoCluster.xtalkEM3
265  TopoMaker.XTalkEMEta = flags.Calo.TopoCluster.xtalkEMEta
266  TopoMaker.XTalkDeltaT = flags.Calo.TopoCluster.xtalkDeltaT
267  TopoMaker.XTalk2Eratio1 = flags.Calo.TopoCluster.xtalk2Eratio1
268  TopoMaker.XTalk2Eratio2 = flags.Calo.TopoCluster.xtalk2Eratio2
269  TopoMaker.XTalk3Eratio = flags.Calo.TopoCluster.xtalk3Eratio
270  TopoMaker.XTalkEtaEratio = flags.Calo.TopoCluster.xtalkEtaEratio
271  TopoMaker.XTalk2DEratio = flags.Calo.TopoCluster.xtalk2DEratio
272 
273  # note E or AbsE
274  #
275  # the following properties must be set to TRUE in order to make double
276  # sided cuts on the seed and the cluster level
277  #
278  TopoMaker.SeedCutsInAbsE = True
279  TopoMaker.ClusterCutsInAbsEt = True
280  TopoMaker.ClusterEtorAbsEtCut = 0.0*MeV
281  # use 2-gaussian or single gaussian noise for TileCal
282  TopoMaker.TwoGaussianNoise = flags.Calo.TopoCluster.doTwoGaussianNoise
283 
284  TopoMaker.UseGPUCriteria = flags.Calo.TopoCluster.UseGPUCompatibleCriteria
285 
286  result.setPrivateTools(TopoMaker)
287  return result
288 
290  result=ComponentAccumulator()
291  TopoSplitter = CompFactory.CaloTopoClusterSplitter("TopoSplitter")
292  # cells from the following samplings will be able to form local
293  # maxima. The excluded samplings are PreSamplerB, EMB1,
294  # PreSamplerE, EME1, all Tile samplings, all HEC samplings and the
295  # two rear FCal samplings.
296  #
297  TopoSplitter.SamplingNames = ["EMB2", "EMB3",
298  "EME2", "EME3",
299  "FCAL0"]
300  # cells from the following samplings will also be able to form
301  # local maxima but only if they are not overlapping in eta and phi
302  # with local maxima in previous samplings from the primary list.
303  #
304  TopoSplitter.SecondarySamplingNames = ["EMB1","EME1",
305  "TileBar0","TileBar1","TileBar2",
306  "TileExt0","TileExt1","TileExt2",
307  "HEC0","HEC1","HEC2","HEC3",
308  "FCAL1","FCAL2"]
309  TopoSplitter.ShareBorderCells = True
310  TopoSplitter.RestrictHECIWandFCalNeighbors = False
311  TopoSplitter.WeightingOfNegClusters = flags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute
312 
313  TopoSplitter.UseGPUCriteria = flags.Calo.TopoCluster.UseGPUCompatibleCriteria
314 
315  result.setPrivateTools(TopoSplitter)
316  return result
317 
318 def CaloTopoClusterCfg(flags, cellsname="AllCalo", clustersname=None, clustersnapname="CaloTopoClusters"):
319  """
320  Configures topo clustering
321 
322  If output writing is enabled (ESD,AOD) the topo clusters are added to them
323  """
324 
325  doLCCalib = flags.Calo.TopoCluster.doTopoClusterLocalCalib
326 
327  if clustersname is None:
328  clustersname = "CaloCalTopoClusters" if doLCCalib else "CaloTopoClusters"
329 
330 
331  if clustersname=="CaloTopoClusters" and doLCCalib is True:
332  raise RuntimeError("Inconsistent arguments: Name must not be 'CaloTopoClusters' if doLCCalib is True")
333 
334  result=ComponentAccumulator()
335 
336  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
337  from TileGeoModel.TileGMConfig import TileGMCfg
338  from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
339  # Schedule total noise cond alg
340  result.merge(CaloNoiseCondAlgCfg(flags,"totalNoise"))
341  # Schedule electronic noise cond alg (needed for LC weights)
342  result.merge(CaloNoiseCondAlgCfg(flags,"electronicNoise"))
343 
344  CaloClusterMaker, CaloClusterSnapshot=CompFactory.getComps("CaloClusterMaker","CaloClusterSnapshot",)
345 
346  result.merge(LArGMCfg(flags))
347 
348  result.merge(TileGMCfg(flags))
349 
350  TopoMaker = result.popToolsAndMerge( CaloTopoClusterToolCfg(flags, cellsname=cellsname))
351  TopoSplitter = result.popToolsAndMerge( CaloTopoClusterSplitterToolCfg(flags) )
352  #
353  # the following options are not set, since these are the default
354  # values
355  #
356  # NeighborOption = "super3D",
357  # NumberOfCellsCut = 4,
358  # EnergyCut = 500*MeV,
359 
360  CaloTopoCluster=CaloClusterMaker(clustersname+"Maker")
361  CaloTopoCluster.ClustersOutputName=clustersname
362 
363  CaloTopoCluster.ClusterMakerTools = [TopoMaker, TopoSplitter]
364 
365  from CaloBadChannelTool.CaloBadChanToolConfig import CaloBadChanToolCfg
366  caloBadChanTool = result.popToolsAndMerge( CaloBadChanToolCfg(flags) )
367  CaloClusterBadChannelList=CompFactory.CaloClusterBadChannelList
368  BadChannelListCorr = CaloClusterBadChannelList(badChannelTool = caloBadChanTool)
369  CaloTopoCluster.ClusterCorrectionTools += [BadChannelListCorr]
370 
371  momentsMaker=result.popToolsAndMerge(getTopoMoments(flags))
372  CaloTopoCluster.ClusterCorrectionTools += [momentsMaker]
373 
374  if flags.Calo.TopoCluster.doCalibHitMoments:
375  calibHitsMomentsMaker=getTopoCalibMoments(flags)
376  CaloTopoCluster.ClusterCorrectionTools += [calibHitsMomentsMaker]
377 
378  if doLCCalib:
379  theCaloClusterSnapshot=CaloClusterSnapshot(OutputName=clustersnapname,SetCrossLinks=True,FinalClusterContainerName=clustersname)
380  CaloTopoCluster.ClusterCorrectionTools += [theCaloClusterSnapshot]
381  #if not clustersname:
382  CaloTopoCluster.ClusterCorrectionTools += getTopoClusterLocalCalibTools(flags)
383 
384  from CaloRec.CaloTopoClusterConfig import caloTopoCoolFolderCfg
385  result.merge(caloTopoCoolFolderCfg(flags))
386 
387 
388  result.addEventAlgo(CaloTopoCluster,primary=True)
389 
390  if CaloTopoCluster.ClustersOutputName in flags.Calo.TopoCluster.skipWriteList:
391  # don't add these clusters to ESD and AOD
392  return result
393 
394 
395  #Output config:
396  AODMoments=[ "SECOND_R"
397  ,"SECOND_LAMBDA"
398  ,"CENTER_MAG"
399  ,"CENTER_LAMBDA"
400  ,"FIRST_ENG_DENS"
401  ,"ENG_FRAC_MAX"
402  ,"ISOLATION"
403  ,"ENG_BAD_CELLS"
404  ,"N_BAD_CELLS"
405  ,"BADLARQ_FRAC"
406  ,"ENG_POS"
407  ,"SIGNIFICANCE"
408  ,"AVG_LAR_Q"
409  ,"AVG_TILE_Q"
410  ,"EM_PROBABILITY"
411  ,"BadChannelList"
412  ,"SECOND_TIME"
413  ,"NCELL_SAMPLING"]
414 
415  if flags.Calo.TopoCluster.writeExtendedClusterMoments:
416  AODMoments += ["LATERAL"
417  ,"LONGITUDINAL"
418  ,"CELL_SIGNIFICANCE"
419  ,"PTD"
420  ,"MASS"]
421 
422  if flags.Reco.EnableHI:
423  AODMoments += ["CELL_SIG_SAMPLING"]
424 
425  if flags.Calo.TopoCluster.writeCalibHitClusterMoments:
426  AODMoments += ["ENG_CALIB_TOT"
427  ,"ENG_CALIB_OUT_L"
428  ,"ENG_CALIB_OUT_T"
429  ,"ENG_CALIB_EMB0"
430  ,"ENG_CALIB_EME0"
431  ,"ENG_CALIB_TILEG3"
432  ,"ENG_CALIB_DEAD_TOT"
433  ,"ENG_CALIB_DEAD_EMB0"
434  ,"ENG_CALIB_DEAD_TILE0"
435  ,"ENG_CALIB_DEAD_TILEG3"
436  ,"ENG_CALIB_DEAD_EME0"
437  ,"ENG_CALIB_DEAD_HEC0"
438  ,"ENG_CALIB_DEAD_FCAL"
439  ,"ENG_CALIB_DEAD_LEAKAGE"
440  ,"ENG_CALIB_DEAD_UNCLASS"
441  ,"ENG_CALIB_FRAC_EM"
442  ,"ENG_CALIB_FRAC_HAD"
443  ,"ENG_CALIB_FRAC_REST"]
444 
445 
446  from OutputStreamAthenaPool.OutputStreamConfig import addToAOD, addToESD
447  toESD = [f"xAOD::CaloClusterContainer#{CaloTopoCluster.ClustersOutputName}",
448  f"xAOD::CaloClusterAuxContainer#{CaloTopoCluster.ClustersOutputName}Aux.-sigmaWidth",
449  f"CaloClusterCellLinkContainer#{CaloTopoCluster.ClustersOutputName}_links"]
450  toAOD = [f"xAOD::CaloClusterContainer#{CaloTopoCluster.ClustersOutputName}",
451  f"CaloClusterCellLinkContainer#{CaloTopoCluster.ClustersOutputName}_links"]
452 
453  AODMoments.append("CellLink") #Add data-link to cell-link container
454  if flags.Calo.TopoCluster.addCalibrationHitDecoration: #Add calib hit deco if requried
455  AODMoments.append(flags.Calo.TopoCluster.CalibrationHitDecorationName)
456 
457  if flags.Calo.TopoCluster.addCPData:
458  AODMoments += ["ClusterWidthEta","ClusterWidthPhi"]
459 
460  auxItems = f"xAOD::CaloClusterAuxContainer#{CaloTopoCluster.ClustersOutputName}Aux."
461  auxItems+= ".".join(AODMoments)
462 
463  toAOD.append(auxItems)
464 
465  result.merge(addToESD(flags, toESD))
466  result.merge(addToAOD(flags, toAOD))
467 
468  return result
469 
470 def addSnapshot(topomaker, corrName,contName):
471  from AthenaCommon.Logging import logging
472  mlog = logging.getLogger('CaloTopoClusterConfig:addSnapshot')
473  corrTools=topomaker.ClusterCorrectionTools
474  newCorrTools=[]
475  found=False
476  for t in corrTools:
477  newCorrTools.append(t)
478  if (t.getName()==corrName):
479  newSnapshot=CompFactory.CaloClusterSnapshot("Snapshot_"+corrName,OutputName=contName,FinalClusterContainerName=topomaker.ClustersOutputName)
480  newCorrTools.append(newSnapshot)
481  found=True
482  if not found:
483  mlog.error("Did not find cluster correction tool %s", corrName)
484  else:
485  mlog.info("Added cluster snapshot after correction tool %s", corrName)
486  topomaker.ClusterCorrectionTools = newCorrTools
487  topomaker.ClusterCorrectionTools += [newSnapshot]
488  return
489 
490 # Run with python -m CaloRec.CaloTopoClusterConfig
492  if flags is None:
493  from AthenaConfiguration.AllConfigFlags import initConfigFlags
494  flags = initConfigFlags()
495  from AthenaConfiguration.TestDefaults import defaultTestFiles
496  flags.Input.Files = defaultTestFiles.ESD_RUN3_MC
497  flags.Output.ESDFileName="esdOut.pool.root"
498  flags.Exec.MaxEvents = 10
499 
500  flags.fillFromArgs()
501  flags.lock()
502 
503  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
504  cfg = MainServicesCfg(flags)
505 
506  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
507  cfg.merge(PoolReadCfg(flags))
508 
509  topoAcc = CaloTopoClusterCfg(flags)
510  topoAlg = topoAcc.getPrimary()
511  topoAlg.ClustersOutputName = "CaloCalTopoClustersNew"
512  cfg.merge(topoAcc)
513 
514  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
515  cfg.merge(OutputStreamCfg(flags,"xAOD", ItemList = ["xAOD::CaloClusterContainer#CaloCalTopoClusters*",
516  "xAOD::CaloClusterAuxContainer#*CaloCalTopoClusters*Aux.",
517  ]))
518 
519  ThinNegativeEnergyCaloClustersAlg=CompFactory.ThinNegativeEnergyCaloClustersAlg
520  theNegativeEnergyCaloClustersThinner = ThinNegativeEnergyCaloClustersAlg(
521  "ThinNegativeEnergyCaloClustersAlg",
522  CaloClustersKey=topoAlg.ClustersOutputName,
523  ThinNegativeEnergyCaloClusters = True,
524  StreamName = 'StreamAOD'
525  )
526  cfg.addEventAlgo(theNegativeEnergyCaloClustersThinner,"AthAlgSeq")
527 
528  cfg.addEventAlgo(CompFactory.ClusterDumper("TopoDumper",ContainerName=topoAlg.ClustersOutputName,FileName="NewTopoClusters.txt"),sequenceName="AthAlgSeq")
529 
530  cfg.run()
531 
532 if __name__=="__main__":
python.LArElecCalibDBConfig.LArElecCalibDBCfg
def LArElecCalibDBCfg(flags, condObjs)
Definition: LArElecCalibDBConfig.py:47
CaloClusterBadChannelList
Definition: CaloClusterBadChannelList.h:26
python.CaloTopoClusterConfig.getTopoClusterLocalCalibTools
def getTopoClusterLocalCalibTools(flags)
Definition: CaloTopoClusterConfig.py:29
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
python.CaloTopoClusterConfig.getTopoCalibMoments
def getTopoCalibMoments(flags)
Definition: CaloTopoClusterConfig.py:200
python.CaloTopoClusterConfig.addSnapshot
def addSnapshot(topomaker, corrName, contName)
Definition: CaloTopoClusterConfig.py:470
python.CaloTopoClusterConfig.getTopoTruthMoments
def getTopoTruthMoments(flags)
Definition: CaloTopoClusterConfig.py:161
CaloClusterSnapshot
Definition: CaloClusterSnapshot.h:13
ThinNegativeEnergyCaloClustersAlg
Definition: ThinNegativeEnergyCaloClustersAlg.h:26
python.CaloNoiseCondAlgConfig.CaloNoiseCondAlgCfg
def CaloNoiseCondAlgCfg(flags, noisetype="totalNoise")
Definition: CaloNoiseCondAlgConfig.py:11
CaloBadChanToolConfig.CaloBadChanToolCfg
def CaloBadChanToolCfg(flags, **kwargs)
Definition: CaloBadChanToolConfig.py:8
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
CaloLCWeightTool
calculates hadronic cell weights based on cluster and cell quantities
Definition: CaloLCWeightTool.h:34
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:81
python.CaloTopoClusterConfig.CaloTopoClusterSplitterToolCfg
def CaloTopoClusterSplitterToolCfg(flags)
Definition: CaloTopoClusterConfig.py:289
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
python.OutputStreamConfig.addToESD
def addToESD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:127
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.CaloTopoClusterConfig.CaloTopoClusterCfg
def CaloTopoClusterCfg(flags, cellsname="AllCalo", clustersname=None, clustersnapname="CaloTopoClusters")
Definition: CaloTopoClusterConfig.py:318
CaloLCClassificationTool
classify clusters according to their probability to stem from an em object
Definition: CaloLCClassificationTool.h:29
CaloLCOutOfClusterTool
calculates out-of-cluster corrections based on cluster quantities
Definition: CaloLCOutOfClusterTool.h:28
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.CaloTopoClusterConfig.CaloTopoClusterConfigTest
def CaloTopoClusterConfigTest(flags=None)
Definition: CaloTopoClusterConfig.py:491
python.OutputStreamConfig.addToAOD
def addToAOD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:142
python.CaloTopoClusterConfig.getTopoMoments
def getTopoMoments(flags)
Definition: CaloTopoClusterConfig.py:96
CaloLCDeadMaterialTool
dead material correction tool for local hadronic calibration
Definition: CaloLCDeadMaterialTool.h:40
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
CaloClusterMaker
Top algorithm to reconstruct CaloCluster objects from CaloCell objects.
Definition: CaloClusterMaker.h:38
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7