131 ISvcLocator *svcLocator = Gaudi::svcLocator();
133 ATH_MSG_DEBUG(
"++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
135 <<
"+ Start of Barrel EM GeoModel definition +\n"
137 <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
147 bool doDetailedAbsorberStraight =
false;
148 bool doDetailedAbsorberFold =
false;
150 SmartIF<IGeoModelSvc> geoModel{svcLocator->service (
"GeoModelSvc")};
151 if(!geoModel.isValid())
152 throw std::runtime_error(
"Error in BarrelConstruction, cannot access GeoModelSvc");
153 SmartIF<IRDBAccessSvc> rdbAccess{svcLocator->service (
"RDBAccessSvc")};
154 if(!rdbAccess.isValid())
155 throw std::runtime_error(
"Error in BarrelConstruction, cannot access RDBAccessSvc");
159 ATH_MSG_INFO(
"Getting primary numbers for " << larVersionKey.node() <<
", " << larVersionKey.tag());
161 IRDBRecordset_ptr switchSet = rdbAccess->getRecordsetPtr(
"LArSwitches", larVersionKey.tag(), larVersionKey.node());
162 if ((*switchSet).size() !=0) {
165 if (switches->
getInt(
"DETAILED_ABSORBER") !=0) {
167 doDetailedAbsorberStraight =
true;
168 doDetailedAbsorberFold =
true;
179 ATH_MSG_INFO(
" Makes detailed absorber sandwich ? " << doDetailedAbsorberStraight <<
" " << doDetailedAbsorberFold);
184 GeoGenfun::Sqrt Sqrt;
185 GeoGenfun::ATan ATan;
188 double twopi32 = 2.*twopi64;
191 SmartIF<StoreGateSvc>
detStore{svcLocator->service(
"DetectorStore")};
193 throw std::runtime_error(
"Error in LArDetectorFactory, cannot access DetectorStore");
198 if (StatusCode::SUCCESS !=
detStore->retrieve(materialManager, std::string(
"MATERIALS"))) {
199 throw std::runtime_error(
"Error in BarrelConstruction, stored MaterialManager is not found.");
202 const GeoMaterial *Iron = materialManager->
getMaterial(
"std::Iron");
203 if (!Iron)
throw std::runtime_error(
"Error in BarrelConstruction, std::Iron is not found.");
205 const GeoMaterial *
LAr = materialManager->
getMaterial(
"std::LiquidArgon");
206 if (!
LAr)
throw std::runtime_error(
"Error in BarrelConstruction, std::LiquidArgon is not found.");
208 const GeoMaterial *Lead = materialManager->
getMaterial(
"std::Lead");
209 if (!Lead)
throw std::runtime_error(
"Error in BarrelConstruction, std::Lead is not found.");
211 const GeoMaterial *G10_bar = materialManager->
getMaterial(
"LAr::G10_bar");
212 if (!G10_bar)
throw std::runtime_error(
"Error in BarrelConstruction, LAr::G10_bar is not found.");
214 const GeoMaterial *Moth_elect = materialManager->
getMaterial(
"LAr::MBoards");
215 if (!Moth_elect)
throw std::runtime_error(
"Error in BarrelConstruction, LAr::MBoards is not found.");
217 const GeoMaterial *Cable_elect = materialManager->
getMaterial(
"LAr::Cables");
218 if (!Cable_elect)
throw std::runtime_error(
"Error in BarrelConstruction, LAr::Cables is not found.");
220 const GeoMaterial *Thin_abs = materialManager->
getMaterial(
"LAr::Thinabs");
221 if (!Thin_abs)
throw std::runtime_error(
"Error in BarrelConstruction, LAr::Thinabs is not found.");
223 const GeoMaterial *Thick_abs = materialManager->
getMaterial(
"LAr::Thickabs");
224 if (!Thick_abs)
throw std::runtime_error(
"Error in BarrelConstruction, LAr::Thickabs is not found.");
226 const GeoMaterial *Kapton_Cu = materialManager->
getMaterial(
"LAr::KaptonC");
227 if (!Kapton_Cu)
throw std::runtime_error(
"Error in BarrelConstruction, LAr::KaptonC is not found.");
229 const GeoMaterial *Sumb = materialManager->
getMaterial(
"LAr::SBoard");
230 if (!Sumb)
throw std::runtime_error(
"Error in BarrelConstruction, LAr::SBoard is not found.");
232 const GeoMaterial *Glue = materialManager->
getMaterial(
"LAr::Glue");
233 if (!Glue)
throw std::runtime_error(
"Error in BarrelConstruction, LAr::Glue is not found.");
235 const GeoElement *Pb = materialManager->
getElement(
"Lead");
236 if (!Pb)
throw std::runtime_error(
"Error in BarrelConstruction, element lead not found ");
238 const GeoElement *Fe = materialManager->
getElement(
"Iron");
239 if (!Fe)
throw std::runtime_error(
"Error in BarrelConstruction, element Fe not found ");
257 std::cout <<
"*** BarrelConstruction: List of Materials, density,X0,Lambda " << std::endl;
258 std::cout <<
" Iron " << Iron->getDensity() <<
" "
259 << Iron->getRadLength() <<
" "
260 << Iron->getIntLength() << std::endl;
261 std::cout <<
" LAR " <<
LAr->getDensity() <<
" "
262 <<
LAr->getRadLength() <<
" "
263 <<
LAr->getIntLength() << std::endl;
264 std::cout <<
" G10_bar " << G10_bar->getDensity() <<
" "
265 << G10_bar->getRadLength() <<
" "
266 << G10_bar->getIntLength() << std::endl,
267 std::cout <<
" Moth_elect " << Moth_elect->getDensity() <<
" "
268 << Moth_elect->getRadLength() <<
" "
269 << Moth_elect->getIntLength() << std::endl;
270 std::cout <<
" Cable " << Cable_elect->getDensity() <<
" "
271 << Cable_elect->getRadLength() <<
" "
272 << Cable_elect->getIntLength() << std::endl;
273 std::cout <<
" Sumb " << Sumb->getDensity() <<
" "
274 << Sumb->getRadLength() <<
" "
275 << Sumb->getIntLength() << std::endl;
276 std::cout <<
" Thin_abs " << Thin_abs->getDensity() <<
" "
277 << Thin_abs->getRadLength() <<
" "
278 << Thin_abs->getIntLength() << std::endl;
279 std::cout <<
" Thick_abs " << Thick_abs->getDensity() <<
" "
280 << Thick_abs->getRadLength() <<
" "
281 << Thick_abs->getIntLength() << std::endl;
282 std::cout <<
" Kapton_Cu " << Kapton_Cu->getDensity() <<
" "
283 << Kapton_Cu->getRadLength() <<
" "
284 << Kapton_Cu->getIntLength() << std::endl;
286 std::string baseName =
"LAr::EMB::";
301 double Moth_Phi_Min = 0.;
305 std::cout <<
" *** Mother volume (Ecam) parameters " << std::endl;
306 std::cout <<
" Rmin/Rmax " << Moth_inner_radius <<
" " << Moth_outer_radius << std::endl;
307 std::cout <<
" Zmin/Zmax " << Moth_Z_min <<
" " << Moth_Z_max << std::endl;
315 double Bar_Z_min = Moth_Z_min;
316 double Bar_Z_max = Moth_Z_max;
325 std::cout <<
" Bar_Eta_cut " << Bar_Eta_cut << std::endl;
328 double Bar_Z_cut, Bar_Rcmx ;
338 double Zhalf = (Bar_Z_max-Bar_Z_min)/2.;
340 double Zhalfc = (Bar_Z_cut-Bar_Z_min)/2.;
348 double Rhocen[15], Phicen[15], Delta[15], deltay[15], deltax[15], TetaTrans[15];
349 for (
int idat=0; idat<15; idat++)
375 TetaTrans[idat] = 2.*
atan(
exp(-etaTrans));
377 ATH_MSG_DEBUG(
"idat " << idat <<
" Rhocen/Phice/Delta/deltay/deltax/etatrans "
379 << Delta[idat]*(1./
Gaudi::Units::deg) <<
" " << deltay[idat] <<
" " << deltax[idat]
385 if (Phicen[0]<0.) checkParity=1;
389 int Nabsorber = (Ncell==64) ? Ncell + 1 : Ncell;
390 int Nelectrode = Ncell;
397 ATH_MSG_WARNING(
"================LAr BarrelConstruction===========================\n"
398 <<
"===YOU ARE RUNNING WITH A LIMITED SLICE OF BARREL ACCORDEON ===\n"
399 <<
"===THIS OPTION IS FOR VISUALIZATION OR OTHER TESTING, ONLY!! ===\n"
400 <<
"===AND IF THIS IS NOT YOUR INTENTION PLEASE BE SURE TO SET ===\n"
401 <<
"===THE FLAG GeoModelSvc.LArDetectorTool.BarrelCellVisLimit=-1 ===\n"
402 <<
"===Remember there are no defaults in Athena. Thank you. ===\n"
403 <<
"=================================================================");
410 const double r1 = Moth_inner_radius
415 const double inv_r2_r1 = 1. / (
r2-
r1);
418 double zmax1_Stac = z1 + (Rhocen[0]-
r1)*(Moth_Z_max-z1)*inv_r2_r1;
436 double Zplan[] = {Bar_Z_min-Zp0,Bar_Z_cut-Zp0,Bar_Z_max-Zp0};
437 double Riacc[] = {Moth_inner_radius,Moth_inner_radius, Rhocen1-safety_rhocen1};
438 double Roacc[] = {Moth_outer_radius,Moth_outer_radius,Moth_outer_radius};
441 std::cout <<
" *** Parameters for ECAM Pcon volume " << std::endl;
442 std::cout <<
" Zplan " << Zplan[0] <<
" " << Zplan[1] <<
" " << Zplan[2] << std::endl;
443 std::cout <<
" Rin " << Riacc[0] <<
" " << Riacc[1] <<
" " << Riacc[2] << std::endl;
444 std::cout <<
" Rout " << Roacc[0] <<
" " << Roacc[1] <<
" " << Roacc[2] << std::endl;
447 int ecamArraySize =
sizeof(Zplan) /
sizeof(
double);
448 std::string
name = baseName +
"ECAM";
449 GeoPcon* pCon =
new GeoPcon(Moth_Phi_Min2,
452 for (
int i=0;
i< ecamArraySize;
i++)
454 pCon->addPlane(Zplan[
i],Riacc[
i],Roacc[
i]);
456 const GeoLogVol* logVol =
new GeoLogVol(
name,pCon,
LAr);
466 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store EMB_POS");
471 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store EMB_NEG");
481 #ifdef BUILD_FRONT_ELECTRONICS
487 GeoIntrusivePtr<GeoPhysVol>Elnicsf_phys=
nullptr;
493 double DeltaZ = Zhalfc;
494 double Zpos = Zhalfc+Bar_Z_min;
497 std::string
name = baseName +
"TELF";
499 std::cout <<
" *** parameters for TELF tubs " << std::endl;
500 std::cout <<
" DeltaZ " << DeltaZ << std::endl;
501 std::cout <<
" Rmin/Rmax " << Rmini <<
" " << Rmaxi << std::endl,
503 std::cout <<
" Zpos in ECAM " << Zpos << std::endl;
505 GeoTubs* tubs =
new GeoTubs(Rmini,
510 const GeoLogVol* logVol =
new GeoLogVol(
name,tubs,
LAr);
511 Elnicsf_phys =
new GeoPhysVol(logVol);
523 GeoIntrusivePtr<GeoPhysVol>Sumb_phys=
nullptr;
526 double Rmini = Moth_inner_radius+Xel1f-ThickSum;
528 double DeltaZ = Zhalfc;
530 std::string
name = baseName +
"SUMB";
532 std::cout <<
" *** parameters for SUMB tubs " << std::endl;
533 std::cout <<
" DeltaZ " << DeltaZ << std::endl;
534 std::cout <<
" Rmin/Rmax " << Rmini <<
" " << Rmaxi << std::endl,
536 std::cout <<
" Zpos in TELF " << Zpos << std::endl;
539 GeoTubs * tubs =
new GeoTubs(Rmini,Rmaxi,DeltaZ,Moth_Phi_Min,Moth_Phi_Max);
540 const GeoLogVol* logVol =
new GeoLogVol(
name,tubs,Sumb);
541 Sumb_phys =
new GeoPhysVol(logVol);
542 Elnicsf_phys->add(
new GeoTransform(GeoTrf::TranslateZ3D(Zpos)));
543 Elnicsf_phys->add(Sumb_phys);
550 double RhoPosB = Moth_inner_radius + ClearancePS;
560 double PhiPos0 = twopi64 + PhiOrig;
562 std::string
name = baseName +
"MOAC";
564 std::cout <<
" *** parameters for MotherBoard (box)" << std::endl;
565 std::cout <<
" dx,dy,dz " << bdx <<
" " << bdy <<
" " << bdz << std::endl;
566 std::cout <<
" Radius pos " << RhoPosB << std::endl;
569 GeoBox * box =
new GeoBox(bdx,bdy,bdz);
570 const GeoLogVol * logVol =
new GeoLogVol(
name,box,Moth_elect);
571 GeoPhysVol * pV =
new GeoPhysVol(logVol);
572 GeoSerialIdentifier * iD =
new GeoSerialIdentifier(0);
573 GeoGenfun::Variable
c;
574 GeoGenfun::GENFUNCTION PhiPos = PhiPos0 + twopi32*
c;
575 GeoXF::TRANSFUNCTION TX =
576 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),RhoPosB*Cos(PhiPos))*
577 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),RhoPosB*Sin(PhiPos))*
578 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),PhiPos);
579 GeoSerialTransformer *st =
new GeoSerialTransformer(pV, &TX, NoOFboard);
580 Elnicsf_phys->add(iD);
581 Elnicsf_phys->add(st);
604 double RhoPosC = Moth_inner_radius + ClearancePS;
606 std::string
name = baseName +
"CAAC";
608 std::cout <<
" *** Parameters for Cable (Trap) " << std::endl;
609 std::cout <<
" Dzc " << Dzc << std::endl;
610 std::cout <<
" Dx1,Dx2 (half thickness at eta=0 and etamax " << Dx1 <<
" " << Dx2 << std::endl;
611 std::cout <<
" Dy1,Dy2 " << Dy1 <<
" " << Dy2 << std::endl;
612 std::cout <<
" Radial Position " << RhoPosC << std::endl;
615 GeoTrap* trap =
new GeoTrap(Dzc,0.,0.,Dy1,Dx1,Dx1,0.,
617 const GeoLogVol* logVol =
new GeoLogVol(
name,trap,Cable_elect);
619 GeoPhysVol * pV =
new GeoPhysVol(logVol);
620 GeoSerialIdentifier * iD =
new GeoSerialIdentifier(0);
621 double PhiPos0 = (twopi64 - asin(bdy/RhoPosB))/2.;
623 std::cout <<
" PhiPos0 " << PhiPos0 << std::endl;
625 GeoGenfun::Variable
I;
628 GeoGenfun::Rectangular KDelta;
629 KDelta.baseline().setValue(0.0);
630 KDelta.height().setValue(1.0);
631 KDelta.x0().setValue(-0.5);
632 KDelta.x1().setValue(0.5);
635 GeoGenfun::Mod Mod1(1.0),Mod2(2.0),Mod4(4.0);
636 GeoGenfun::GENFUNCTION Int =
I - Mod1;
637 GeoGenfun::GENFUNCTION Ccopy = Int(I + 0.5);
639 GeoGenfun::GENFUNCTION PhiPos1 = PhiPos0 + PhiOrig;
640 GeoGenfun::GENFUNCTION PhiPos2 = twopi32 - PhiPos0 + PhiOrig;
641 GeoGenfun::GENFUNCTION PhiPos00 =
642 (KDelta(Mod4(Ccopy)-2) + KDelta(Mod4(Ccopy)-3))*PhiPos2 +
643 (1.0-KDelta(Mod4(Ccopy)-2)-KDelta(Mod4(Ccopy)-3))*PhiPos1;
644 GeoGenfun::GENFUNCTION PhiPos = PhiPos00 + Mod2(Ccopy)*twopi32;
645 GeoXF::TRANSFUNCTION TX =
646 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),RhoPosC*Cos(PhiPos))*
647 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),RhoPosC*Sin(PhiPos))*
648 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),PhiPos);
649 GeoSerialTransformer *st =
new GeoSerialTransformer(pV, &TX, NoOFcable);
651 for (
int ii=0;ii<NoOFcable;ii++) {
652 std::cout <<
"copy, phi " << ii <<
" " << PhiPos(ii)/
Gaudi::Units::deg << std::endl;
655 Elnicsf_phys->add(iD);
656 Elnicsf_phys->add(st);
661 #endif // BUILD_FRONT_ELECTRONICS
668 #ifdef BUILD_HIGHETA_ELECTRONICS
680 double ze1= zmax1_Stac+clearance;
681 double ze2 = Bar_Z_max;
683 double DeltaZ = 0.5*(ze2-ze1)-safety;
684 double Zpos = ze1+DeltaZ+0.5*safety;
689 std::string
name = baseName +
"TELB";
691 std::cout <<
" *** Parameters for high eta electronics (Cons) " <<std::endl;
692 std::cout <<
" Rmini1,Rmini2,Rmaxi1,Rmaxi2 " << Rmini1 <<
" " << Rmini2 <<
" "
693 << Rmaxi1 <<
" " << Rmaxi2 << std::endl,
694 std::cout <<
" DeltaZ " << DeltaZ << std::endl;
696 std::cout <<
" Zpos " << Zpos << std::endl;
698 GeoCons* cons =
new GeoCons(Rmini1,Rmini2,Rmaxi1,Rmaxi2,
699 DeltaZ,Moth_Phi_Min,Moth_Phi_Max);
700 const GeoLogVol* logVol =
new GeoLogVol(
name,cons,Cable_elect);
701 GeoIntrusivePtr<GeoPhysVol> physVol =
new GeoPhysVol(logVol);
710 #endif // BUILD_HIGHETA_ELECTRONICS
717 #ifdef BUILD_FRONT_G10
725 double Zpos = DeltaZ+Bar_Z_min;
726 double Rmini = Moth_inner_radius + Xel1f;
727 double Rmaxi = Rmini+Xg10f;
728 std::string
name = baseName +
"GTENF";
730 std::cout <<
" *** parameters for front G10 ring (tubs) " << std::endl;
731 std::cout <<
" Rmini,Rmaxi " << Rmini <<
" " << Rmaxi << std::endl;
732 std::cout <<
" DeltaZ " << DeltaZ << std::endl;
734 std::cout <<
" Zpos " << Zpos << std::endl;
736 GeoTubs* tubs =
new GeoTubs(Rmini,Rmaxi,DeltaZ,Moth_Phi_Min,Moth_Phi_Max);
737 const GeoLogVol* logVol =
new GeoLogVol(
name,tubs,G10_bar);
738 GeoIntrusivePtr<GeoPhysVol> physVol =
new GeoPhysVol(logVol);
746 larVersionKey.node());
747 if (extraCones->size() > 0 ) {
749 const std::string& conName = cone->getString(
"CONE");
750 if (conName==
"ExtraInBar") {
751 double extra_dz = 0.5*( cone->getDouble(
"DZ") );
752 double extra_rmin1 = cone->getDouble(
"RMIN1");
753 double extra_rmin2 = cone->getDouble(
"RMIN2");
754 double extra_rmax1 = cone->getDouble(
"RMAX1");
755 double extra_rmax2 = cone->getDouble(
"RMAX2");
756 double extra_phi0 = cone->getDouble(
"PHI0");
757 double extra_dphi = cone->getDouble(
"DPHI");
758 double extra_zpos = cone->getDouble(
"ZPOS");
760 std::string
name = baseName +
"ExtraMat1";
761 GeoCons* cons =
new GeoCons(extra_rmin1,extra_rmin2,extra_rmax1,extra_rmax2,
762 extra_dz,extra_phi0,extra_dphi);
763 const GeoLogVol* logVol =
new GeoLogVol(
name,cons,Lead);
764 GeoIntrusivePtr<GeoPhysVol> physVol2 =
new GeoPhysVol(logVol);
765 physVol->add(
new GeoTransform(GeoTrf::TranslateZ3D(extra_zpos)));
766 physVol->add(physVol2);
773 #endif // BUILD_FRONT_G10
775 #ifdef BUILD_BACK_G10
779 double DeltaZ = Zhalf;
780 double Zpos = Zhalf+Bar_Z_min;
782 double Rmini = Rhocen[Nbrt]+Xtal;
787 std::string
name = baseName +
"GTENB";
789 std::cout <<
" *** parameters for back G10 ring (tubs) " << std::endl;
790 std::cout <<
" Rmini,Rmaxi " << Rmini <<
" " << Rmaxi << std::endl;
791 std::cout <<
" DeltaZ " << DeltaZ << std::endl;
793 std::cout <<
" Zpos " << Zpos << std::endl;
796 GeoTubs* tubs =
new GeoTubs(Rmini,Rmaxi,DeltaZ,Moth_Phi_Min,Moth_Phi_Max);
797 const GeoLogVol* logVol =
new GeoLogVol(
name,tubs,G10_bar);
798 GeoIntrusivePtr<GeoPhysVol> physVol =
new GeoPhysVol(logVol);
805 #endif // BUILD_BACK_G10
808 GeoIntrusivePtr<GeoPhysVol>stacPhysical=
nullptr;
819 double Zplan1[] = {Bar_Z_min,zmax1_Stac+clearance,Bar_Z_max};
820 double Riacc1[] = {Rhocen[0],Rhocen[0], Bar_Rcmx-clearance};
821 double Roacc1[] = {Rhocen[Nbrt],Rhocen[Nbrt],Rhocen[Nbrt]};
823 std::string
name = baseName +
"STAC";
825 std::cout <<
" *** Parameters for STAC Pcon volume " << std::endl;
826 std::cout <<
" Zplan " << Zplan1[0] <<
" " << Zplan1[1] <<
" " << Zplan1[2] << std::endl;
827 std::cout <<
" Rin " << Riacc1[0] <<
" " << Riacc1[1] <<
" " << Riacc1[2] << std::endl;
828 std::cout <<
" Rout " << Roacc1[0] <<
" " << Roacc1[1] <<
" " << Roacc1[2] << std::endl;
830 std::cout <<
" Zpos " << -Zp0 << std::endl;
832 GeoPcon* pCone =
new GeoPcon(Moth_Phi_Min2,Moth_Phi_Max2);
833 for (
int i=0;
i<3;
i++) pCone->addPlane(Zplan1[
i],Riacc1[
i],Roacc1[
i]);
834 const GeoLogVol* logVol =
new GeoLogVol(
name,pCone,
LAr);
835 stacPhysical =
new GeoPhysVol(logVol);
843 #ifdef BUILD_ACCORDION_PLATES
860 double Thce = (Thpb+Thgl+Thfe)*Contract;
861 double Thel = Thcu+Thfg;
865 double Zmin = Bar_Z_min;
866 double Zmax = Bar_Z_max;
880 double Zcp1l[14]={},Zcp1h[14]={},Zcp2l[14]={},Zcp2h[14]={};
881 double Rhol[14]={},Rhoh[14]={};
888 double Cenx[15]={0}, Ceny[15]={0} ;
889 for (
int jf=0; jf<(Nbrt+1); jf++)
891 Cenx[jf] = Rhocen[jf]*
cos(Phicen[jf]);
892 Ceny[jf] = Rhocen[jf]*
sin(Phicen[jf]);
893 Zcp1[jf] = Rhocen[jf]/
tan(TetaTrans[jf]);
895 Zcp2[jf] = z1 + (Rhocen[jf]-
r1)*inv_r2_r1*(Moth_Z_max-z1);
900 std::cout <<
" jf " << jf
901 <<
"Cenx/Ceny " << Cenx[jf] <<
" " << Ceny[jf] <<
" "
902 <<
"Zcp1/Zcp2 " << Zcp1[jf] <<
" " << Zcp2[jf] << std::endl;
909 for (
int jl=0; jl<Nbrt; jl++)
911 double Adisc2 = (Cenx[jl+1]-Cenx[jl])*(Cenx[jl+1]-Cenx[jl])+
912 (Ceny[jl+1]-Ceny[jl])*(Ceny[jl+1]-Ceny[jl]);
913 double Along2 = Adisc2 - 4.*Rint*Rint;
914 Along[jl] = sqrt(Along2);
916 std::cout <<
"jl " << jl
917 <<
"straight length " << Along[jl] << std::endl;
919 double ddelta =
M_PI/2.-Delta[jl];
921 if (checkParity==0) {
922 if (jl%2==1) ddelta=-1.*ddelta;
924 if (jl%2==0) ddelta=-1.*ddelta;
926 double xlong=Along[jl]-2.*safety_along;
927 double x2=0.5*(Cenx[jl+1]+Cenx[jl])+0.5*xlong*
cos(ddelta);
928 double y2=0.5*(Ceny[jl+1]+Ceny[jl])+0.5*xlong*
sin(ddelta);
929 double x1=0.5*(Cenx[jl+1]+Cenx[jl])-0.5*xlong*
cos(ddelta);
930 double y1=0.5*(Ceny[jl+1]+Ceny[jl])-0.5*xlong*
sin(ddelta);
933 Zcp1l[jl] = Rhol[jl]/
tan(TetaTrans[jl]);
934 Zcp1h[jl] = Rhoh[jl]/
tan(TetaTrans[jl+1]);
936 Zcp2l[jl] = z1 + (Rhol[jl]-
r1)*inv_r2_r1*(Moth_Z_max-z1);
938 Zcp2l[jl]=Moth_Z_max;
940 Zcp2h[jl] = z1 + (Rhoh[jl]-
r1)*inv_r2_r1*(Moth_Z_max-z1);
942 Zcp2h[jl]=Moth_Z_max;
944 std::cout <<
"x1,y1,x2,y2 " <<
x1 <<
" " <<
y1 <<
" " <<
x2 <<
" "
946 std::cout <<
" lower/upper radius " << Rhol[jl] <<
" " << Rhoh[jl]
947 <<
" Z for eta0.8 " << Zcp1l[jl] <<
" " << Zcp1h[jl]
948 <<
" Z for etamax " << Zcp2l[jl] <<
" " << Zcp2h[jl] << std::endl;
956 GeoGenfun::Variable icopy;
957 GeoGenfun::GENFUNCTION Game = Gama0 + Psi/2 + Alfa*icopy;
958 GeoGenfun::GENFUNCTION Gama = Gama0 + Alfa*icopy;
963 enum FB {FRONT, BACK, TERM};
965 for (
int fb=FRONT; fb!=TERM; fb++)
968 int irl = fb==FRONT ? 0 : Nbrt;
970 double Xtips = Xtip_pb + Xtip_gt;
971 double Xtipt = Xtip_pc + Xtip_gs;
975 double radius = fb==FRONT ? Cenx[0] - Xtip_pb/2 : Cenx[Nbrt] + Xtipt/2;
977 double Zhalfb = fb==FRONT ? (Bar_Z_cut-
Zmin)/2. : (
Zmax-
Zmin)/2.;
980 std::string
name = baseName +
"FrontBack::Absorber";
981 GeoBox *box =
new GeoBox(Xhalfb,Thce/2,Zhalfb);
982 GeoBox *box2 =
new GeoBox(Xhalfb,Thce/2,dz01);
983 const GeoLogVol *logVol =
new GeoLogVol(
name,box,Thin_abs);
984 const GeoLogVol *logVol2 =
new GeoLogVol(
name,box2,Thick_abs);
985 GeoIntrusivePtr<GeoPhysVol> physVol =
new GeoPhysVol(logVol);
986 GeoIntrusivePtr<GeoPhysVol> physVol2 =
new GeoPhysVol(logVol2);
987 physVol->add(
new GeoTransform(GeoTrf::Translate3D(0.,0.,dz01-Zhalfb)));
988 physVol->add(physVol2);
989 GeoGenfun::GENFUNCTION Xcd =
radius*Cos(Gama);
990 GeoGenfun::GENFUNCTION Ycd =
radius*Sin(Gama);
991 GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(
Zmin+Zhalfb);
994 GeoXF::TRANSFUNCTION TX =
995 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
996 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
997 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
998 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama);
999 GeoSerialTransformer *st =
new GeoSerialTransformer(physVol, &TX, Nabsorber);
1003 if (fb==FRONT) std::cout <<
" *** Front tip Absorber " << std::endl;
1004 else std::cout <<
" *** Back tip Absorber " << std::endl;
1005 std::cout <<
" Thin Abs Box " << Xhalfb <<
" " << Thce/2. <<
" " << Zhalfb << std::endl;
1006 std::cout <<
" Thick Abs Box " << Xhalfb <<
" " << Thce/2. <<
" " << dz01 << std::endl;
1007 std::cout <<
" Z position thick in thin " << dz01-Zhalfb << std::endl;
1008 std::cout <<
" Radial position " <<
radius << std::endl;
1009 std::cout <<
" Phi0 (Gaudi::Units::deg) " << Gama(0)/
Gaudi::Units::deg << std::endl;
1010 std::cout <<
" Z position in ECAM " <<
Zmin+Zhalfb << std::endl;
1017 double radiusg = Cenx[0]-Xtip_pb/2. - Xtips/2 ;
1018 double Zhalfbg = (Bar_Z_cut-
Zmin)/2. ;
1019 std::string
name = baseName +
"FrontBack::G10";
1021 std::cout <<
" *** Front tip G10 " << std::endl;
1022 std::cout <<
" Box parameters " << Xhalfbg <<
" " << Thce/2. <<
" " << Zhalfbg << std::endl;
1024 GeoBox *box =
new GeoBox(Xhalfbg,Thce/2,Zhalfbg);
1025 const GeoLogVol *logVol =
new GeoLogVol(
name,box,G10_bar);
1026 GeoPhysVol *physVol =
new GeoPhysVol(logVol);
1028 #ifdef BUILD_FRONT_STEEL
1031 name = baseName +
"FrontBack::Steel";
1034 std::cout <<
" Iron Box parameters " << Xhalfbg
1035 <<
" " << Tgfe/4. <<
" " << Zhalfbg << std::endl;
1037 GeoBox *box2 =
new GeoBox(Xhalfbg,Tgfe/4.,Zhalfbg);
1038 const GeoLogVol *logVol2 =
new GeoLogVol(
name,box2,Iron);
1039 GeoIntrusivePtr<GeoPhysVol>physVol2 =
new GeoPhysVol(logVol2);
1041 std::cout <<
" Position Iron in G10 at y = +- " << 0.5*(+Thce-Tgfe/2.) << std::endl;
1043 physVol->add(
new GeoTransform(GeoTrf::Translate3D(0.,0.5*(-Thce+Tgfe/2.),0.)));
1044 physVol->add(physVol2);
1045 physVol->add(
new GeoTransform(GeoTrf::Translate3D(0.,0.5*(+Thce-Tgfe/2.),0.)));
1046 physVol->add(physVol2);
1047 #endif // build_front_steel
1050 GeoGenfun::GENFUNCTION Xcd = radiusg*Cos(Gama);
1051 GeoGenfun::GENFUNCTION Ycd = radiusg*Sin(Gama);
1052 GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(Zhalfbg+
Zmin);
1053 GeoXF::TRANSFUNCTION TX =
1054 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
1055 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
1056 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
1057 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama);
1058 GeoSerialTransformer *st =
new GeoSerialTransformer(physVol, &TX, Nabsorber);
1062 std::cout <<
" Radial position G10 tip " << radiusg << std::endl;
1063 std::cout <<
" Phi0 (Gaudi::Units::deg)" << Gama(0)/
Gaudi::Units::deg << std::endl;
1064 std::cout <<
" Zposition in ECAM " <<
Zmin+Zhalfbg << std::endl;
1071 double Zhalfbe = fb==FRONT ? (Bar_Z_cut-
Zmin)/2. : (
Zmax -
Zmin)/2;
1072 double radiuse = fb==FRONT ? Cenx[0] - Xtips/2 : Cenx[Nbrt] + Xtipt/2;
1073 std::string
name = baseName +
"FrontBack::Electrode";
1074 GeoBox *box =
new GeoBox(Xhalfbe,Thel/2,Zhalfbe);
1075 const GeoLogVol *logVol =
new GeoLogVol(
name,box,Kapton_Cu);
1076 GeoIntrusivePtr<GeoPhysVol> physVol =
new GeoPhysVol(logVol);
1077 GeoGenfun::GENFUNCTION Xcd = radiuse*Cos(Game);
1078 GeoGenfun::GENFUNCTION Ycd = radiuse*Sin(Game);
1079 GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(
Zmin+Zhalfbe);
1081 GeoXF::TRANSFUNCTION TX =
1082 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
1083 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
1084 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
1085 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Game);
1087 GeoSerialTransformer *st =
new GeoSerialTransformer(physVol, &TX, Nelectrode);
1092 if (fb==FRONT) std::cout <<
" *** Front tip electrode " << std::endl;
1093 else std::cout <<
" *** Back tip electrode " << std::endl;
1094 std::cout <<
" Box " << Xhalfbe <<
" " << Thel/2. <<
" " << Zhalfbe << std::endl;
1095 std::cout <<
" Radial position " << radiuse << std::endl;
1096 std::cout <<
" Phi0 (Gaudi::Units::deg)" << Game(0)/
Gaudi::Units::deg << std::endl;
1097 std::cout <<
" Z position in ECAM " <<
Zmin+Zhalfbe << std::endl;
1115 for(
int irl=0; irl<Nbrt; irl++)
1118 std::cout <<
" ----- irl = " << irl << std::endl;
1122 if (checkParity==0) {
1123 iparit= (1-2*(irl%2));
1125 iparit=(2*(irl%2)-1);
1129 double Zcon1 = Zcp2[irl];
1130 double Zcon2 = Zcp2[irl+1];
1134 if (irl>0 && Rhoh[irl-1] < Bar_Rcmx) Zcon1=Zcp2h[irl-1];
1135 if (Rhoh[irl] < Bar_Rcmx) Zcon2=Zcp2h[irl];
1146 if (Rhocen[irl] < Bar_Rcmx && Rhocen[irl+1] > Bar_Rcmx) {
1148 std::cout <<
" Divide section in two pieces at r= " << Bar_Rcmx << std::endl;
1153 for (
int idivi=0;idivi<ndivi;idivi++) {
1167 frac=(Bar_Rcmx-Rhol[irl])/(Rhoh[irl]-Rhol[irl]);
1172 frac=(Rhoh[irl]-Bar_Rcmx)/(Rhoh[irl]-Rhol[irl]);
1175 std::cout <<
" Division " << idivi <<
" fraction of straight section " <<
frac << std::endl;
1179 tl1=tl1-safety_zlen;
1180 bl1=bl1-safety_zlen;
1186 double Dz = Thce/2.;
1189 GeoGenfun::GENFUNCTION x1a =
LArGeo::Fx(irl+0., Gama, Cenx, Ceny)
1192 GeoGenfun::GENFUNCTION x2a =
LArGeo::Fx(irl+1., Gama, Cenx, Ceny)
1195 GeoGenfun::GENFUNCTION y1a =
LArGeo::Fy(irl+0., Gama, Cenx, Ceny)
1198 GeoGenfun::GENFUNCTION y2a =
LArGeo::Fy(irl+1., Gama, Cenx, Ceny)
1201 GeoGenfun::GENFUNCTION
dx = x2a - x1a;
1202 GeoGenfun::GENFUNCTION
dy = y2a - y1a;
1206 GeoGenfun::GENFUNCTION Da = Sqrt (
dx*
dx +
dy*
dy );
1207 GeoGenfun::GENFUNCTION da = Sqrt ( (Da - 2.*Rint)*(Da + 2.*Rint) );
1210 GeoGenfun::GENFUNCTION cosalfa = (da*
dx -iparit*2.*Rint*
dy)/Da/Da;
1211 GeoGenfun::GENFUNCTION sinalfa = (da*
dy +iparit*2.*Rint*
dx)/Da/Da;
1212 GeoGenfun::GENFUNCTION newalpha =
LArGeo::ATan2(sinalfa,cosalfa);
1216 double Zx0 = (tl1+bl1)/2.;
1222 Xb1 = (Zcp1l[irl]-
Zmin)/2.;
1223 Xt1 = (Zcp1h[irl]-
Zmin)/2.;
1225 double xfrac=(Bar_Rcmx-Rhol[irl])/(Rhoh[irl]-Rhol[irl]);
1227 Xb1 = (Zcp1l[irl]-
Zmin)/2.;
1228 Xt1 = (xfrac*Zcp1h[irl]+(1.-xfrac)*Zcp1l[irl]-
Zmin)/2.;
1231 Xb1 = (xfrac*Zcp1h[irl]+(1.-xfrac)*Zcp1l[irl]-
Zmin)/2.;
1232 Xt1 = (Zcp1h[irl]-
Zmin)/2.;
1239 double Xt2 = tl1-Xt1;
1240 double Xb2 = bl1-Xb1;
1243 double Xtrans2 = Zx0 - (Xb2+Xt2)/2.;
1248 GeoGenfun::GENFUNCTION alpha = ATan(0.5*(bl1-tl1)/
h1);
1249 GeoGenfun::GENFUNCTION alpha_t = ATan(0.5*(Xb1-Xt1)/
h1);
1261 GeoGenfun::GENFUNCTION alpha_2 = ATan((2.*bl1-Xb2-(2.*tl1-Xt2))/(2.*
h1));
1267 GeoGenfun::GENFUNCTION alfrot = -
M_PI/2. - newalpha;
1269 GeoGenfun::GENFUNCTION Xcd = (x1a + x2a)/2. + (2.*idivi-1.)*(1.-
frac)*da/2.*cosalfa;
1270 GeoGenfun::GENFUNCTION Ycd = (y1a + y2a)/2. + (2.*idivi-1.)*(1.-
frac)*da/2.*sinalfa;
1271 GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(
Zmin+(tl1+bl1)/2.+safety_zlen);
1273 GeoXF::TRANSFUNCTION TX =
1274 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
1275 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
1276 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
1277 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),-alfrot)*
1286 std::string thinName = baseName +
"ThinAbs::Straight";
1287 std::string thickName = baseName +
"ThickAbs::Straight";
1290 std::cout <<
" *** thinAbs trap parameters " << std::endl;
1291 std::cout <<
" Thickness " <<
Dz << std::endl;
1292 std::cout <<
" h1 (rad leng) " <<
h1(
instance) << std::endl;
1293 std::cout <<
" tl1,bl1 " << tl1 <<
" " << bl1 << std::endl;
1294 std::cout <<
" alpha " << alpha(
instance) << std::endl;
1295 std::cout <<
" *** thickAbs trap parameters " << std::endl;
1296 std::cout <<
" Thickness " <<
Dz << std::endl;
1297 std::cout <<
" h1 (rad leng) " <<
h1(
instance) << std::endl;
1298 std::cout <<
" tl1,bl1 " << Xt1 <<
" " << Xb1 << std::endl;
1299 std::cout <<
" alpha " << alpha_t(
instance) << std::endl;
1301 std::cout <<
" Position absorber x,y,z " << Xcd(
instance) <<
" " << Ycd(
instance)
1302 <<
" " << Zcd(
instance) << std::endl;
1303 std::cout <<
" Rotation along Z " << -alfrot(
instance)/
deg << std::endl;
1304 std::cout <<
" Rotation along Y " << -90 << std::endl;
1309 GeoIntrusivePtr<GeoPhysVol> thinPhys =
nullptr;
1312 if (!doDetailedAbsorberStraight) {
1314 const GeoLogVol* thinLog =
new GeoLogVol(thinName,thinTrap,Thin_abs);
1315 thinPhys =
new GeoPhysVol(thinLog);
1319 const GeoLogVol* thickLog =
new GeoLogVol(thickName,thickTrap,Thick_abs);
1320 GeoIntrusivePtr<GeoPhysVol> thickPhys =
new GeoPhysVol(thickLog);
1322 thinPhys->add(
new GeoTransform(GeoTrf::TranslateX3D(Xtrans)));
1323 thinPhys->add(thickPhys);
1326 std::cout <<
" Position thick Abs in Thin at " << Xtrans << std::endl;
1330 if (doDetailedAbsorberStraight) {
1334 std::cout <<
" dz overall absorber volume " <<
Dz <<
" radial length " <<
h1(
instance) <<
1335 " lenghts " << tl1 <<
" " << bl1 <<
" Angle y axis " << alpha(
instance) << std::endl;
1337 const GeoLogVol* thinLog =
new GeoLogVol(thinName,thinTrap,myIron);
1338 thinPhys =
new GeoPhysVol(thinLog);
1342 double dz_glue =
Dz - 0.5*Thfe*Contract;
1344 std::cout <<
" dz glue volume in which lead will be put " << dz_glue << std::endl;
1346 GeoTrap* thickTrapGlue =
new GeoTrap(dz_glue,0.,0.,
h1(
instance),tl1,bl1,alpha(
instance),
1348 std::string thickGlueName = baseName +
"ThickAbsGlue::Straight";
1349 const GeoLogVol* thickTrapGlueLog =
new GeoLogVol(thickGlueName,thickTrapGlue, Glue);
1350 GeoIntrusivePtr<GeoPhysVol> thickTrapGluePhys =
new GeoPhysVol(thickTrapGlueLog);
1351 thinPhys->add(
new GeoTransform(GeoTrf::Translate3D(0.,0.,0.)));
1352 thinPhys->add(thickTrapGluePhys);
1355 double dz_lead_thick=0.5*Thpb*Contract;
1357 std::cout <<
" dz thick lead " << dz_lead_thick <<
" lenghts " << Xt1 <<
" " << Xb1 <<
" Angle y axis " << alpha_t(
instance) << std::endl;
1358 std::cout <<
" position in overall absorber at X trans " << Xtrans << std::endl;
1360 GeoTrap* thickTrapLead =
new GeoTrap(dz_lead_thick,0.,0.,
h1(
instance),Xt1,Xb1,alpha_t(
instance),
1362 std::string thickLeadName= baseName+
"ThickAbsLead::Straight";
1363 const GeoLogVol* thickTrapLeadLog =
new GeoLogVol(thickLeadName,thickTrapLead, myLead);
1364 GeoIntrusivePtr<GeoPhysVol> thickTrapLeadPhys =
new GeoPhysVol(thickTrapLeadLog);
1365 thickTrapGluePhys->add(
new GeoTransform(GeoTrf::TranslateX3D(Xtrans)));
1366 thickTrapGluePhys->add(thickTrapLeadPhys);
1368 double dz_lead_thin = 0.5*Thpb_thin*Contract;
1370 std::cout <<
" dz thin lead " << dz_lead_thin <<
" lenghts " << Xt2 <<
" " << Xb2 <<
" Angle y axis " << alpha_2(
instance) << std::endl;
1371 std::cout <<
" position in overall absorber at X trans " << Xtrans2 << std::endl;
1373 GeoTrap* thinTrapLead =
new GeoTrap(dz_lead_thin,0.,0.,
h1(
instance),Xt2,Xb2,alpha_2(
instance),
1375 std::string thinLeadName = baseName+
"ThinAbsLead::Straight";
1376 const GeoLogVol* thinTrapLeadLog =
new GeoLogVol(thinLeadName,thinTrapLead, myLead);
1377 GeoIntrusivePtr<GeoPhysVol> thinTrapLeadPhys =
new GeoPhysVol(thinTrapLeadLog);
1378 thickTrapGluePhys->add(
new GeoTransform(GeoTrf::TranslateX3D(Xtrans2)));
1379 thickTrapGluePhys->add(thinTrapLeadPhys);
1397 stacPhysical->add(
new GeoTransform(TX(
instance)));
1398 int icopytot=1000000*idivi+10000*irl+
instance;
1399 stacPhysical->add(
new GeoIdentifierTag(icopytot));
1400 stacPhysical->add(thinPhys);
1405 gStraightAbsorbers->
setHalfLength(irl,thinTrap->getDydzn());
1406 GeoSerialTransformer *st =
new GeoSerialTransformer(thinPhys, &TX, Nabsorber);
1407 stacPhysical->add(
new GeoSerialIdentifier(irl*10000+idivi*1000000));
1408 stacPhysical->add(st);
1416 double phi0_safety=0.;
1417 if (irl==0) phi0_safety=0.003;
1423 int irl2 = (irl==Nbrt-1) ? irl+1 : irl;
1425 for (
int jrl=irl1; jrl<=irl2; jrl++) {
1430 GeoGenfun::GENFUNCTION x0a =
LArGeo::Fx(iirl, Gama, Cenx, Ceny)
1433 GeoGenfun::GENFUNCTION y0a =
LArGeo::Fy(iirl, Gama, Cenx, Ceny)
1436 GeoGenfun::GENFUNCTION dx0 = x1a - x0a;
1437 GeoGenfun::GENFUNCTION dy0 = y1a - y0a;
1439 GeoGenfun::GENFUNCTION Da0 = Sqrt ( dx0*dx0 + dy0*dy0 );
1440 GeoGenfun::GENFUNCTION da0 = Sqrt ( (Da0 - 2.*Rint)*(Da0 + 2.*Rint) );
1442 GeoGenfun::GENFUNCTION cosalfa0 = (da0*dx0 +iparit*2.*Rint*dy0)/Da0/Da0;
1443 GeoGenfun::GENFUNCTION sinalfa0 = (da0*dy0 -iparit*2.*Rint*dx0)/Da0/Da0;
1444 GeoGenfun::GENFUNCTION alpha_prev =
LArGeo::ATan2(sinalfa0,cosalfa0);
1447 if (jrl>0 && jrl<Nbrt) {
1448 std::cout <<
"x1,y1,x0,y0 " << x1a(0) <<
" " << y1a(0) <<
" "
1449 << x0a(0) <<
" " << y0a(0) << std::endl;
1450 std::cout <<
" newalpha, alpha_prev " << newalpha(0) <<
" "
1451 << alpha_prev(0) << std::endl;
1454 GeoGenfun::Mod Mod2Pi(2*
M_PI);
1456 GeoGenfun::GENFUNCTION phi0_dfold_0 =
1457 GeoGenfun::FixedConstant(
M_PI/2.+phi0_safety);
1458 GeoGenfun::GENFUNCTION dphi_dfold_0 = Mod2Pi(newalpha-phi0_safety - Gama);
1459 GeoGenfun::GENFUNCTION phi0_dfold_1 = Mod2Pi(
M_PI/2.+ alpha_prev - Gama);
1460 GeoGenfun::GENFUNCTION dphi_dfold_1 = Mod2Pi(newalpha-alpha_prev);
1461 GeoGenfun::GENFUNCTION phi0_dfold_2 = Mod2Pi(
M_PI/2.+ newalpha - Gama);
1462 GeoGenfun::GENFUNCTION dphi_dfold_2 = Mod2Pi(- newalpha + Gama);
1464 GeoGenfun::GENFUNCTION phi0_ufold_0 =
1465 Mod2Pi(
M_PI/2.+newalpha-Gama);
1466 GeoGenfun::GENFUNCTION dphi_ufold_0 = Mod2Pi(-newalpha+Gama-phi0_safety);
1467 GeoGenfun::GENFUNCTION phi0_ufold_1 = Mod2Pi(
M_PI/2. + newalpha - Gama);
1468 GeoGenfun::GENFUNCTION dphi_ufold_1 = Mod2Pi(alpha_prev - newalpha);
1469 GeoGenfun::GENFUNCTION phi0_ufold_2 = GeoGenfun::FixedConstant(
M_PI/2.);
1470 GeoGenfun::GENFUNCTION dphi_ufold_2 = Mod2Pi(newalpha-Gama);
1472 const GeoGenfun::AbsFunction* phi0_fold=
nullptr;
1473 const GeoGenfun::AbsFunction* dphi_fold=
nullptr;
1474 const GeoXF::Function* TXfold=
nullptr;
1476 std::string thinName;
1477 std::string thickName;
1478 if (jrl%2==checkParity) {
1479 thinName = baseName +
"ThinAbs::CornerDownFold";
1480 thickName = baseName +
"ThickAbs::CornerDownFold";
1482 thinName = baseName +
"ThinAbs::CornerUpFold";
1483 thickName = baseName +
"ThickAbs::CornerUpFold";
1487 double Rcmin=Rint-Thce/2.;
1488 double Rcmax=Rint+Thce/2.;
1491 double ddz0 = dz0-safety_zlen;
1492 double ddz01 = dz01-safety_zlen;
1494 ddz0=dza-safety_zlen;
1495 ddz01=dza1-safety_zlen;
1499 GeoGenfun::GENFUNCTION zpos = GeoGenfun::FixedConstant(
Zmin+dz0);
1501 if (jrl%2==checkParity) phirot = -
M_PI;
1502 GeoXF::TRANSFUNCTION TXfold1=
1503 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x1a) *
1504 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y1a) *
1505 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1506 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama+phirot);
1507 GeoXF::TRANSFUNCTION TXfold2 =
1508 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x2a) *
1509 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y2a) *
1510 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1511 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama+phirot);
1514 if (jrl==0 && checkParity==0) {
1515 phi0_fold = &(phi0_dfold_0);
1516 dphi_fold = &(dphi_dfold_0);
1517 TXfold = &(TXfold1);
1520 if (jrl%2==checkParity && jrl >0 && jrl<Nbrt) {
1521 phi0_fold = &(phi0_dfold_1);
1522 dphi_fold = &(dphi_dfold_1);
1523 TXfold = &(TXfold1);
1526 if (jrl%2 ==checkParity && jrl == Nbrt) {
1527 phi0_fold = &(phi0_dfold_2);
1528 dphi_fold = &(dphi_dfold_2);
1529 TXfold = &(TXfold2);
1532 if (jrl==0 && checkParity==1) {
1533 phi0_fold = &(phi0_ufold_0);
1534 dphi_fold = &(dphi_ufold_0);
1535 TXfold = &(TXfold1);
1538 if (jrl%2 ==(1-checkParity) && jrl>0 && jrl < Nbrt) {
1539 phi0_fold = &(phi0_ufold_1);
1540 dphi_fold = &(dphi_ufold_1);
1541 TXfold = &(TXfold1);
1544 if (jrl%2==(1-checkParity) && jrl==Nbrt) {
1545 phi0_fold = &(phi0_ufold_2);
1546 dphi_fold = &(dphi_ufold_2);
1547 TXfold = &(TXfold2);
1550 if (!phi0_fold || !dphi_fold || !TXfold) {
1551 ATH_MSG_INFO(
" LArGeoBarrel::BarrelConstruction fold not defined...");
1557 GeoIntrusivePtr<GeoPhysVol> thinPhys =
nullptr;
1559 if (!doDetailedAbsorberFold) {
1560 GeoTubs* thinTubs =
new GeoTubs(Rcmin,Rcmax,ddz0,
1562 GeoTubs* thickTubs =
new GeoTubs(Rcmin,Rcmax,ddz01,
1565 std::cout <<
" Thin Abs Corner (tubs) " << std::endl;
1566 std::cout <<
" Rmin,Rmax,dZ,phi0,Dphi[rad] " << Rcmin <<
" " << Rcmax <<
" "
1567 << ddz0 <<
" " << (*phi0_fold)(
instance) <<
" "
1568 <<(*dphi_fold)(
instance) << std::endl;
1569 std::cout <<
" Thick Abs Corner (tubs) " << std::endl;
1570 std::cout <<
" Rmin,Rmax,dZ,phi0,Dphi[rad] " << Rcmin <<
" " << Rcmax <<
" "
1571 << ddz01 <<
" " << (*phi0_fold)(
instance) <<
" "
1572 << (*dphi_fold)(
instance) << std::endl;
1574 const GeoLogVol* thinLog =
new GeoLogVol(thinName,thinTubs,Thin_abs);
1575 const GeoLogVol* thickLog =
new GeoLogVol(thickName,thickTubs,Thick_abs);
1577 thinPhys =
new GeoPhysVol(thinLog);
1578 GeoIntrusivePtr<GeoPhysVol> thickPhys =
new GeoPhysVol(thickLog);
1580 thinPhys->add(
new GeoTransform(GeoTrf::TranslateZ3D(ddz01-ddz0)));
1581 thinPhys->add(thickPhys);
1583 std::cout <<
" Position Thick fold in Thin Z = " << ddz01-ddz0 << std::endl;
1588 if (doDetailedAbsorberFold) {
1591 GeoTubs* thinTubs =
new GeoTubs(Rcmin,Rcmax,ddz0,
1593 const GeoLogVol* thinLog =
new GeoLogVol(thinName,thinTubs,myIron);
1594 thinPhys =
new GeoPhysVol(thinLog);
1597 std::cout <<
" overall fold volume rmin,rmax,dz " << Rcmin <<
" " << Rcmax <<
" " << ddz0 << std::endl;
1601 GeoTubs* glueTubs =
new GeoTubs(Rcmin+0.5*Thfe*Contract,Rcmax-0.5*Thfe*Contract,ddz0,
1603 std::string foldGlueName = baseName+
"Glue::Fold";
1604 const GeoLogVol* glueTubsLog =
new GeoLogVol(foldGlueName,glueTubs,Glue);
1605 GeoIntrusivePtr<GeoPhysVol> glueTubsPhys =
new GeoPhysVol(glueTubsLog);
1606 thinPhys->add(
new GeoTransform(GeoTrf::TranslateZ3D(0.)));
1607 thinPhys->add(glueTubsPhys);
1609 std::cout <<
" glue fold volume " << Rcmin+0.5*Thfe*Contract <<
" " << Rcmax-0.5*Thfe*Contract <<
" " << ddz0 << std::endl;
1615 GeoTubs* thickLeadTubs =
new GeoTubs(Rint-0.5*Thpb*Contract,Rint+0.5*Thpb*Contract,ddz01,
1617 std::string foldThickLeadName = baseName+
"ThickLead::Fold";
1618 const GeoLogVol* thickLeadLog =
new GeoLogVol(foldThickLeadName,thickLeadTubs,myLead);
1619 GeoIntrusivePtr<GeoPhysVol> thickLeadPhys =
new GeoPhysVol(thickLeadLog);
1620 glueTubsPhys->add(
new GeoTransform(GeoTrf::TranslateZ3D(ddz01-ddz0)));
1621 glueTubsPhys->add(thickLeadPhys);
1623 std::cout <<
" thick lead volume " << Rint-Thpb*Contract <<
" " << Rint+Thpb*Contract <<
" " << ddz01 << std::endl;
1624 std::cout <<
" put in glue fold volume with z translation " << ddz01-ddz0 << std::endl;
1628 GeoTubs* thinLeadTubs =
new GeoTubs(Rint-0.5*Thpb_thin*Contract,Rint+0.5*Thpb_thin*Contract,ddz0-ddz01,
1630 std::string foldThinLeadName = baseName+
"ThinLead::Fold";
1631 const GeoLogVol* thinLeadLog =
new GeoLogVol(foldThinLeadName,thinLeadTubs,myLead);
1632 GeoIntrusivePtr<GeoPhysVol> thinLeadPhys =
new GeoPhysVol(thinLeadLog);
1633 glueTubsPhys->add(
new GeoTransform(GeoTrf::TranslateZ3D(ddz01)));
1634 glueTubsPhys->add(thinLeadPhys);
1637 std::cout <<
" thin lead volume " << Rint-Thpb_thin*Contract <<
" " << Rint+Thpb_thin*Contract <<
" " << ddz01 << std::endl;
1638 std::cout <<
" put in glue fold volume with z translation " << ddz01 << std::endl;
1647 std::cout <<
" Position absorber fold x,y,z,rotation/z " << x1a(
instance) <<
1651 std::cout <<
" Position absorber fold x,y,z,rotation/z " << x2a(
instance) <<
1657 stacPhysical->add(
new GeoTransform((*TXfold)(
instance)));
1659 stacPhysical->add(
new GeoIdentifierTag(icopytot));
1660 stacPhysical->add(thinPhys);
1663 GeoSerialTransformer *st =
new GeoSerialTransformer(thinPhys, TXfold, Nabsorber);
1664 stacPhysical->add(
new GeoSerialIdentifier(jrl*10000));
1665 stacPhysical->add(st);
1679 double Dze = Thel/2.;
1682 GeoGenfun::GENFUNCTION x1e =
LArGeo::Fx(irl+0., Game, Cenx, Ceny)
1685 GeoGenfun::GENFUNCTION x2e =
LArGeo::Fx(irl+1., Game, Cenx, Ceny)
1688 GeoGenfun::GENFUNCTION y1e =
LArGeo::Fy(irl+0., Game, Cenx, Ceny)
1691 GeoGenfun::GENFUNCTION y2e =
LArGeo::Fy(irl+1., Game, Cenx, Ceny)
1694 GeoGenfun::GENFUNCTION dxe = x2e - x1e;
1695 GeoGenfun::GENFUNCTION dye = y2e - y1e;
1697 GeoGenfun::GENFUNCTION De = Sqrt ( dxe*dxe + dye*dye );
1698 GeoGenfun::GENFUNCTION de = Sqrt ( (De - 2.*Rint)*(De + 2.*Rint) );
1701 GeoGenfun::GENFUNCTION cosalfae = (de*dxe -iparit*2.*Rint*dye)/De/De;
1702 GeoGenfun::GENFUNCTION sinalfae = (de*dye +iparit*2.*Rint*dxe)/De/De;
1703 GeoGenfun::GENFUNCTION newalphe =
LArGeo::ATan2(sinalfae,cosalfae);
1709 GeoGenfun::GENFUNCTION alfrote = -
M_PI/2. - newalphe;
1711 GeoGenfun::GENFUNCTION Xcde = (x1e + x2e)/2.+ (2.*idivi-1.)*(1.-
frac)*de/2.*cosalfae;
1712 GeoGenfun::GENFUNCTION Ycde = (y1e + y2e)/2.+ (2.*idivi-1.)*(1.-
frac)*de/2.*sinalfae;
1713 GeoGenfun::GENFUNCTION Zcde = GeoGenfun::FixedConstant(
Zmin+(tl1+bl1)/2.+safety_zlen);
1717 GeoGenfun::GENFUNCTION alpha_e = ATan(0.5*(bl1-tl1)/h1e);
1720 GeoXF::TRANSFUNCTION TXE =
1721 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcde) *
1722 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycde) *
1723 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcde) *
1724 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),-alfrote)*
1730 std::string
name = baseName +
"Electrode::Straight";
1732 std::cout <<
" *** Electrode trap parameters " << std::endl;
1733 std::cout <<
" Thickness " << Dze << std::endl;
1734 std::cout <<
" h1 (rad leng) " << h1e(
instance) << std::endl;
1735 std::cout <<
" tl1,tb1 " << tl1 <<
" " << bl1 << std::endl;
1736 std::cout <<
" alpha " << alpha_e(
instance) << std::endl;
1737 std::cout <<
" Position electrode x,y,z " << Xcde(
instance) <<
" " << Ycde(
instance)
1738 <<
" " << Zcde(
instance) << std::endl;
1739 std::cout <<
" Rotation along Z " << -alfrote(
instance)/
deg << std::endl;
1740 std::cout <<
" Rotation along Y " << -90 << std::endl;
1744 GeoTrap* trap =
new GeoTrap(Dze,0.,0.,h1e(
instance),tl1,bl1,alpha_e(
instance),
1746 const GeoLogVol* logVol =
new GeoLogVol(
name,trap,Kapton_Cu);
1747 GeoIntrusivePtr<GeoPhysVol> physVol =
new GeoPhysVol(logVol);
1761 stacPhysical->add(
new GeoTransform(TXE(
instance)));
1762 int icopytot=1000000*idivi+10000*irl+
instance;
1763 stacPhysical->add(
new GeoIdentifierTag(icopytot));
1764 stacPhysical->add(physVol);
1770 GeoSerialTransformer *st =
new GeoSerialTransformer(physVol, &TXE, Nelectrode);
1771 stacPhysical->add(
new GeoSerialIdentifier(irl*10000+idivi*1000000));
1772 stacPhysical->add(st);
1781 double phi0_safety=0.;
1782 if (irl==0) phi0_safety=0.003;
1788 int irl2 = (irl==Nbrt-1) ? irl+1 : irl;
1790 for (
int jrl=irl1; jrl<=irl2; jrl++) {
1795 GeoGenfun::GENFUNCTION x0e =
LArGeo::Fx(iirl, Game, Cenx, Ceny)
1798 GeoGenfun::GENFUNCTION y0e =
LArGeo::Fy(iirl, Game, Cenx, Ceny)
1801 GeoGenfun::GENFUNCTION dx0 = x1e - x0e;
1802 GeoGenfun::GENFUNCTION dy0 = y1e - y0e;
1804 GeoGenfun::GENFUNCTION Da0 = Sqrt ( dx0*dx0 + dy0*dy0 );
1805 GeoGenfun::GENFUNCTION da0 = Sqrt ( (Da0 - 2.*Rint)*(Da0 + 2.*Rint) );
1807 GeoGenfun::GENFUNCTION cosalfa0 = (da0*dx0 +iparit*2.*Rint*dy0)/Da0/Da0;
1808 GeoGenfun::GENFUNCTION sinalfa0 = (da0*dy0 -iparit*2.*Rint*dx0)/Da0/Da0;
1809 GeoGenfun::GENFUNCTION alphe_prev =
LArGeo::ATan2(sinalfa0,cosalfa0);
1812 if (jrl>0 && jrl<Nbrt) {
1813 std::cout <<
" newalphae, alphae_prev " << newalphe(0) <<
" "
1814 << alphe_prev(0) << std::endl;
1819 GeoGenfun::Mod Mod2Pi(2*
M_PI);
1820 GeoGenfun::GENFUNCTION phi0_dfold_0 =
1821 GeoGenfun::FixedConstant(
M_PI/2.+phi0_safety);
1822 GeoGenfun::GENFUNCTION dphi_dfold_0 = Mod2Pi(newalphe-phi0_safety-Game);
1823 GeoGenfun::GENFUNCTION phi0_dfold_1 = Mod2Pi(
M_PI/2.+ alphe_prev - Game);
1824 GeoGenfun::GENFUNCTION dphi_dfold_1 = Mod2Pi(newalphe-alphe_prev);
1825 GeoGenfun::GENFUNCTION phi0_dfold_2 = Mod2Pi(
M_PI/2.+ newalphe - Game);
1826 GeoGenfun::GENFUNCTION dphi_dfold_2 = Mod2Pi(- newalphe + Game);
1828 GeoGenfun::GENFUNCTION phi0_ufold_0 =
1829 Mod2Pi(
M_PI/2.+newalphe-Game);
1830 GeoGenfun::GENFUNCTION dphi_ufold_0 = Mod2Pi(-newalphe+Game-phi0_safety);
1831 GeoGenfun::GENFUNCTION phi0_ufold_1 = Mod2Pi(
M_PI/2. + newalphe - Game);
1832 GeoGenfun::GENFUNCTION dphi_ufold_1 = Mod2Pi(alphe_prev - newalphe);
1833 GeoGenfun::GENFUNCTION phi0_ufold_2 = GeoGenfun::FixedConstant(
M_PI/2.);
1834 GeoGenfun::GENFUNCTION dphi_ufold_2 = Mod2Pi(newalphe - Game);
1836 const GeoGenfun::AbsFunction* phi0_fold=
nullptr;
1837 const GeoGenfun::AbsFunction* dphi_fold=
nullptr;
1838 const GeoXF::Function* TXfold=
nullptr;
1841 if (jrl%2==checkParity) {
1842 eName = baseName +
"Electrode::CornerDownFold";
1844 eName = baseName +
"Electrode::CornerUpFold";
1848 double Rcmine=Rint-Thel/2.;
1849 double Rcmaxe=Rint+Thel/2.;
1852 double ddz0 = dz0-safety_zlen;
1854 ddz0 = dza - safety_zlen;
1857 GeoGenfun::GENFUNCTION zpos = GeoGenfun::FixedConstant(
Zmin+dz0);
1859 if (jrl%2==checkParity) phirot = -
M_PI;
1860 GeoXF::TRANSFUNCTION TXfold1=
1861 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x1e) *
1862 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y1e) *
1863 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1864 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Game+phirot);
1865 GeoXF::TRANSFUNCTION TXfold2 =
1866 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x2e) *
1867 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y2e) *
1868 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1869 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Game+phirot);
1872 if (jrl==0 && checkParity==0) {
1873 phi0_fold = &(phi0_dfold_0);
1874 dphi_fold = &(dphi_dfold_0);
1875 TXfold = &(TXfold1);
1878 if (jrl%2==checkParity && jrl >0 && jrl<Nbrt) {
1879 phi0_fold = &(phi0_dfold_1);
1880 dphi_fold = &(dphi_dfold_1);
1881 TXfold = &(TXfold1);
1884 if (jrl%2 ==checkParity && jrl == Nbrt) {
1885 phi0_fold = &(phi0_dfold_2);
1886 dphi_fold = &(dphi_dfold_2);
1887 TXfold = &(TXfold2);
1890 if (jrl==0 && checkParity==1 ) {
1891 phi0_fold = &(phi0_ufold_0);
1892 dphi_fold = &(dphi_ufold_0);
1893 TXfold = &(TXfold1);
1897 if (jrl%2 ==(1-checkParity) && jrl>0 && jrl < Nbrt) {
1898 phi0_fold = &(phi0_ufold_1);
1899 dphi_fold = &(dphi_ufold_1);
1900 TXfold = &(TXfold1);
1903 if (jrl%2==(1-checkParity) && jrl==Nbrt) {
1904 phi0_fold = &(phi0_ufold_2);
1905 dphi_fold = &(dphi_ufold_2);
1906 TXfold = &(TXfold2);
1909 if (!phi0_fold || !dphi_fold || !TXfold) {
1910 ATH_MSG_INFO(
" LArGeoBarrel::BarrelConstruction fold not defined...");
1916 GeoTubs* foldeTubs =
new GeoTubs(Rcmine,Rcmaxe,ddz0,
1919 std::cout <<
" Electrode Corner (tubs) " << std::endl;
1920 std::cout <<
" Rmin,Rmax,dZ,phi0,Dphi[rad] " << Rcmine <<
" " << Rcmaxe <<
" "
1921 << ddz0 <<
" " << (*phi0_fold)(
instance) <<
" "
1922 <<(*dphi_fold)(
instance) << std::endl;
1924 const GeoLogVol* foldeLog =
new GeoLogVol(eName,foldeTubs,Kapton_Cu);
1926 GeoIntrusivePtr<GeoPhysVol> foldePhys =
new GeoPhysVol(foldeLog);
1930 std::cout <<
" Position electrode fold x,y,z,rotation/z " << x1e(
instance) <<
1934 std::cout <<
" Position electrode fold x,y,z,rotation/z " << x2e(
instance) <<
1940 stacPhysical->add(
new GeoTransform((*TXfold)(
instance)));
1942 stacPhysical->add(
new GeoIdentifierTag(icopytot));
1943 stacPhysical->add(foldePhys);
1946 GeoSerialTransformer *st =
new GeoSerialTransformer(foldePhys, TXfold, Nelectrode);
1947 stacPhysical->add(
new GeoSerialIdentifier(jrl*10000));
1948 stacPhysical->add(st);
1961 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store STRAIGHTELECTRODES structure");
1965 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store STRAIGHTABSORBERS structure");
1969 #endif // BUILD_ACCORDION_PLATES
1971 ATH_MSG_DEBUG(
"++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1973 <<
"+ END of Barrel EM GeoModel definition +\n"
1975 <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++");