114 ISvcLocator *svcLocator = Gaudi::svcLocator();
116 if (svcLocator->service(
"MessageSvc",
msgSvc,
true )==StatusCode::FAILURE) {
117 throw std::runtime_error(
"Error in EndcapCryostatConstruction, cannot access MessageSvc");
120 MsgStream
log(
msgSvc,
"LArGeo::EndcapCryostatConstruction");
125 if (svcLocator->service(
"DetectorStore",
detStore,
false )==StatusCode::FAILURE) {
126 throw std::runtime_error(
"Error in EndcapCryostatConstruction, cannot access DetectorStore");
132 if (StatusCode::SUCCESS !=
detStore->retrieve(materialManager, std::string(
"MATERIALS")))
return nullptr;
134 const GeoMaterial *Lead = materialManager->
getMaterial(
"std::Lead");
136 throw std::runtime_error(
"Error in EndcapCryostatConstruction, std::Lead is not found.");
139 const GeoMaterial *Air = materialManager->
getMaterial(
"std::Air");
141 throw std::runtime_error(
"Error in EndcapCryostatConstruction, std::Air is not found.");
144 const GeoMaterial *Al = materialManager->
getMaterial(
"std::Aluminium");
146 throw std::runtime_error(
"Error in EndcapCryostatConstruction, std::Aluminium is not found.");
149 const GeoMaterial *
LAr = materialManager->
getMaterial(
"std::LiquidArgon");
151 throw std::runtime_error(
"Error in EndcapCryostatConstruction, std::LiquidArgon is not found.");
154 const GeoMaterial *G10 = materialManager->
getMaterial(
"LAr::G10");
155 if (!G10)
throw std::runtime_error(
"Error in EndcapCryostatConstruction, LAr::G10 is not found.");
157 const GeoMaterial *Copper = materialManager->
getMaterial(
"std::Copper");
158 if (!Copper)
throw std::runtime_error(
"Error in EndcapCryostatConstruction, std::Copper is not found.");
160 const GeoMaterial *Iron = materialManager->
getMaterial(
"std::Iron");
161 if (!Iron)
throw std::runtime_error(
"Error in EndcapCryostatConstruction, std::Iron is not found.");
163 const GeoMaterial *Polystyrene = materialManager->
getMaterial(
"std::Polystyrene");
164 if (!Polystyrene)
throw std::runtime_error(
"Error in EndcapCryostatConstruction, std::Polystyrene is not found.");
172 std::string detectorKey = LArVersion.empty() ?
AtlasVersion : LArVersion;
173 std::string detectorNode = LArVersion.empty() ?
"ATLAS" :
"LAr";
177 if (larPosition->size()==0 ) {
179 if (larPosition->size()==0 ) {
180 throw std::runtime_error(
"Error, no lar position table in database!");
193 planeIndMap cryoMotherPlanes, emhPlanes, fcalNosePlanes;
194 std::vector<planeIndMap> brassPlugPlanesVect;
195 brassPlugPlanesVect.emplace_back();
196 brassPlugPlanesVect.emplace_back();
197 planeIndMap::const_iterator iter;
199 for (
unsigned int ind=0;
ind<cryoPcons->size();
ind++)
201 int key = (*cryoPcons)[
ind]->getInt(
"PLANE_ID");
202 const std::string& pconName = (*cryoPcons)[
ind]->getString(
"PCON");
203 if(pconName==
"Endcap::CryoMother") {
204 cryoMotherPlanes[
key] =
ind;
206 else if(pconName==
"Endcap::EMH") {
209 else if(pconName==
"Endcap::FcalNose") {
210 fcalNosePlanes[
key] =
ind;
212 else if(pconName==
"Endcap::BrassPlug1") {
213 brassPlugPlanesVect[0][
key] =
ind;
215 else if(pconName==
"Endcap::BrassPlug2") {
216 brassPlugPlanesVect[1][
key] =
ind;
226 std::string baseName =
"LAr::Endcap::Cryostat";
237 std::string cryoMotherName = baseName +
"::MotherVolume";
238 GeoPcon* cryoMotherShape =
new GeoPcon(0.,2.*
M_PI);
240 double zStartCryoMother = 0.;
242 for(
unsigned int ind = 0;
ind < cryoMotherPlanes.size(); ++
ind){
243 iter = cryoMotherPlanes.find(
ind);
244 if(iter == cryoMotherPlanes.end()){
245 throw std::runtime_error(
246 "Error in EndcapCryostatConstruction, missing plane in Endcap Cryo Mother"
249 const IRDBRecord *currentRecord = (*cryoPcons)[(*iter).second];
250 double zplane = currentRecord->
getDouble(
"ZPLANE");
251 double rmin = currentRecord->
getDouble(
"RMIN");
252 double rmax = currentRecord->
getDouble(
"RMAX");
258 <<
" at " << zplane <<
" to accomodate FEC" <<
endmsg;
263 <<
" at " << rmax <<
" to accomodate FT Chimney" <<
endmsg;
266 cryoMotherShape->addPlane(zplane, rmin, rmax);
267 if(
ind == 0) zStartCryoMother = zplane;
271 const GeoLogVol* cryoMotherLogical =
new GeoLogVol(cryoMotherName, cryoMotherShape, Air);
272 GeoIntrusivePtr<GeoFullPhysVol> cryoMotherPhysical{
new GeoFullPhysVol(cryoMotherLogical)};
285 if(
m_fullGeo && cryoCylinders->size()>0){
286 unsigned int nextra=cryoExtraCyl->size();
290 for(
unsigned int i=0;
i<nextra;
i++){
291 const std::string&
name=(*cryoExtraCyl)[
i]->getString(
"CONE");
292 if(
name.find(
"EmecCylBeforePS") != std::string::npos){
293 double rmin=(*cryoExtraCyl)[
i]->getDouble(
"RMIN1");
294 double rmax=(*cryoExtraCyl)[
i]->getDouble(
"RMAX1");
295 double dz = (*cryoExtraCyl)[
i]->getDouble(
"DZ");
298 double rmin_warm=0.,rmax_warm=0.,dz_warm=0.,zInCryostat_warm=0.;
299 double rmin_cold=0.,rmax_cold=0.,dz_cold=0.,zInCryostat_cold=0.;
304 int cylNumber = currentRecord->
getInt(
"CYL_NUMBER");
305 if(currentRecord->
getString(
"CYL_LOCATION")==
"Endcap"){
325 double maxdz=(zInCryostat_cold-dz_cold)-(zInCryostat_warm+dz_warm);
326 if(dz>maxdz) dz=maxdz;
327 double zpos=((zInCryostat_cold-dz_cold)+(zInCryostat_warm+dz_warm))/2.;
329 std::ostringstream cylStream;
330 cylStream << baseName <<
"::ExtraCyl";
331 std::string cylName = cylStream.str();
332 cylName = cylName +
"_beforePS";
334 double phi0=(*cryoExtraCyl)[
i]->getDouble(
"PHI0");
335 double dphi=(*cryoExtraCyl)[
i]->getDouble(
"DPHI");
336 if(dphi>6.28) dphi=2.*
M_PI;
337 const std::string& material=(*cryoExtraCyl)[
i]->getString(
"MATERIAL");
340 throw std::runtime_error(
"Error in EndcapCryostatConstruction,material for CylBeforePS is not found.");
343 GeoTubs *solidCyl =
new GeoTubs(rmin,rmax,dz/2.,
phi0,dphi);
344 const GeoLogVol *logicCyl =
new GeoLogVol(cylName,solidCyl,
mat);
345 GeoPhysVol *physCyl =
new GeoPhysVol(logicCyl);
347 cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zpos)));
348 cryoMotherPhysical->add(physCyl);
350 std::cout<<
"**************************************************"<<std::endl;
351 std::cout<<
"EndcapCryostatConstruction insert extra material between warm and cold wall of cryo at front of PS::"<<std::endl;
352 std::cout<<
" ExtraCyl params: name,mat= "<<cylName<<
" "<<
mat->getName()
353 <<
" rmin,rmax,dzthick,zpos="<<rmin<<
" "<<rmax<<
" "<<dz<<
" "<<zpos
354 <<
" PhiStart,PhiSize="<<
phi0<<
" "<<dphi
357 std::cout<<
" warm cyl params: rmin,rmax,dzthick,zpos="<<rmin_warm<<
" "<<rmax_warm<<
" "<<2.*dz_warm<<
" "
358 <<zInCryostat_warm<<std::endl;
359 std::cout<<
" cold cyl params: rmin,rmax,dzthick,zpos="<<rmin_cold<<
" "<<rmax_cold<<
" "<<2.*dz_cold<<
" "
360 <<zInCryostat_cold<<std::endl;
361 std::cout<<
"**************************************************"<<std::endl;
383 int cylNumber = currentRecord->
getInt(
"CYL_NUMBER");
384 if(
m_fullGeo || cylNumber == 14 || cylNumber == 100) {
387 if(currentRecord->
getString(
"CYL_LOCATION")==
"Endcap") {
388 std::ostringstream cylStream;
389 cylStream << baseName <<
"::Cylinder";
390 std::string cylName = (cylNumber == 100?
"JDSH_AddShield_Inner":cylStream.str());
393 const std::string& qualifier = currentRecord->
getString(
"QUALIFIER");
394 if (!qualifier.empty()) cylName = cylName +
"::" + qualifier;
397 const GeoShape* solidCyl =
new GeoTubs(
404 const GeoMaterial *material = materialManager->
getMaterial(currentRecord->
getString(
"MATERIAL"));
407 std::ostringstream errorMessage;
408 errorMessage <<
"Error in EndcapCrysostat Construction" << std::endl;
409 errorMessage <<
"Material " << currentRecord->
getString(
"MATERIAL") <<
" is not found" << std::endl;
410 throw std::runtime_error(errorMessage.str().c_str());
415 log <<
MSG::DEBUG <<
"Cut holes for feedthroughs in warm wall "
423 GeoTube *warmhole =
new GeoTube(0., warmhole_radius, (rmax - rmin) * 4);
425 const double r = (rmin + rmax) * 0.5;
426 const GeoShape* warmwall = solidCyl;
428 auto put = [&warmwall, &warmhole_pos, &
r, &
h1](
double pos){
430 warmwall = &(warmwall->subtract(
431 h1 << GeoTrf::Translate3D(
x,
y, warmhole_pos)
435 for(
unsigned int i{0};
i < LArEndcapCratePhiPos->size(); ++
i){
436 const int num = (*LArEndcapCratePhiPos)[
i]->getInt(
"CRATENUM");
446 }
else if(cylNumber == 20){
447 log <<
MSG::DEBUG <<
"Cut holes for feedthroughs in cold wall "
454 GeoTube *coldhole =
new GeoTube(0., coldhole_radius, (rmax - rmin) * 4);
456 const double r = (rmin + rmax) * 0.5;
457 const GeoShape *coldwall = solidCyl;
459 auto put = [&coldwall, &coldhole_pos, &
r, &
h1](
double pos){
461 coldwall = &(coldwall->subtract(
462 h1 << GeoTrf::Translate3D(
x,
y, coldhole_pos)
466 for(
unsigned int i{0};
i < LArEndcapCratePhiPos->size(); ++
i){
467 const int num = (*LArEndcapCratePhiPos)[
i]->getInt(
"CRATENUM");
480 const GeoLogVol* logicCyl =
new GeoLogVol(cylName,solidCyl,material);
481 GeoIntrusivePtr<GeoPhysVol> physCyl =
new GeoPhysVol(logicCyl);
491 cryoMotherPhysical->add(
new GeoIdentifierTag(cylNumber));
492 cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zInCryostat)));
495 if ( cylNumber == 14 ) {
497 cryoMotherPhysical->add(
new GeoNameTag(cylName +
"::PresamplerMother") );
501 GeoIntrusivePtr<GeoFullPhysVol> emecPSEnvelope = endcapPresamplerConstruction.
Envelope();
502 if (emecPSEnvelope) {
510 GeoTransform *xfPs =
new GeoTransform(GeoTrf::TranslateZ3D(Zpos));
513 physCyl->add( emecPSEnvelope );
515 std::string
tag = bPos? std::string(
"PRESAMPLER_EC_POS") : std::string(
"PRESAMPLER_EC_NEG");
520 if(!
status.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+
tag).c_str());
525 cryoMotherPhysical->add(physCyl);
533 if (!fcalNosePlanes.empty()) {
534 GeoPcon *fcalNosePcon =
new GeoPcon(0,2*
M_PI);
535 for(
unsigned int ind=0;
ind<fcalNosePlanes.size();
ind++) {
536 iter = fcalNosePlanes.find(
ind);
538 if(iter==fcalNosePlanes.end()) {
539 throw std::runtime_error(
"Error in BarrelCryostatConstruction, missing plane in InnerWall");
541 const IRDBRecord *currentRecord = (*cryoPcons)[(*iter).second];
542 fcalNosePcon->addPlane(currentRecord->
getDouble(
"ZPLANE"),
548 const GeoLogVol *fcalNoseLog =
new GeoLogVol(
"LAr::Endcap::Cryostat::Cone::Mixed", fcalNosePcon, Al);
549 cryoMotherPhysical->add(
new GeoIdentifierTag(coneNumber));
550 GeoIntrusivePtr<GeoPhysVol>fcalNosePhys =
new GeoPhysVol(fcalNoseLog);
551 cryoMotherPhysical->add(fcalNosePhys);
564 std::string totalEMHLArName = baseName +
"::EmecHecLAr";
565 GeoPcon* totalEMHLArShape =
new GeoPcon(0.,2.*
M_PI);
567 for(
unsigned int ind=0;
ind<emhPlanes.size();
ind++)
569 iter = emhPlanes.find(
ind);
571 if(iter==emhPlanes.end())
572 throw std::runtime_error(
"Error in EndcapCryostatConstruction, missing plane in EMH");
575 const IRDBRecord *currentRecord = (*cryoPcons)[(*iter).second];
576 totalEMHLArShape->addPlane(currentRecord->
getDouble(
"ZPLANE"),
582 const GeoLogVol* totalEMHLArLogical =
583 new GeoLogVol(totalEMHLArName, totalEMHLArShape,
LAr);
585 GeoIntrusivePtr<GeoFullPhysVol> totalEMHLArPhysical =
new GeoFullPhysVol(totalEMHLArLogical);
588 const GeoMaterial *PlugBrass(
nullptr);
589 for(
size_t i(0);
i<2;++
i) {
590 const planeIndMap& brassPlugPlanes = brassPlugPlanesVect[
i];
591 if (!brassPlugPlanes.empty()) {
593 PlugBrass = materialManager->
getMaterial(
"LAr::PlugBrass");
594 if (!PlugBrass)
throw std::runtime_error(
"Error in EndcapCryostatConstruction, LAr::PlugBrass is not found.");
596 GeoPcon *brassPlugPcon =
new GeoPcon(0,2*
M_PI);
597 for(
unsigned int ind=0;
ind<brassPlugPlanes.size();
ind++) {
598 iter = brassPlugPlanes.find(
ind);
600 if(iter==brassPlugPlanes.end()) {
601 throw std::runtime_error(
"Error in EndcapCryostatConstruction, missing plane in BrassPlug");
603 const IRDBRecord *currentRecord = (*cryoPcons)[(*iter).second];
604 brassPlugPcon->addPlane(currentRecord->
getDouble(
"ZPLANE"),
609 const GeoLogVol *brassPlugLog =
new GeoLogVol(
"LAr::Endcap::Cryostat::BrassPlug", brassPlugPcon, PlugBrass);
610 GeoIntrusivePtr<GeoPhysVol>brassPlugPhys =
new GeoPhysVol(brassPlugLog);
611 totalEMHLArPhysical->add(
new GeoIdentifierTag(
i+1));
612 totalEMHLArPhysical->add(brassPlugPhys);
621 const double icable_dz = coldhole_radius;
622 const double icable_dr =
623 (1920./LArEndcapCratePhiPos->size()) *
627 <<
" of cables inside EC cryostat in front of FT" <<
endmsg;
629 const GeoMaterial* icable_mat = materialManager->
getMaterial(
"LAr::FT::Cable");
630 GeoShape* icable =
new GeoTube(rcoldwall - icable_dr, rcoldwall, icable_dz);
631 GeoLogVol* icableLV =
new GeoLogVol(
"LAr::Endcap::InnerFTCables", icable, icable_mat);
632 GeoIntrusivePtr<GeoPhysVol> icablePV =
new GeoPhysVol(icableLV);
633 totalEMHLArPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(z_pos)));
634 totalEMHLArPhysical->add(icablePV);
637 cryoMotherPhysical->add( totalEMHLArPhysical );
647 if (!posRec)
throw std::runtime_error(
"Error, no lar position record in the database") ;
649 GeoAlignableTransform *xfEmec =
new GeoAlignableTransform(xfPos);
651 std::string
tag = bPos? std::string(
"EMEC_POS") : std::string(
"EMEC_NEG");
656 if(!
status.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+
tag).c_str());
660 if(!
status.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+
tag).c_str());
664 totalEMHLArPhysical->add(xfEmec);
665 totalEMHLArPhysical->add( envelope );
670 std::string wheelType=
"front";
671 bool threeBoards=
false;
672 HECWheelConstruction frontHEC(
m_fullGeo,wheelType,threeBoards,bPos) ;
673 GeoIntrusivePtr<GeoFullPhysVol> EnvelopeF = frontHEC.GetEnvelope();
682 GeoAlignableTransform *xfHec1 =
new GeoAlignableTransform(xfPosHec1);
684 std::string
tag1 = bPos? std::string(
"HEC1_POS") : std::string(
"HEC1_NEG");
688 if(!
status.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+
tag1).c_str());
692 if(!
status.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+
tag1).c_str());
694 totalEMHLArPhysical->add( xfHec1);
695 totalEMHLArPhysical->add(
new GeoIdentifierTag(0));
696 totalEMHLArPhysical->add( EnvelopeF );
702 HECWheelConstruction rearHEC(
m_fullGeo,wheelType,threeBoards,bPos) ;
703 GeoIntrusivePtr<GeoFullPhysVol> EnvelopeR = rearHEC.GetEnvelope();
707 GeoAlignableTransform *xfHec2 =
new GeoAlignableTransform(xfPosHec2);
709 std::string
tag2 = bPos? std::string(
"HEC2_POS") : std::string(
"HEC2_NEG");
713 if(!
status.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+
tag2).c_str());
717 if(!
status.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+
tag2).c_str());
719 totalEMHLArPhysical->add( xfHec2);
720 totalEMHLArPhysical->add(
new GeoIdentifierTag(1));
721 totalEMHLArPhysical->add( EnvelopeR );
746 std::string
tag = bPos ?
"FCAL_POS" :
"FCAL_NEG";
749 if (!posRec)
throw std::runtime_error(
"Error, no lar position record in the database") ;
751 GeoAlignableTransform *fcalXF =
new GeoAlignableTransform(xfPos);
756 if(!
status.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+
tag).c_str());
759 const GeoLogVol *envVol = fcalEnvelope->getLogVol();
760 const GeoShape *envShape = envVol->getShape();
761 if (envShape->typeID()!=GeoTubs::getClassTypeID()) {
762 throw std::runtime_error(
"Cannot recognize FCAL container shape");
765 const GeoTubs * tubs = (
const GeoTubs *) envShape;
768 cryoMotherPhysical->add(fcalXF);
769 cryoMotherPhysical->add(
new GeoTransform( GeoTrf::TranslateZ3D(tubs->getZHalfLength()) ) );
770 cryoMotherPhysical->add( fcalEnvelope );
785 std::map<std::string,unsigned> trdMap;
786 for(
unsigned indTrd(0);indTrd<mbtsTrds->size();++indTrd) {
787 const std::string& keyTrd = (*mbtsTrds)[indTrd]->getString(
"TRD");
788 trdMap[keyTrd]=indTrd;
802 GeoIntrusivePtr<GeoPhysVol> pvMM =
nullptr;
804 if(mbtsPcons->size()==0) {
810 const std::string& strTubeName = (*first)->getString(
"TUBE");
811 if(strTubeName ==
"MBTS_mother") {
814 else if(strTubeName ==
"Moderator") {
817 else if(strTubeName ==
"JMTUBE") {
828 const GeoMaterial *matMM = materialManager->
getMaterial((*itMother)->getString(
"MATERIAL"));
830 GeoIntrusivePtr<GeoTube> tubeMM{
new GeoTube(rminMM,rmaxMM,dzMM)};
832 GeoTube *tubeJM=
nullptr;
833 const GeoShape *solidMM=
nullptr;
834 if (itTube!=mbtsTubs->end()) {
838 GeoPcon *pcon =
new GeoPcon(0,2*
M_PI);
839 pcon->addPlane(-dzMM,rminMM,rmaxMM);
840 pcon->addPlane( dzMM,rminMM,rmaxMM);
841 pcon->addPlane( dzMM,rminMM,rMaxMod);
842 pcon->addPlane( dzMM+2*dzMod, rminMM,rMaxMod);
843 tubeJM =
new GeoTube(rminMM,rMaxMod,dzMod);
847 if (!solidMM) solidMM =
new GeoTube(rminMM,rmaxMM,dzMM);
849 GeoLogVol* lvMM =
new GeoLogVol(
"MBTS_mother",solidMM,matMM);
850 pvMM =
new GeoPhysVol(lvMM);
852 cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zposMM)));
853 cryoMotherPhysical->add(pvMM);
861 const GeoMaterial *matMod = materialManager->
getMaterial((*itModerator)->getString(
"MATERIAL"));
863 GeoTube* solidMod =
new GeoTube(rminMM,rmaxMM,dzMod);
864 GeoLogVol* lvMod =
new GeoLogVol(
"Moderator",solidMod, matMod);
865 GeoIntrusivePtr<GeoPhysVol> pvMod =
new GeoPhysVol(lvMod);
867 pvMM->add(
new GeoTransform(GeoTrf::TranslateZ3D(zposMod)));
871 GeoLogVol* lvMod =
new GeoLogVol(
"ModeratorTube",tubeJM, matMod);
872 GeoIntrusivePtr<GeoPhysVol> pvMod =
new GeoPhysVol(lvMod);
874 pvMM->add(
new GeoTransform(GeoTrf::TranslateZ3D(tubeMM->getZHalfLength()+tubeJM->getZHalfLength())));
883 planeIndMap::const_iterator iter;
885 for (
unsigned int ind=0;
ind<mbtsPcons->size();
ind++) {
886 int key = (*mbtsPcons)[
ind]->getInt(
"PLANE_ID");
887 const std::string& pconName = (*mbtsPcons)[
ind]->getString(
"PCON");
888 if(pconName==
"MBTS::Mother") {
889 mbtsMotherPlanes[
key] =
ind;
891 else if(pconName==
"MBTS::JM") {
896 double zStartMM = 0.;
899 GeoPcon* solidMM =
new GeoPcon(0.,2.*
M_PI);
900 for(
unsigned int ind=0;
ind<mbtsMotherPlanes.size();
ind++) {
901 iter = mbtsMotherPlanes.find(
ind);
902 if(iter==mbtsMotherPlanes.end())
903 throw std::runtime_error(
"Error in EndcapCryostatConstruction, missing plane in MBTS Mother");
905 const IRDBRecord *currentRecord = (*mbtsPcons)[(*iter).second];
906 solidMM->addPlane(currentRecord->
getDouble(
"ZPLANE"),
910 zStartMM = currentRecord->
getDouble(
"ZPLANE");
915 GeoPcon* solidMod =
new GeoPcon(0.,2.*
M_PI);
916 for(
unsigned int ind=0;
ind<jmTubePlanes.size();
ind++) {
917 iter = jmTubePlanes.find(
ind);
918 if(iter==jmTubePlanes.end())
919 throw std::runtime_error(
"Error in EndcapCryostatConstruction, missing plane in Moderator+JM tube volume");
921 const IRDBRecord *currentRecord = (*mbtsPcons)[(*iter).second];
922 solidMod->addPlane(currentRecord->
getDouble(
"ZPLANE"),
931 GeoLogVol* lvMM =
new GeoLogVol(
"MBTS_mother",solidMM,Air);
932 pvMM =
new GeoPhysVol(lvMM);
934 zposMM = zStartCryoMother - zStartMM;
935 cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zposMM)));
936 cryoMotherPhysical->add(pvMM);
939 if((mbtsTubs->size()!=1) || ((*mbtsTubs)[0]->getString(
"TUBE")!=
"MBTS::JM"))
940 throw std::runtime_error(
"Error in EndcapCryostatConstruction, unexpected number of tubes or wrong name for the JM tube");
941 GeoTube* tubeJM =
new GeoTube((*mbtsTubs)[0]->getDouble(
"RMIN"),
942 (*mbtsTubs)[0]->getDouble(
"RMAX"),
943 (*mbtsTubs)[0]->getDouble(
"DZ"));
944 const GeoMaterial* matJM = materialManager->
getMaterial((*mbtsTubs)[0]->getString(
"MATERIAL"));
945 GeoLogVol* lvJM =
new GeoLogVol(
"ModeratorJMTube",tubeJM, matJM);
946 GeoIntrusivePtr<GeoPhysVol> pvJM =
new GeoPhysVol(lvJM);
948 pvMM->add(
new GeoTransform(GeoTrf::TranslateZ3D((*mbtsTubs)[0]->getDouble(
"ZPOS"))));
952 GeoLogVol* lvMod =
new GeoLogVol(
"ModeratorJMPcon",solidMod, matJM);
953 GeoIntrusivePtr<GeoPhysVol> pvMod =
new GeoPhysVol(lvMod);
959 if(mbtsGen->size()==0) {
961 for(
unsigned int scinId=0; scinId<mbtsScin->size(); scinId++) {
962 const IRDBRecord* curScin = (*mbtsScin)[scinId];
964 int nScin = curScin->
getInt(
"SCINNUM");
973 double startPhi = 0.;
976 startPhi = curScin->
getDouble(
"STARTPHI");
978 catch(std::runtime_error&) {}
982 std::ostringstream ostr;
983 ostr << curScin->
getInt(
"SCIN_ID");
984 std::string scinName = std::string(
"MBTS")+ostr.str();
986 GeoTrd* solidScin =
new GeoTrd(dx1Scin,dx2Scin,dy1Scin,dy2Scin,dzScin);
987 GeoLogVol* lvScin =
new GeoLogVol(scinName,solidScin,matScin);
988 GeoIntrusivePtr<GeoPhysVol> pvScin =
new GeoPhysVol(lvScin);
993 GeoSerialTransformer* stScin =
nullptr;
997 TRANSFUNCTION xfScin = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateZ3D(zposScin)*GeoTrf::TranslateX3D(rposScin)*GeoTrf::RotateY3D(90*
Gaudi::Units::deg);
998 stScin =
new GeoSerialTransformer(pvScin,&xfScin,nScin);
1001 TRANSFUNCTION xfScin = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateZ3D(zposScin)*GeoTrf::TranslateX3D(rposScin)*GeoTrf::RotateY3D(90*
Gaudi::Units::deg);
1002 stScin =
new GeoSerialTransformer(pvScin,&xfScin,nScin);
1005 pvMM->add(
new GeoSerialIdentifier(0));
1013 int nAirEnv = (*mbtsGen)[0]->getInt(
"NSCIN");
1014 double startPhi = (*mbtsGen)[0]->getDouble(
"STARTPHI");
1015 double zposAirEnv = (*mbtsGen)[0]->getDouble(
"ZPOSENV");
1016 double rposAirEnv = (*mbtsGen)[0]->getDouble(
"RPOSENV");
1018 GeoIntrusivePtr<GeoPhysVol>pvAirEnv{}, pvAluEnv{} , pvAirInAlu{};
1021 std::map<std::string,unsigned>::const_iterator itTrdMap = trdMap.find(
"MBTSAirEnv");
1022 if(itTrdMap==trdMap.end())
1023 throw std::runtime_error(
"Error in EndcapCryostatConstruction, unable to get MBTS air envelope parameters from the database!");
1024 const IRDBRecord* rec = (*mbtsTrds)[itTrdMap->second];
1028 for(itTrdMap=trdMap.begin();itTrdMap!=trdMap.end();++itTrdMap) {
1029 rec = (*mbtsTrds)[itTrdMap->second];
1030 const std::string& trd = rec->
getString(
"TRD");
1031 if(rec->
getString(
"PARENT")==
"MBTSAirEnv") {
1032 GeoIntrusivePtr<GeoPhysVol> nevVol =
buildMbtsTrd(rec,materialManager,pvAirEnv);
1033 if(trd.compare(
"MBTSAluEnv")==0)
1039 for(itTrdMap=trdMap.begin();itTrdMap!=trdMap.end();++itTrdMap) {
1040 rec = (*mbtsTrds)[itTrdMap->second];
1041 const std::string& trd = rec->
getString(
"TRD");
1042 if(rec->
getString(
"PARENT")==
"MBTSAluEnv") {
1043 GeoIntrusivePtr<GeoPhysVol> nevVol =
buildMbtsTrd(rec,materialManager,pvAluEnv);
1044 if(trd.compare(
"MBTSAirInAlu")==0)
1045 pvAirInAlu = nevVol;
1050 for(itTrdMap=trdMap.begin();itTrdMap!=trdMap.end();++itTrdMap) {
1051 rec = (*mbtsTrds)[itTrdMap->second];
1052 if(rec->
getString(
"PARENT")==
"MBTSAirInAlu")
1059 GeoSerialTransformer* stAirEnv =
nullptr;
1062 TRANSFUNCTION xfAirEnv = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateZ3D(zposAirEnv)*GeoTrf::TranslateX3D(rposAirEnv)*GeoTrf::RotateY3D(90*
Gaudi::Units::deg);
1063 stAirEnv =
new GeoSerialTransformer(pvAirEnv,&xfAirEnv,nAirEnv);
1066 TRANSFUNCTION xfAirEnv = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateZ3D(zposAirEnv)*GeoTrf::TranslateX3D(rposAirEnv)*GeoTrf::RotateY3D(90*
Gaudi::Units::deg);
1067 stAirEnv =
new GeoSerialTransformer(pvAirEnv,&xfAirEnv,nAirEnv);
1070 pvMM->add(
new GeoSerialIdentifier(0));
1071 pvMM->add(stAirEnv);
1085 , detectorNode).isFailure()) {
1086 throw std::runtime_error(
"Failed to build MBTS readout geometry");
1094 crateBuilder.create(cryoMotherPhysical);
1096 return cryoMotherPhysical;