70 GeoIntrusivePtr<GeoFullPhysVol> barrelEnvelope{
nullptr}, endcapEnvelopePos{
nullptr}, endcapEnvelopeNeg{
nullptr};
72 double projectivityDisplacement(0.);
79 ISvcLocator *svcLocator = Gaudi::svcLocator();
81 if (svcLocator->service(
"MessageSvc",
msgSvc,
true )==StatusCode::FAILURE) {
82 throw std::runtime_error(
"Error in LAr::DetectorFactor, cannot access MessageSvc");
85 MsgStream
log(
msgSvc,
"LAr::DetectorFactory");
88 if (StatusCode::SUCCESS !=
m_detStore->
retrieve(materialManager, std::string(
"MATERIALS"))) {
89 throw std::runtime_error(
"Error in LArDetectorFactory, cannot access Material Manager");
94 if(svcLocator->service (
"RDBAccessSvc",rdbAccess) == StatusCode::FAILURE)
95 throw std::runtime_error(
"Error in BarrelCryostatConstruction, cannot access RDBAccessSvc");
98 log <<
MSG::DEBUG <<
"Getting primary numbers for " << larVersionKey.node() <<
", " << larVersionKey.tag() <<
endmsg;
102 if(larPosition->size()==0) {
103 larPosition = rdbAccess->
getRecordsetPtr(
"LArPosition",
"LArPosition-00");
104 if (larPosition->size()==0)
105 throw std::runtime_error(
"Error, no lar position table in database!");
109 projectivityDisplacement = (*emecGeometry)[0]->getDouble(
"ZSHIFT");
119 lArMaterialManager.buildMaterials();
131 barrelEnvelope = barrelCryostatConstruction.GetEnvelope(
m_parameters.get());
135 endcapEnvelopePos = endcapCryostatConstruction.createEnvelope(
true);
136 endcapEnvelopeNeg = endcapCryostatConstruction.createEnvelope(
false);
140 a_container->add(
new GeoNameTag(
"LAr"));
151 if(!barrelRec)
throw std::runtime_error(
"Error, no lar position record in the database");
153 GeoAlignableTransform* barrelAlXf =
new GeoAlignableTransform(xfBarrel);
158 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_B PhysVol");
162 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_B Alignable XF");
165 a_container->add(
new GeoNameTag(
"LArBarrel"));
166 a_container->add(barrelAlXf);
167 a_container->add(barrelEnvelope);
171 if (!posRec)
throw std::runtime_error(
"Error, no lar position record in the database") ;
173 GeoAlignableTransform *xfEndcapPos =
new GeoAlignableTransform(xfPos);
178 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_EC_POS PhysVol");
182 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store LARCRYO_EC_POS");
187 if (!negRec)
throw std::runtime_error(
"Error, no lar position record in the database") ;
189 GeoAlignableTransform *xfEndcapNeg =
new GeoAlignableTransform(xfNeg);
194 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_EC_NEG PhysVol");
198 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store LARCRYO_EC_NEG");
201 a_container->add(
new GeoNameTag(
"LArEndcapPos"));
202 a_container->add(xfEndcapPos);
203 a_container->add(endcapEnvelopePos);
204 a_container->add(
new GeoNameTag(
"LArEndcapNeg"));
205 a_container->add(xfEndcapNeg);
207 a_container->add(endcapEnvelopeNeg);
212 if(!barrelRec)
throw std::runtime_error(
"Error, no lar position record in the database");
214 GeoAlignableTransform* barrelAlXf =
new GeoAlignableTransform(xfBarrel);
219 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_B PhysVol");
223 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_B Alignable XF");
226 a_container->add(
new GeoNameTag(
"LArBarrel"));
227 a_container->add(barrelAlXf);
228 a_container->add(barrelEnvelope);
234 if (!posRec)
throw std::runtime_error(
"Error, no lar position record in the database") ;
236 GeoAlignableTransform *xfEndcapPos =
new GeoAlignableTransform(xfPos);
241 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_EC_POS PhysVol");
245 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store LARCRYO_EC_POS");
250 if (!negRec)
throw std::runtime_error(
"Error, no lar position record in the database") ;
252 GeoAlignableTransform *xfEndcapNeg =
new GeoAlignableTransform(xfNeg);
257 if(!
status.isSuccess())
throw std::runtime_error(
"Cannot store LARCRYO_EC_NEG PhysVol");
261 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store LARCRYO_EC_NEG");
264 a_container->add(
new GeoNameTag(
"LArEndcapPos"));
265 a_container->add(xfEndcapPos);
266 a_container->add(endcapEnvelopePos);
267 a_container->add(
new GeoNameTag(
"LArEndcapNeg"));
268 a_container->add(xfEndcapNeg);
270 a_container->add(endcapEnvelopeNeg);
275 TBBarrelCryostatConstruction tbbarrelCryostatConstruction;
279 barrelEnvelope = tbbarrelCryostatConstruction.GetEnvelope(
m_parameters.get());
281 a_container->add(
new GeoNameTag(
"LAr"));
282 a_container->add(barrelEnvelope);
291 , projectivityDisplacement);
298 if(!embDetectorManager
299 || !emecDetectorManager
300 || !hecDetectorManager
301 || !fcalDetectorManager) {
302 std::string errorMessage=
"Failed to build LAr Readout Geometry description";
303 throw std::runtime_error(errorMessage);