11 #include "GeoModelKernel/GeoPcon.h"
12 #include "GeoModelKernel/GeoTubs.h"
13 #include "GeoModelKernel/GeoTube.h"
14 #include "GeoModelKernel/GeoTrd.h"
15 #include "GeoModelKernel/GeoTrap.h"
16 #include "GeoModelKernel/GeoBox.h"
17 #include "GeoModelKernel/GeoMaterial.h"
18 #include "GeoModelKernel/GeoLogVol.h"
19 #include "GeoModelKernel/GeoPhysVol.h"
20 #include "GeoModelKernel/GeoNameTag.h"
21 #include "GeoModelKernel/GeoTransform.h"
22 #include "GeoModelKernel/GeoSerialIdentifier.h"
23 #include "GeoModelKernel/GeoIdentifierTag.h"
24 #include "GeoModelKernel/GeoDefinitions.h"
25 #include "GeoModelKernel/Units.h"
27 #include "GeoModelKernel/GeoShapeUnion.h"
28 #include "GeoModelKernel/GeoShapeShift.h"
29 #include "GeoModelKernel/GeoShapeSubtraction.h"
30 #include "GeoModelKernel/GeoCutVolAction.h"
32 #include "GeoGenericFunctions/AbsFunction.h"
33 #include "GeoGenericFunctions/Variable.h"
34 #include "GeoModelKernel/GeoXF.h"
35 #include "GeoModelKernel/GeoSerialTransformer.h"
37 #include "GaudiKernel/MsgStream.h"
38 #include "GaudiKernel/SystemOfUnits.h"
44 #define MLOG(x) if (m_log->level()<=MSG::x) *m_log << MSG::x
47 using namespace GeoXF;
54 : m_theMaterialManager(matManager)
55 , m_dbManager(pDbManager)
57 , m_switches(switches)
58 , m_barrelPeriodThickness(0.)
60 , m_extendedPeriodThickness(0.)
63 , m_matIronHalfDens(0)
64 , m_additionalIronLayer(0.027)
84 (*m_log) <<
MSG::DEBUG <<
" TileGeoSectionBuilder::fillSection ModuleNcp= "<<ModuleNcp<<
endmsg;
94 const GeoMaterial* matAluminium = 0;
99 double dX1 =0., dX2 =0., dY1 =0., dY2 =0., dZ1 =0., dZ2 =0.;
100 std::string volname =
"";
103 float PosXcut =0., PosYcut =0., PosY =0., Rmore =0.;
104 float Radius =0., YcorA =0., YcorB =0., lenPla =0., Blia =0.;
111 if (ModuleNcp>=35 && ModuleNcp<=37) SideFl = -1;
117 GeoIntrusivePtr<const GeoShapeUnion> CutA{
nullptr};
118 GeoIntrusivePtr<GeoShape> CutB{
nullptr};
121 if (sec_number==2 &&
m_dbManager->
BoolCuts() && ((ModuleNcp>=35 && ModuleNcp<=37) || (ModuleNcp>=60 && ModuleNcp<=62))) {
134 checking(
"CutB1",
false, 1, dX1,dX2,dY1,dY2,dZ1);
135 GeoTrd* CutB1 =
new GeoTrd(dX1,dX2,dY1,dY2,dZ1);
149 checking(
"Cut1up",
false, 1, dX1,dX2,dY1,dY2,dZ1);
150 GeoTrd* Cut1up =
new GeoTrd(dX1,dX2,dY1,dY2,dZ1);
159 checking(
"Cut2down",
false, 1, dX1,dX2,dY1,dY2,dZ2);
160 GeoTrd* Cut1down =
new GeoTrd(dX1,dX2,dY1,dY2,dZ2);
162 GeoTrf::Translate3D yPosA(0.,0.,-dZ1-dZ2);
164 const GeoShapeUnion& CutA1 = Cut1up->add(*Cut1down<<yPosA);
173 TransCut2 = GeoTrf::TranslateZ3D(-Radius)
181 TransCut2 = GeoTrf::TranslateX3D(2*ptTmp.x())*GeoTrf::RotateZ3D(180*
Gaudi::Units::deg)*TransCut2;
184 if (ModuleNcp>=60 && ModuleNcp<=62) {
185 TransCutL = GeoTrf::TranslateZ3D(-Radius)
192 TransCutL = GeoTrf::TranslateX3D(2*ptTmp.x())*GeoTrf::RotateZ3D(180*
Gaudi::Units::deg)*TransCutL;
195 }
else if (ModuleNcp>=35 && ModuleNcp<=37) {
196 TransCutR = GeoTrf::TranslateZ3D(-Radius)
203 TransCutR = GeoTrf::TranslateX3D(2*ptTmp.x())*GeoTrf::RotateZ3D(180*
Gaudi::Units::deg)*TransCutR;
214 double thicknessGirderMother = 0.0;
215 double specialModuleZShift = 0.0;
221 if ((Id4 == 7) && (sec_number == 3))
231 if ((Id4 == 7) && (sec_number == 3)) {
236 thicknessGirderMother/2,thicknessGirderMother/2,dy1GirderMother,dy2GirderMother,heightGirderMother/2);
238 GeoTrd* girderMother =
new GeoTrd(thicknessGirderMother/2,
239 thicknessGirderMother/2,
242 heightGirderMother/2);
244 GeoLogVol* lvGirderMother =
new GeoLogVol(
"GirderMother",girderMother,matAir);
245 GeoPhysVol* pvGirderMother =
new GeoPhysVol(lvGirderMother);
253 GeoTransform* tfGirderMother = 0;
262 mother->add(tfGirderMother);
263 mother->add(pvGirderMother);
271 double thicknessFrontPlate, heightFrontPlate, dy1FrontPlate, dy2FrontPlate;
280 if (thicknessFrontPlate > rless) {
286 (*
m_log) <<
MSG::DEBUG <<
" FrontPlateSh dX1,dX2= "<<thicknessFrontPlate/2<<
", "<<thicknessFrontPlate/2
287 <<
" dY1,dY2= "<<dy1FrontPlate<<
" "<<dy2FrontPlate<<
" dZ= "<<heightFrontPlate/2
290 GeoTrd* frontPlateSh =
new GeoTrd(thicknessFrontPlate/2,
291 thicknessFrontPlate/2,
296 GeoLogVol* lvFrontPlateSh =
new GeoLogVol(
"FrontPlateSh",frontPlateSh,matIron);
297 GeoPhysVol* pvFrontPlateSh =
new GeoPhysVol(lvFrontPlateSh);
298 GeoTransform* tfFrontPlateSh =
new GeoTransform(GeoTrf::Translate3D(
302 mother->add(tfFrontPlateSh);
303 mother->add(pvFrontPlateSh);
311 ((ModuleNcp>=35 && ModuleNcp<=37)||(ModuleNcp>=60 && ModuleNcp<=62)) )) {
313 std::string volname =
"";
314 double dXCutA = 0, dXCutB = 0;
327 GeoTrd* frontPlate =
new GeoTrd(thicknessFrontPlate/2 -(dXCutA+dXCutB),
328 thicknessFrontPlate/2 -(dXCutA+dXCutB),
343 GeoLogVol* lvFrontPlate =
new GeoLogVol(
"FrontPlate",frontPlate,matIron);
344 GeoPhysVol* pvFrontPlate =
new GeoPhysVol(lvFrontPlate);
345 GeoTransform* tfFrontPlate =
new GeoTransform(GeoTrf::Translate3D(
349 mother->add(tfFrontPlate);
350 mother->add(pvFrontPlate);
362 GeoTrd* frontPlate =
new GeoTrd(thicknessFrontPlate/2,
363 thicknessFrontPlate/2,
368 GeoLogVol* lvFrontPlate =
new GeoLogVol(
"FrontPlate",frontPlate,matIron);
369 GeoPhysVol* pvFrontPlate =
new GeoPhysVol(lvFrontPlate);
370 GeoTransform* tfFrontPlate =
new GeoTransform(GeoTrf::Translate3D(
374 mother->add(tfFrontPlate);
375 mother->add(pvFrontPlate);
380 double dy1EndPlate, dy2EndPlate, thicknessEndPlate, heightEndPlate;
389 GeoIntrusivePtr<GeoTransform> tfEndPlateSh{
nullptr};
403 GeoTrd* endPlateSh =
new GeoTrd(thicknessEndPlate/2,
408 GeoLogVol* lvEndPlateSh = 0;
411 if (sec_number==2 && ((ModuleNcp>=35 && ModuleNcp<=37)||(ModuleNcp>=60 && ModuleNcp<=62)) ) {
416 GeoTrd* endPlateShCut =
new GeoTrd(thicknessEndPlate,
423 double rotationAngle ;
424 double shiftCutPlate ;
425 int rotationSign = 1;
426 if (ModuleNcp > 50) rotationSign *= -1;
427 if ( neg ) rotationSign *= -1;
430 if ( ( ModuleNcp == 37 ) || ( ModuleNcp == 60 ) ) {
434 cutOutTransformation =
435 GeoTrf::Translate3D(0,0, -heightEndPlate/2.) *
437 GeoTrf::Translate3D(0.,0., -rotationSign * (dy2EndPlate + shiftCutPlate ) ) *
438 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
440 const GeoShape & endPlateShCutted3760 = (endPlateSh->subtract( (*endPlateShCut)<< cutOutTransformation ) ) ;
441 lvEndPlateSh =
new GeoLogVol(
"EndPlateSh", &(endPlateShCutted3760) , matIron);
443 }
else if ( ( ModuleNcp == 36 ) || ( ModuleNcp == 61 ) ) {
447 cutOutTransformation =
448 GeoTrf::Translate3D( 0, 0, -heightEndPlate/2. ) *
449 GeoTrf::Translate3D( 0, 0, - (dy2EndPlate - shiftCutPlate + 0.5*dy2EndPlate*(1.-
std::cos(rotationAngle*
Gaudi::Units::rad))) ) *
450 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
452 const GeoShape & endPlateShCutted3661 = (endPlateSh->subtract( (*endPlateShCut)<< cutOutTransformation ) ) ;
453 lvEndPlateSh =
new GeoLogVol(
"EndPlateSh", &(endPlateShCutted3661) , matIron);
455 }
else if ( ( ModuleNcp == 35 ) || ( ModuleNcp == 62 ) ) {
459 cutOutTransformation =
460 GeoTrf::Translate3D( 0, 0, -heightEndPlate/2. ) *
461 GeoTrf::Translate3D( 0, 0, - (dy2EndPlate - shiftCutPlate) ) *
462 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
464 const GeoShape & endPlateShCutted3562 = (endPlateSh->subtract( (*endPlateShCut)<< cutOutTransformation ) ) ;
465 lvEndPlateSh =
new GeoLogVol(
"EndPlateSh", &(endPlateShCutted3562) , matIron);
468 (*m_log) << MSG::ERROR <<
" TileGeoSectionBuilder::fillSection . Wrong Module in cut-out region. ModuleNcp= "<<ModuleNcp<<
endmsg;
469 lvEndPlateSh =
new GeoLogVol(
"EndPlateSh", endPlateSh , matIron);
473 lvEndPlateSh =
new GeoLogVol(
"EndPlateSh", endPlateSh , matIron);
482 GeoPhysVol* pvEndPlateSh =
new GeoPhysVol(lvEndPlateSh);
484 tfEndPlateSh =
new GeoTransform(GeoTrf::Translate3D(
485 specialModuleZShift +
489 mother->add(tfEndPlateSh);
490 mother->add(pvEndPlateSh);
493 (*m_log) <<
MSG::DEBUG <<
" _fillSection: ext.barrel EndPlateSh Ok "<<
endmsg;
502 GeoTrd* endPlate1 =
new GeoTrd(thicknessEndPlate/2,
508 GeoLogVol* lvEndPlate1 =
new GeoLogVol(
"EndPlate1",endPlate1,matIron);
509 GeoPhysVol* pvEndPlate1 =
new GeoPhysVol(lvEndPlate1);
513 GeoTrd* epHole1 =
new GeoTrd (thicknessEndPlate/2,
519 GeoLogVol* lvEPHole1 =
new GeoLogVol(
"EPHole1",epHole1,matAir);
520 GeoPhysVol* pvEPHole1 =
new GeoPhysVol(lvEPHole1);
521 GeoTransform* tfEPHole1 =
new GeoTransform(GeoTrf::Translate3D(0.,0.,
523 pvEndPlate1->add(tfEPHole1);
524 pvEndPlate1->add(pvEPHole1);
527 GeoTransform* tfEndPlate1 =
new GeoTransform(GeoTrf::Translate3D(
529 mother->add(tfEndPlate1);
530 mother->add(pvEndPlate1);
538 GeoIntrusivePtr<GeoTransform> tfEndPlate2{
nullptr};
542 double radShift =lenPla;
543 double rminbT=rminb + radShift;
551 GeoLogVol* lvEndPlate2 = 0;
552 GeoTrd* endPlate2 =
new GeoTrd(thicknessEndPlate/2,
558 tfEndPlate2 =
new GeoTransform(GeoTrf::Translate3D(
561 if (sec_number==2 && ((ModuleNcp>=35 && ModuleNcp<=37)||(ModuleNcp>=60 && ModuleNcp<=62)) ) {
563 GeoTrd* endPlate2Cut =
new GeoTrd(thicknessEndPlate,
568 double rotationAngle ;
569 double shiftCutPlate ;
570 int rotationSign = 1;
571 if (ModuleNcp > 50) rotationSign *= -1;
572 if ( neg ) rotationSign *= -1;
574 if ( ( ModuleNcp == 37 ) || ( ModuleNcp == 60 ) ) {
578 cutOutTransformation =
579 GeoTrf::Translate3D( 0, 0, -heightEndPlate/2. ) *
580 GeoTrf::Translate3D( 0, 0, - (dy2EndPlate - shiftCutPlate) ) *
581 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
583 const GeoShape & endPlate2Cutted3760 = (endPlate2->subtract( (*endPlate2Cut)<< cutOutTransformation ) ) ;
584 lvEndPlate2 =
new GeoLogVol(
"EndPlate2", &(endPlate2Cutted3760) , matIron);
586 }
else if ( ( ModuleNcp == 36 ) || ( ModuleNcp == 61 ) ) {
590 cutOutTransformation =
591 GeoTrf::Translate3D( 0, 0, -heightEndPlate/2. ) *
592 GeoTrf::Translate3D( 0, 0, - (dy2EndPlate - shiftCutPlate) ) *
593 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
595 const GeoShape & endPlate2Cutted3661 = (endPlate2->subtract( (*endPlate2Cut)<< cutOutTransformation ) ) ;
596 lvEndPlate2 =
new GeoLogVol(
"EndPlate2", &(endPlate2Cutted3661) , matIron);
598 }
else if ( ( ModuleNcp == 35 ) || ( ModuleNcp == 62 ) ) {
602 cutOutTransformation =
603 GeoTrf::Translate3D( 0, 0, -heightEndPlate/2. ) *
604 GeoTrf::Translate3D( 0, 0, - (dy2EndPlate - shiftCutPlate) ) *
605 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
607 const GeoShape & endPlate2Cutted3562 = (endPlate2->subtract( (*endPlate2Cut)<< cutOutTransformation ) ) ;
608 lvEndPlate2 =
new GeoLogVol(
"EndPlate2", &(endPlate2Cutted3562) , matIron);
620 lvEndPlate2 =
new GeoLogVol(
"EndPlate2",endPlate2,matIron);
623 GeoPhysVol* pvEndPlate2 =
new GeoPhysVol(lvEndPlate2);
629 GeoTrd* epHole2 =
new GeoTrd (thicknessEndPlate/2,
635 GeoLogVol* lvEPHole2 =
new GeoLogVol(
"EPHole2",epHole2,matAir);
636 GeoPhysVol* pvEPHole2 =
new GeoPhysVol(lvEPHole2);
637 GeoTransform* tfEPHole2 =
new GeoTransform(GeoTrf::Translate3D(0.,0.,
639 pvEndPlate2->add(tfEPHole2);
640 pvEndPlate2->add(pvEPHole2);
643 mother->add(tfEndPlate2);
644 mother->add(pvEndPlate2);
658 thicknessAbsorber/2,thicknessAbsorber/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
661 double thicknessPeriod =0, thicknessAbsorber1 =0, thicknessAbsorber2 =0, thicknessAbsorber3 =0;
662 double PosAbsor1 =0, PosAbsor2 =0, PosAbsor3 =0;
663 int nA1 =32, nA2 = 0, nA3 =16;
665 GeoTrd *absorber{
nullptr}, *absorber1{
nullptr}, *absorber3{
nullptr};
666 GeoLogVol *lvAbsorber{
nullptr}, *lvAbsorber1{
nullptr}, *lvAbsorber3{
nullptr};
667 GeoIntrusivePtr<GeoPhysVol> pvAbsorber{
nullptr}, pvAbsorber1{
nullptr}, pvAbsorber3{
nullptr};
668 GeoPhysVol *pvTmp_Absorber1{
nullptr}, *pvTmp_Absorber3{
nullptr};
671 switch (sec_number) {
680 thicknessAbsorber1 = nA1*thicknessPeriod;
681 PosAbsor1 = thicknessAbsorber/2 - thicknessAbsorber1/2;
683 thicknessAbsorber2 = nA2*thicknessPeriod;
684 PosAbsor2 = thicknessAbsorber/2 - thicknessAbsorber1 - thicknessAbsorber2/2;
686 thicknessAbsorber3 = nA3*thicknessPeriod;
687 PosAbsor3 = thicknessAbsorber/2 - thicknessAbsorber1 - thicknessAbsorber2 - thicknessAbsorber3/2;
690 (*
m_log) <<
MSG::DEBUG <<
" Number of periods per Module: N= "<<nA1+nA2+nA3
691 <<
" Middle absorber, numbers of periods = "<<nA2
695 absorber1 =
new GeoTrd(thicknessAbsorber1/2, thicknessAbsorber1/2,
696 dy1Absorber, dy2Absorber,
699 lvAbsorber1 =
new GeoLogVol(
"Absorber",absorber1,matIron);
700 pvAbsorber1 =
new GeoPhysVol(lvAbsorber1);
703 absorber =
new GeoTrd(thicknessAbsorber2/2, thicknessAbsorber2/2,
704 dy1Absorber, dy2Absorber,
707 lvAbsorber =
new GeoLogVol(
"Absorber",absorber,matIron);
708 pvAbsorber =
new GeoPhysVol(lvAbsorber);
712 absorber3 =
new GeoTrd(thicknessAbsorber3/2, thicknessAbsorber3/2,
713 dy1Absorber, dy2Absorber,
716 lvAbsorber3 =
new GeoLogVol(
"Absorber",absorber3,matIron);
717 pvAbsorber3 =
new GeoPhysVol(lvAbsorber3);
721 (*m_log) <<
MSG::DEBUG <<
" _fillSection: Ex.Barrel pvAbsorber 1,3 Ok "<<
endmsg;
727 absorber =
new GeoTrd(thicknessAbsorber/2, thicknessAbsorber/2,
728 dy1Absorber, dy2Absorber,
732 lvAbsorber =
new GeoLogVol(
"Absorber",absorber,matIron);
735 lvAbsorber =
new GeoLogVol(
"Absorber",absorber,matAir);
737 pvAbsorber =
new GeoPhysVol(lvAbsorber);
743 (*m_log) <<
MSG::DEBUG <<
" _fillSection: special pvAbsorber made from Air Ok "<<
endmsg;
751 double thicknessAbsorberChild;
755 GeoLogVol* lvPeriod = 0;
756 GeoPhysVol* pvPeriod = 0;
757 GeoTransform* tfPeriod = 0;
758 GeoSerialTransformer* stPeriod = 0;
760 GeoTrd* absorberChild = 0;
761 GeoLogVol* lvAbsorberChild = 0;
762 GeoPhysVol* pvAbsorberChild = 0;
763 GeoTransform* tfAbsorberChild = 0;
766 switch (sec_number) {
776 <<
", dzglue: " << dzglue <<
" ==> thicknessPeriod: " << thicknessPeriod <<
endmsg;
782 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
784 period =
new GeoTrd(thicknessPeriod/2,
790 lvPeriod =
new GeoLogVol(
"Period",
period,matIron);
791 pvPeriod =
new GeoPhysVol(lvPeriod);
801 absorberChild =
new GeoTrd(thicknessAbsorberChild/2,
802 thicknessAbsorberChild/2,
806 lvAbsorberChild =
new GeoLogVol(
"AbsorberChild",absorberChild,matAir);
807 pvAbsorberChild =
new GeoPhysVol(lvAbsorberChild);
810 GENFUNCTION periodPos1 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorberChild)/2;
811 TRANSFUNCTION xfReplica1 = Pow(GeoTrf::TranslateX3D(1.),periodPos1);
813 (thicknessAbsorberChild - thicknessAbsorber)/2);
815 stPeriod =
new GeoSerialTransformer(pvPeriod,
819 pvAbsorberChild->add(
new GeoSerialIdentifier(0));
820 pvAbsorberChild->add(stPeriod);
823 tfAbsorberChild =
new GeoTransform(GeoTrf::Translate3D((thicknessAbsorberChild - thicknessAbsorber)/2,0.,0.));
824 pvAbsorber->add(tfAbsorberChild);
825 pvAbsorber->add(pvAbsorberChild);
831 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
833 period =
new GeoTrd(thicknessPeriod/2,
838 lvPeriod =
new GeoLogVol(
"Period",
period,matIron);
839 pvPeriod =
new GeoPhysVol(lvPeriod);
848 thicknessAbsorberChild = thicknessPeriod;
849 absorberChild =
new GeoTrd(thicknessAbsorberChild/2,
850 thicknessAbsorberChild/2,
854 lvAbsorberChild =
new GeoLogVol(
"AbsorberChild",absorberChild,matAir);
855 pvAbsorberChild =
new GeoPhysVol(lvAbsorberChild);
858 (-thicknessAbsorberChild + thicknessAbsorber)/2);
861 tfPeriod =
new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
864 pvAbsorberChild->add(tfPeriod);
865 pvAbsorberChild->add(pvPeriod);
868 tfAbsorberChild =
new GeoTransform(GeoTrf::Translate3D((-thicknessAbsorberChild + thicknessAbsorber)/2,0.,0.));
869 pvAbsorber->add(tfAbsorberChild);
870 pvAbsorber->add(pvAbsorberChild);
879 <<
", dzglue: " << dzglue <<
" ==> thicknessPeriod: " << thicknessPeriod <<
endmsg;
882 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
884 period =
new GeoTrd(thicknessPeriod/2,
889 lvPeriod =
new GeoLogVol(
"Period",
period,matIron);
890 pvPeriod =
new GeoPhysVol(lvPeriod);
903 GENFUNCTION periodPos1 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorber1)/2;
904 TRANSFUNCTION xfReplica1 = Pow(GeoTrf::TranslateX3D(1.),periodPos1);
906 (-thicknessAbsorber+thicknessAbsorber1)/2.);
908 stPeriod =
new GeoSerialTransformer(pvPeriod,&xfReplica1,nA1);
910 pvAbsorber1->add(
new GeoSerialIdentifier(0));
911 pvAbsorber1->add(stPeriod);
915 if ((ModuleNcp>=35 && ModuleNcp<=37) || (ModuleNcp>=60 && ModuleNcp<=62)) {
917 GeoCutVolAction action1(*CutA, TransCut2);
918 pvAbsorber1->apply(&action1);
919 pvTmp_Absorber1 = action1.getPV();
929 GENFUNCTION periodPos2 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorber2)/2;
930 TRANSFUNCTION xfReplica2 = Pow(GeoTrf::TranslateX3D(1.),periodPos2);
932 (-thicknessAbsorber+thicknessAbsorber2)/2.+thicknessAbsorber1);
934 stPeriod =
new GeoSerialTransformer(pvPeriod,&xfReplica2,nA2);
936 pvAbsorber->add(
new GeoSerialIdentifier(nA1));
937 pvAbsorber->add(stPeriod);
944 GENFUNCTION periodPos3 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorber3)/2;
945 TRANSFUNCTION xfReplica3 = Pow(GeoTrf::TranslateX3D(1.),periodPos3);
947 (-thicknessAbsorber+thicknessAbsorber3)/2.+thicknessAbsorber2+thicknessAbsorber1);
949 stPeriod =
new GeoSerialTransformer(pvPeriod,&xfReplica3,nA3);
951 pvAbsorber3->add(
new GeoSerialIdentifier(nA1+nA2));
952 pvAbsorber3->add(stPeriod);
955 if (ModuleNcp>=60 && ModuleNcp<=62) {
958 GeoCutVolAction action2(*CutB, TransCutL);
959 pvAbsorber3->apply(&action2);
960 pvTmp_Absorber3 = action2.getPV();
964 }
else if (ModuleNcp>=35 && ModuleNcp<=37) {
967 GeoCutVolAction action3(*CutB, TransCutR);
968 pvAbsorber3->apply(&action3);
969 pvTmp_Absorber3 = action3.getPV();
991 <<
", dzglue: " << dzglue <<
" ==> thicknessPeriod: " << thicknessPeriod <<
endmsg;
993 checking(
"Period 3 (ITC1 special)",
true, 4,
994 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
996 period =
new GeoTrd(thicknessPeriod/2,
1001 lvPeriod =
new GeoLogVol(
"Period",
period,matIron);
1002 pvPeriod =
new GeoPhysVol(lvPeriod);
1012 absorberChild =
new GeoTrd(thicknessAbsorberChild/2,
1013 thicknessAbsorberChild/2,
1017 lvAbsorberChild =
new GeoLogVol(
"AbsorberChild",absorberChild,matAir);
1018 pvAbsorberChild =
new GeoPhysVol(lvAbsorberChild);
1021 GENFUNCTION periodPosITC1sp = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorberChild)/2;
1022 TRANSFUNCTION xfReplicaITC1sp = Pow(GeoTrf::TranslateX3D(1.),periodPosITC1sp);
1024 (thicknessAbsorberChild - thicknessAbsorber)/2);
1026 stPeriod =
new GeoSerialTransformer(pvPeriod,
1030 pvAbsorberChild->add(
new GeoSerialIdentifier(0));
1031 pvAbsorberChild->add(stPeriod);
1034 tfAbsorberChild =
new GeoTransform(GeoTrf::Translate3D((thicknessAbsorberChild - thicknessAbsorber)/2,0.,0.));
1035 pvAbsorber->add(tfAbsorberChild);
1036 pvAbsorber->add(pvAbsorberChild);
1042 checking(
"Period 5 (ITC1 special)",
true, 4,
1043 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
1045 period =
new GeoTrd(thicknessPeriod/2,
1050 lvPeriod =
new GeoLogVol(
"Period",
period,matIron);
1051 pvPeriod =
new GeoPhysVol(lvPeriod);
1059 thicknessAbsorberChild = thicknessPeriod;
1060 absorberChild =
new GeoTrd(thicknessAbsorberChild/2,
1061 thicknessAbsorberChild/2,
1065 lvAbsorberChild =
new GeoLogVol(
"AbsorberChild",absorberChild,matAir);
1066 pvAbsorberChild =
new GeoPhysVol(lvAbsorberChild);
1069 (-thicknessAbsorberChild + thicknessAbsorber)/2);
1072 tfPeriod =
new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
1074 pvAbsorberChild->add(tfPeriod);
1075 pvAbsorberChild->add(pvPeriod);
1078 tfAbsorberChild =
new GeoTransform(GeoTrf::Translate3D((-thicknessAbsorberChild + thicknessAbsorber)/2,0.,0.));
1079 pvAbsorber->add(tfAbsorberChild);
1080 pvAbsorber->add(pvAbsorberChild);
1083 (*m_log) <<
MSG::DEBUG <<
" _fillSection: Absorber (ITC plug special) Ok "<<
endmsg;
1089 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
1091 period =
new GeoTrd(thicknessPeriod/2,
1096 lvPeriod =
new GeoLogVol(
"Period",
period,matIron);
1097 pvPeriod =
new GeoPhysVol(lvPeriod);
1106 GENFUNCTION periodPos3 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorber)/2;
1107 TRANSFUNCTION xfReplica3 = Pow(GeoTrf::TranslateX3D(1.),periodPos3);
1118 stPeriod =
new GeoSerialTransformer(pvPeriod,
1122 pvAbsorber->add(
new GeoSerialIdentifier(0));
1123 pvAbsorber->add(stPeriod);
1138 <<
", dzglue: " << dzglue <<
" ==> thicknessPeriod: " << thicknessPeriod <<
endmsg;
1141 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
1143 period =
new GeoTrd(thicknessPeriod/2,
1148 lvPeriod =
new GeoLogVol(
"Period",
period,matIron);
1149 pvPeriod =
new GeoPhysVol(lvPeriod);
1159 absorberChild =
new GeoTrd(thicknessAbsorberChild/2,
1160 thicknessAbsorberChild/2,
1164 lvAbsorberChild =
new GeoLogVol(
"AbsorberChild",absorberChild,matAir);
1165 pvAbsorberChild =
new GeoPhysVol(lvAbsorberChild);
1168 GENFUNCTION periodPos1 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorberChild)/2;
1169 TRANSFUNCTION xfReplica1 = Pow(GeoTrf::TranslateX3D(1.),periodPos1);
1171 (thicknessAbsorberChild - thicknessAbsorber)/2);
1173 stPeriod =
new GeoSerialTransformer(pvPeriod,
1177 pvAbsorberChild->add(
new GeoSerialIdentifier(0));
1178 pvAbsorberChild->add(stPeriod);
1181 tfAbsorberChild =
new GeoTransform(GeoTrf::Translate3D((thicknessAbsorberChild - thicknessAbsorber)/2,0.,0.));
1182 pvAbsorber->add(tfAbsorberChild);
1183 pvAbsorber->add(pvAbsorberChild);
1189 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
1191 period =
new GeoTrd(thicknessPeriod/2,
1196 lvPeriod =
new GeoLogVol(
"Period",
period,matIron);
1197 pvPeriod =
new GeoPhysVol(lvPeriod);
1205 thicknessAbsorberChild = thicknessPeriod;
1206 absorberChild =
new GeoTrd(thicknessAbsorberChild/2,
1207 thicknessAbsorberChild/2,
1211 lvAbsorberChild =
new GeoLogVol(
"AbsorberChild",absorberChild,matAir);
1212 pvAbsorberChild =
new GeoPhysVol(lvAbsorberChild);
1215 (-thicknessAbsorberChild + thicknessAbsorber)/2);
1218 tfPeriod =
new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
1220 pvAbsorberChild->add(tfPeriod);
1221 pvAbsorberChild->add(pvPeriod);
1224 tfAbsorberChild =
new GeoTransform(GeoTrf::Translate3D((-thicknessAbsorberChild + thicknessAbsorber)/2,0.,0.));
1225 pvAbsorber->add(tfAbsorberChild);
1226 pvAbsorber->add(pvAbsorberChild);
1243 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::fillSection: Unexpected section = "
1248 thicknessPeriod = thicknessAbsorber;
1249 MLOG(
DEBUG) <<
"DEFAULT Section -- thicknessAbsorber: " << thicknessAbsorber <<
" ==> thicknessPeriod: " << thicknessPeriod <<
endmsg;
1252 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
1256 if (dy1Period <= 0.0 || dy2Period <= 0.0 || dy1Period > dy1Absorber || dy2Period > dy2Absorber || dy1Period >= dy2Period ) {
1257 dy1Period = dy1Absorber;
1258 dy2Period = dy2Absorber;
1261 period =
new GeoTrd(thicknessPeriod/2,
1267 lvPeriod =
new GeoLogVol(
"Period",
period,matAluminium);
1268 pvPeriod =
new GeoPhysVol(lvPeriod);
1279 tfPeriod =
new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
1280 pvAbsorber->add(
new GeoIdentifierTag(0));
1281 pvAbsorber->add(tfPeriod);
1282 pvAbsorber->add(pvPeriod);
1285 (*m_log) <<
MSG::DEBUG <<
" _fillSection: Absorber (case default) Ok "<<
endmsg;
1291 GeoTransform *tfAbsorber{
nullptr}, *tfAbsorber1{
nullptr}, *tfAbsorber3{
nullptr};
1296 if (sec_number==3) {
1299 mother->add(tfAbsorber);
1300 mother->add(pvAbsorber);
1302 }
else if (sec_number==2) {
1306 tfAbsorber1 =
new GeoTransform(GeoTrf::Translate3D(dXAbsorber*
Gaudi::Units::cm/2 - PosAbsor1, 0.,
1308 mother->add(tfAbsorber1);
1309 if (
m_dbManager->
BoolCuts() && ((ModuleNcp>=35 && ModuleNcp<=37) || (ModuleNcp>=60 && ModuleNcp<=62)) ) {
1310 mother->add(pvTmp_Absorber1);
1312 mother->add(pvAbsorber1);
1316 (*m_log) <<
MSG::DEBUG <<
" _fillsection ext.barrel pvAbsorber1 Ok"<<
endmsg;
1318 tfAbsorber =
new GeoTransform(GeoTrf::Translate3D(dXAbsorber*
Gaudi::Units::cm/2 - PosAbsor2, 0.,
1320 mother->add(tfAbsorber);
1321 mother->add(pvAbsorber);
1324 (*m_log) <<
MSG::DEBUG <<
" _fillsection ext.barrel pvAbsorber Ok"<<
endmsg;
1326 tfAbsorber3 =
new GeoTransform(GeoTrf::Translate3D(dXAbsorber*
Gaudi::Units::cm/2 - PosAbsor3, 0.,
1328 mother->add(tfAbsorber3);
1329 if (
m_dbManager->
BoolCuts() && ((ModuleNcp>=35 && ModuleNcp<=37) || (ModuleNcp>=60 && ModuleNcp<=62)) ) {
1330 mother->add(pvTmp_Absorber3);
1332 mother->add(pvAbsorber3);
1336 (*m_log) <<
MSG::DEBUG <<
" _fillsection ext.barrel pvAbsorber3 Ok"<<
endmsg;
1339 tfAbsorber =
new GeoTransform(GeoTrf::Translate3D(dXAbsorber*
Gaudi::Units::cm/2, 0.,
1341 mother->add(tfAbsorber);
1342 mother->add(pvAbsorber);
1354 double tan_delta_phi_2,
1367 GeoTrd* girderElement = 0;
1368 GeoLogVol* lvGirderElement = 0;
1369 GeoPhysVol* pvGirderElement = 0;
1370 GeoTransform* tfGirderElement = 0;
1372 int CurrentGird = 1;
1386 double dy1GirderElement, dy2GirderElement;
1387 if (elementSizeInY >0) {
1388 dy1GirderElement = elementSizeInY/2;
1389 dy2GirderElement = elementSizeInY/2;
1391 dy1GirderElement = (elementRC - elementSizeInR/2) * tan_delta_phi_2;
1392 dy2GirderElement = (elementRC + elementSizeInR/2) * tan_delta_phi_2;
1404 lvGirderElement =
new GeoLogVol(
"GirderIron",girderElement,matIron);
1409 lvGirderElement =
new GeoLogVol(
"GirderAluminium",girderElement,matAluminium);
1414 lvGirderElement =
new GeoLogVol(
"GirderElectronics",girderElement,matElBoard);
1419 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::FillGirder: unknown material = "
1425 pvGirderElement =
new GeoPhysVol(lvGirderElement);
1426 tfGirderElement =
new GeoTransform(GeoTrf::Translate3D(0.,
1429 mother->add(tfGirderElement);
1430 mother->add(pvGirderElement);
1442 double corrected_dz)
1444 bool boolNeg =
false;
1446 if (ModuleNcp > 99) {
1447 ModuleNcp = ModuleNcp/100;
1493 GeoTrd* fingerElementTrd = 0;
1494 GeoTrap* fingerElementTrap = 0;
1496 GeoBox *fingerCablesL{
nullptr}, *fingerCablesR{
nullptr};
1497 GeoPhysVol *pvFingerElement = 0, *pvFingerCablesL{
nullptr}, *pvFingerCablesR{
nullptr};
1498 GeoLogVol *lvFingerElement = 0, *lvFingerCablesL{
nullptr}, *lvFingerCablesR{
nullptr};
1499 GeoTransform* tfFingerElement = 0, *tfFingerCables{
nullptr};
1501 GeoTransform* ZrotateMod = 0;
1502 GeoTransform* yrotateMod = 0;
1503 GeoTransform* zrotateMod = 0;
1505 const GeoMaterial *currentMaterial{
nullptr}, *leftMaterial{
nullptr}, *rightMaterial{
nullptr};
1506 std::string currentName, leftName, rightName;
1508 int CurrentTicg = 100*sec_number + 1;
1510 double AirVolumeShift = 0.0;
1511 double AirVolumeSize = corrected_dz;
1523 if (corrected_dz > 0.) {
1524 if (j-CurrentTicg==0) {
1525 AirVolumeShift = (elementDz-corrected_dz)/2 - elementZPozition;
1526 AirVolumeSize = elementDz;
1528 (*m_log) <<
MSG::DEBUG <<
"TileFinger: OldAirVolumeCenter ="<<elementZPozition <<
endmsg;
1529 (*m_log) <<
MSG::DEBUG <<
"TileFinger: NewAirVolumeCenter ="<<elementZPozition+AirVolumeShift <<
endmsg;
1530 (*m_log) <<
MSG::DEBUG <<
"TileFinger: AirVolumeShift ="<< AirVolumeShift <<
endmsg;
1531 (*m_log) <<
MSG::DEBUG <<
"TileFinger: AirVolumeSize ="<< AirVolumeSize <<
endmsg;
1535 if (elementZPozition*2-AirVolumeSize<-0.01) {
1536 elementZPozition += AirVolumeShift;
1541 elementDz = corrected_dz - AirVolumeSize;
1543 (*m_log) <<
MSG::DEBUG <<
"TileFinger: NewCoverThickness ="<<elementDz <<
endmsg;
1544 (*m_log) <<
MSG::DEBUG <<
"TileFinger: OldCoverCenter ="<<elementZPozition <<
endmsg;
1546 elementZPozition = (corrected_dz-elementDz)/2;
1555 currentMaterial = matIron;
1556 currentName =
"FingerIron";
1561 currentMaterial = matAluminium;
1562 currentName =
"FingerAluminum";
1567 currentMaterial = matElBoard;
1568 currentName =
"FingerElectronics";
1573 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::fillFinger: unexpected material = "
1585 lvFingerElement =
new GeoLogVol(currentName,fingerElementTrd,currentMaterial);
1595 std::atan((elementDy1-elementDy2)/(2.*elementHeight)),
1599 std::atan((elementDy1-elementDy2)/(2.*elementHeight)));
1601 lvFingerElement =
new GeoLogVol(currentName,fingerElementTrap,currentMaterial);
1604 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::fillFinger: unexpected shape = "
1610 pvFingerElement =
new GeoPhysVol(lvFingerElement);
1611 tfFingerElement =
new GeoTransform(GeoTrf::Translate3D(elementZPozition*
Gaudi::Units::cm,
1615 mother->add(tfFingerElement);
1617 if (elementOffset<0) {
1619 mother->add(ZrotateMod);
1624 mother->add(yrotateMod);
1625 mother->add(zrotateMod);
1628 mother->add(
new GeoIdentifierTag(ModuleNcp));
1629 mother->add(pvFingerElement);
1632 if (testbeam)
return;
1636 int Isector =0, LRflag =0;
1638 if ((ModuleNcp/4 - (
float)ModuleNcp/4) != 0) {
1639 Isector = (
int)ModuleNcp/4;
1641 Isector = (
int)ModuleNcp/4-1;
1643 LRflag = ModuleNcp-4*Isector;
1652 double dXleft =35., dXright = 35.;
1653 double dZleft = elementDz/2, dZright = dZleft;
1654 double dZsaddleL = elementDz/4, dZsaddleR = dZsaddleL;
1658 rightName = leftName =
"LArCables";
1661 dZright = elementDz, dXright = 35;
1664 rightName =
"LArService";
1666 }
else if (LRflag == 4) {
1667 dZleft = elementDz, dXleft = 35;
1670 leftName =
"LArService";
1673 if (sec_number == 1) {
1674 if ( (ModuleNcp >=40 && ModuleNcp <=41) || (ModuleNcp >=56 && ModuleNcp <=57) ) {
1675 dZright = dZleft = 8.5;
1676 dZsaddleL = dZsaddleR = 13.7;
1677 rightMaterial = leftMaterial = iron;
1678 rightName = leftName =
"BarrelSaddleSupport";
1682 if ( (ModuleNcp >=39 && ModuleNcp <=42) || (ModuleNcp >=55 && ModuleNcp <=58) ) {
1683 dZright = dZleft = 8.5;
1684 dZsaddleR = dZsaddleL = 13.7;
1685 rightMaterial = leftMaterial = iron;
1686 rightName = leftName =
"ExtBarrelSaddleSupport";
1691 (*
m_log) <<
MSG::DEBUG <<
" Finger : number= "<<sec_number<<
" ModuleNcp = " <<ModuleNcp<<
" Sector= "<< Isector
1692 <<
" LRflag= " << LRflag <<
" Neg "<< boolNeg
1695 GeoTransform *rotateY =
new GeoTransform(GeoTrf::RotateY3D(90*
Gaudi::Units::deg));
1696 GeoTransform *rotateZ =
new GeoTransform(GeoTrf::RotateZ3D(3*
Gaudi::Units::deg));
1697 GeoTransform *rotateZm =
new GeoTransform(GeoTrf::RotateZ3D(-3*
Gaudi::Units::deg));
1701 lvFingerCablesL =
new GeoLogVol(leftName,fingerCablesL,leftMaterial);
1702 pvFingerCablesL =
new GeoPhysVol(lvFingerCablesL);
1706 lvFingerCablesR =
new GeoLogVol(rightName,fingerCablesR,rightMaterial);
1707 pvFingerCablesR =
new GeoPhysVol(lvFingerCablesR);
1709 double YpoFinger =0;
1712 YpoFinger = -elementOffset+5.4;
1714 YpoFinger = elementOffset-5.4;
1720 mother->add(tfFingerCables);
1724 mother->add(rotateY);
1725 mother->add(rotateZm);
1727 mother->add(rotateY);
1728 mother->add(rotateZ);
1731 mother->add(
new GeoIdentifierTag(ModuleNcp));
1732 mother->add(pvFingerCablesL);
1735 YpoFinger = elementOffset-5.4;
1737 YpoFinger = -elementOffset+5.4;
1743 mother->add(tfFingerCables);
1747 mother->add(rotateY);
1748 mother->add(rotateZ);
1750 mother->add(rotateY);
1751 mother->add(rotateZm);
1754 mother->add(
new GeoIdentifierTag(ModuleNcp));
1755 mother->add(pvFingerCablesR);
1762 double tan_delta_phi_2,
1767 int CurrentScin = 0;
1768 const GeoShape* glue = 0;
1769 GeoLogVol* lvGlue = 0;
1770 GeoPhysVol* pvGlue = 0;
1771 GeoTransform* tfGlue = 0;
1773 double scintiWrapInZ, scintiWrapInR, scintiThickness, scintiDeltaInPhi;
1774 double scintiHeight, scintiRC, scintiZPos, dy1Scintillator, dy2Scintillator;
1775 const GeoShape* scintillator = 0;
1776 GeoLogVol* lvScintillator = 0;
1777 GeoPhysVol* pvScintillator = 0;
1778 GeoTransform* tfScintillator = 0;
1780 double thicknessWrapper, heightWrapper, dy1Wrapper, dy2Wrapper;
1781 const GeoShape* wrapper = 0;
1782 GeoLogVol* lvWrapper = 0;
1783 GeoPhysVol* pvWrapper = 0;
1784 GeoTransform* tfWrapper = 0;
1786 GeoIdentifierTag* idTag = 0;
1806 CurrentScin = 100*2 + 1;
1825 const GeoMaterial* matScin =
nullptr;
1832 if (matScin !=
nullptr) {
1853 if (dzglue>0.0 && period_type<4 && !removeGlue) {
1857 dzglue2 = floor(dzglue2*1.0
e+10)*1.0e-10;
1870 dzglue2,dzglue2,dy1Glue,dy2Glue,heightGlue2);
1872 glue =
new GeoTrd(dzglue2,dzglue2,dy1Glue,dy2Glue,heightGlue2);
1877 idTag =
new GeoIdentifierTag(j-CurrentScin);
1887 GeoShape *air1 =
new GeoTubs(csTubeOuterR, csHoleR, thicknessMother2, 0.,360.0 *
Gaudi::Units::deg);
1888 GeoShape *air2 =
new GeoTubs(csTubeOuterR, csHoleR, thicknessMother2, 0.,360.0 *
Gaudi::Units::deg);
1889 GeoShape *air3 =
new GeoTubs(0., csTubeInnerR, thicknessMother2, 0.,360.0 *
Gaudi::Units::deg);
1891 GeoLogVol * lvAir1 =
new GeoLogVol(
"CsTubeAir1",air1,matAir);
1892 GeoLogVol * lvAir2 =
new GeoLogVol(
"CsTubeAir2",air2,matAir);
1893 GeoLogVol * lvAir3 =
new GeoLogVol(
"CsTubeAir3",air3,matAir);
1894 GeoPhysVol * pvAir1 =
new GeoPhysVol(lvAir1);
1895 GeoPhysVol * pvAir2 =
new GeoPhysVol(lvAir2);
1896 GeoPhysVol * pvAir3 =
new GeoPhysVol(lvAir3);
1898 GeoTransform* tftube1 =
new GeoTransform(tfHole1);
1899 GeoTransform* tftube2 =
new GeoTransform(tfHole2);
1900 GeoTransform* tftube3 =
new GeoTransform(tfHole2);
1902 mother->add(tftube1);
1903 mother->add(pvAir1);
1904 mother->add(tftube2);
1905 mother->add(pvAir2);
1906 mother->add(tftube3);
1907 mother->add(pvAir3);
1911 glue =
makeHoles(glue, csHoleR, dzglue2, off, off0);
1915 lvGlue =
new GeoLogVol(
"Glue",glue,matGlue);
1916 pvGlue =
new GeoPhysVol(lvGlue);
1919 switch(period_type) {
1929 mother->add(tfGlue);
1930 mother->add(pvGlue);
1934 tfGlue =
new GeoTransform(GeoTrf::Translate3D(-dzglue/2*
Gaudi::Units::cm,0.,0.));
1935 mother->add(tfGlue);
1936 mother->add(pvGlue);
1941 mother->add(tfGlue);
1942 mother->add(pvGlue);
1946 tfGlue =
new GeoTransform(GeoTrf::Translate3D((thickness-dzglue)/2*
Gaudi::Units::cm,0.,0.));
1947 mother->add(tfGlue);
1948 mother->add(pvGlue);
1952 idTag =
new GeoIdentifierTag(j-CurrentScin);
1975 thicknessWrapper/2,thicknessWrapper/2,dy1Wrapper,dy2Wrapper,heightWrapper/2);
1977 wrapper =
new GeoTrd(thicknessWrapper/2,
1986 lvWrapper =
new GeoLogVol(
"Wrapper",wrapper,matAir);
1987 pvWrapper =
new GeoPhysVol(lvWrapper);
1995 checking(
"Scintillator 0",
true, 6,
2007 lvScintillator =
new GeoLogVol(
"Scintillator",scintillator,matScin);
2008 pvScintillator =
new GeoPhysVol(lvScintillator);
2011 tfScintillator =
new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
2012 pvWrapper->add(idTag);
2013 pvWrapper->add(tfScintillator);
2014 pvWrapper->add(pvScintillator);
2018 (*m_log) <<
MSG::VERBOSE <<
" X scintiZPos= "<<scintiZPos;
2027 mother->add(tfWrapper);
2028 mother->add(pvWrapper);
2041 mother->add(tfGlue);
2042 mother->add(pvGlue);
2047 mother->add(tfGlue);
2048 mother->add(pvGlue);
2052 idTag =
new GeoIdentifierTag(j-CurrentScin);
2075 thicknessWrapper/2,thicknessWrapper/2,dy1Wrapper,dy2Wrapper,heightWrapper/2);
2077 wrapper =
new GeoTrd(thicknessWrapper/2,
2086 lvWrapper =
new GeoLogVol(
"Wrapper",wrapper,matAir);
2087 pvWrapper =
new GeoPhysVol(lvWrapper);
2095 checking(
"Scintillator 1",
true, 6,
2107 lvScintillator =
new GeoLogVol(
"Scintillator",scintillator,matScin);
2108 pvScintillator =
new GeoPhysVol(lvScintillator);
2111 tfScintillator =
new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
2112 pvWrapper->add(idTag);
2113 pvWrapper->add(tfScintillator);
2114 pvWrapper->add(pvScintillator);
2118 (*m_log) <<
MSG::VERBOSE <<
" X scintiZPos= "<<scintiZPos;
2127 mother->add(tfWrapper);
2128 mother->add(pvWrapper);
2140 tfGlue =
new GeoTransform(GeoTrf::Translate3D((-thickness + dzglue)*
Gaudi::Units::cm/2,0.,0.));
2141 mother->add(tfGlue);
2142 mother->add(pvGlue);
2147 mother->add(tfGlue);
2148 mother->add(pvGlue);
2152 tfGlue =
new GeoTransform(GeoTrf::Translate3D(dzglue/2*
Gaudi::Units::cm,0.,0.));
2153 mother->add(tfGlue);
2154 mother->add(pvGlue);
2159 mother->add(tfGlue);
2160 mother->add(pvGlue);
2164 idTag =
new GeoIdentifierTag(j-CurrentScin);
2188 thicknessWrapper/2,thicknessWrapper/2,dy1Wrapper,dy2Wrapper,heightWrapper/2);
2190 wrapper =
new GeoTrd(thicknessWrapper/2,
2199 lvWrapper =
new GeoLogVol(
"Wrapper",wrapper,matAir);
2200 pvWrapper =
new GeoPhysVol(lvWrapper);
2208 checking(
"Scintillator 2",
true, 6,
2220 lvScintillator =
new GeoLogVol(
"Scintillator",scintillator,matScin);
2221 pvScintillator =
new GeoPhysVol(lvScintillator);
2224 tfScintillator =
new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
2225 pvWrapper->add(idTag);
2226 pvWrapper->add(tfScintillator);
2227 pvWrapper->add(pvScintillator);
2231 (*m_log) <<
MSG::VERBOSE <<
" X scintiZPos= "<<scintiZPos;
2240 mother->add(tfWrapper);
2241 mother->add(pvWrapper);
2265 idTag =
new GeoIdentifierTag(j-CurrentScin);
2274 thicknessWrapper/2,thicknessWrapper/2,dy1Wrapper,dy2Wrapper,heightWrapper/2);
2276 wrapper =
new GeoTrd(thicknessWrapper/2,
2285 lvWrapper =
new GeoLogVol(
"Wrapper",wrapper,matAir);
2286 pvWrapper =
new GeoPhysVol(lvWrapper);
2294 checking(
"Scintillator 3",
true, 6,
2306 lvScintillator =
new GeoLogVol(
"Scintillator",scintillator,matScin);
2307 pvScintillator =
new GeoPhysVol(lvScintillator);
2310 tfScintillator =
new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
2311 pvWrapper->add(idTag);
2312 pvWrapper->add(tfScintillator);
2313 pvWrapper->add(pvScintillator);
2321 tfWrapper =
new GeoTransform(GeoTrf::Translate3D(0.,
2325 mother->add(tfWrapper);
2326 mother->add(pvWrapper);
2336 double dy1Period =
period->getYHalfLength1();
2337 double tanphi = (
period->getYHalfLength2()-dy1Period)/
period->getZHalfLength()/2.;
2339 if (std::abs(tanphi-tan_delta_phi_2) > 1.e-5)
2343 idTag =
new GeoIdentifierTag(j-CurrentScin);
2360 dy1Wrapper = dy1Period - thicknessEnvelope + ((scintiRC - scintiHeight/2. - scintiWrapInR)*tanphi)*
Gaudi::Units::cm;
2361 dy2Wrapper = dy1Period - thicknessEnvelope + ((scintiRC + scintiHeight/2. + scintiWrapInR)*tanphi)*
Gaudi::Units::cm;
2366 thicknessWrapper/2,thicknessWrapper/2,dy1Wrapper,dy2Wrapper,heightWrapper/2);
2368 wrapper =
new GeoTrd(thicknessWrapper/2,
2373 lvWrapper =
new GeoLogVol(
"Wrapper",wrapper,matAir);
2374 pvWrapper =
new GeoPhysVol(lvWrapper);
2377 dy1Scintillator = dy1Period - thicknessEnvelope + ((scintiRC - scintiHeight/2.)*tanphi - scintiDeltaInPhi)*
Gaudi::Units::cm;
2378 dy2Scintillator = dy1Period - thicknessEnvelope + ((scintiRC + scintiHeight/2.)*tanphi - scintiDeltaInPhi)*
Gaudi::Units::cm;
2380 checking(
"Scintillator 4",
true, 6,
2388 lvScintillator =
new GeoLogVol(
"Scintillator",scintillator,matScin);
2389 pvScintillator =
new GeoPhysVol(lvScintillator);
2392 tfScintillator =
new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
2393 pvWrapper->add(idTag);
2394 pvWrapper->add(tfScintillator);
2395 pvWrapper->add(pvScintillator);
2403 tfWrapper =
new GeoTransform(GeoTrf::Translate3D(0.,
2407 mother->add(tfWrapper);
2408 mother->add(pvWrapper);
2419 double X1,
double X2,
double Y1,
double Y2,
double Z)
2421 double rless = .005;
2422 std::string Step[8] = {
" ",
2433 << std::setiosflags(std::ios::fixed) << std::setw(9) << std::setprecision(4)
2434 <<
" dX1,dX2= "<<X1<<
" "<<X2
2435 <<
" dY1,dY2= "<<Y1<<
" "<<Y2
2437 << std::resetiosflags(std::ios::fixed)
2440 if (X1 < rless && X2 < rless) {
2441 (*m_log) << MSG::WARNING <<
" volume "<<
Name<<
" is empty, X1 or X2<0 "<<
endmsg;
2443 if (Y1 < rless && Y2 < rless) {
2444 (*m_log) << MSG::WARNING <<
" volume "<<
Name<<
" is empty, Y1 or Y2<0 "<<
endmsg;
2447 (*m_log) << MSG::WARNING <<
" volume "<<
Name<<
" is empty, Z<0 "<<
endmsg;
2464 int currentSample, etaIndex, nsamp;
2465 std::vector<int> samples;
2466 std::vector<int> firstScin;
2467 std::vector<int> lastScin;
2471 float phi_min, phi_max;
2472 float dphi = 2.0f*
M_PI/64;
2475 phi_max = nphi*dphi/2;
2479 phi_max = nphi * dphi;
2483 float rBarrel[] = {2450., 3020., 3630.};
2484 float drBarrel[] = {300., 840., 380.};
2486 float rExtended[] = {2450., 2870., 3480.};
2487 float drExtended[] = {300., 540., 680.};
2489 float rGap[] = {3215., 3630., 2802.5, 2475.5, 2066., 1646.};
2490 float drGap[] = {450., 380., 313., 341., 478., 362.};
2505 int indHardcoded = 0;
2522 int sign_eta = (
side>0) ? 1 : -1;
2535 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::fillDescriptor: No TICL structures for detector: "
2553 if (currentSample==samples[
index])
break;
2554 if (
index==samples.size()) {
2555 samples.push_back(currentSample);
2563 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::fillDescriptor: No TICL structures for the detector: "
2570 etaIndex = samples[
index];
2571 if (etaIndex > nsamp) nsamp = etaIndex;
2575 eta_min[etaIndex-1],
2576 eta_max[etaIndex-1],
2583 zcenter[etaIndex-1],
2588 rcenter[etaIndex-1] = rBarrel[indHardcoded];
2589 dr[etaIndex-1] = drBarrel[indHardcoded];
2591 rcenter[etaIndex-1] = rExtended[indHardcoded];
2592 dr[etaIndex-1] = drExtended[indHardcoded];
2599 rcenter[etaIndex-1],
2620 if (etaIndex > nsamp) nsamp = etaIndex;
2622 neta[etaIndex-1] = 1;
2630 zcenter[etaIndex-1],
2634 rcenter[etaIndex-1] = rGap[indHardcoded];
2635 dr[etaIndex-1] = drGap[indHardcoded];
2642 rcenter[etaIndex-1],
2657 float rMB[] = { 676., 254. };
2658 float drMB[] = { 306., 116. };
2676 phi_max = nphi * dphi + phi_min;
2679 descriptor->
set(&*eta_min.begin(),
2698 descriptor->
print();
2715 MLOG(
DEBUG) <<
"TileGeoSectionBuilder::computeCellDim for detector="
2719 std::vector<double> rmins;
2720 std::vector<double> rmaxs;
2721 std::vector<double> zmins;
2722 std::vector<double> zmaxs;
2726 std::vector<int> samples;
2730 unsigned int CurrentScin;
2732 int nSide, nTower, nSample=0;
2733 unsigned int nFirstRow, nLastRow,
nRows;
2735 double dzCell, dzPeriod;
2737 double zEnd1 =0,zEnd2 =0,zEnd1Lim =0,zEnd2Lim =0;
2740 float minTilesInRow;
2780 tileSize=
round(tileSize);
2784 rmins.push_back(rMin);
2785 rmaxs.push_back(rMax);
2805 zmaxs.push_back(0.);
2817 if (currentSample==samples[
index])
break;
2818 if (
index==samples.size()) samples.push_back(currentSample);
2822 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::computeCellDim: No TICL structures for the detector: "
2829 currentSample = samples[
index];
2835 nLastRow = nFirstRow + 2;
2839 nRows = nLastRow - nFirstRow + 1;
2844 for (
unsigned int jj=1; jj<
nRows; jj++) {
2852 dzCell = minTilesInRow * dzPeriod;
2854 dzCell = (minTilesInRow + 0.5) * dzPeriod;
2856 MLOG(
DEBUG) <<
"dzCell: " << dzCell <<
" minTilesInRow: " << minTilesInRow <<
" isSquare: " << isSquare <<
" dzPeriod: " << dzPeriod <<
endmsg;
2858 for (
unsigned int jj=nFirstRow; jj<=nLastRow; jj++)
2859 zmaxs[jj-1] = zmins[jj-1] + dzCell;
2866 int firstC = nLastRow + 1;
2871 for (
unsigned int jj=firstC-nFirstRow+1; jj<=nLastRow-nFirstRow; jj++) {
2879 dzCell = minTilesInRow*dzPeriod;
2881 dzCell = (minTilesInRow + 0.5)*dzPeriod;
2884 MLOG(
DEBUG) <<
"BC - dzCell: " << dzCell <<
" minTilesInRow: " << minTilesInRow <<
" isSquare: " << isSquare <<
endmsg;
2886 for (
unsigned int jj=firstC; jj<=nLastRow; jj++)
2887 zmaxs[jj-1] = zmins[jj-1] + dzCell;
2899 for (
unsigned int jj=nFirstRow; jj<=nLastRow; jj++) {
2900 double Zmin=zmins[jj-1];
2901 double Zmax=zmaxs[jj-1];
2904 else if (
Zmin>zEnd2Lim)
Zmin=zEnd2;
2906 else if (
Zmax>zEnd2Lim)
Zmax=zEnd2;
2909 cellDim->
addRMin(rmins[jj-1]);
2910 cellDim->
addRMax(rmaxs[jj-1]);
2915 cellDimNeg->addRMin(rmins[jj-1]);
2916 cellDimNeg->addRMax(rmaxs[jj-1]);
2917 cellDimNeg->addZMin(-
Zmax-zShiftNeg);
2918 cellDimNeg->addZMax(-
Zmin-zShiftNeg);
2919 if (jj==nFirstRow || (BCcell && jj==nLastRow))
2920 MLOG(
DEBUG) <<
"Zmin: " <<
Zmin <<
" Zmax: " <<
Zmax <<
" zShiftPos: " << zShiftPos <<
" zShiftNeg: " << zShiftNeg <<
endmsg;
2923 if (jj==nFirstRow || (BCcell && jj==nLastRow))
2928 for (
unsigned int jj=nFirstRow; jj<=nLastRow; jj++)
2929 zmins[jj-1] = zmaxs[jj-1];
2937 nSample = currentSample - 1;
2945 cellDimNeg->computeVolume();
2955 std::cout << std::setiosflags(std::ios::fixed)
2956 << std::setw(9) << std::setprecision(2);
2957 std::cout <<
"\n **** Cell dimensions computed for : ";
2958 std::cout <<
"(" <<
detector <<
", "
2961 << nSample <<
")\n";
2962 std::cout <<
" >> CellDim contains " << cellDim->
getNRows() <<
" rows\n";
2963 for (
unsigned int jj=0; jj<cellDim->
getNRows(); jj++)
2964 std::cout << cellDim->
getRMin(jj) <<
" "
2965 << cellDim->
getRMax(jj) <<
" "
2966 << cellDim->
getZMin(jj) <<
" "
2967 << cellDim->
getZMax(jj) <<
"\n";
2971 std::cout <<
" >> CellDimNeg contains " << cellDimNeg->getNRows() <<
" rows\n";
2972 for (
unsigned int jj=0; jj<cellDimNeg->getNRows(); jj++)
2973 std::cout << cellDimNeg->getRMin(jj) <<
" "
2974 << cellDimNeg->getRMax(jj) <<
" "
2975 << cellDimNeg->getZMin(jj) <<
" "
2976 << cellDimNeg->getZMax(jj) <<
"\n";
2977 std::cout <<
" >> CellNeg Volume is " << cellDimNeg->getVolume()*(1./
Gaudi::Units::cm3) <<
" cm^3\n";
2979 std::cout <<
"\n" << std::resetiosflags(std::ios::fixed);
2986 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::computeCellDim: No TICL structures in detector: "
2996 for (
unsigned int sec=0; sec<2; sec++) {
3022 if (addPlates && sec)
3029 tileSize=
round(tileSize);
3033 rmins.push_back(rMin);
3034 rmaxs.push_back(rMax);
3053 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::computeCellDim: Bad return from TILBnscin" <<
endmsg;
3060 for (
unsigned int jj=0; jj<nscin; jj++) {
3063 cellDim->
addZMin(zmins[jj]+zShiftPos);
3064 cellDim->
addZMax(zmaxs[jj]+zShiftPos);
3066 cellDimNeg->addRMin(rmins[jj]);
3067 cellDimNeg->addRMax(rmaxs[jj]);
3068 cellDimNeg->addZMin(-zmaxs[jj]-zShiftNeg);
3069 cellDimNeg->addZMax(-zmins[jj]-zShiftNeg);
3071 MLOG(
DEBUG) <<
"Zmin: " << zmins[0] <<
" Zmax: " << zmaxs[0] <<
" zShiftPos: " << zShiftPos <<
" zShiftNeg: " << zShiftNeg <<
endmsg;
3077 cellDimNeg->computeVolume();
3083 std::cout << std::setiosflags(std::ios::fixed)
3084 << std::setw(9) << std::setprecision(2);
3085 std::cout <<
"\n **** Cell dimension computed for : ";
3086 std::cout <<
"(" <<
detector <<
", "
3089 << nSample <<
")\n";
3090 std::cout <<
" >> CellDim contains " << cellDim->
getNRows() <<
" rows\n";
3091 for (
unsigned int jj=0; jj<cellDim->
getNRows(); jj++)
3092 std::cout << cellDim->
getRMin(jj) <<
" "
3093 << cellDim->
getRMax(jj) <<
" "
3094 << cellDim->
getZMin(jj) <<
" "
3095 << cellDim->
getZMax(jj) <<
"\n";
3098 std::cout <<
" >> CellDimNeg contains " << cellDimNeg->getNRows() <<
" rows\n";
3099 for (
unsigned int jj=0; jj<cellDimNeg->getNRows(); jj++)
3100 std::cout << cellDimNeg->getRMin(jj) <<
" "
3101 << cellDimNeg->getRMax(jj) <<
" "
3102 << cellDimNeg->getZMin(jj) <<
" "
3103 << cellDimNeg->getZMax(jj) <<
"\n";
3104 std::cout <<
" >> CellNeg Volume is " << cellDimNeg->getVolume()*(1./
Gaudi::Units::cm3) <<
" cm^3\n";
3105 std::cout <<
"\n" << std::resetiosflags(std::ios::fixed);
3110 for (
unsigned int sec=0; sec<2; sec++) {
3134 if (j==CurrentScin) {
3136 rMax = rCenter + dR2;
3138 rMin = rCenter - dR2;
3142 rMin = rCenter - dR2;
3143 rMax = rCenter + dR2;
3146 rmins.push_back(rMin);
3147 rmaxs.push_back(rMax);
3155 if (sec==0 && jj==0)
3180 cellDimNeg->computeVolume();
3186 std::cout << std::setiosflags(std::ios::fixed)
3187 << std::setw(9) << std::setprecision(2);
3188 std::cout <<
"\n **** Cell dimension computed for : ";
3189 std::cout <<
"(" <<
detector <<
", "
3192 << nSample <<
")\n";
3193 std::cout <<
" >> CellDim contains " << cellDim->
getNRows() <<
" rows\n";
3194 for (
unsigned int jj=0; jj<cellDim->
getNRows(); jj++)
3195 std::cout << cellDim->
getRMin(jj) <<
" "
3196 << cellDim->
getRMax(jj) <<
" "
3197 << cellDim->
getZMin(jj) <<
" "
3198 << cellDim->
getZMax(jj) <<
"\n";
3201 std::cout <<
" >> CellDimNeg contains " << cellDimNeg->getNRows() <<
" rows\n";
3202 for (
unsigned int jj=0; jj<cellDimNeg->getNRows(); jj++)
3203 std::cout << cellDimNeg->getRMin(jj) <<
" "
3204 << cellDimNeg->getRMax(jj) <<
" "
3205 << cellDimNeg->getZMin(jj) <<
" "
3206 << cellDimNeg->getZMax(jj) <<
"\n";
3207 std::cout <<
" >> CellNeg Volume is " << cellDimNeg->getVolume()*(1./
Gaudi::Units::cm3) <<
" cm^3\n";
3208 std::cout <<
"\n" << std::resetiosflags(std::ios::fixed);
3243 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::calculateZ: Unexpected detector: "
3277 if (
side<1) zcenter *= -1;
3308 cell = firstScin - 2;
3315 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::calculateR: Unexpected detector: "
3320 float oldrc = rcenter;
3332 rMax = rcenter +
dr * 0.5;
3334 rMin = rcenter -
dr * 0.5;
3336 rcenter = (rMax+rMin) * 0.5;
3351 }
else if (
cell == -2) {
3353 }
else if (firstScin == 1) {
3374 rcenter = (rMax+rMin)*0.5;
3383 std::cout << std::setiosflags(std::ios::fixed) << std::setw(9) << std::setprecision(2);
3384 std::cout <<
"Detector " <<
detector <<
" sample " <<
sample <<
" old r/dr " << oldrc <<
" " << olddr << std::endl;
3385 std::cout <<
"Detector " <<
detector <<
" sample " <<
sample <<
" new r/dr " << rcenter <<
" " <<
dr <<
" delta r/dr " << rcenter-oldrc <<
" " <<
dr-olddr << std::endl;
3386 std::cout << std::resetiosflags(std::ios::fixed);
3421 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::calculateEta: No TICL structures of positive side "
3422 <<
"in Central Barrel for sample: " <<
sample <<
endmsg;
3444 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::calculateEta: No TICL structures in detector: "
3452 (*m_log) << MSG::ERROR <<
"TileGeoSectionBuilder::calculateEta: Unexpected detector: "
3481 << std::setprecision (std::numeric_limits<double>::digits10 + 1)
3482 <<
" Absorber center = " << center
3483 <<
" length = " << absorber
3484 <<
" period = " <<
period
3485 <<
" nperiods = " <<
np
3487 double zC,dZ,z1,z2=-absorber/2.+center;
3488 for (
int i=0;
i<
np; ++
i) {
3489 zC = (
period*(2*
i+1)-absorber)/2. + center;
3494 <<
i <<
" z1= " << z1 <<
" z2= " << z2
3495 <<
" dist from previous= " << dZ <<
endmsg;
3502 (*m_log) <<
MSG::VERBOSE << std::setprecision (std::numeric_limits<double>::digits10 + 1)
3509 const GeoShapeUnion& scintUnion =
hole->add( *
hole << GeoTrf::Translate3D((off0-off*2.0),0.,0.));
3511 const GeoShape & motherWithHoles = (mother->subtract(scintUnion<<tfHole));
3512 return &motherWithHoles;
3521 const GeoShape & motherWithHoles = (mother->subtract((*hole1)<<tfHole1).subtract((*hole2)<<tfHole2));
3522 return &motherWithHoles;