ATLAS Offline Software
SCT_DetectorFactoryLite.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
9 
10 //
11 // GeoModel include files:
12 //
15 
16 #include "GeoModelRead/ReadGeoModel.h"
17 #include "GeoModelKernel/GeoVolumeCursor.h"
18 #include "GeoModelKernel/GeoAlignableTransform.h"
19 #include "GeoModelKernel/GeoDefinitions.h"
20 #include "GeoModelKernel/GeoIdentifierTag.h"
21 #include "GeoModelKernel/GeoLogVol.h"
22 #include "GeoModelKernel/GeoMaterial.h"
23 #include "GeoModelKernel/GeoNameTag.h"
24 #include "GeoModelKernel/GeoPhysVol.h"
25 #include "GeoModelKernel/GeoShape.h"
26 #include "GeoModelKernel/GeoShapeShift.h"
27 #include "GeoModelKernel/GeoShapeUnion.h"
28 #include "GeoModelKernel/GeoTransform.h"
29 #include "GeoModelKernel/GeoTube.h"
30 #include "GeoModelKernel/GeoVPhysVol.h"
31 
34 
38 
42 
50 
52 
53 #include "StoreGate/StoreGateSvc.h"
54 
55 #include "GaudiKernel/ISvcLocator.h"
56 #include "GaudiKernel/SystemOfUnits.h"
57 
58 #include <iomanip>
59 #include <iostream>
60 #include <string>
61 
64 
65 SCT_DetectorFactoryLite::SCT_DetectorFactoryLite(GeoModelIO::ReadGeoModel *sqliteReader,
66  SCT_GeoModelAthenaComps * athenaComps,
67  const SCT_Options & options)
68  : InDetDD::DetectorFactoryBase(athenaComps),
69  m_sqliteReader (sqliteReader)
70 {
71  // Create the detector manager
73  // Create the database
74  m_db = std::make_unique<SCT_DataBase>(athenaComps);
75 
76  // Create the Si common items
77  std::unique_ptr<InDetDD::SiCommonItems> commonItems{std::make_unique<InDetDD::SiCommonItems>(athenaComps->getIdHelper())};
78 
79  // Create the geometry manager.
80  m_geometryManager = std::make_unique<SCT_GeometryManager>(m_db.get());
81  m_geometryManager->setOptions(options);
82  m_geometryManager->setCommonItems(commonItems.get());
83 
84  // Add SiCommonItems to SCT_DetectorManager to hold and delete it.
85  m_detectorManager->setCommonItems(std::move(commonItems));
86 
87  m_useDynamicAlignFolders = options.dynamicAlignFolders();
88  // Set Version information
89  // Get the geometry tag
90  IRDBRecordset_ptr switchSet
91  = rdbAccessSvc()->getRecordsetPtr("SctSwitches", "");
92  const IRDBRecord *switches = (*switchSet)[0];
93 
94  std::string layout = "Final";
95  std::string description;
96  if (!switches->isFieldNull("LAYOUT")) {
97  layout = switches->getString("LAYOUT");
98  }
99  if (!switches->isFieldNull("DESCRIPTION")) {
100  description = switches->getString("DESCRIPTION");
101  }
102  std::string versionName = switches->getString("VERSIONNAME");
103  int versionMajorNumber = 3;
104  int versionMinorNumber = 6;
105  int versionPatchNumber = 0;
106  InDetDD::Version version("", // Redundant when GeoModel is read from SQLite
107  versionName,
108  layout,
109  description,
110  versionMajorNumber,
111  versionMinorNumber,
112  versionPatchNumber);
114 
115  m_mapFPV = std::shared_ptr<FPVMap>(new FPVMap(m_sqliteReader->getPublishedNodes<std::string, GeoFullPhysVol*>("SCT")));
116  m_mapAXF = std::shared_ptr<AXFMap>(new AXFMap(m_sqliteReader->getPublishedNodes<std::string, GeoAlignableTransform*>("SCT")));
117 }
118 
120 {
121 
122  msg(MSG::INFO) << "Building SCT Detector." << endmsg;
123  msg(MSG::INFO) << " " << m_detectorManager->getVersion().fullDescription() << endmsg;
124 
125  // Change precision.
126  int oldPrecision = std::cout.precision(6);
127 
128  // The tree tops get added to world.
129  const SCT_GeneralParameters * sctGeneral = m_geometryManager->generalParameters();
130 
131  std::string barrelLabel = "Barrel";
132  std::string forwardPlusLabel = "EndcapA";
133  std::string forwardMinusLabel = "EndcapC";
134 
135  bool barrelPresent = sctGeneral->partPresent(barrelLabel);
136  bool forwardPlusPresent = sctGeneral->partPresent(forwardPlusLabel);
137  bool forwardMinusPresent = sctGeneral->partPresent(forwardMinusLabel);
138 
139  //
140  // The Barrel
141  //
142  if (barrelPresent) {
143 
144  msg(MSG::DEBUG) << "Building the SCT Barrel." << endmsg;
145 
147 
148  // Create the SCT Barrel
149  SCT_Barrel sctBarrel("SCT_Barrel", m_detectorManager, m_geometryManager.get(), nullptr, m_sqliteReader, m_mapFPV, m_mapAXF);
150 
151  SCT_Identifier id{m_geometryManager->athenaComps()->getIdHelper()};
152  id.setBarrelEC(0);
153  //GeoVPhysVol * barrelPV =
154  sctBarrel.build(id);
155  GeoFullPhysVol *barrelPV = (*m_mapFPV)["SCT_Barrel"];
156  GeoAlignableTransform * barrelTransform = (*m_mapAXF)["SCT_Barrel"];
157  m_detectorManager->addTreeTop(barrelPV);
158 
159  // Store alignable transform
160  m_detectorManager->addAlignableTransform(3, id.getWaferId(), barrelTransform, barrelPV);
161 
162  }
163 
164  //
165  // The Positive Z Endcap (EndcapA)
166  //
167  if (forwardPlusPresent) {
168 
169  msg(MSG::DEBUG) << "Building the SCT Endcap A (positive z)." << endmsg;
170 
172 
173  // Create the Forward
174  SCT_Forward sctForwardPlus("SCT_ForwardA", +2, m_detectorManager, m_geometryManager.get(), nullptr, m_sqliteReader, m_mapFPV, m_mapAXF);
175  SCT_Identifier idFwdPlus{m_geometryManager->athenaComps()->getIdHelper()};
176  idFwdPlus.setBarrelEC(2);
177  //GeoVPhysVol * forwardPlusPV =
178  sctForwardPlus.build(idFwdPlus);
179 
180  GeoFullPhysVol *forwardPlusPV = (*m_mapFPV)["SCT_ForwardPlus"];
181  GeoAlignableTransform * fwdGeoTransformPlus = (*m_mapAXF)["SCT_ForwardPlus"];
182 
183  m_detectorManager->addTreeTop(forwardPlusPV);
184 
185  // Store alignable transform
186  m_detectorManager->addAlignableTransform(3, idFwdPlus.getWaferId(), fwdGeoTransformPlus, forwardPlusPV);
187  }
188 
189  //
190  // The Negative Z Endcap (EndcapC)
191  //
192 
193  if (forwardMinusPresent) {
194 
195  msg(MSG::DEBUG) << "Building the SCT Endcap C (negative z)." << endmsg;
196 
198 
199  SCT_Forward sctForwardMinus("SCT_ForwardC", -2, m_detectorManager, m_geometryManager.get(), nullptr, m_sqliteReader, m_mapFPV, m_mapAXF);
200 
201  SCT_Identifier idFwdMinus{m_geometryManager->athenaComps()->getIdHelper()};
202  idFwdMinus.setBarrelEC(-2);
203  //GeoVPhysVol * forwardMinusPV =
204  sctForwardMinus.build(idFwdMinus);
205 
206  GeoFullPhysVol *forwardMinusPV = (*m_mapFPV)["SCT_ForwardMinus"];
207  GeoAlignableTransform * fwdGeoTransformMinus = (*m_mapAXF)["SCT_ForwardMinus"];
208  m_detectorManager->addTreeTop(forwardMinusPV);
209 
210 
211  // Store alignable transform
212  m_detectorManager->addAlignableTransform(3, idFwdMinus.getWaferId(), fwdGeoTransformMinus, forwardMinusPV);
213  }
214 
215  // Set the neighbours
217 
218  // Set maximum number of strips in numerology.
219  for (int iDesign = 0; iDesign < m_detectorManager->numDesigns(); iDesign++) {
221  }
222 
223  // Register the keys and the level corresponding to the key
224  // and whether it expects a global or local shift.
225  // level 0: sensor, level 1: module, level 2, layer/disc, level 3: whole barrel/enccap
226 
227 
229 
231  m_detectorManager->addFolder("/Indet/Align");
232  m_detectorManager->addChannel("/Indet/Align/ID",3,InDetDD::global);
233  m_detectorManager->addChannel("/Indet/Align/SCT",2,InDetDD::global);
234 
235  if (barrelPresent) {
236  m_detectorManager->addChannel("/Indet/Align/SCTB1",1,InDetDD::local);
237  m_detectorManager->addChannel("/Indet/Align/SCTB2",1,InDetDD::local);
238  m_detectorManager->addChannel("/Indet/Align/SCTB3",1,InDetDD::local);
239  m_detectorManager->addChannel("/Indet/Align/SCTB4",1,InDetDD::local);
240  }
241  if (forwardPlusPresent) {
242  m_detectorManager->addChannel("/Indet/Align/SCTEA1",1,InDetDD::local);
243  m_detectorManager->addChannel("/Indet/Align/SCTEA2",1,InDetDD::local);
244  m_detectorManager->addChannel("/Indet/Align/SCTEA3",1,InDetDD::local);
245  m_detectorManager->addChannel("/Indet/Align/SCTEA4",1,InDetDD::local);
246  m_detectorManager->addChannel("/Indet/Align/SCTEA5",1,InDetDD::local);
247  m_detectorManager->addChannel("/Indet/Align/SCTEA6",1,InDetDD::local);
248  m_detectorManager->addChannel("/Indet/Align/SCTEA7",1,InDetDD::local);
249  m_detectorManager->addChannel("/Indet/Align/SCTEA8",1,InDetDD::local);
250  m_detectorManager->addChannel("/Indet/Align/SCTEA9",1,InDetDD::local);
251  }
252  if (forwardMinusPresent) {
253  m_detectorManager->addChannel("/Indet/Align/SCTEC1",1,InDetDD::local);
254  m_detectorManager->addChannel("/Indet/Align/SCTEC2",1,InDetDD::local);
255  m_detectorManager->addChannel("/Indet/Align/SCTEC3",1,InDetDD::local);
256  m_detectorManager->addChannel("/Indet/Align/SCTEC4",1,InDetDD::local);
257  m_detectorManager->addChannel("/Indet/Align/SCTEC5",1,InDetDD::local);
258  m_detectorManager->addChannel("/Indet/Align/SCTEC6",1,InDetDD::local);
259  m_detectorManager->addChannel("/Indet/Align/SCTEC7",1,InDetDD::local);
260  m_detectorManager->addChannel("/Indet/Align/SCTEC8",1,InDetDD::local);
261  m_detectorManager->addChannel("/Indet/Align/SCTEC9",1,InDetDD::local);
262  }
263  }
264 
265  else {
267  m_detectorManager->addGlobalFolder("/Indet/AlignL1/ID");
268  m_detectorManager->addGlobalFolder("/Indet/AlignL2/SCT");
269  m_detectorManager->addChannel("/Indet/AlignL1/ID",3,InDetDD::global);
270  m_detectorManager->addChannel("/Indet/AlignL2/SCT",2,InDetDD::global);
271  m_detectorManager->addFolder("/Indet/AlignL3");
272 
273  if (barrelPresent) {
274  m_detectorManager->addChannel("/Indet/AlignL3/SCTB1",1,InDetDD::local);
275  m_detectorManager->addChannel("/Indet/AlignL3/SCTB2",1,InDetDD::local);
276  m_detectorManager->addChannel("/Indet/AlignL3/SCTB3",1,InDetDD::local);
277  m_detectorManager->addChannel("/Indet/AlignL3/SCTB4",1,InDetDD::local);
278  }
279  if (forwardPlusPresent) {
280  m_detectorManager->addChannel("/Indet/AlignL3/SCTEA1",1,InDetDD::local);
281  m_detectorManager->addChannel("/Indet/AlignL3/SCTEA2",1,InDetDD::local);
282  m_detectorManager->addChannel("/Indet/AlignL3/SCTEA3",1,InDetDD::local);
283  m_detectorManager->addChannel("/Indet/AlignL3/SCTEA4",1,InDetDD::local);
284  m_detectorManager->addChannel("/Indet/AlignL3/SCTEA5",1,InDetDD::local);
285  m_detectorManager->addChannel("/Indet/AlignL3/SCTEA6",1,InDetDD::local);
286  m_detectorManager->addChannel("/Indet/AlignL3/SCTEA7",1,InDetDD::local);
287  m_detectorManager->addChannel("/Indet/AlignL3/SCTEA8",1,InDetDD::local);
288  m_detectorManager->addChannel("/Indet/AlignL3/SCTEA9",1,InDetDD::local);
289  }
290  if (forwardMinusPresent) {
291  m_detectorManager->addChannel("/Indet/AlignL3/SCTEC1",1,InDetDD::local);
292  m_detectorManager->addChannel("/Indet/AlignL3/SCTEC2",1,InDetDD::local);
293  m_detectorManager->addChannel("/Indet/AlignL3/SCTEC3",1,InDetDD::local);
294  m_detectorManager->addChannel("/Indet/AlignL3/SCTEC4",1,InDetDD::local);
295  m_detectorManager->addChannel("/Indet/AlignL3/SCTEC5",1,InDetDD::local);
296  m_detectorManager->addChannel("/Indet/AlignL3/SCTEC6",1,InDetDD::local);
297  m_detectorManager->addChannel("/Indet/AlignL3/SCTEC7",1,InDetDD::local);
298  m_detectorManager->addChannel("/Indet/AlignL3/SCTEC8",1,InDetDD::local);
299  m_detectorManager->addChannel("/Indet/AlignL3/SCTEC9",1,InDetDD::local);
300  }
301  }
302 
303  // Return precision to its original value
304  std::cout.precision(oldPrecision);
305 
306 }
307 
308 
310 {
311  return m_detectorManager;
312 }
313 
314 
SCT_Barrel.h
SCT_DetectorFactoryLite::m_useDynamicAlignFolders
bool m_useDynamicAlignFolders
Definition: SCT_DetectorFactoryLite.h:60
SCT_GeneralParameters::partPresent
bool partPresent(const std::string &partName) const
Definition: SCT_GeneralParameters.cxx:37
SCT_Identifier
Definition: SCT_Identifier.h:12
InDetDD::SiDetectorManager::numerology
const SiNumerology & numerology() const
Access Numerology.
Definition: SiDetectorManager.h:126
InDetDD::SCT_DetectorManager
Definition: SCT_DetectorManager.h:49
SCT_Identifier.h
SCT_DetectorFactoryLite::m_mapFPV
std::shared_ptr< FPVMap > m_mapFPV
Definition: SCT_DetectorFactoryLite.h:65
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
IRDBAccessSvc::getRecordsetPtr
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.
SCT_GeoModelAthenaComps.h
InDetDD::timedependent_run2
@ timedependent_run2
Definition: InDetDD_Defs.h:19
SCT_ModuleSideDesign.h
SCT_MaterialManager.h
SCT_DataBase.h
InDetDD::SiDetectorManager::numDesigns
int numDesigns() const
Definition: SiDetectorManager.cxx:140
IRDBRecord::getString
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
InDetDD::SiNumerology::addEndcap
void addEndcap(int id)
Definition: SiNumerology.cxx:102
StoredAlignX.h
InDetDD::InDetDetectorManager::setVersion
void setVersion(const Version &version)
Definition: InDetDetectorManager.cxx:43
InDetDD::Version
Definition: Version.h:24
SCT_DetectorFactoryLite::FPVMap
std::map< std::string, GeoFullPhysVol * > FPVMap
Definition: SCT_DetectorFactoryLite.h:62
InDetDD::static_run1
@ static_run1
Definition: InDetDD_Defs.h:19
InDetDD::global
@ global
Definition: InDetDD_Defs.h:16
InDetDD::DetectorFactoryBase::msg
MsgStream & msg(MSG::Level lvl) const
Definition: InDetDetectorFactoryBase.h:37
InDetDD::SCT_ModuleSideDesign::cells
int cells() const
number of readout stips within module side:
Definition: SCT_ModuleSideDesign.h:228
InDetDD::InDetDetectorManager::addAlignFolderType
void addAlignFolderType(const AlignFolderType alignfolder)
Definition: InDetDetectorManager.cxx:81
SCT_DetectorFactoryLite::m_mapAXF
std::shared_ptr< AXFMap > m_mapAXF
Definition: SCT_DetectorFactoryLite.h:66
SCT_Forward.h
InDetDD::SiDetectorManager::setCommonItems
void setCommonItems(std::unique_ptr< const SiCommonItems > &&commonItems)
Set SiCommonItems.
Definition: SiDetectorManager.cxx:151
SCT_Options
Definition: SCT_Options.h:12
SCT_GeneralParameters.h
SCT_DetectorFactoryLite::m_detectorManager
InDetDD::SCT_DetectorManager * m_detectorManager
Definition: SCT_DetectorFactoryLite.h:57
Version.h
InDetDD_Defs.h
SCT_Barrel::build
virtual GeoVPhysVol * build(SCT_Identifier id)
Definition: SCT_Barrel.cxx:96
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
InDetDD::DetectorFactoryBase::detStore
StoreGateSvc * detStore()
Definition: InDetDetectorFactoryBase.h:27
SCT_Barrel
Definition: SCT_Barrel.h:17
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
SiCommonItems.h
AlignableTransformContainer.h
InDetDD::InDetDetectorManager::addFolder
void addFolder(const std::string &key)
Definition: InDetDetectorManager.cxx:66
InDetDD::SiNumerology::setMaxNumPhiCells
void setMaxNumPhiCells(int cells)
Definition: SiNumerology.cxx:86
SCT_DetectorFactoryLite.h
InDetDD::SCT_DetectorManager::addTreeTop
void addTreeTop(const PVConstLink &vol)
Add tree top.
Definition: SCT_DetectorManager.cxx:60
InDetDD::InDetDetectorManager::getVersion
const Version & getVersion() const
Get version information.
Definition: InDetDetectorManager.cxx:33
InDetDD::InDetDetectorManager::addGlobalFolder
void addGlobalFolder(const std::string &key)
Definition: InDetDetectorManager.cxx:76
python.AtlRunQueryLib.options
options
Definition: AtlRunQueryLib.py:379
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
SCT_GeneralParameters
Definition: SCT_GeneralParameters.h:16
InDetDD::local
@ local
Definition: InDetDD_Defs.h:16
InDetDD::SCT_DetectorManager::getSCT_Design
const SCT_ModuleSideDesign * getSCT_Design(int i) const
Access to module design, casts to SCT_ModuleSideDesign.
Definition: SCT_DetectorManager.cxx:300
SCT_DetectorFactoryLite::getDetectorManager
virtual const InDetDD::SCT_DetectorManager * getDetectorManager() const override
Definition: SCT_DetectorFactoryLite.cxx:309
InDetDD::SiCommonItems
Definition: SiCommonItems.h:45
StoredMaterialManager.h
SCT_DetectorFactoryLite::m_sqliteReader
GeoModelIO::ReadGeoModel * m_sqliteReader
Definition: SCT_DetectorFactoryLite.h:56
get_generator_info.version
version
Definition: get_generator_info.py:33
SCT_DetectorFactoryLite::create
virtual void create(GeoPhysVol *world) override
Definition: SCT_DetectorFactoryLite.cxx:119
SCT_GeoModelAthenaComps
Class to hold various Athena components.
Definition: SCT_GeoModelAthenaComps.h:14
SCT_GeoModelAthenaComps::getIdHelper
const SCT_ID * getIdHelper() const
Definition: SCT_GeoModelAthenaComps.cxx:19
SCT_DetectorFactoryLite::AXFMap
std::map< std::string, GeoAlignableTransform * > AXFMap
Definition: SCT_DetectorFactoryLite.h:63
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
InDetDD::Version::fullDescription
std::string fullDescription() const
Full Description For example, Version: SCT-DC1-00, Name: DC1, Layout: Final, Code Version: 2....
Definition: Version.cxx:90
SCT_Forward
Definition: SCT_Forward.h:18
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
IRDBRecord::isFieldNull
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
SCT_DetectorFactoryLite::SCT_DetectorFactoryLite
SCT_DetectorFactoryLite(GeoModelIO::ReadGeoModel *sqliteReader, SCT_GeoModelAthenaComps *athenaComps, const SCT_Options &options)
Definition: SCT_DetectorFactoryLite.cxx:65
InDetDD::DetectorFactoryBase::rdbAccessSvc
IRDBAccessSvc * rdbAccessSvc()
Definition: InDetDetectorFactoryBase.h:32
InDetDD::SCT_DetectorManager::addAlignableTransform
virtual void addAlignableTransform(int level, const Identifier &id, GeoAlignableTransform *xf, const GeoVFullPhysVol *child)
Add alignable transforms. No access to these, they will be changed by manager:
Definition: SCT_DetectorManager.cxx:264
DEBUG
#define DEBUG
Definition: page_access.h:11
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
InDetDD::InDetDetectorManager::addChannel
void addChannel(const std::string &key, int level, FrameType frame)
Alignment access.
Definition: InDetDetectorManager.cxx:56
StoreGateSvc.h
SCT_Forward::build
virtual GeoVPhysVol * build(SCT_Identifier id)
Definition: SCT_Forward.cxx:132
SCT_DetectorFactoryLite::m_db
std::unique_ptr< SCT_DataBase > m_db
Definition: SCT_DetectorFactoryLite.h:59
IGeoDbTagSvc.h
SCT_DetectorFactoryLite::m_geometryManager
std::unique_ptr< SCT_GeometryManager > m_geometryManager
Definition: SCT_DetectorFactoryLite.h:58
InDetDD::SiNumerology::addBarrel
void addBarrel(int id)
Definition: SiNumerology.cxx:97
StoredPhysVol.h
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88
InDetDD::SCT_DetectorManager::initNeighbours
virtual void initNeighbours() override
Initialize the neighbours. This can only be done when all elements are built.
Definition: SCT_DetectorManager.cxx:112