68{
69
70 GeoIntrusivePtr<GeoFullPhysVol> barrelEnvelope{nullptr}, endcapEnvelopePos{nullptr}, endcapEnvelopeNeg{nullptr};
71
72 double projectivityDisplacement(0.);
73
76
77
78 StoredMaterialManager* materialManager = nullptr;
79 if (StatusCode::SUCCESS !=
m_detStore->retrieve(materialManager, std::string(
"MATERIALS"))) {
80 throw std::runtime_error("Error in LArDetectorFactory, cannot access Material Manager");
81 }
82
83 SmartIF<IRDBAccessSvc> rdbAccess{Gaudi::svcLocator()->service("RDBAccessSvc")};
84
85 if(!rdbAccess.isValid())
86 throw std::runtime_error("Error in BarrelCryostatConstruction, cannot access RDBAccessSvc");
87
88 DecodeVersionKey larVersionKey("LAr");
89 ATH_MSG_DEBUG(
"Getting primary numbers for " << larVersionKey.node() <<
", " << larVersionKey.tag());
90
91 IRDBRecordset_ptr larPosition = rdbAccess->getRecordsetPtr(
"LArPosition",larVersionKey.tag(),larVersionKey.node());
92
93 if(larPosition->
size()==0) {
94 larPosition = rdbAccess->getRecordsetPtr("LArPosition", "LArPosition-00");
95 if (larPosition->
size()==0)
96 throw std::runtime_error("Error, no lar position table in database!");
97 }
98
99 IRDBRecordset_ptr emecGeometry = rdbAccess->getRecordsetPtr(
"EmecGeometry",larVersionKey.tag(),larVersionKey.node());
100 projectivityDisplacement = (*emecGeometry)[0]->getDouble("ZSHIFT");
101
102
103
104
105
106
107
108
109 LArMaterialManager lArMaterialManager(
m_detStore);
110 lArMaterialManager.buildMaterials();
111
113
117
120
122 barrelEnvelope = barrelCryostatConstruction.GetEnvelope(
m_parameters.get());
123 }
124
126 endcapEnvelopePos = endcapCryostatConstruction.createEnvelope(true);
127 endcapEnvelopeNeg = endcapCryostatConstruction.createEnvelope(false);
128 }
129
130
131 a_container->add(new GeoNameTag("LAr"));
132
134
135
136
137
138
139
140
142 if(!barrelRec) throw std::runtime_error("Error, no lar position record in the database");
144 GeoAlignableTransform* barrelAlXf = new GeoAlignableTransform(xfBarrel);
145
146 {
147 StoredPhysVol *sPhysVol = new StoredPhysVol(barrelEnvelope);
149 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_B PhysVol");
150
151 StoredAlignX *sAlignX = new StoredAlignX(barrelAlXf);
153 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_B Alignable XF");
154 }
155
156 a_container->add(new GeoNameTag("LArBarrel"));
157 a_container->add(barrelAlXf);
158 a_container->add(barrelEnvelope);
159
160
162 if (!posRec) throw std::runtime_error("Error, no lar position record in the database") ;
164 GeoAlignableTransform *xfEndcapPos = new GeoAlignableTransform(xfPos);
165
166 {
167 StoredPhysVol *sPhysVol = new StoredPhysVol(endcapEnvelopePos);
169 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_EC_POS PhysVol");
170
171 StoredAlignX *sAlignX = new StoredAlignX(xfEndcapPos);
173 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store LARCRYO_EC_POS");
174 }
175
176
178 if (!negRec) throw std::runtime_error("Error, no lar position record in the database") ;
180 GeoAlignableTransform *xfEndcapNeg = new GeoAlignableTransform(xfNeg);
181
182 {
183 StoredPhysVol *sPhysVol = new StoredPhysVol(endcapEnvelopeNeg);
185 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_EC_NEG PhysVol");
186
187 StoredAlignX *sAlignX = new StoredAlignX(xfEndcapNeg);
189 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store LARCRYO_EC_NEG");
190 }
191
192 a_container->add( new GeoNameTag("LArEndcapPos"));
193 a_container->add(xfEndcapPos);
194 a_container->add(endcapEnvelopePos);
195 a_container->add( new GeoNameTag("LArEndcapNeg"));
196 a_container->add(xfEndcapNeg);
197 a_container->add( new GeoTransform(GeoTrf::RotateY3D(180.0*Gaudi::Units::deg)));
198 a_container->add(endcapEnvelopeNeg);
199 }
201
203 if(!barrelRec) throw std::runtime_error("Error, no lar position record in the database");
205 GeoAlignableTransform* barrelAlXf = new GeoAlignableTransform(xfBarrel);
206
207 {
208 StoredPhysVol *sPhysVol = new StoredPhysVol(barrelEnvelope);
210 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_B PhysVol");
211
212 StoredAlignX *sAlignX = new StoredAlignX(barrelAlXf);
214 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_B Alignable XF");
215 }
216
217 a_container->add(new GeoNameTag("LArBarrel"));
218 a_container->add(barrelAlXf);
219 a_container->add(barrelEnvelope);
220
221 }
223
225 if (!posRec) throw std::runtime_error("Error, no lar position record in the database") ;
227 GeoAlignableTransform *xfEndcapPos = new GeoAlignableTransform(xfPos);
228
229 {
230 StoredPhysVol *sPhysVol = new StoredPhysVol(endcapEnvelopePos);
232 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_EC_POS PhysVol");
233
234 StoredAlignX *sAlignX = new StoredAlignX(xfEndcapPos);
236 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store LARCRYO_EC_POS");
237 }
238
239
241 if (!negRec) throw std::runtime_error("Error, no lar position record in the database") ;
243 GeoAlignableTransform *xfEndcapNeg = new GeoAlignableTransform(xfNeg);
244
245 {
246 StoredPhysVol *sPhysVol = new StoredPhysVol(endcapEnvelopeNeg);
248 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_EC_NEG PhysVol");
249
250 StoredAlignX *sAlignX = new StoredAlignX(xfEndcapNeg);
252 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store LARCRYO_EC_NEG");
253 }
254
255 a_container->add( new GeoNameTag("LArEndcapPos"));
256 a_container->add(xfEndcapPos);
257 a_container->add(endcapEnvelopePos);
258 a_container->add( new GeoNameTag("LArEndcapNeg"));
259 a_container->add(xfEndcapNeg);
260 a_container->add( new GeoTransform(GeoTrf::RotateY3D(180.0*Gaudi::Units::deg)));
261 a_container->add(endcapEnvelopeNeg);
262
263 }
264 }
265 else {
266 TBBarrelCryostatConstruction tbbarrelCryostatConstruction;
269
270 barrelEnvelope = tbbarrelCryostatConstruction.GetEnvelope(
m_parameters.get());
271
272 a_container->add(new GeoNameTag("LAr"));
273 a_container->add(barrelEnvelope);
274
275 }
276 }
277
282 , projectivityDisplacement);
283
284 EMBDetectorManager* embDetectorManager{std::get<0>(subDetManagers)};
285 EMECDetectorManager* emecDetectorManager{std::get<1>(subDetManagers)};
286 HECDetectorManager* hecDetectorManager{std::get<2>(subDetManagers)};
287 FCALDetectorManager* fcalDetectorManager{std::get<3>(subDetManagers)};
288
289 if(!embDetectorManager
290 || !emecDetectorManager
291 || !hecDetectorManager
292 || !fcalDetectorManager) {
293 std::string errorMessage="Failed to build LAr Readout Geometry description";
294 throw std::runtime_error(errorMessage);
295 }
296
297 m_detectorManager =
new LArDetectorManager(embDetectorManager,emecDetectorManager,hecDetectorManager,fcalDetectorManager);
302}
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
std::tuple< EMBDetectorManager *, EMECDetectorManager *, HECDetectorManager *, FCALDetectorManager * > buildLArReadoutGeometry(StoreGateSvc *detStore, const LArHVManager *hvManager, IMessageSvc *msgSvc, int testbeam, double projectivityDisplacement)
static const IRDBRecord * getTransformRecord(IRDBRecordset_ptr positionRecSet, const std::string &key)
static GeoTrf::Transform3D getTransform(const IRDBRecord *currentRec)
virtual unsigned int size() const =0
std::unique_ptr< VDetectorParameters > m_parameters
std::string m_EMECVariantInner
std::string m_EMECVariantOuter
IMessageSvc * getMessageSvc(bool quiet=false)
::StatusCode StatusCode
StatusCode definition for legacy code.