ATLAS Offline Software
CaloThinCellsInAODAlgConfig.py
Go to the documentation of this file.
1 """Configuration for the LAr Calo Cells Digits and RawChannels By Cluster Sampling Thinner algorithm for AODs
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 
4 """
5 from AthenaCommon.Logging import logging
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
9 from LArConfiguration.LArConfigFlags import RawChannelSource
10 from OutputStreamAthenaPool.OutputStreamConfig import addToAOD
11 
12 def CaloThinCellsInAODAlgCfg(flags, **kwargs):
13  """Return ComponentAccumulator for CaloThinCellsInAODAlgCfg algorithm"""
14  # based on LArDigitThinner+CaloThinCellsByClusterAlg+CaloThinCellsBySamplingAlg
15 
16  acc = ComponentAccumulator()
17 
18  kwargs.setdefault("ClusterPtCut", 1000) # MeV
19  kwargs.setdefault("ClusterEtaCut", 1.4)
20  kwargs.setdefault("isMC", flags.Input.isMC)
21 
22  # Input Containers
23  if not flags.Input.isMC and not flags.Overlay.DataOverlay:
24  kwargs.setdefault("InputDigitsContainerName","FREE")
25  from LArByteStream.LArRawDataReadingConfig import LArRawDataReadingCfg
26  acc.merge(LArRawDataReadingCfg(flags, LArDigitKey="FREE"))
27 
28  acc.merge(LArOnOffIdMappingCfg(flags))
29 
30  if flags.LAr.RawChannelSource is RawChannelSource.Calculated:
31  kwargs.setdefault("InputRawChannelContainerName","LArRawChannels_FromDigits")
32 
33  kwargs.setdefault("InputCaloCellContainerName" ,"AllCalo")
34  kwargs.setdefault("CaloClusterContainerKey" ,"CaloCalTopoClusters")
35 
36  # Output Containers
37  outputHitCntName = 'LArHitEMB_ClusterThinned'
38  outputDigCntName = "LArDigitContainer_ClusterThinned"
39  outputRawChCntName = "LArRawChannels_ClusterThinned"
40  outputCaloCellCntName = "AllCalo_ClusterThinned"
41 
42  kwargs.setdefault("OutputHitsContainerName" ,outputHitCntName)
43  kwargs.setdefault("OutputDigitsContainerName" ,outputDigCntName)
44  kwargs.setdefault("OutputRawChannelContainerName",outputRawChCntName)
45  kwargs.setdefault("OutputCaloCellContainerName" ,outputCaloCellCntName)
46 
47  acc.addEventAlgo(CompFactory.CaloThinCellsInAODAlg(**kwargs))
48 
49  if flags.Input.isMC:
50  acc.merge(addToAOD(flags,[f"LArHitContainer#{outputHitCntName}"]))
51  acc.merge(addToAOD(flags,[f"LArDigitContainer#{outputDigCntName}"]))
52  acc.merge(addToAOD(flags,[f"LArRawChannelContainer#{outputRawChCntName}"]))
53  acc.merge(addToAOD(flags,[f"CaloCellContainer#{outputCaloCellCntName}"]))
54 
55  return acc
56 
57 if __name__ == "__main__":
58  from AthenaConfiguration.AllConfigFlags import initConfigFlags
59  from AthenaConfiguration.TestDefaults import defaultTestFiles
60  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
61 
62  mlog = logging.getLogger('CaloThinCellsInAODAlgCfg')
63 
64  flags = initConfigFlags()
65  flags.Input.Files = defaultTestFiles.RAW_RUN2
66  flags.Output.doWriteAOD = True
67  flags.Exec.MaxEvents = 10
68  flags.lock()
69 
70  acc = MainServicesCfg(flags)
71 
72  acc.merge(CaloThinCellsInAODAlgCfg(flags))
73 
74  acc.getService("MessageSvc").defaultLimit=999999
75 
76  acc.run()
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloThinCellsInAODAlgConfig.CaloThinCellsInAODAlgCfg
def CaloThinCellsInAODAlgCfg(flags, **kwargs)
Definition: CaloThinCellsInAODAlgConfig.py:12
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
LArCablingConfig.LArOnOffIdMappingCfg
def LArOnOffIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:62
python.LArRawDataReadingConfig.LArRawDataReadingCfg
def LArRawDataReadingCfg(configFlags, **kwargs)
Definition: LArRawDataReadingConfig.py:10
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.OutputStreamConfig.addToAOD
def addToAOD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:142