162 log << MSG::DEBUG <<
"createEnvelope() started" <<
endmsg;
164 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
165 if(!detStore.isValid()) {
166 throw std::runtime_error(
"Error in LArDetectorConstructionTBEC, cannot access DetectorStore");
172 if (StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string(
"MATERIALS")))
return nullptr;
174 const GeoMaterial *Air = materialManager->
getMaterial(
"std::Air");
175 if (!Air)
throw std::runtime_error(
"Error in LArDetectorConstructionTBEC, std::Air is not found.");
177 const GeoMaterial *Lead = materialManager->
getMaterial(
"std::Lead");
178 if (!Lead)
throw std::runtime_error(
"Error in LArDetectorConstructionTBEC, std::Lead is not found.");
191 std::string baseName =
"LAr::TBEC";
202 std::string tbecMotherName = baseName +
"::MotherVolume";
203 GeoBox* tbecMotherShape =
new GeoBox( 5.*Gaudi::Units::m, 5.*Gaudi::Units::m, 15.*Gaudi::Units::m );
204 const GeoLogVol* tbecMotherLogical =
new GeoLogVol( tbecMotherName, tbecMotherShape, Air );
205 GeoIntrusivePtr<GeoFullPhysVol> tbecMotherPhysical =
new GeoFullPhysVol( tbecMotherLogical );
207 double xcent = -120.*Gaudi::Units::cm, zcent = 395.7*Gaudi::Units::cm;
208 double zfface = zcent - 60.09*Gaudi::Units::cm;
209 log << MSG::DEBUG <<
"eta = " <<
m_eta_pos;
212 log <<
", positioning cryostat with angle " <<
m_eta_pos*(1./Gaudi::Units::deg) <<
" Gaudi::Units::deg";
219 double axisZHalfLength = 5*Gaudi::Units::m;
221 GeoTube* axisShape =
new GeoTube( 0.*Gaudi::Units::cm, 1.*Gaudi::Units::cm, axisZHalfLength );
224 std::string XAxisName = baseName +
"::XAxis";
225 const GeoLogVol* XAxisLogical =
new GeoLogVol( XAxisName, axisShape, Air );
226 GeoIntrusivePtr<GeoPhysVol> XAxisPhysVol =
new GeoPhysVol( XAxisLogical );
228 tbecMotherPhysical->add(
new GeoIdentifierTag( 1 ) );
229 tbecMotherPhysical->add(
new GeoTransform( GeoTrf::Transform3D( GeoTrf::Translation3D( axisZHalfLength, 0.*Gaudi::Units::m, 0.*Gaudi::Units::m ) *GeoTrf::RotateY3D( 90.*Gaudi::Units::deg )) ) );
230 tbecMotherPhysical->add( XAxisPhysVol );
233 std::string YAxisName = baseName +
"::YAxis";
234 const GeoLogVol* YAxisLogical =
new GeoLogVol( YAxisName, axisShape, Air );
235 GeoIntrusivePtr<GeoPhysVol> YAxisPhysVol =
new GeoPhysVol( YAxisLogical );
237 tbecMotherPhysical->add(
new GeoIdentifierTag( 1 ) );
238 tbecMotherPhysical->add(
new GeoTransform( GeoTrf::Transform3D( GeoTrf::Translation3D( 0.*Gaudi::Units::m, axisZHalfLength, 0.*Gaudi::Units::m )*GeoTrf::RotateX3D( -90.*Gaudi::Units::deg ) ) ) );
239 tbecMotherPhysical->add( YAxisPhysVol );
242 std::string ZAxisName = baseName +
"::ZAxis";
243 const GeoLogVol* ZAxisLogical =
new GeoLogVol( ZAxisName, axisShape, Air );
244 GeoIntrusivePtr<GeoPhysVol> ZAxisPhysVol =
new GeoPhysVol( ZAxisLogical );
246 tbecMotherPhysical->add(
new GeoIdentifierTag( 1 ) );
247 tbecMotherPhysical->add(
new GeoTransform( GeoTrf::TranslateZ3D( axisZHalfLength ) ) );
248 tbecMotherPhysical->add( ZAxisPhysVol );
254 std::string CompensatorName = baseName +
"::LeadCompensator";
255 GeoBox* CompensatorShape =
new GeoBox( 152.*Gaudi::Units::cm, 195.*Gaudi::Units::cm, 0.56*Gaudi::Units::cm );
256 const GeoLogVol* CompensatorLogical =
new GeoLogVol( CompensatorName, CompensatorShape, Lead );
257 GeoIntrusivePtr<GeoPhysVol> CompensatorPhysical =
new GeoPhysVol( CompensatorLogical );
259 tbecMotherPhysical->add(
new GeoIdentifierTag( 1 ) );
261 GeoTrf::Vector3D tmpvec1(xcent, 0., 300.*Gaudi::Units::cm);
262 GeoTrf::Vector3D tmpvec1Rotated = GeoTrf::RotateY3D(
m_eta_pos)*tmpvec1;
263 GeoTrf::Translate3D tmpxf1(tmpvec1Rotated.x(),tmpvec1Rotated.y(),tmpvec1Rotated.z());
264 tbecMotherPhysical->add(
new GeoTransform( tmpxf1 * GeoTrf::RotateY3D(
m_eta_pos)));
265 tbecMotherPhysical->add( CompensatorPhysical );
271 GeoIntrusivePtr<GeoVFullPhysVol> cryoPhys = cryoConstruction.
GetEnvelope();
272 GeoIntrusivePtr<GeoPhysVol> LArPhysical = cryoConstruction.
GetLArPhysical();
274 tbecMotherPhysical->add(
new GeoIdentifierTag( 1 ) );
275 GeoTrf::Vector3D tmpvec2(xcent, 0., zcent);
276 GeoTrf::Vector3D tmpvec2Rotated = GeoTrf::RotateY3D(
m_eta_pos)*tmpvec2;
277 GeoTrf::Translate3D tmpxf2(tmpvec2Rotated.x(),tmpvec2Rotated.y(),tmpvec2Rotated.z());
278 tbecMotherPhysical->add(
new GeoTransform( tmpxf2 * GeoTrf::RotateY3D(
m_eta_pos)));
279 tbecMotherPhysical->add( cryoPhys );
283 log << MSG::VERBOSE <<
"Creating beam chambers ..." << std::endl;
285 const double beamCZ[ 4 ] = { 17.9*Gaudi::Units::m, 7.673*Gaudi::Units::m, 1.352*Gaudi::Units::m, .256*Gaudi::Units::m };
286 const double beamCSize = 11.*Gaudi::Units::cm, beamCTh = 28*Gaudi::Units::mm;
288 GeoBox* BeamCShape =
new GeoBox( beamCSize, beamCSize, beamCTh );
289 for (
int i = 0; i < 4; i++ ) {
290 std::string BeamCName = baseName +
"::BeamChamber";
291 BeamCName+= char( i ) +
'0';
292 GeoLogVol* BeamCLogical =
new GeoLogVol( BeamCName, BeamCShape, Air );
293 GeoIntrusivePtr<GeoPhysVol> BeamCPhysical =
new GeoPhysVol( BeamCLogical );
295 tbecMotherPhysical->add(
new GeoIdentifierTag( 1 ) );
296 tbecMotherPhysical->add(
new GeoTransform( GeoTrf::Translate3D( 0.*Gaudi::Units::cm, 0.*Gaudi::Units::cm, zfface - beamCZ[ i ] ) ) );
297 tbecMotherPhysical->add( BeamCPhysical );
301 log << MSG::DEBUG << std::endl
302 <<
"Module deviation: " <<
m_ModuleRotation * (1./Gaudi::Units::deg) <<
" Gaudi::Units::deg" << std::endl
303 <<
"Phi position: " <<
m_phi_pos * (1./Gaudi::Units::deg) <<
" Gaudi::Units::deg" << std::endl
304 <<
"Y shift: " <<
m_YShift * (1./Gaudi::Units::mm) <<
" Gaudi::Units::mm"
310 GeoIntrusivePtr<GeoFullPhysVol>emecEnvelope= (GeoIntrusivePtr<GeoFullPhysVol>) emecModuleConstruction.GetEnvelope();
312 StatusCode status=detStore->record(sPhysVol,
"EMEC_POS");
313 if(!status.isSuccess())
throw std::runtime_error (
"Cannot store EMEC_POS");
316 GeoTrf::Vector3D pos( -xcent,
m_YShift, -51.4/2*Gaudi::Units::cm );
320 LArPhysical->add(
new GeoIdentifierTag( 1 ) );
321 LArPhysical->add(
new GeoTransform( GeoTrf::Transform3D( GeoTrf::Translation3D(pos(0),pos(1),pos(2)))*Mrot ) );
322 LArPhysical->add( emecEnvelope );
325 pos-= GeoTrf::Vector3D( 0.*Gaudi::Units::mm, 0.*Gaudi::Units::mm, 61.*Gaudi::Units::mm +2.*Gaudi::Units::mm +13.5*Gaudi::Units::mm );
330 GeoIntrusivePtr<GeoFullPhysVol> PresamplerEnvelope = PresamplerConstruction.
Envelope();
333 StatusCode status=detStore->record(sPhysVol,
"PRESAMPLER_EC_POS");
334 if(!status.isSuccess())
throw std::runtime_error (
"Cannot store PRESAMPLER_EC_POS");
338 LArPhysical->add(
new GeoIdentifierTag( 1 ) );
339 LArPhysical->add(
new GeoTransform( GeoTrf::Transform3D( GeoTrf::Translation3D(pos(0),pos(1),pos(2)))*Mrot ) );
340 LArPhysical->add( PresamplerEnvelope );
344return tbecMotherPhysical;