ATLAS Offline Software
Loading...
Searching...
No Matches
CaloDetDescrManager_test.py
Go to the documentation of this file.
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
9from AthenaConfiguration.MainServicesConfig import MainServicesCfg
10from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
11from AthenaConfiguration.TestDefaults import defaultTestFiles
12from AthenaConfiguration.AllConfigFlags import initConfigFlags
13from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
14from AthenaPython.PyAthenaComps import Alg, StatusCode
15import 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
66def 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
77flags = initConfigFlags()
78flags.Input.Files = defaultTestFiles.RDO_RUN2
79flags.Input.TimeStamps = [1000]
80flags.Detector.GeometryLAr = True
81flags.Detector.GeometryTile = True
82flags.needFlagsCategory('Tile')
83flags.needFlagsCategory('LAr')
84
85flags.lock()
86acc = MainServicesCfg(flags)
87
88acc.merge(McEventSelectorCfg(flags))
89
90acc.merge(testCfg(flags))
91acc.run(1)
void print(char *figname, TCanvas *c1)
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138