ATLAS Offline Software
Loading...
Searching...
No Matches
InDetServMatGeometryManager.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
11
12#include "GaudiKernel/SystemOfUnits.h"
13
15 : AthMessaging("InDetServMatGeometryManager")
16 , m_athenaComps(athenaComps)
17{
18 ATH_MSG_DEBUG("Initializing InDetServMatGeometryManager");
19
20 const IGeoDbTagSvc *geoDbTag = m_athenaComps->geoDbTagSvc();
21 IRDBAccessSvc *rdbSvc = m_athenaComps->rdbAccessSvc();
22
23 // Get version tag and node for Pixel.
24 DecodeVersionKey pixelVersionKey(geoDbTag,"Pixel");
25 const std::string& pixelDetectorKey = pixelVersionKey.tag();
26 const std::string& pixelDetectorNode = pixelVersionKey.node();
27
28 // Get version tag and node for SCT.
29 DecodeVersionKey sctVersionKey(geoDbTag,"SCT");
30 const std::string& sctDetectorKey = sctVersionKey.tag();
31 const std::string& sctDetectorNode = sctVersionKey.node();
32
34 DecodeVersionKey indetVersionKey(geoDbTag,"InnerDetector");
35 const std::string& indetDetectorKey = indetVersionKey.tag();
36 const std::string& indetDetectorNode = indetVersionKey.node();
37
39//
40// Gets the record sets
41//
43
44 ATH_MSG_DEBUG("Retrieving Pixel Record Sets from database ...");
45 ATH_MSG_DEBUG("Pixel: Key = " << pixelDetectorKey << " Node = " << pixelDetectorNode);
46 ATH_MSG_DEBUG("SCT: Key = " << sctDetectorKey << " Node = " << sctDetectorNode);
47 ATH_MSG_DEBUG("InDet: Key = " << indetDetectorKey << " Node = " << indetDetectorNode);
48
49 m_InDetWeights = rdbSvc->getRecordsetPtr("InDetWeights", indetDetectorKey, indetDetectorNode);
50
51 m_PixelBarrelGeneral = rdbSvc->getRecordsetPtr("PixelBarrelGeneral", pixelDetectorKey, pixelDetectorNode);
52 m_PixelEndcapGeneral = rdbSvc->getRecordsetPtr("PixelEndcapGeneral", pixelDetectorKey, pixelDetectorNode);
53 m_PixelLayer = rdbSvc->getRecordsetPtr("PixelLayer", pixelDetectorKey, pixelDetectorNode);
54 m_PixelDisk = rdbSvc->getRecordsetPtr("PixelDisk", pixelDetectorKey, pixelDetectorNode);
55 m_PixelDiskRing = rdbSvc->getRecordsetPtr("PixelDiskRing", pixelDetectorKey, pixelDetectorNode);
56 m_PixelStave = rdbSvc->getRecordsetPtr("PixelStave", pixelDetectorKey, pixelDetectorNode);
57 m_PixelRing = rdbSvc->getRecordsetPtr("PixelRing", pixelDetectorKey, pixelDetectorNode);
58 m_PixelModule = rdbSvc->getRecordsetPtr("PixelModule", pixelDetectorKey, pixelDetectorNode);
59 m_PixelReadout = rdbSvc->getRecordsetPtr("PixelReadout", pixelDetectorKey, pixelDetectorNode);
60 m_PixelWeights = rdbSvc->getRecordsetPtr("PixelWeights", pixelDetectorKey, pixelDetectorNode);
61 m_PixelEnvelope = rdbSvc->getRecordsetPtr("PixelEnvelope", pixelDetectorKey, pixelDetectorNode);
62 m_PixelSvcRoute = rdbSvc->getRecordsetPtr("PixelServiceRoute", pixelDetectorKey, pixelDetectorNode);
63
64 m_SctBrlGeneral = rdbSvc->getRecordsetPtr("SSctBrlGeneral", sctDetectorKey, sctDetectorNode);
65 m_SctBrlLayer = rdbSvc->getRecordsetPtr("SSctBrlLayer", sctDetectorKey, sctDetectorNode);
66 m_SctBrlLadder = rdbSvc->getRecordsetPtr("SSctBrlLadder", sctDetectorKey, sctDetectorNode);
67 m_SctFwdGeneral = rdbSvc->getRecordsetPtr("SSctFwdGeneral", sctDetectorKey, sctDetectorNode);
68 m_SctFwdWheel = rdbSvc->getRecordsetPtr("SSctFwdWheel", sctDetectorKey, sctDetectorNode);
69 m_SctFwdDiscSupport = rdbSvc->getRecordsetPtr("SSctFwdDiscSupport", sctDetectorKey, sctDetectorNode);
70 m_SctBrlServPerLayer = rdbSvc->getRecordsetPtr("SSctBrlServPerLayer", sctDetectorKey, sctDetectorNode);
71 m_SctWeights = rdbSvc->getRecordsetPtr("SctWeights", sctDetectorKey, sctDetectorNode);
72
73 m_InDetSimpleServices = rdbSvc->getRecordsetPtr("InDetSimpleServices", indetDetectorKey, indetDetectorNode);
74
75 m_scalingTable = rdbSvc->getRecordsetPtr("InDetServMatScaling", indetDetectorKey, indetDetectorNode);
76
77 m_switches = rdbSvc->getRecordsetPtr("InDetServSwitches", indetDetectorKey, indetDetectorNode);
78
79 m_matMgr = new InDetMaterialManager("InDetServMatMaterialManager", m_athenaComps);
80 m_matMgr->addWeightTable(m_InDetWeights, "indet");
81 m_matMgr->addWeightTable(m_PixelWeights, "pix");
82 m_matMgr->addWeightTable(m_SctWeights, "sct");
83 m_matMgr->addScalingTable(m_scalingTable);
84
85}
86
91
92// flag for whether or not to build services
94{
95 try {
96 if(!(*m_switches)[0]->isFieldNull("BUILDSERVICES")) {
97 return (*m_switches)[0]->getInt("BUILDSERVICES");
98 }
99 }
100 catch(std::runtime_error&) {
101 ATH_MSG_DEBUG("The switches table has no BUILDSERVICES column");
102 }
103 return false;
104}
105
106int InDetServMatGeometryManager::SupportTubeIndex(const std::string& name) const
107{
108 int i=0;
109 for(const auto& rec : *m_InDetSimpleServices) {
110 if(rec->getString("NAME")==name) return i;
111 ++i;
112 }
113 return -1;
114}
115
116double InDetServMatGeometryManager::SupportTubeRMin(const std::string& name) const
117{
118 int ind = SupportTubeIndex(name);
119 if (ind >= 0) return (*m_InDetSimpleServices)[ind]->getDouble("RMIN");
120 return 0;
121}
122
123double InDetServMatGeometryManager::SupportTubeRMax(const std::string& name) const
124{
125 int ind = SupportTubeIndex(name);
126 if (ind >= 0) return (*m_InDetSimpleServices)[ind]->getDouble("RMAX");
127 return 0;
128}
129
130double InDetServMatGeometryManager::SupportTubeZMin(const std::string& name) const
131{
132 int ind = SupportTubeIndex(name);
133 if (ind >= 0) (*m_InDetSimpleServices)[ind]->getDouble("ZMIN");
134 return 0;
135}
136
137double InDetServMatGeometryManager::SupportTubeZMax(const std::string& name) const
138{
139 int ind = SupportTubeIndex(name);
140 if (ind >= 0) (*m_InDetSimpleServices)[ind]->getDouble("ZMAX");
141 return 0;
142}
143
144int InDetServMatGeometryManager::SupportTubeExists(const std::string& name) const
145{
146 if (SupportTubeIndex(name) != -1) return 1;
147 return 0;
148}
149
150
151// number of layers
153{
154 return (*m_PixelBarrelGeneral)[0]->getInt("NLAYER");
155}
156
157// layer radius
159{
160 return (*m_PixelLayer)[layer]->getDouble("RLAYER") * Gaudi::Units::mm;
161}
162
163// layer length
165{
166 int staveIndex = (*m_PixelLayer)[layer]->getInt("STAVEINDEX");
167 return (*m_PixelStave)[staveIndex]->getDouble("ENVLENGTH") * Gaudi::Units::mm;
168}
169
170// Number of staves/sectors per barrel layer
172{
173 return (*m_PixelLayer)[layer]->getInt("NSECTORS");
174}
175
176// Number of modules per stave
178{
179 int staveIndex = (*m_PixelLayer)[layer]->getInt("STAVEINDEX");
180 return (*m_PixelStave)[staveIndex]->getInt("NMODULE");
181}
182
183// Bent stave (conical layout) parameters
185{
186 int staveIndex = (*m_PixelLayer)[layer]->getInt("STAVEINDEX");
187 try {
188 if(!(*m_PixelStave)[staveIndex]->isFieldNull("BENTSTAVEANGLE")) {
189 return (*m_PixelStave)[staveIndex]->getDouble("BENTSTAVEANGLE");
190 }
191 }
192 catch(std::runtime_error&) {
193 ATH_MSG_DEBUG("No value for the BENTSTAVEANGLE column in the PixelStave table record " << staveIndex);
194 }
195 return 0.;
196}
197
199{
200 int staveIndex = (*m_PixelLayer)[layer]->getInt("STAVEINDEX");
201 try {
202 if(!(*m_PixelStave)[staveIndex]->isFieldNull("BENTSTAVENMODULE")) {
203 return (*m_PixelStave)[staveIndex]->getDouble("BENTSTAVENMODULE");
204 }
205 }
206 catch(std::runtime_error&) {
207 ATH_MSG_DEBUG("No value for the BENTSTAVEMODULE column in the PixelStave table record " << staveIndex);
208 }
209 return 0.;
210}
211
213{
214 int staveIndex = (*m_PixelLayer)[layer]->getInt("STAVEINDEX");
215 return (*m_PixelStave)[staveIndex]->getDouble("MODULEDZ");
216}
217
218// Number of staves/sectors per endcap layer
220{
221 if(!(*m_PixelDisk)[layer]->isFieldNull("NSECTORS")) {
222 return (*m_PixelDisk)[layer]->getInt("NSECTORS");
223 }
224 return 0;
225}
226
228{
229 return (*m_PixelRing)[ring]->getInt("NMODULE");
230}
231
233{
234 int nModulesDisk = 0;
235 for(const auto& diskRing : *m_PixelDiskRing) {
236 int disk = diskRing->getInt("DISK");
237 if (disk == layer) {
238 int ring = diskRing->getInt("RING");
239 nModulesDisk += pixelModulesPerRing( ring);
240 }
241 }
242 if(pixelEndcapNumSectorsForLayer(layer)==0) return 0;
243 return nModulesDisk / pixelEndcapNumSectorsForLayer(layer);
244}
245
247{
248 int sumChips = 0;
249 int sumModules = 0;
250 for(const auto& diskRing : *m_PixelDiskRing) {
251 int disk = diskRing->getInt("DISK");
252 if (disk == layer) {
253 int ring = diskRing->getInt("RING");
254 int moduleType = diskRing->getInt("MODULETYPE");
255 int nModules = pixelModulesPerRing(ring);
256 sumModules += nModules;
257 sumChips += nModules * pixelChipsPerModule(moduleType);
258 }
259 }
260 if(sumModules==0) return 0;
261 if (sumChips % sumModules == 0) return sumChips/sumModules;
262 else return 1 + sumChips/sumModules; // round to larger integer
263}
264
265// number of disks
267{
268 return (*m_PixelEndcapGeneral)[0]->getInt("NDISK");
269}
270
271// disk Z position
273{
274 return (*m_PixelDisk)[disk]->getDouble("ZDISK") * Gaudi::Units::mm;
275}
276
277// disk min radius
279{
280 std::string route = pixelDiskServiceRoute(disk);
281 if(route=="StdRoute")
282 return (*m_PixelDisk)[disk]->getDouble("RMIN") * Gaudi::Units::mm - 11*Gaudi::Units::mm;
283
284 // support structures - SUP1RMIN is always closest to centre
285 return (*m_PixelDisk)[disk]->getDouble("SUP1RMIN") * Gaudi::Units::mm;
286
287}
288
289// disk max radius
291{
292 std::string route = pixelDiskServiceRoute(disk);
293 if(route=="StdRoute")
294 return (*m_PixelDisk)[disk]->getDouble("RMAX") * Gaudi::Units::mm + 11*Gaudi::Units::mm;
295
296 // support structures - SUP3RMAX is always furthest from centre
297 return (*m_PixelDisk)[disk]->getDouble("SUP3RMAX") * Gaudi::Units::mm;
298
299}
300
301// EOS ZOffset
303{
304 try {
305 if(disk >=0
306 && static_cast<unsigned>(disk) < m_PixelSvcRoute->size()
307 && !(*m_PixelSvcRoute)[disk]->isFieldNull("EOSZOFFSET")) {
308 return (*m_PixelSvcRoute)[disk]->getDouble("EOSZOFFSET");
309 }
310 }
311 catch(std::runtime_error&) {
312 ATH_MSG_DEBUG("No EOSZOFFSET value for the PixelSvcRoute table record " << disk);
313 }
314 return 0.0;
315}
316
317// return name of support tube where
319{
320 try {
321 if(disk >=0
322 && static_cast<unsigned>(disk) < m_PixelSvcRoute->size()
323 && !(*m_PixelSvcRoute)[disk]->isFieldNull("SERVICEROUTE")) {
324 return (*m_PixelSvcRoute)[disk]->getString("SERVICEROUTE");
325 }
326 }
327 catch (std::runtime_error&) {
328 ATH_MSG_DEBUG("No SERVICEROUTE value for the PixelSvcRoute table record " << disk);
329 }
330 return "StdRoute";
331}
332
334{
335 return (*m_PixelEnvelope)[0]->getDouble("RMAX") * Gaudi::Units::mm;
336}
337
339{
340 return (*m_PixelLayer)[layer]->getInt("MODULETYPE");
341}
342
344{
345 return (*m_PixelModule)[moduleType]->getInt("DESIGNTYPE");
346}
347
349{
350 int nChipsEta = (*m_PixelReadout)[moduleType]->getInt("NCHIPSETA");
351 int nChipsPhi = (*m_PixelReadout)[moduleType]->getInt("NCHIPSPHI");
352 return nChipsEta*nChipsPhi;
353}
354
355// number of layers
357{
358 return (*m_SctBrlGeneral)[0]->getInt("NUMLAYERS");
359}
360
361// layer radius
363{
364 return (*m_SctBrlLayer)[layer]->getDouble("RADIUS") * Gaudi::Units::mm;
365}
366
367// layer length
369{
370 return (*m_SctBrlLayer)[layer]->getDouble("CYLLENGTH") * Gaudi::Units::mm;
371}
372
373// layer type. Long(0) or Short (1) strips. NEEDS CHECKING
375{
376 int ladType = (*m_SctBrlLayer)[layer]->getInt("LADDERTYPE");
377 return (*m_SctBrlLadder)[ladType]->getInt("MODTYPE");
378}
379
380// Number of staves/sectors per barrel layer
382{
383 return (*m_SctBrlLayer)[layer]->getInt("SKISPERLAYER");
384}
385
387{
388 int ladType = (*m_SctBrlLayer)[layer]->getInt("LADDERTYPE");
389 return (*m_SctBrlLadder)[ladType]->getInt("NUMPERLADDER");
390}
391
392// Number of staves/sectors per endcap layer
394{
395 return 32; // FIXME: hardwired number, should go to text file and DB
396}
397
398// number of disks
400{
401 return (*m_SctFwdGeneral)[0]->getInt("NUMWHEELS");
402}
403
404// disk Z position
406{
407 return (*m_SctFwdWheel)[disk]->getDouble("ZPOSITION") * Gaudi::Units::mm;
408}
409
410// disk Z position
412{
413 return (*m_SctFwdDiscSupport)[disk]->getDouble("OUTERRADIUS") * Gaudi::Units::mm;
414}
415
417{
418 return (*m_SctBrlServPerLayer)[0]->getDouble("SUPPORTCYLINNERRAD") * Gaudi::Units::mm;
419}
420
#define ATH_MSG_DEBUG(x)
Definition of the abstract IRDBAccessSvc interface.
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
const std::string & tag() const
Return version tag.
const std::string & node() const
Return the version node.
IRDBAccessSvc is an abstract interface to the athena service that provides the following functionalit...
virtual IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
Class to hold various Athena components.
InDetMaterialManager.
int SupportTubeExists(const std::string &name) const
int SupportTubeIndex(const std::string &name) const
double SupportTubeZMin(const std::string &name) const
double pixelLadderModuleDeltaZ(int layer) const
int pixelChipsPerModule(int moduleType) const
double SupportTubeRMax(const std::string &name) const
double SupportTubeZMax(const std::string &name) const
InDetServMatGeometryManager(InDetDD::AthenaComps *athenaComps)
std::string pixelDiskServiceRoute(int disk) const
double SupportTubeRMin(const std::string &name) const
double pixelLadderBentStaveAngle(int layer) const