ATLAS Offline Software
LArGMConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AtlasGeoModel.GeoModelConfig import GeoModelCfg
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaConfiguration.Enums import LHCPeriod, ProductionStep, Project
6 from IOVDbSvc.IOVDbSvcConfig import addFolders
7 
8 def LArGMCfg(flags):
9  result=GeoModelCfg(flags)
10 
11  activateCondAlgs = flags.Common.Project is not Project.AthSimulation
12  tool = CompFactory.LArDetectorToolNV(ApplyAlignments=flags.LAr.doAlign, EnableMBTS=flags.Detector.GeometryMBTS)
13  if flags.Common.ProductionStep != ProductionStep.Simulation and flags.Common.ProductionStep != ProductionStep.FastChain:
14  tool.GeometryConfig = "RECO"
15 
16  result.getPrimary().DetectorTools += [ tool ]
17 
18  if flags.LAr.doAlign:
19  if flags.Input.isMC:
20  #Monte Carlo case:
21  if activateCondAlgs:
22  result.merge(addFolders(flags,"/LAR/Align","LAR_OFL",className="DetCondKeyTrans"))
23  result.merge(addFolders(flags,"/LAR/LArCellPositionShift","LAR_OFL",className="CaloRec::CaloCellPositionShift"))
24  else:
25  result.merge(addFolders(flags,"/LAR/Align","LAR_OFL"))
26  result.merge(addFolders(flags,"/LAR/LArCellPositionShift","LAR_OFL"))
27  else:
28  result.merge(addFolders(flags,"/LAR/Align","LAR_ONL",className="DetCondKeyTrans"))
29  result.merge(addFolders(flags,"/LAR/LArCellPositionShift","LAR_ONL",className="CaloRec::CaloCellPositionShift"))
30 
31  if activateCondAlgs:
32  result.addCondAlgo(CompFactory.LArAlignCondAlg())
33  result.addCondAlgo(CompFactory.CaloAlignCondAlg())
34  AthReadAlg_ExtraInputs = set()
35  caloCellsInInput = "CaloCellContainer" in [i.split('#')[0] for i in flags.Input.TypedCollections]
36  sCellsInInput = False
37  caloCellKeys = []
38  if caloCellsInInput:
39  from SGComps.AddressRemappingConfig import AddressRemappingCfg
40  result.merge(AddressRemappingCfg())
41 
42  caloCellKeys = [i.split('#')[1] for i in flags.Input.TypedCollections if "CaloCellContainer"==i.split('#')[0] ]
43  for key in caloCellKeys:
44  if key != 'AllCalo':
45  sCellsInInput = True
46 
47  AthReadAlg_ExtraInputs.add(('CaloDetDescrManager', 'ConditionStore+CaloDetDescrManager'))
48  if (flags.GeoModel.Run >= LHCPeriod.Run3 and flags.Detector.GeometryTile) or sCellsInInput:
49  # TODO: avoid depending on Tile in SuperCell alignment
50  from TileGeoModel.TileGMConfig import TileGMCfg
51  result.merge(TileGMCfg(flags))
52  result.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg())
53  AthReadAlg_ExtraInputs.add(('CaloSuperCellDetDescrManager', 'ConditionStore+CaloSuperCellDetDescrManager'))
54 
55 
56  if caloCellsInInput:
57  for key in caloCellKeys:
58  AthReadAlg=CompFactory.AthReadAlg
59  AthReadAlg_CaloCellCont = AthReadAlg (f'AthReadAlg_{key}',
60  Key = f'CaloCellContainer/{key}',
61  Aliases = [],
62  ExtraInputs = AthReadAlg_ExtraInputs)
63  result.addCondAlgo(AthReadAlg_CaloCellCont)
64  else:
65  # Build unalinged CaloDetDescrManager instance in the Condition Store
66  if activateCondAlgs:
67  result.addCondAlgo(CompFactory.CaloAlignCondAlg(LArAlignmentStore="",CaloCellPositionShiftFolder=""))
68  if flags.GeoModel.Run >= LHCPeriod.Run3 and flags.Detector.GeometryTile and flags.Common.ProductionStep != ProductionStep.Overlay:
69  # TODO: avoid depending on Tile in SuperCell alignment
70  from TileGeoModel.TileGMConfig import TileGMCfg
71  result.merge(TileGMCfg(flags))
72  result.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg())
73 
74  return result
75 
76 if __name__ == "__main__":
77  from AthenaConfiguration.AllConfigFlags import initConfigFlags
78  from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
79 
80  flags = initConfigFlags()
81  flags.Input.Files = defaultTestFiles.RAW_RUN2
82  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
83  flags.lock()
84 
85  acc = LArGMCfg(flags)
86  f=open('LArGMCfg.pkl','wb')
87  acc.store(f)
88  f.close()
AddressRemappingConfig.AddressRemappingCfg
def AddressRemappingCfg(renameMaps=[], overwriteMaps=[])
Definition: AddressRemappingConfig.py:10
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.GeoModelConfig.GeoModelCfg
def GeoModelCfg(flags)
Definition: GeoModelConfig.py:16
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7