ATLAS Offline Software
CaloDetDescrManager_test.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
3 #
4 # Author: Christos Anastopoulos
5 # Date: Jan, 2023
6 # Brief: Test for CaloDetDescrManager
7 #
8 
9 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
10 from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
11 from AthenaConfiguration.TestDefaults import defaultTestFiles
12 from AthenaConfiguration.AllConfigFlags import initConfigFlags
13 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
14 from AthenaPython.PyAthenaComps import Alg, StatusCode
15 import ROOT
16 
17 
19  def execute(self):
20  ctx = self.getContext()
21  mgr = self.condStore['CaloDetDescrManager'].find(ctx.eventID())
22  phi = 0.0
23  for sampl in [ROOT.CaloSampling.PreSamplerB,
24  ROOT.CaloSampling.EMB1,
25  ROOT.CaloSampling.EMB2,
26  ROOT.CaloSampling.EMB3,
27  ROOT.CaloSampling.PreSamplerE,
28  ROOT.CaloSampling.EME1,
29  ROOT.CaloSampling.EME2,
30  ROOT.CaloSampling.EME3,
31  ROOT.CaloSampling.HEC0,
32  ROOT.CaloSampling.HEC1,
33  ROOT.CaloSampling.HEC2,
34  ROOT.CaloSampling.HEC3,
35  ROOT.CaloSampling.TileBar0,
36  ROOT.CaloSampling.TileBar1,
37  ROOT.CaloSampling.TileBar2,
38  ROOT.CaloSampling.TileGap1,
39  ROOT.CaloSampling.TileGap2,
40  ROOT.CaloSampling.TileGap3,
41  ROOT.CaloSampling.TileExt0,
42  ROOT.CaloSampling.TileExt1,
43  ROOT.CaloSampling.TileExt2,
44  ROOT.CaloSampling.FCAL0,
45  ROOT.CaloSampling.FCAL1,
46  ROOT.CaloSampling.FCAL2,
47  ]:
48  print("Sampling:{}".format(sampl))
49  for i in range(21):
50  eta = 1e-2 + 0.2*i
51  dd = mgr.get_element(sampl, eta, phi)
52  if (dd):
53  print("----: eta:{:.2f}, phi:{:.2f}".
54  format(eta, phi))
55  print("CaloDD: r_raw:{:.2f}, r:{:.2f}, dr:{:.2f}".
56  format(dd.r_raw(), dd.r(), dd.dr()))
57  print("CaloDD: z_raw:{:.2f}, z:{:.2f}, dz:{:.2f}".
58  format(dd.z_raw(), dd.z(), dd.dz()))
59  print()
60  import sys
61  sys.stdout.flush()
62 
63  return StatusCode.Success
64 
65 
66 def testCfg(flags):
67  result = ComponentAccumulator()
68 
69  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
70  from TileGeoModel.TileGMConfig import TileGMCfg
71  result.merge(LArGMCfg(flags))
72  result.merge(TileGMCfg(flags))
73  result.addEventAlgo(CaloDetDescrManagerAlg('CaloDetDescrManagerAlg'))
74 
75  return result
76 
77 flags = initConfigFlags()
78 flags.Input.Files = defaultTestFiles.RDO_RUN2
79 flags.Input.TimeStamps = [1000]
80 flags.Detector.GeometryLAr = True
81 flags.Detector.GeometryTile = True
82 flags.needFlagsCategory('Tile')
83 flags.needFlagsCategory('LAr')
84 
85 flags.lock()
86 acc = MainServicesCfg(flags)
87 
88 acc.merge(McEventSelectorCfg(flags))
89 
90 acc.merge(testCfg(flags))
91 acc.run(1)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
vtune_athena.format
format
Definition: vtune_athena.py:14
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
python.CaloDetDescrManager_test.CaloDetDescrManagerAlg.execute
def execute(self)
Definition: CaloDetDescrManager_test.py:19
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.McEventSelectorConfig.McEventSelectorCfg
def McEventSelectorCfg(flags, **kwargs)
Definition: McEventSelectorConfig.py:5
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
python.CaloDetDescrManager_test.CaloDetDescrManagerAlg
Definition: CaloDetDescrManager_test.py:18
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
python.CaloDetDescrManager_test.testCfg
def testCfg(flags)
Definition: CaloDetDescrManager_test.py:66
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7