ATLAS Offline Software
CaloCellMakerConfig.py
Go to the documentation of this file.
1 #!/usr/bin/env athena.py
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 
4 
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.Enums import LHCPeriod
8 from LArCellRec.LArCellBuilderConfig import LArCellBuilderCfg,LArCellCorrectorCfg
9 from TileRecUtils.TileCellBuilderConfig import TileCellBuilderCfg
10 from CaloCellCorrection.CaloCellCorrectionConfig import CaloCellPedestalCorrCfg, CaloCellNeighborsAverageCorrCfg, CaloCellTimeCorrCfg, CaloEnergyRescalerCfg
11 
12 def CaloCellMakerCfg(flags):
13  result=ComponentAccumulator()
14 
15  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
16  from TileGeoModel.TileGMConfig import TileGMCfg
17 
18  result.merge(LArGMCfg(flags))
19  result.merge(TileGMCfg(flags))
20 
21  larCellBuilder = result.popToolsAndMerge(LArCellBuilderCfg(flags))
22  larCellCorrectors = result.popToolsAndMerge(LArCellCorrectorCfg(flags))
23  tileCellBuilder = result.popToolsAndMerge(TileCellBuilderCfg(flags))
24  cellFinalizer = CompFactory.CaloCellContainerFinalizerTool()
25 
26  cellMakerTools=[larCellBuilder,tileCellBuilder,cellFinalizer]+larCellCorrectors
27 
28  #Add corrections tools that are not LAr or Tile specific:
29  if flags.Calo.Cell.doPileupOffsetBCIDCorr or flags.Calo.Cell.doPedestalCorr:
30  theCaloCellPedestalCorr=CaloCellPedestalCorrCfg(flags)
31  cellMakerTools.append(result.popToolsAndMerge(theCaloCellPedestalCorr))
32 
33  #LAr HV scale corr must come after pedestal corr
34  if flags.LAr.doHVCorr:
35  from LArCellRec.LArCellBuilderConfig import LArHVCellContCorrCfg
36  theLArHVCellContCorr=LArHVCellContCorrCfg(flags)
37  cellMakerTools.append(result.popToolsAndMerge(theLArHVCellContCorr))
38 
39 
40  if flags.Calo.Cell.doDeadCellCorr:
41  theCaloCellNeighborAvg=CaloCellNeighborsAverageCorrCfg(flags)
42  cellMakerTools.append(result.popToolsAndMerge(theCaloCellNeighborAvg))
43 
44  if flags.Calo.Cell.doEnergyCorr:
45  theCaloCellEnergyRescaler=CaloEnergyRescalerCfg(flags)
46  cellMakerTools.append(result.popToolsAndMerge(theCaloCellEnergyRescaler))
47  if flags.Calo.Cell.doTimeCorr:
48  theCaloTimeCorr=CaloCellTimeCorrCfg(flags)
49  cellMakerTools.append(result.popToolsAndMerge(theCaloTimeCorr))
50 
51  if flags.LAr.doDeadOTxCorr:
52  from LArCellRec.LArCellBuilderConfig import LArDeadOTXCorrCfg
53  theLArDeadOTXCorr=LArDeadOTXCorrCfg(flags)
54  cellMakerTools.append(result.popToolsAndMerge(theLArDeadOTXCorr))
55 
56  cellAlgo = CompFactory.CaloCellMaker(CaloCellMakerToolNames=cellMakerTools,
57  CaloCellsOutputName="AllCalo",
58  EnableChronoStat=(flags.Concurrency.NumThreads == 0))
59 
60  result.addEventAlgo(cellAlgo, primary=True)
61 
62  outputContainers = ["CaloCellContainer#AllCalo"]
63  if flags.GeoModel.Run in [LHCPeriod.Run1, LHCPeriod.Run2, LHCPeriod.Run3]:
64  outputContainers += ["TileCellContainer#MBTSContainer"]
65  if flags.GeoModel.Run is LHCPeriod.Run2:
66  outputContainers += ["TileCellContainer#E4prContainer"]
67  from OutputStreamAthenaPool.OutputStreamConfig import addToESD, addToAOD
68  result.merge(addToESD(flags, outputContainers))
69  result.merge(addToAOD(flags, outputContainers))
70 
71  # Add a SuperCell container creation, if asked by flags
72  if flags.LAr.DT.storeET_ID or flags.LAr.DT.storeET_additional:
73  from LArConfiguration.LArSuperCellConfig import LArSuperCellCfg
74  result.merge(LArSuperCellCfg(flags))
75 
76  return result
77 
78 
79 
80 if __name__=="__main__":
81  from AthenaCommon.Logging import log
82  from AthenaCommon.Constants import DEBUG
83  log.setLevel(DEBUG)
84 
85  from AthenaConfiguration.AllConfigFlags import initConfigFlags
86  from AthenaConfiguration.TestDefaults import defaultTestFiles,defaultGeometryTags
87  flags = initConfigFlags()
88  flags.Input.Files = defaultTestFiles.RDO_RUN2
89  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
90  flags.lock()
91 
92  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
93  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
94  cfg=MainServicesCfg(flags)
95  cfg.merge(PoolReadCfg(flags))
96  from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
97  cfg.merge(EventInfoCnvAlgCfg(flags, disableBeamSpot=True),sequenceName="AthAlgSeq")
98 
99 
100  acc=CaloCellMakerCfg(flags)
101  acc.getPrimary().CaloCellsOutputName="AllCaloNew"
102  cfg.merge(acc)
103 
104  from AthenaCommon.Utils.unixtools import find_datafile
105  reffile=find_datafile("CaloRec/CaloCells.txt.ref")
106  if not reffile:
107  log.error("Reference file 'CaloRec/CaloCells.txt.ref' not found")
108  reffile=""
109 
110  from AthenaCommon.SystemOfUnits import GeV
111  cfg.addEventAlgo(CompFactory.CaloCellDumper(InputContainer="AllCaloNew",EnergyCut=2*GeV,
112  RefName=reffile))
113 
114  cfg.run(5)
115 
CaloCellCorrectionConfig.CaloEnergyRescalerCfg
def CaloEnergyRescalerCfg(configFlags)
Definition: CaloCellCorrectionConfig.py:80
SystemOfUnits
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.LArSuperCellConfig.LArSuperCellCfg
def LArSuperCellCfg(inputFlags)
Definition: LArSuperCellConfig.py:5
CaloCellCorrectionConfig.CaloCellPedestalCorrCfg
def CaloCellPedestalCorrCfg(configFlags)
Definition: CaloCellCorrectionConfig.py:8
TileCellBuilderConfig.TileCellBuilderCfg
def TileCellBuilderCfg(flags, mergeChannels=True, **kwargs)
Definition: TileCellBuilderConfig.py:11
python.CaloCellMakerConfig.CaloCellMakerCfg
def CaloCellMakerCfg(flags)
Definition: CaloCellMakerConfig.py:12
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
Constants
some useful constants -------------------------------------------------—
LArCellBuilderConfig.LArHVCellContCorrCfg
def LArHVCellContCorrCfg(configFlags)
Definition: LArCellBuilderConfig.py:59
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
python.OutputStreamConfig.addToESD
def addToESD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:127
LArCellBuilderConfig.LArCellBuilderCfg
def LArCellBuilderCfg(configFlags)
Definition: LArCellBuilderConfig.py:11
CaloCellCorrectionConfig.CaloCellNeighborsAverageCorrCfg
def CaloCellNeighborsAverageCorrCfg(flags)
Definition: CaloCellCorrectionConfig.py:50
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
LArCellBuilderConfig.LArDeadOTXCorrCfg
def LArDeadOTXCorrCfg(configFlags)
Definition: LArCellBuilderConfig.py:67
python.OutputStreamConfig.addToAOD
def addToAOD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:142
python.xAODEventInfoCnvConfig.EventInfoCnvAlgCfg
def EventInfoCnvAlgCfg(flags, name="EventInfoCnvAlg", inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=False, **kwargs)
Definition: xAODEventInfoCnvConfig.py:11
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
python.Utils.unixtools.find_datafile
def find_datafile(fname, pathlist=None, access=os.R_OK)
pathresolver-like helper function --------------------------------------—
Definition: unixtools.py:67
LArCellBuilderConfig.LArCellCorrectorCfg
def LArCellCorrectorCfg(configFlags)
Definition: LArCellBuilderConfig.py:27
CaloCellCorrectionConfig.CaloCellTimeCorrCfg
def CaloCellTimeCorrCfg(configFlags)
Definition: CaloCellCorrectionConfig.py:71
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7