15 #include "GeoModelKernel/GeoElement.h"
16 #include "GeoModelKernel/GeoMaterial.h"
17 #include "GeoModelKernel/GeoFullPhysVol.h"
18 #include "GeoModelKernel/GeoPhysVol.h"
19 #include "GeoModelKernel/GeoVPhysVol.h"
20 #include "GeoModelKernel/GeoLogVol.h"
21 #include "GeoModelKernel/GeoPcon.h"
22 #include "GeoModelKernel/GeoTubs.h"
23 #include "GeoModelKernel/GeoTube.h"
24 #include "GeoModelKernel/GeoBox.h"
25 #include "GeoModelKernel/GeoCons.h"
26 #include "GeoModelKernel/GeoTransform.h"
27 #include "GeoModelKernel/GeoNameTag.h"
28 #include "GeoModelKernel/GeoAlignableTransform.h"
29 #include "GeoModelKernel/GeoIdentifierTag.h"
30 #include "GeoModelKernel/GeoVolumeTagCatalog.h"
31 #include "GeoModelKernel/GeoShapeIntersection.h"
32 #include "GeoModelKernel/GeoShapeSubtraction.h"
33 #include "GeoModelKernel/GeoShapeShift.h"
34 #include "GeoModelKernel/GeoShapeUnion.h"
35 #include "GeoModelKernel/GeoSerialTransformer.h"
43 #include "GaudiKernel/MsgStream.h"
44 #include "GaudiKernel/Bootstrap.h"
51 #include "CLHEP/Geometry/Transform3D.h"
53 #include "GaudiKernel/PhysicalConstants.h"
55 #include "GeoGenericFunctions/Abs.h"
56 #include "GeoGenericFunctions/Mod.h"
57 #include "GeoGenericFunctions/Rectangular.h"
58 #include "GeoGenericFunctions/Variable.h"
59 #include "GeoGenericFunctions/FixedConstant.h"
60 #include "GeoGenericFunctions/Sin.h"
61 #include "GeoGenericFunctions/Cos.h"
68 using namespace GeoXF;
73 using planeIndMap = std::map<int, unsigned int, std::less<int>>;
78 , m_barrelVisLimit(-1)
79 , m_cryoMotherPhysical(nullptr)
89 if (m_cryoMotherPhysical)
return m_cryoMotherPhysical;
94 SmartIF<StoreGateSvc>
detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
96 throw std::runtime_error(
"Error in LArDetectorFactory, cannot access DetectorStore");
102 if (StatusCode::SUCCESS !=
detStore->retrieve(materialManager, std::string(
"MATERIALS")))
return nullptr;
104 const GeoMaterial *Air = materialManager->
getMaterial(
"std::Air");
106 throw std::runtime_error(
"Error in BarrelCryostatConstruction, std::Air is not found.");
109 const GeoMaterial *Aluminium = materialManager->
getMaterial(
"std::Aluminium");
111 throw std::runtime_error(
"Error in BarrelCryostatConstruction, std::Aluminium is not found.");
114 const GeoMaterial *Titanium = materialManager->
getMaterial(
"std::Titanium");
116 Titanium = Aluminium;
121 const GeoMaterial *
LAr = materialManager->
getMaterial(
"std::LiquidArgon");
123 throw std::runtime_error(
"Error in BarrelCryostatConstruction, std::LiquidArgon is not found.");
128 SmartIF<IGeoModelSvc> geoModel{Gaudi::svcLocator()->service(
"GeoModelSvc")};
129 if(!geoModel.isValid())
130 throw std::runtime_error(
"Error in BarrelCryostatConstruction, cannot access GeoModelSvc");
131 SmartIF<IRDBAccessSvc> rdbAccess{Gaudi::svcLocator()->service(
"RDBAccessSvc")};
132 if(!rdbAccess.isValid())
133 throw std::runtime_error(
"Error in BarrelCryostatConstruction, cannot access RDBAccessSvc");
135 planeIndMap innerWallPlanes, innerEndWallPlanes, outerWallPlanes, cryoMotherPlanes, totalLarPlanes, halfLarPlanes, sctEcCoolingPlanes;
136 planeIndMap::const_iterator iter;
140 ATH_MSG_DEBUG(
"Getting primary numbers for " << larVersionKey.
node() <<
", " << larVersionKey.
tag());
145 std::string
names[]={
"EMB_POS",
"EMB_NEG",
"SOLENOID"};
146 GeoAlignableTransform *xf[]={
nullptr,
nullptr,
nullptr};
147 for (
int n=0;
n<3;
n++) {
149 IRDBRecordset_ptr larPosition = rdbAccess->getRecordsetPtr(
"LArPosition",larVersionKey.
tag(), larVersionKey.
node());
151 if (larPosition->size()==0 ) {
152 larPosition = rdbAccess->getRecordsetPtr(
"LArPosition",
"LArPosition-00");
153 if (larPosition->size()==0 ) {
154 throw std::runtime_error(
"Error, no lar position table in database!");
159 if (!posRec)
throw std::runtime_error(
"Error, no lar position record in the database") ;
161 xf[
n] =
new GeoAlignableTransform(xfPos);
165 if(!
status.isSuccess())
throw std::runtime_error ((
"Cannot store " +
names[
n]).c_str() );
168 GeoAlignableTransform *xfHalfLArPos=xf[0], *xfHalfLArNeg=xf[1], *xfSolenoid=xf[2];
174 IRDBRecordset_ptr idSupportRails = rdbAccess->getRecordsetPtr(
"IdSupportRail", larVersionKey.
tag(), larVersionKey.
node());
177 larVersionKey.
node());
178 if(cryoCylinders->size()==0)
179 cryoCylinders = rdbAccess->getRecordsetPtr(
"CryoCylinders",
"CryoCylinders-00");
184 larVersionKey.
node());
185 if(cryoPcons->size()==0)
186 cryoPcons = rdbAccess->getRecordsetPtr(
"CryoPcons",
"CryoPcons-00");
189 for (
unsigned int ind=0;
ind<cryoPcons->size();
ind++)
191 int key = (*cryoPcons)[
ind]->getInt(
"PLANE_ID");
192 const std::string& pconName = (*cryoPcons)[
ind]->getString(
"PCON");
193 if(pconName==
"Barrel::InnerWall")
194 innerWallPlanes[
key] =
ind;
195 if (pconName==
"Barrel::InnerEndWall")
196 innerEndWallPlanes[
key] =
ind;
197 else if(pconName==
"Barrel::OuterWall")
198 outerWallPlanes[
key] =
ind;
199 else if(pconName==
"Barrel::CryoMother")
200 cryoMotherPlanes[
key] =
ind;
201 else if(pconName==
"Barrel::TotalLAr")
202 totalLarPlanes[
key] =
ind;
203 else if(pconName==
"Barrel::HalfLAr")
205 else if(pconName==
"Barrel::SctEcCooling")
206 sctEcCoolingPlanes[
key] =
ind;
222 std::string cryoMotherName =
"LAr::Barrel::Cryostat::MotherVolume";
249 double dphi_all = 2.*
M_PI;
251 GeoPcon* cryoMotherShape =
255 for(
unsigned int ind=0;
ind<cryoMotherPlanes.size();
ind++)
257 iter = cryoMotherPlanes.find(
ind);
259 if(iter==cryoMotherPlanes.end()) {
260 throw std::runtime_error(
"Error in BarrelCryostatConstruction, missing plane in CryoMother");
263 currentRecord = (*cryoPcons)[(*iter).second];
265 cryoMotherShape->addPlane(currentRecord->getDouble(
"ZPLANE"),
266 currentRecord->getDouble(
"RMIN"),
267 currentRecord->getDouble(
"RMAX"));
279 const GeoLogVol* cryoMotherLogical =
280 new GeoLogVol(cryoMotherName, cryoMotherShape, Air);
282 m_cryoMotherPhysical =
new GeoFullPhysVol(cryoMotherLogical);
285 GeoVolumeTagCatalog::VolumeTagCatalog()->addTaggedVolume(
"Envelope",
"LArBarrel",m_cryoMotherPhysical);
293 for (
unsigned int ind=0;
ind < cryoCylinders->size();
ind++)
295 currentRecord = (*cryoCylinders)[
ind];
297 if(currentRecord->getString(
"CYL_LOCATION")==
"Barrel::CryoMother")
300 const GeoMaterial *material = materialManager->
getMaterial(currentRecord->getString(
"MATERIAL"));
304 std::ostringstream errorMessage;
305 errorMessage <<
"Error in BarrelCrysostat Construction" << std::endl;
306 errorMessage <<
"Material " << currentRecord->getString(
"MATERIAL") <<
" is not found" << std::endl;
307 throw std::runtime_error(errorMessage.str().c_str());
311 std::ostringstream cylStream;
312 int cylID = currentRecord->getInt(
"CYL_ID");
313 cylStream <<
"LAr::Barrel::Cryostat::Cylinder::#" << cylID;
314 std::string cylName= cylStream.str();
316 int cylNumber = currentRecord->getInt(
"CYL_NUMBER");
319 double zInCryostat = zMin + dZ / 2.;
322 if ((*cryoEars).size()>0 && cylID==1) {
324 double rmin = record->
getDouble(
"EARRMIN");
325 double rmax = record->
getDouble(
"EARRMAX");
326 double zthick = record->
getDouble(
"EARZTHICKNESS");
327 double yvert = record->
getDouble(
"EARVERTICALEXTENT");
328 GeoTubs *tubs =
new GeoTubs(rmin,
334 GeoBox *box =
new GeoBox( rmax, yvert/2, rmax);
336 const GeoShape & shape = tubs->intersect(*box);
337 const GeoLogVol *logVol =
new GeoLogVol (
"LAr::Barrel::Cryostat::Sector::Ear",&shape, material);
338 GeoIntrusivePtr<GeoPhysVol>earPhysVol =
new GeoPhysVol(logVol);
340 m_cryoMotherPhysical->add(
new GeoNameTag(std::string(
"CryostatEarForward")));
341 m_cryoMotherPhysical->add(
new GeoIdentifierTag(cylNumber));
342 m_cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zInCryostat)));
343 m_cryoMotherPhysical->add(earPhysVol);
345 m_cryoMotherPhysical->add(
new GeoNameTag(cylName+std::string(
"CryostatEarBackward")));
346 m_cryoMotherPhysical->add(
new GeoIdentifierTag(cylNumber));
347 m_cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(-zInCryostat)));
348 m_cryoMotherPhysical->add(earPhysVol);
351 if ((*cryoEars).size() > 0 && cylID==6) {
353 double rmin = record->
getDouble(
"LEGRMIN");
354 double rmax = record->
getDouble(
"LEGRMAX");
355 double zthick = record->
getDouble(
"LEGZTHICKNESS");
356 double yvert = record->
getDouble(
"LEGYMAX");
359 GeoTubs *tubs =
new GeoTubs(rmin,
365 GeoTrf::TranslateY3D
offset(rmax-yvert);
366 GeoBox * box =
new GeoBox(rmax,rmax, rmax);
367 const GeoShape & shape = tubs->subtract((*box)<<
offset);
369 const GeoLogVol *logVol =
new GeoLogVol (
"LAr::Barrel::Cryostat::Sector::Leg",&shape, material);
370 GeoIntrusivePtr<GeoPhysVol>legPhysVol =
new GeoPhysVol(logVol);
372 m_cryoMotherPhysical->add(
new GeoNameTag(std::string(
"CryostatLegForward")));
373 m_cryoMotherPhysical->add(
new GeoIdentifierTag(cylNumber));
374 m_cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zInCryostat+zthick)));
375 m_cryoMotherPhysical->add(legPhysVol);
377 m_cryoMotherPhysical->add(
new GeoNameTag(cylName+std::string(
"CryostatLegBackward")));
378 m_cryoMotherPhysical->add(
new GeoIdentifierTag(cylNumber));
379 m_cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(-zInCryostat-zthick)));
380 m_cryoMotherPhysical->add(legPhysVol);
384 const GeoShape* solidBarrelCylinder =
nullptr;
385 const GeoLogVol* logicBarrelCylinder =
nullptr;
388 if(m_fullGeo || (10<=cylID && cylID<=14)) {
397 ATH_MSG_DEBUG(
"Cut holes for feedthroughs in warm wall " << cylName);
401 const double warmhole_radius = bellow_Router;
403 GeoTube *warmhole =
new GeoTube(0., warmhole_radius, (rmax - rmin) * 2);
405 const double r = (rmin + rmax) * 0.5;
406 const GeoShape *warmwall = solidBarrelCylinder;
408 const int NCrates = 16;
409 auto put = [&warmwall, &warmhole_pos, &
r, &
h1](
double pos){
412 warmwall = &(warmwall->subtract(
413 h1 << GeoTrf::Translate3D(
x,
y, warmhole_pos)
417 for(
int i = 0;
i < NCrates; ++
i){
422 solidBarrelCylinder = warmwall;
423 }
else if(cylID == 2){
424 ATH_MSG_DEBUG(
"Cut holes for feedthroughs in cold wall " << cylName);
429 GeoTube *coldhole =
new GeoTube(0., coldhole_radius, (rmax - rmin) * 2);
431 const double r = (rmin + rmax) * 0.5;
432 const GeoShape *coldwall = solidBarrelCylinder;
434 const int NCrates = 16;
435 for(
int i = 0;
i < NCrates; ++
i){
437 auto put = [&coldwall, &coldhole_pos, &
r, &
h1](
double pos){
440 coldwall = &(coldwall->subtract(
441 h1 << GeoTrf::Translate3D(
x,
y, coldhole_pos)
448 solidBarrelCylinder = coldwall;
452 logicBarrelCylinder =
new GeoLogVol(cylName,solidBarrelCylinder,material);
455 if(logicBarrelCylinder) {
459 GeoIntrusivePtr<GeoFullPhysVol> physBarrelCylinder =
new GeoFullPhysVol(logicBarrelCylinder);
461 m_cryoMotherPhysical->add(
new GeoNameTag(cylName+std::string(
"Phys")));
462 m_cryoMotherPhysical->add(
new GeoIdentifierTag(cylNumber));
465 if(10<=cylID && cylID<=14)
466 m_cryoMotherPhysical->add(xfSolenoid);
468 m_cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zInCryostat)));
469 m_cryoMotherPhysical->add(physBarrelCylinder);
479 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store SOLENOID");
483 GeoIntrusivePtr<GeoPhysVol> physBarrelCylinder =
new GeoPhysVol(logicBarrelCylinder);
485 m_cryoMotherPhysical->add(
new GeoNameTag(cylName+std::string(
"PhysForward")));
486 m_cryoMotherPhysical->add(
new GeoIdentifierTag(cylNumber));
487 m_cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zInCryostat)));
488 m_cryoMotherPhysical->add(physBarrelCylinder);
490 m_cryoMotherPhysical->add(
new GeoNameTag(cylName+std::string(
"PhysBackward")));
491 m_cryoMotherPhysical->add(
new GeoIdentifierTag(cylNumber));
492 if(m_activateFT && (cylID == 2 || cylID == 7)){
493 m_cryoMotherPhysical->add(
new GeoTransform(GeoTrf::RotateY3D(180.*
Gaudi::Units::deg)));
494 m_cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zInCryostat)));
496 m_cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(-zInCryostat)));
498 m_cryoMotherPhysical->add(physBarrelCylinder);
507 GeoPcon *outerWallPcon =
new GeoPcon(0,dphi_all);
509 for(
unsigned int ind=0;
ind<outerWallPlanes.size();
ind++) {
510 iter = outerWallPlanes.find(
ind);
512 if(iter==outerWallPlanes.end())
513 throw std::runtime_error(
"Error in BarrelCryostatConstruction, missing plane in OuterWall");
515 currentRecord = (*cryoPcons)[(*iter).second];
516 outerWallPcon->addPlane(currentRecord->getDouble(
"ZPLANE"),
517 currentRecord->getDouble(
"RMIN"),
518 currentRecord->getDouble(
"RMAX"));
522 const GeoLogVol *outerWallLog =
new GeoLogVol(
"LAr::Barrel::Cryostat::OuterWall", outerWallPcon, Aluminium);
523 m_cryoMotherPhysical->add(
new GeoNameTag(std::string(
"Barrel Cryo OuterWall Phys")));
524 GeoIntrusivePtr<GeoPhysVol>outerWallPhys =
new GeoPhysVol(outerWallLog);
525 m_cryoMotherPhysical->add(outerWallPhys);
528 GeoPcon *innerWallPcon =
new GeoPcon(0,dphi_all);
530 for(
unsigned int ind=0;
ind<innerWallPlanes.size();
ind++) {
531 iter = innerWallPlanes.find(
ind);
533 if(iter==innerWallPlanes.end())
534 throw std::runtime_error(
"Error in BarrelCryostatConstruction, missing plane in InnerWall");
536 currentRecord = (*cryoPcons)[(*iter).second];
537 innerWallPcon->addPlane(currentRecord->getDouble(
"ZPLANE"),
538 currentRecord->getDouble(
"RMIN"),
539 currentRecord->getDouble(
"RMAX"));
543 const GeoLogVol *innerWallLog =
new GeoLogVol(
"LAr::Barrel::Cryostat::InnerWall", innerWallPcon, Aluminium);
544 m_cryoMotherPhysical->add(
new GeoNameTag(std::string(
"Barrel Cryo InnerWall Phys")));
545 GeoIntrusivePtr<GeoPhysVol>innerWallPhys =
new GeoPhysVol(innerWallLog);
546 m_cryoMotherPhysical->add(innerWallPhys);
552 larVersionKey.
node());
553 if (cryoBolts->size() >0) {
554 ATH_MSG_INFO(
" new description with barrel croystat bolts");
555 const IRDBRecord * cryoBoltsRecord = (*cryoBolts) [0];
556 double rmax_vis = cryoBoltsRecord->
getDouble(
"RBOLT");
557 int Nvis = cryoBoltsRecord->
getInt(
"NBOLT");
558 double PhiPos0 = cryoBoltsRecord->
getDouble(
"PHI0");
559 double RhoPosB = cryoBoltsRecord->
getDouble(
"RADIUS");
562 const GeoMaterial *bolt_material = materialManager->
getMaterial(cryoBoltsRecord->
getString(
"MATERIAL"));
563 if (!bolt_material) {
564 throw std::runtime_error(
"Error in BarrelCryostatConstruction, material for bolt not found");
570 if ((iter = innerWallPlanes.find(
index1))!= innerWallPlanes.end()) {
571 const IRDBRecord * pconsRecord = (*cryoPcons) [(*iter).second];
574 if ((iter = innerWallPlanes.find(
index2))!= innerWallPlanes.end()) {
575 const IRDBRecord * pconsRecord = (*cryoPcons) [(*iter).second];
578 if (z1>0. && z2>0.) {
579 double zthick_vis=(z2-z1)-0.1;
581 GeoTubs *tub_vis =
new GeoTubs(0.,rmax_vis,zthick_vis/2., (
double) 0., dphi_all);
582 const GeoLogVol * log_vis =
new GeoLogVol(
"LAr::Barrel::Cryostat::InnerWall::Vis",tub_vis,bolt_material);
583 GeoIntrusivePtr<GeoPhysVol> phys_vis =
new GeoPhysVol(log_vis);
585 double xxVis=((
double)(Nvis));
586 double ZposB=0.5*(z1+z2);
587 double twopi128 = 2.*
M_PI/xxVis;
588 GeoGenfun::Variable
i;
589 GeoGenfun::Mod Mod1(1.0),Mod128(xxVis),Mod2(2.0);
590 GeoGenfun::GENFUNCTION PhiPos = PhiPos0 + twopi128*Mod128(
i);
591 GeoGenfun::GENFUNCTION Int =
i - Mod1;
594 GeoXF::TRANSFUNCTION TX =
595 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),RhoPosB*Cos(PhiPos))*
596 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),RhoPosB*Sin(PhiPos))*
597 GeoXF::Pow(GeoTrf::TranslateZ3D(2*ZposB),Int(
i/128))*
598 GeoTrf::TranslateZ3D(-ZposB);
599 GeoSerialTransformer *st =
new GeoSerialTransformer(phys_vis, &TX, 2*Nvis);
600 innerWallPhys->add(st);
604 ATH_MSG_INFO(
" old description withut bold in the geometry database ");
611 larVersionKey.
node());
612 if (extraCones->size() > 0 ) {
615 const std::string& conName = cone->getString(
"CONE");
616 if (conName.find(
"ExtraInCryo") != std::string::npos) {
618 double extra_dz = 0.5*( cone->getDouble(
"DZ") );
619 double extra_rmin1 = cone->getDouble(
"RMIN1");
620 double extra_rmin2 = cone->getDouble(
"RMIN2");
621 double extra_rmax1 = cone->getDouble(
"RMAX1");
622 double extra_rmax2 = cone->getDouble(
"RMAX2");
623 double extra_phi0 = cone->getDouble(
"PHI0");
624 double extra_dphi = cone->getDouble(
"DPHI");
625 double extra_zpos = cone->getDouble(
"ZPOS");
629 if (extra_dphi>6.2831) extra_dphi = dphi_all;
634 =
new GeoCons(extra_rmin1,extra_rmin2,extra_rmax1,extra_rmax2,extra_dz,extra_phi0,extra_dphi);
636 std::ostringstream extraStream;
637 extraStream <<
"LAr::Barrel::Cryostat::ExtraMat" << nextra;
638 std::string extraName= extraStream.str();
641 GeoLogVol* extraLog =
new GeoLogVol(extraName,extraCons,Aluminium);
642 GeoIntrusivePtr<GeoPhysVol> extraPhys =
new GeoPhysVol(extraLog);
643 m_cryoMotherPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(extra_zpos)));
644 m_cryoMotherPhysical->add(extraPhys);
651 const GeoMaterial* myMaterial;
652 double length,height,
width,pairSeparation,distFromRidge;
653 int nPairTot,indexWall;
654 IRDBRecordset_ptr newBlocks = rdbAccess->getRecordsetPtr(
"LArBarBumperBlocks", larVersionKey.
tag(),larVersionKey.
node());
655 if (newBlocks->size() >0 ) {
657 const IRDBRecord * newBlocksRecord = (*newBlocks) [0];
659 height = newBlocksRecord->
getDouble(
"HEIGHT");
661 pairSeparation = newBlocksRecord->
getDouble(
"PAIRSEP");
662 distFromRidge = newBlocksRecord->
getDouble(
"DISTANCEFROMRIDGE");
663 nPairTot = newBlocksRecord->
getInt(
"NPAIRTOT");
664 indexWall = newBlocksRecord->
getInt(
"INDEXWALL");
667 throw std::runtime_error(
"Error in BarrelCryostatConstruction, material for coil bumpber not found");
673 const IRDBRecord * tiBlocksRecord = (*tiBlocks) [0];
675 height = tiBlocksRecord->
getDouble(
"HEIGHT");
677 pairSeparation = tiBlocksRecord->
getDouble(
"PAIRSEP");
678 distFromRidge = tiBlocksRecord->
getDouble(
"DISTANCEFROMRIDGE");
679 nPairTot = tiBlocksRecord->
getInt(
"NPAIRTOT");
686 if ((iter = innerWallPlanes.find(indexWall))!= innerWallPlanes.end()) {
687 const IRDBRecord * pconsRecord = (*cryoPcons) [(*iter).second];
696 GeoBox *box =
new GeoBox(
length/2.0, height/2.0,
width/2.0);
697 GeoLogVol *logVol =
new GeoLogVol(
"LAr::Barrel::Cryostat::Sector::TitaniumBlock", box,myMaterial);
698 GeoIntrusivePtr<GeoPhysVol>physVol =
new GeoPhysVol(logVol);
700 double angle=pairSeparation/
r;
703 if (newBlocks->size() >0) {
704 GeoGenfun::Variable
i;
705 GeoGenfun::Mod Mod1(1.0),Mod2(2.0);
706 GeoGenfun::GENFUNCTION Truncate =
i - Mod1(
i);
707 GeoGenfun::GENFUNCTION AngleZ = -
angle/2.+
angle*Truncate(Mod2(
i/2))+ 2.*
M_PI/(1.0*nPairTot)*Truncate(
i/4) + 2*
M_PI/(2.*nPairTot);
708 GeoGenfun::GENFUNCTION TransZ = -
pos + 2.*
pos*Mod2(
i);
711 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),TransZ)*
712 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),AngleZ)*
713 GeoTrf::Translate3D(0.,
r+height/2,0.);
714 GeoSerialTransformer *
t =
new GeoSerialTransformer(physVol, &
tx, nPairTot*4);
715 m_cryoMotherPhysical->add(
t);
719 GeoGenfun::Variable
i;
720 GeoGenfun::Mod Mod1(1.0),Mod2(2.0);
721 GeoGenfun::GENFUNCTION Truncate =
i - Mod1(
i);
724 Pow(GeoTrf::RotateZ3D(2*
M_PI/nPairTot),Truncate(
i/4))*
725 Pow(GeoTrf::RotateZ3D(
angle),Mod2(
i/2))*
726 GeoTrf::RotateZ3D(-
angle/2)*
727 Pow(GeoTrf::TranslateZ3D(2*
pos),Mod2(
i))*
728 GeoTrf::Translate3D(0,
r+height/2, -
pos);
729 GeoSerialTransformer *
t =
new GeoSerialTransformer(physVol, &
tx, nPairTot*4);
730 m_cryoMotherPhysical->add(
t);
735 ATH_MSG_WARNING(
" could not find wall index plane => no coil bumper description ");
742 if(!innerEndWallPlanes.empty()) {
743 GeoPcon *innerEndWallPcon =
new GeoPcon(0,dphi_all);
745 for(
unsigned int ind=0;
ind<innerEndWallPlanes.size();
ind++) {
746 iter = innerEndWallPlanes.find(
ind);
748 if(iter==innerEndWallPlanes.end())
749 throw std::runtime_error(
"Error in BarrelCryostatConstruction, missing plane in InnerEndWall");
751 currentRecord = (*cryoPcons)[(*iter).second];
752 innerEndWallPcon->addPlane(currentRecord->getDouble(
"ZPLANE"),
753 currentRecord->getDouble(
"RMIN"),
754 currentRecord->getDouble(
"RMAX"));
758 const GeoLogVol *innerEndWallLog =
new GeoLogVol(
"LAr::Barrel::Cryostat::InnerEndWall", innerEndWallPcon, Aluminium);
759 m_cryoMotherPhysical->add(
new GeoNameTag(std::string(
"Barrel Cryo InnerEndWall Phys")));
760 GeoIntrusivePtr<GeoPhysVol>innerEndWallPhys =
new GeoPhysVol(innerEndWallLog);
761 m_cryoMotherPhysical->add(innerEndWallPhys);
762 m_cryoMotherPhysical->add(
new GeoTransform(GeoTrf::RotateY3D(
M_PI)));
763 m_cryoMotherPhysical->add(innerEndWallPhys);
781 GeoPcon* totalLArShape =
785 for(
unsigned int ind=0;
ind<totalLarPlanes.size();
ind++)
787 iter = totalLarPlanes.find(
ind);
789 if(iter==totalLarPlanes.end())
790 throw std::runtime_error(
"Error in BarrelCryostatConstruction, missing plane in CryoMother");
793 currentRecord = (*cryoPcons)[(*iter).second];
794 totalLArShape->addPlane(currentRecord->getDouble(
"ZPLANE"),
795 currentRecord->getDouble(
"RMIN"),
796 currentRecord->getDouble(
"RMAX"));
800 std::string totalLArName =
"LAr::Barrel::Cryostat::TotalLAr";
801 const GeoLogVol* totalLArLogical =
new GeoLogVol(totalLArName, totalLArShape,
LAr);
806 m_cryoMotherPhysical->add(
new GeoNameTag(
"Total LAR Volume"));
807 GeoIntrusivePtr<GeoPhysVol> totalLArPhysical =
new GeoPhysVol(totalLArLogical);
808 m_cryoMotherPhysical->add(totalLArPhysical);
824 std::string halfLArName =
"LAr::Barrel::Cryostat::HalfLAr";
825 GeoPcon* halfLArShape =
831 for(
unsigned int ind=0;
ind<halfLarPlanes.size();
ind++)
833 iter = halfLarPlanes.find(
ind);
835 if(iter==halfLarPlanes.end())
836 throw std::runtime_error(
"Error in BarrelCryostatConstruction, missing plane in CryoMother");
839 currentRecord = (*cryoPcons)[(*iter).second];
840 halfLArShape->addPlane(currentRecord->getDouble(
"ZPLANE"),
841 currentRecord->getDouble(
"RMIN"),
842 currentRecord->getDouble(
"RMAX"));
847 const GeoLogVol* halfLArLogicalPos =
848 new GeoLogVol(halfLArName +
"::Pos", halfLArShape,
LAr);
849 GeoIntrusivePtr<GeoPhysVol> halfLArPhysicalPos =
new GeoPhysVol(halfLArLogicalPos);
851 const GeoLogVol* halfLArLogicalNeg =
852 new GeoLogVol(halfLArName +
"::Neg", halfLArShape,
LAr);
853 GeoIntrusivePtr<GeoPhysVol> halfLArPhysicalNeg =
new GeoPhysVol(halfLArLogicalNeg);
855 totalLArPhysical->add(
new GeoNameTag(halfLArName +
"::PosPhysical"));
858 totalLArPhysical->add(xfHalfLArPos);
859 totalLArPhysical->add(halfLArPhysicalPos);
861 totalLArPhysical->add(
new GeoNameTag(halfLArName +
"::NegPhysical"));
864 totalLArPhysical->add(xfHalfLArNeg);
865 totalLArPhysical->add(
new GeoTransform(GeoTrf::RotateY3D(180.*
Gaudi::Units::deg)) );
866 totalLArPhysical->add(halfLArPhysicalNeg);
880 GeoIntrusivePtr<GeoFullPhysVol> barrelPosEnvelope = barrelConstruction.
GetPositiveEnvelope();
881 if ( barrelPosEnvelope)
882 halfLArPhysicalPos->add(barrelPosEnvelope);
885 GeoIntrusivePtr<GeoFullPhysVol> barrelNegEnvelope = barrelConstruction.
GetNegativeEnvelope();
886 if ( barrelNegEnvelope)
887 halfLArPhysicalNeg->add(barrelNegEnvelope);
893 for (
unsigned int ind=0;
ind < cryoCylinders->size();
ind++) {
894 currentRecord = (*cryoCylinders)[
ind];
896 if(currentRecord->getString(
"CYL_LOCATION")==
"Barrel::HalfLAr"||
897 currentRecord->getString(
"CYL_LOCATION")==
"Barrel::TotalLAr") {
898 bool isHalfLar = currentRecord->getString(
"CYL_LOCATION")==
"Barrel::HalfLAr";
900 const GeoMaterial *material = materialManager->
getMaterial(currentRecord->getString(
"MATERIAL"));
903 std::ostringstream errorMessage;
904 errorMessage <<
"Error in BarrelCrysostat Construction" << std::endl;
905 errorMessage <<
"Material " << currentRecord->getString(
"MATERIAL") <<
" is not found" << std::endl;
906 throw std::runtime_error(errorMessage.str().c_str());
909 std::ostringstream cylStream;
910 cylStream <<
"LAr::Barrel::Cryostat::";
912 if (!currentRecord->isFieldNull(
"QUALIFIER")) {
913 const std::string& qualifier = currentRecord->getString(
"QUALIFIER");
914 if (!qualifier.empty()) cylStream << qualifier <<
"::";
916 cylStream <<
"Cylinder::#" << currentRecord->getInt(
"CYL_ID");
917 std::string cylName= cylStream.str();
919 GeoTubs* solidBarrelCylinder
926 const GeoLogVol* logicBarrelCylinder
927 =
new GeoLogVol(cylName,solidBarrelCylinder,material);
929 GeoIntrusivePtr<GeoPhysVol> physBarrelCylinder =
new GeoPhysVol(logicBarrelCylinder);
933 int cylNumber = currentRecord->getInt(
"CYL_NUMBER");
938 halfLArPhysicalPos->add(
new GeoNameTag(cylName+std::string(
"PhysForward")));
939 halfLArPhysicalPos->add(
new GeoIdentifierTag(cylNumber));
941 halfLArPhysicalPos->add(
new GeoTransform(GeoTrf::TranslateZ3D(zInCryostat)));
942 halfLArPhysicalPos->add(physBarrelCylinder);
944 halfLArPhysicalNeg->add(
new GeoNameTag(cylName+std::string(
"PhysBackward")));
945 halfLArPhysicalNeg->add(
new GeoIdentifierTag(cylNumber));
947 halfLArPhysicalNeg->add(
new GeoTransform(GeoTrf::TranslateZ3D(zInCryostat)));
948 halfLArPhysicalNeg->add(physBarrelCylinder);
950 totalLArPhysical->add(
new GeoNameTag(cylName+std::string(
"PhysForward")));
951 totalLArPhysical->add(
new GeoIdentifierTag(cylNumber));
952 totalLArPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zInCryostat)));
953 totalLArPhysical->add(physBarrelCylinder);
955 totalLArPhysical->add(
new GeoNameTag(cylName+std::string(
"PhysBackward")));
956 totalLArPhysical->add(
new GeoIdentifierTag(cylNumber));
957 totalLArPhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(-zInCryostat)));
958 totalLArPhysical->add(physBarrelCylinder);
973 GeoIntrusivePtr<GeoFullPhysVol> barrelPSPosEnvelope = barrelPSConstruction.
GetPositiveEnvelope();
974 GeoTransform *xfPos =
new GeoTransform(
GeoTrf::Transform3D(GeoTrf::TranslateZ3D(PresamplerMother_length+presamplerShift)));
976 halfLArPhysicalPos->add(xfPos);
978 halfLArPhysicalPos->add(barrelPSPosEnvelope);
982 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store PRESAMPLER_B_POS");
985 GeoIntrusivePtr<GeoFullPhysVol> barrelPSNegEnvelope = barrelPSConstruction.
GetNegativeEnvelope();
986 GeoTransform *xfNeg =
new GeoTransform(
GeoTrf::Transform3D(GeoTrf::TranslateZ3D(PresamplerMother_length+presamplerShift)));
988 halfLArPhysicalNeg->add(xfNeg);
990 halfLArPhysicalNeg->add(barrelPSNegEnvelope);
994 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store PRESAMPLER_B_NEG");
1000 IRDBRecordset_ptr cryoPconPhiSect = rdbAccess->getRecordsetPtr(
"CryoPconPhiSect", larVersionKey.
tag(),larVersionKey.
node());
1001 if ((*cryoPconPhiSect).size()!=0){
1002 for(
unsigned i=0;
i<cryoPconPhiSect->size(); ++
i) {
1003 double startPhi = (*cryoPconPhiSect)[
i]->getDouble(
"STARTPHI");
1004 double dPhi = (*cryoPconPhiSect)[
i]->getDouble(
"DPHI");
1005 double centerPhi = startPhi + 0.5*
dPhi;
1007 const GeoMaterial* material = materialManager->
getMaterial((*cryoPconPhiSect)[
i]->getString(
"MATERIAL"));
1009 std::string
message = std::string(
"Error in BarrelCryostatConstruction! ") + (*cryoPconPhiSect)[
i]->getString(
"MATERIAL") + std::string(
" is not found.");
1010 throw std::runtime_error(
message.c_str());
1015 for(
unsigned int ii=0; ii<sctEcCoolingPlanes.size(); ii++) {
1016 iter = sctEcCoolingPlanes.find(ii);
1018 if(iter==sctEcCoolingPlanes.end()) {
1019 std::ostringstream
stream;
1020 stream <<
"Error in BarrelCryostatConstruction, missing plane " << ii <<
" in SCT-EC cooling";
1021 throw std::runtime_error(
stream.str().c_str());
1024 currentRecord = (*cryoPcons)[(*iter).second];
1025 pcon->addPlane(currentRecord->getDouble(
"ZPLANE"),
1026 currentRecord->getDouble(
"RMIN"),
1027 currentRecord->getDouble(
"RMAX"));
1031 const GeoLogVol* sctCiCoolingLog =
new GeoLogVol(
"LAr::Barrel::Cryostat::SctCiCooling",pcon,material);
1032 GeoIntrusivePtr<GeoPhysVol> sctCiCoolingPhys =
new GeoPhysVol(sctCiCoolingLog);
1034 GeoTransform* xfPos1 =
new GeoTransform(GeoTrf::Transform3D::Identity());
1035 GeoTransform* xfPos2 =
new GeoTransform(GeoTrf::RotateZ3D(180*
Gaudi::Units::deg));
1039 m_cryoMotherPhysical->add(xfPos1);
1040 m_cryoMotherPhysical->add(sctCiCoolingPhys);
1041 m_cryoMotherPhysical->add(xfPos2);
1042 m_cryoMotherPhysical->add(sctCiCoolingPhys);
1043 m_cryoMotherPhysical->add(xfNeg1);
1044 m_cryoMotherPhysical->add(sctCiCoolingPhys);
1045 m_cryoMotherPhysical->add(xfNeg2);
1046 m_cryoMotherPhysical->add(sctCiCoolingPhys);
1050 ATH_MSG_DEBUG(
"CryoPconPhiSect table not found - not building SCT cooling ");
1054 if(!rdbAccess->getChildTag(
"LArBarrelDM",larVersionKey.
tag(),larVersionKey.
node()).empty() && m_fullGeo) {
1057 crackDMConstruction.
create(m_cryoMotherPhysical);
1060 return m_cryoMotherPhysical;