ATLAS Offline Software
Loading...
Searching...
No Matches
InDetServMatGeometryManager.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
12
13#include "GaudiKernel/SystemOfUnits.h"
14
16 : m_athenaComps(athenaComps),
17 m_matMgr(nullptr)
18{
19
20 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initializing InDetServMatGeometryManager" << endmsg;
21
22 const IGeoDbTagSvc *geoDbTag = m_athenaComps->geoDbTagSvc();
23 IRDBAccessSvc *rdbSvc = m_athenaComps->rdbAccessSvc();
24
25 // Get version tag and node for Pixel.
26 DecodeVersionKey pixelVersionKey(geoDbTag,"Pixel");
27 const std::string& pixelDetectorKey = pixelVersionKey.tag();
28 const std::string& pixelDetectorNode = pixelVersionKey.node();
29
30 // Get version tag and node for SCT.
31 DecodeVersionKey sctVersionKey(geoDbTag,"SCT");
32 const std::string& sctDetectorKey = sctVersionKey.tag();
33 const std::string& sctDetectorNode = sctVersionKey.node();
34
36 DecodeVersionKey indetVersionKey(geoDbTag,"InnerDetector");
37 const std::string& indetDetectorKey = indetVersionKey.tag();
38 const std::string& indetDetectorNode = indetVersionKey.node();
39
41//
42// Gets the record sets
43//
45
46 if(msgLvl(MSG::DEBUG)) {
47 msg(MSG::DEBUG) << "Retrieving Pixel Record Sets from database ..." << endmsg;
48 msg(MSG::DEBUG) << "Pixel: Key = " << pixelDetectorKey << " Node = " << pixelDetectorNode << endmsg;
49 msg(MSG::DEBUG) << "SCT: Key = " << sctDetectorKey << " Node = " << sctDetectorNode << endmsg;
50 msg(MSG::DEBUG) << "InDet: Key = " << indetDetectorKey << " Node = " << indetDetectorNode << endmsg;
51 }
52
53 m_InDetWeights = rdbSvc->getRecordsetPtr("InDetWeights", indetDetectorKey, indetDetectorNode);
54
55 m_PixelBarrelGeneral = rdbSvc->getRecordsetPtr("PixelBarrelGeneral", pixelDetectorKey, pixelDetectorNode);
56 m_PixelEndcapGeneral = rdbSvc->getRecordsetPtr("PixelEndcapGeneral", pixelDetectorKey, pixelDetectorNode);
57 m_PixelLayer = rdbSvc->getRecordsetPtr("PixelLayer", pixelDetectorKey, pixelDetectorNode);
58 m_PixelDisk = rdbSvc->getRecordsetPtr("PixelDisk", pixelDetectorKey, pixelDetectorNode);
59 m_PixelDiskRing = rdbSvc->getRecordsetPtr("PixelDiskRing", pixelDetectorKey, pixelDetectorNode);
60 m_PixelStave = rdbSvc->getRecordsetPtr("PixelStave", pixelDetectorKey, pixelDetectorNode);
61 m_PixelRing = rdbSvc->getRecordsetPtr("PixelRing", pixelDetectorKey, pixelDetectorNode);
62 m_PixelModule = rdbSvc->getRecordsetPtr("PixelModule", pixelDetectorKey, pixelDetectorNode);
63 m_PixelReadout = rdbSvc->getRecordsetPtr("PixelReadout", pixelDetectorKey, pixelDetectorNode);
64 m_PixelWeights = rdbSvc->getRecordsetPtr("PixelWeights", pixelDetectorKey, pixelDetectorNode);
65 m_PixelEnvelope = rdbSvc->getRecordsetPtr("PixelEnvelope", pixelDetectorKey, pixelDetectorNode);
66 m_PixelSvcRoute = rdbSvc->getRecordsetPtr("PixelServiceRoute", pixelDetectorKey, pixelDetectorNode);
67
68 m_SctBrlGeneral = rdbSvc->getRecordsetPtr("SSctBrlGeneral", sctDetectorKey, sctDetectorNode);
69 m_SctBrlLayer = rdbSvc->getRecordsetPtr("SSctBrlLayer", sctDetectorKey, sctDetectorNode);
70 m_SctBrlLadder = rdbSvc->getRecordsetPtr("SSctBrlLadder", sctDetectorKey, sctDetectorNode);
71 m_SctFwdGeneral = rdbSvc->getRecordsetPtr("SSctFwdGeneral", sctDetectorKey, sctDetectorNode);
72 m_SctFwdWheel = rdbSvc->getRecordsetPtr("SSctFwdWheel", sctDetectorKey, sctDetectorNode);
73 m_SctFwdDiscSupport = rdbSvc->getRecordsetPtr("SSctFwdDiscSupport", sctDetectorKey, sctDetectorNode);
74 m_SctBrlServPerLayer = rdbSvc->getRecordsetPtr("SSctBrlServPerLayer", sctDetectorKey, sctDetectorNode);
75 m_SctWeights = rdbSvc->getRecordsetPtr("SctWeights", sctDetectorKey, sctDetectorNode);
76
77 m_InDetSimpleServices = rdbSvc->getRecordsetPtr("InDetSimpleServices", indetDetectorKey, indetDetectorNode);
78
79 m_scalingTable = rdbSvc->getRecordsetPtr("InDetServMatScaling", indetDetectorKey, indetDetectorNode);
80
81 m_switches = rdbSvc->getRecordsetPtr("InDetServSwitches", indetDetectorKey, indetDetectorNode);
82
83 m_matMgr = new InDetMaterialManager("InDetServMatMaterialManager", m_athenaComps);
84 m_matMgr->addWeightTable(m_InDetWeights, "indet");
85 m_matMgr->addWeightTable(m_PixelWeights, "pix");
86 m_matMgr->addWeightTable(m_SctWeights, "sct");
87 m_matMgr->addScalingTable(m_scalingTable);
88
89}
90
95
96// flag for whether or not to build services
98{
99 if (db()->testField("","BUILDSERVICES")) {
100 return db()->getInt("","BUILDSERVICES");
101 }
102 if (db()->testField(m_switches,"BUILDSERVICES")) {
103 return db()->getInt(m_switches,"BUILDSERVICES");
104 }
105 return false;
106}
107
108int InDetServMatGeometryManager::SupportTubeIndex(const std::string& name) const
109{
110 for (unsigned int i = 0; i < db()->getTableSize(m_InDetSimpleServices); i++)
111 {
112 if (db()->getString(m_InDetSimpleServices,"NAME",i) == name) return i;
113 }
114 return -1;
115}
116
117double InDetServMatGeometryManager::SupportTubeRMin(const std::string& name) const
118{
119 int ind = SupportTubeIndex(name);
120 if (ind >= 0) return db()->getDouble(m_InDetSimpleServices, "RMIN", ind);
121 return 0;
122}
123
124double InDetServMatGeometryManager::SupportTubeRMax(const std::string& name) const
125{
126 int ind = SupportTubeIndex(name);
127 if (ind >= 0) return db()->getDouble(m_InDetSimpleServices, "RMAX", ind);
128 return 0;
129}
130
131double InDetServMatGeometryManager::SupportTubeZMin(const std::string& name) const
132{
133 int ind = SupportTubeIndex(name);
134 if (ind >= 0) return db()->getDouble(m_InDetSimpleServices, "ZMIN", ind);
135 return 0;
136}
137
138double InDetServMatGeometryManager::SupportTubeZMax(const std::string& name) const
139{
140 int ind = SupportTubeIndex(name);
141 if (ind >= 0) return db()->getDouble(m_InDetSimpleServices, "ZMAX", ind);
142 return 0;
143}
144
145int InDetServMatGeometryManager::SupportTubeExists(const std::string& name) const
146{
147 if (SupportTubeIndex(name) != -1) return 1;
148 return 0;
149}
150
151
152// number of layers
154{
155 return db()->getInt(m_PixelBarrelGeneral,"NLAYER");
156}
157
158// layer radius
160{
161 return db()->getDouble(m_PixelLayer,"RLAYER",layer) * Gaudi::Units::mm;
162}
163
164// layer length
166{
167 int staveIndex = db()->getInt(m_PixelLayer,"STAVEINDEX",layer);
168 return db()->getDouble(m_PixelStave,"ENVLENGTH",staveIndex) * Gaudi::Units::mm;
169}
170
171// Number of staves/sectors per barrel layer
173{
174 return db()->getInt(m_PixelLayer,"NSECTORS",layer);
175}
176
177// Number of modules per stave
179{
180 //msg(MSG::INFO) << "Entering InDetServMatGeometryManager::pixelModulesPerStave for layer " << layer << endmsg;
181
182 int staveIndex = db()->getInt(m_PixelLayer,"STAVEINDEX",layer);
183
184 //msg(MSG::INFO) << "staveIndex for the layer is " << staveIndex << endmsg;
185 //msg(MSG::INFO) << "modules per stave is " << db()->getInt(m_PixelStave,"NMODULE",staveIndex) << endmsg;
186
187 return db()->getInt(m_PixelStave,"NMODULE",staveIndex);
188}
189
190
191// Bent stave (conical layout) parameters
193{
194 if (!db()->testFieldTxt(m_PixelStave, "BENTSTAVEANGLE")) return 0;
195 int staveIndex = db()->getInt(m_PixelLayer,"STAVEINDEX", layer);
196 return db()->getDouble(m_PixelStave,"BENTSTAVEANGLE", staveIndex);
197}
198
200{
201 if (!db()->testFieldTxt(m_PixelStave,"BENTSTAVENMODULE")) return 0;
202 int staveIndex = db()->getInt(m_PixelLayer, "STAVEINDEX", layer);
203 return db()->getInt(m_PixelStave, "BENTSTAVENMODULE", staveIndex);
204}
205
207{
208 int staveIndex = db()->getInt(m_PixelLayer, "STAVEINDEX", layer);
209 return db()->getDouble(m_PixelStave, "MODULEDZ", staveIndex);
210}
211
212
213// Number of staves/sectors per endcap layer
215{
216 return db()->getInt(m_PixelDisk,"NSECTORS",layer); // FIXME: not yet in DB?
217}
218
220{
221 return db()->getInt( m_PixelRing, "NMODULE", ring);
222}
223
225{
226 int nModulesDisk = 0;
227 for (unsigned int indexTmp = 0; indexTmp < db()->getTableSize(m_PixelDiskRing); ++indexTmp) {
228 int disk = db()->getInt(m_PixelDiskRing,"DISK",indexTmp);
229 if ( disk == layer) {
230 int ring = db()->getInt(m_PixelDiskRing,"RING",indexTmp);
231 nModulesDisk += pixelModulesPerRing( ring);
232 //msg(MSG::INFO) << "Pixel Ring " << ring << " on disk " << disk << " has " << pixelModulesPerRing( ring) << " modules" << endmsg;
233 }
234 }
235 if(pixelEndcapNumSectorsForLayer(layer)==0) return 0;
236 return nModulesDisk / pixelEndcapNumSectorsForLayer(layer);
237}
238
240{
241 int sumChips = 0;
242 int sumModules = 0;
243 for (unsigned int indexTmp = 0; indexTmp < db()->getTableSize(m_PixelDiskRing); ++indexTmp) {
244 int disk = db()->getInt(m_PixelDiskRing,"DISK",indexTmp);
245 if ( disk == layer) {
246 int ring = db()->getInt(m_PixelDiskRing,"RING",indexTmp);
247 int moduleType = db()->getInt(m_PixelRing,"MODULETYPE",ring);
248 int nModules = pixelModulesPerRing( ring);
249 sumModules += nModules;
250 sumChips += nModules * pixelChipsPerModule( moduleType);
251 }
252 }
253 if(sumModules==0) return 0;
254 if (sumChips % sumModules == 0) return sumChips/sumModules;
255 else return 1 + sumChips/sumModules; // round to larger integer
256}
257
258// number of disks
260{
261 return db()->getInt(m_PixelEndcapGeneral,"NDISK");
262}
263
264// disk Z position
266{
267 return db()->getDouble(m_PixelDisk,"ZDISK",disk) * Gaudi::Units::mm;
268}
269
270// disk min radius
272{
273 std::string route = pixelDiskServiceRoute(disk);
274 if(route=="StdRoute")
275 return db()->getDouble(m_PixelDisk,"RMIN",disk) * Gaudi::Units::mm - 11*Gaudi::Units::mm;
276
277 // support structures - SUP1RMIN is always closest to centre
278 return db()->getDouble(m_PixelDisk,"SUP1RMIN",disk) * Gaudi::Units::mm;
279
280}
281
282// disk max radius
284{
285 std::string route = pixelDiskServiceRoute(disk);
286 if(route=="StdRoute")
287 return db()->getDouble(m_PixelDisk,"RMAX",disk) * Gaudi::Units::mm + 11*Gaudi::Units::mm;
288
289 // support structures - SUP3RMAX is always furthest from centre
290 return db()->getDouble(m_PixelDisk,"SUP3RMAX",disk) * Gaudi::Units::mm;
291
292}
293
294// EOS ZOffset
296{
297 if (!db()->testField(m_PixelSvcRoute, "EOSZOFFSET"))
298 return 0.0;
299 else
300 return db()->getDouble(m_PixelSvcRoute,"EOSZOFFSET",disk) * Gaudi::Units::mm;
301}
302
303// return name of support tube where
305{
306 if(db()->testField(m_PixelSvcRoute,"SERVICEROUTE"))
307 return db()->getString(m_PixelSvcRoute,"SERVICEROUTE",disk);
308 return "StdRoute";
309}
310
312{
313 return db()->getDouble(m_PixelEnvelope,"RMAX") * Gaudi::Units::mm;
314}
315
317{
318 return db()->getInt( m_PixelLayer, "MODULETYPE", layer);
319}
320 /*
321 else {
322426 // Not in DB yet.
323427 int ringType = getDiskRingType(currentLD,m_eta);
324428 if (ringType>=0) {
325429 type = db()->getInt(PixelRing,"MODULETYPE",ringType);
326430 }
327431 }
328432
329 */
330
332{
333 return db()->getInt( m_PixelModule, "DESIGNTYPE", moduleType);
334}
335
337{
338 int nChipsEta = db()->getInt( m_PixelReadout, "NCHIPSETA", moduleType);
339 int nChipsPhi = db()->getInt( m_PixelReadout, "NCHIPSPHI", moduleType);
340 return nChipsEta*nChipsPhi;
341}
342
343
344
345// number of layers
347{
348 return db()->getInt(m_SctBrlGeneral,"NUMLAYERS");
349}
350
351// layer radius
353{
354 return db()->getDouble(m_SctBrlLayer,"RADIUS",layer) * Gaudi::Units::mm;
355}
356
357// layer length
359{
360 return db()->getDouble(m_SctBrlLayer,"CYLLENGTH",layer) * Gaudi::Units::mm;
361}
362
363// layer type. Long(0) or Short (1) strips. NEEDS CHECKING
365{
366 int ladType = db()->getInt(m_SctBrlLayer,"LADDERTYPE",layer);
367 return db()->getInt(m_SctBrlLadder,"MODTYPE",ladType);
368}
369
370// Number of staves/sectors per barrel layer
372{
373 return db()->getInt(m_SctBrlLayer,"SKISPERLAYER",layer);
374}
375
377{
378 int ladType = db()->getInt(m_SctBrlLayer,"LADDERTYPE",layer);
379 return db()->getInt(m_SctBrlLadder,"NUMPERLADDER",ladType);
380}
381
382// Number of staves/sectors per endcap layer
384{
385 return 32; // FIXME: hardwired number, should go to text file and DB
386 //return db()->getInt(m_SctFwdWheel,"NSECTORS",layer); // FIXME: not yet in DB or text file
387}
388
389// number of disks
391{
392 return db()->getInt(m_SctFwdGeneral,"NUMWHEELS");
393}
394
395// disk Z position
397{
398 return db()->getDouble(m_SctFwdWheel,"ZPOSITION",disk) * Gaudi::Units::mm;
399}
400
401// disk Z position
403{
404 return db()->getDouble(m_SctFwdDiscSupport,"OUTERRADIUS",disk) * Gaudi::Units::mm;
405}
406
408{
409 return db()->getDouble(m_SctBrlServPerLayer,"SUPPORTCYLINNERRAD",0) * Gaudi::Units::mm;
410}
411
#define endmsg
Definition of the abstract IRDBAccessSvc interface.
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
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.
virtual std::string getString(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const =0
virtual int getInt(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const =0
virtual double getDouble(IRDBRecordset_ptr recordSet, const std::string &name, int index=0) const =0
The following methods will first look in the text file if provided and then look in the database.
virtual unsigned int getTableSize(IRDBRecordset_ptr recordSet) const =0
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
const IGeometryDBSvc * db() 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
MsgStream & msg
Definition testRead.cxx:32