ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_DetectorFactoryLite.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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
43#include "SCT_Barrel.h"
44#include "SCT_DataBase.h"
45#include "SCT_Forward.h"
48#include "SCT_Identifier.h"
49#include "SCT_MaterialManager.h"
50
52
54
55#include "GaudiKernel/ISvcLocator.h"
56#include "GaudiKernel/SystemOfUnits.h"
57
58#include <iomanip>
59#include <iostream>
60#include <string>
61
64
65SCT_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,
110 versionMajorNumber,
111 versionMinorNumber,
112 versionPatchNumber);
113 m_detectorManager->setVersion(version);
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
146 m_detectorManager->numerology().addBarrel(0);
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
171 m_detectorManager->numerology().addEndcap(2);
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
197 m_detectorManager->numerology().addEndcap(-2);
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
216 m_detectorManager->initNeighbours();
217
218 // Set maximum number of strips in numerology.
219 for (int iDesign = 0; iDesign < m_detectorManager->numDesigns(); iDesign++) {
220 m_detectorManager->numerology().setMaxNumPhiCells(m_detectorManager->getSCT_Design(iDesign)->cells());
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
230 m_detectorManager->addAlignFolderType(InDetDD::static_run1);
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
313
314
#define endmsg
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
Definition of the abstract IRDBAccessSvc interface.
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
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.
IRDBRecord is one record in the IRDBRecordset object.
Definition IRDBRecord.h:27
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
DetectorFactoryBase(InDetDD::AthenaComps *athenaComps)
Dedicated detector manager extending the functionality of the SiDetectorManager with dedicated SCT in...
Helper class to concentrate common items, such as the pointer to the IdHelper, the lorentzAngle tool ...
Class to hold version information consisting of tag, name layout and description as strings,...
Definition Version.h:24
virtual GeoVPhysVol * build(SCT_Identifier id)
std::unique_ptr< SCT_GeometryManager > m_geometryManager
virtual void create(GeoPhysVol *world) override
SCT_DetectorFactoryLite(GeoModelIO::ReadGeoModel *sqliteReader, SCT_GeoModelAthenaComps *athenaComps, const SCT_Options &options)
std::map< std::string, GeoAlignableTransform * > AXFMap
InDetDD::SCT_DetectorManager * m_detectorManager
std::shared_ptr< AXFMap > m_mapAXF
std::unique_ptr< SCT_DataBase > m_db
std::shared_ptr< FPVMap > m_mapFPV
virtual const InDetDD::SCT_DetectorManager * getDetectorManager() const override
GeoModelIO::ReadGeoModel * m_sqliteReader
std::map< std::string, GeoFullPhysVol * > FPVMap
virtual GeoVPhysVol * build(SCT_Identifier id)
bool partPresent(const std::string &partName) const
Class to hold various Athena components.
const SCT_ID * getIdHelper() const
void setBarrelEC(int i)
Identifier getWaferId()
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:91
Message Stream Member.
@ timedependent_run2
MsgStream & msg
Definition testRead.cxx:32