9 #include <Geant4/G4AssemblyVolume.hh>
10 #include <Geant4/G4Box.hh>
11 #include <Geant4/G4LogicalVolume.hh>
12 #include <Geant4/G4Material.hh>
13 #include <Geant4/G4Polycone.hh>
14 #include <Geant4/G4RotationMatrix.hh>
15 #include <Geant4/G4String.hh>
16 #include <Geant4/G4SubtractionSolid.hh>
17 #include <Geant4/G4SystemOfUnits.hh>
18 #include <Geant4/G4ThreeVector.hh>
19 #include <Geant4/G4Transform3D.hh>
20 #include <Geant4/G4Tubs.hh>
21 #include <Geant4/G4Types.hh>
22 #include <Geant4/G4UserLimits.hh>
24 #pragma GCC diagnostic push
25 #pragma GCC diagnostic ignored "-Wshadow"
26 #include <boost/format.hpp>
27 #pragma GCC diagnostic pop
38 namespace ServiceProperties
69 using namespace ServiceProperties;
73 : m_Detector(detector)
74 , m_DisplayAction(dispAct)
75 , m_overlapCheck(overlapCheck)
108 auto MVTX_Al =
new G4Material(material.c_str(), density = 2.7 *
g /
cm3,
109 natoms = 1, kStateSolid);
113 material =
"MVTX_Epoxy$";
116 auto MVTX_Epoxy =
new G4Material(material.c_str(), density = 1.56 *
g /
cm3, natoms = 4);
123 material =
"MVTX_CarbonFiber$";
126 auto MVTX_CF =
new G4Material(material.c_str(), density = 1.987 *
g /
cm3,
166 const double sEndWheelNRmax[3] = {30.57 *
mm, 38.59 *
mm, 46.30 *
mm};
167 const double sEndWheelNRmin[3] = {22.83 *
mm, 30.67 *
mm, 38.70 *
mm};
168 const double sEndWheelNWallR[3] = {29.57 *
mm, 37.59 *
mm, 45.30 *
mm};
169 const double sEndWheelNThick = 2.8 *
mm;
171 const int sEndWNBaseNBigHoles = 6;
172 const int sEndWNBaseNSmallHoles = 5;
173 const double sEndWNBaseBigHoleD = 4 *
mm;
174 const double sEndWNBaseSmallHoleD = 1.6 *
mm;
175 const double sEndWNBaseHolesR[3] = {27. *
mm, 35. *
mm, 42.7 *
mm};
176 const double sEndWNBaseHolesPhi = 15.;
178 const int sEndWNWallNHoles[3] = {6, 8, 10};
179 const double sEndWNWallHoleD = 4.5 *
mm;
182 const double sEndWNStepXlen[3] = {9.88 *
mm, 11.2 *
mm, 8.38 *
mm};
183 const double sEndWNStepYdispl[3] = {26.521 *
mm, 33.891 *
mm, 41.64 *
mm};
184 const double sEndWNStepHolePhi[3] = {30.0, 22.5, 18.0};
185 const double sEndWNStepHoleTilt[3] = {0., 0.295, 0.297};
187 const double sEndWNStepZlen =
sEndWheelNLen - sEndWheelNThick;
191 double xpos, ypos, zpos, rpos;
194 auto Ta = G4ThreeVector();
195 auto Ra = G4RotationMatrix();
197 const unsigned short nZplanes = 4;
198 const double zPlane[nZplanes] = {0. *
mm,
203 const double rInner[nZplanes] = {sEndWheelNWallR[lay], sEndWheelNWallR[lay],
204 sEndWheelNRmin[lay], sEndWheelNRmin[lay]};
206 const double rOuter[nZplanes] = {sEndWheelNRmax[lay], sEndWheelNRmax[lay],
207 sEndWheelNRmax[lay], sEndWheelNRmax[lay]};
210 nZplanes, zPlane, rInner, rOuter);
214 1.5 * (sEndWheelNRmax[lay] - sEndWheelNWallR[lay]),
217 rmin = (sEndWheelNRmax[lay] + sEndWheelNWallR[lay]) / 2;
219 dphi = 180. / sEndWNWallNHoles[lay];
221 for (
int ihole = 0; ihole < 2 * sEndWNWallNHoles[lay]; ihole++)
223 double phi = phimin + ihole *
dphi;
224 xpos = rmin * sin(phi *
deg);
225 ypos = rmin * cos(phi * deg);
226 Ra.set(-phi * deg, 90 * deg, 0.);
227 Ta.set(xpos, ypos, zpos);
229 endWNBasis, endwnwalhol, &
Ra, Ta);
234 1.5 * sEndWheelNThick, 0, 2 * M_PI * rad);
237 1.5 * sEndWheelNThick, 0, 2 * M_PI * rad);
239 rmin = sEndWNBaseHolesR[lay];
242 for (
int ihole = 0; ihole < (sEndWNBaseNBigHoles + sEndWNBaseNSmallHoles); ihole++)
244 phimin += sEndWNBaseHolesPhi;
245 xpos = rmin * cos(phimin *
deg);
246 ypos = rmin * sin(phimin * deg);
248 Ta.set(xpos, ypos, zpos);
249 auto endwnbashol = (ihole < 2 || ihole == 5 || ihole > 8) ? endwnbasShol : endwnbasBhol;
251 endWNBasis, endwnbashol, &
Ra, Ta);
252 Ta = G4ThreeVector(-xpos, -ypos, zpos);
254 endWNBasis, endwnbashol, &
Ra, Ta);
259 rmin = sEndWheelNWallR[lay];
260 xlen = sEndWNStepXlen[lay] - ((lay == 1) ? 0.01 *
mm : 0. *
mm);
261 double xDispl = sqrt(rmin * rmin - sEndWNStepYdispl[lay] * sEndWNStepYdispl[lay]) - xlen;
262 ylen = sqrt(rmin * rmin - xDispl * xDispl) - sEndWNStepYdispl[lay];
265 (sEndWNStepZlen / 2) - 0.05 * mm);
267 xpos = xDispl + stepBoxNSh->GetXHalfLength();
268 ypos = sEndWNStepYdispl[lay] + stepBoxNSh->GetYHalfLength();
269 rpos = std::sqrt(xpos * xpos + ypos * ypos);
271 phimin = (90. *
deg) - acos(sEndWNStepYdispl[lay] / rmin) * rad - 5 *
deg;
272 dphi = (90. *
deg) - asin(xDispl / rmin) * rad - phimin + 5 *
deg;
273 rmax = rmin + 2 * stepBoxNSh->GetYHalfLength();
276 1.5 * sEndWNStepZlen / 2, phimin, dphi);
278 Ta.set(-xpos, -ypos, 0);
280 stepBoxNSh, stepTubNSh, &
Ra, Ta);
296 endWheel->AddPlacedVolume(endWheelNvol, Ta, &
Ra);
298 dphi = std::atan(ypos / xpos);
301 zpos += (stepBoxNSh->GetZHalfLength());
302 for (
int j = 0;
j < numberOfStaves;
j++)
305 phi +=
j * sEndWNStepHolePhi[lay] *
deg;
306 phi -= sEndWNStepHoleTilt[lay];
307 xpos = rpos * cos(phi);
308 ypos = rpos * sin(phi);
309 Ra.set(0., 0., dphi - phi);
310 Ta.set(xpos, ypos, zpos);
311 endWheel->AddPlacedVolume(stepNShLogVol, Ta, &
Ra);
350 const double sEWSExtSectRmax[3] = {30.97 *
mm, 38.99 *
mm, 46.74 *
mm};
351 const double sEWSExtSectThick[3] = {0.97 *
mm, 1.20 *
mm, 1.01 *
mm};
353 const double sEWSIntSectRmax[3] = {29.77 *
mm, 37.79 *
mm, 45.54 *
mm};
354 const double sEWSIntSectRmin[3] = {28.80 *
mm, 36.80 *
mm, 44.50 *
mm};
355 const double sEWSIntSectLongLen = 26 *
mm;
356 const double sEWSIntSectShortLen = 25 *
mm;
358 const double sEWSTotalLen = 42. *
mm;
360 const int sEndWSWallNHoles[3] = {6, 8, 10};
361 const double sEndWSWallHoleD = 4.5 *
mm;
363 const double sEndWSStepXlen[3] = {10.80 *
mm, 10.05 *
mm, 9.45 *
mm};
364 const double sEndWSStepYdispl[3] = {26.52 *
mm, 33.89 *
mm, 41.64 *
mm};
365 const double sEndWSStepHolePhi[3] = {30.0, 22.5, 18.0};
366 const double sEndWSStepHoleTilt[3] = {0., 0.295, 0.297};
368 const double sEndWSStepZlen = sEWSTotalLen - sEWSIntSectLongLen;
369 const double sEndWheelNWallR = sEWSExtSectRmax[lay] - sEWSExtSectThick[lay] + 0.05 *
mm;
373 double xpos, ypos, zpos, rpos;
376 auto Ta = G4ThreeVector();
377 auto Ra = G4RotationMatrix();
379 const unsigned short nZplanes = 6;
380 const double zPlane[nZplanes] = {0. *
mm,
381 sEWSTotalLen - sEWSIntSectLongLen,
382 sEWSTotalLen - sEWSIntSectLongLen,
383 sEWSTotalLen - sEWSIntSectShortLen,
384 sEWSTotalLen - sEWSIntSectShortLen,
387 const double rInner[nZplanes] = {sEndWheelNWallR,
389 sEWSIntSectRmin[lay],
390 sEWSIntSectRmin[lay],
391 sEWSIntSectRmin[lay],
392 sEWSIntSectRmin[lay]};
394 const double rOuter[nZplanes] = {sEWSExtSectRmax[lay],
395 sEWSExtSectRmax[lay],
396 sEWSExtSectRmax[lay],
397 sEWSExtSectRmax[lay],
398 sEWSIntSectRmax[lay],
399 sEWSIntSectRmax[lay]};
402 nZplanes, zPlane, rInner, rOuter);
406 1.5 * sEWSExtSectThick[lay],
409 rmin = sEWSExtSectRmax[lay] - sEWSExtSectThick[lay] / 2;
411 dphi = 180. / sEndWSWallNHoles[lay];
413 for (
int ihole = 0; ihole < 2 * sEndWSWallNHoles[lay]; ihole++)
415 double phi = phimin + ihole *
dphi;
416 xpos = rmin * sin(phi *
deg);
417 ypos = rmin * cos(phi * deg);
418 Ra.set(-phi * deg, 90 * deg, 0);
419 Ta.set(xpos, ypos, zpos);
421 endWSBasis, endwswalhol, &
Ra, Ta);
426 rmin = sEWSExtSectRmax[lay] - sEWSExtSectThick[lay];
427 xlen = sEndWSStepXlen[lay];
428 double xDispl = sqrt(rmin * rmin - sEndWSStepYdispl[lay] * sEndWSStepYdispl[lay]) - xlen;
429 ylen = sqrt(rmin * rmin - xDispl * xDispl) - sEndWSStepYdispl[lay];
432 (sEndWSStepZlen / 2) - 0.05 *
mm);
434 xpos = xDispl + stepBoxSSh->GetXHalfLength();
435 ypos = sEndWSStepYdispl[lay] + stepBoxSSh->GetYHalfLength();
436 rpos = std::sqrt(xpos * xpos + ypos * ypos);
438 phimin = (90. *
deg) - acos(sEndWSStepYdispl[lay] / rmin) * rad - 5 *
deg;
439 dphi = (90. *
deg) - asin(xDispl / rmin) * rad - phimin + 5 *
deg;
440 rmax = rmin + 2 * stepBoxSSh->GetYHalfLength();
443 1.5 * sEndWSStepZlen / 2, phimin, dphi);
445 Ta.set(-xpos, -ypos, 0.);
447 stepBoxSSh, stepTubSSh, &
Ra, Ta);
461 Ra.set(0., M_PI * rad, 0.);
463 endWheel->AddPlacedVolume(endWheelSvol, Ta, &
Ra);
465 dphi = std::atan(ypos / xpos);
468 zpos += (stepBoxSSh->GetZHalfLength());
469 for (
int j = 0;
j < numberOfStaves;
j++)
472 phi +=
j * sEndWSStepHolePhi[lay] *
deg;
473 phi -= sEndWSStepHoleTilt[lay];
474 xpos = rpos * cos(phi);
475 ypos = rpos * sin(phi);
476 Ra.set(0., 0., dphi - phi);
477 Ta.set(xpos, ypos, -zpos);
478 endWheel->AddPlacedVolume(stepSShLogVol, Ta, &
Ra);
513 const double sEndWheelSExtSectLen = 17 *
mm;
515 const double sThickness[3] = {1. *
mm, 1.12 *
mm, 1.12 *
mm};
516 const double sBigCylDmax[3] = {103 *
mm, 149 *
mm, 195 * mm};
517 const double sBigCylDmin = sBigCylDmax[lay] - 2 * sThickness[lay];
518 const double sSmallCylDmin[3] = {59.94 *
mm, 75.98 *
mm, 91.48 *
mm};
519 const double sTotalLen[3] = {186.8 *
mm, 179.74 *
mm, 223 *
mm};
520 const double sSmallCylLen[3] = {91.86 *
mm, 89.38 *
mm, 85.38 *
mm};
521 const double sConePlusSCLen[3] = {165.79 *
mm, 158.51 *
mm, 152.06 *
mm};
523 const int nZplanes = 4;
524 const double zPlane[nZplanes] = {0 *
mm,
526 -sConePlusSCLen[lay],
529 const double rInner[nZplanes] = {sSmallCylDmin[lay] / 2,
530 sSmallCylDmin[lay] / 2,
534 const double rOuter[nZplanes] = {sSmallCylDmin[lay] / 2 + sThickness[lay],
535 sSmallCylDmin[lay] / 2 + sThickness[lay],
536 sBigCylDmax[lay] / 2,
537 sBigCylDmax[lay] / 2};
540 nZplanes, zPlane, rInner, rOuter);
544 auto coneLogVol =
new G4LogicalVolume(coneSolid, matCF,
546 nullptr,
nullptr,
nullptr);
552 G4ThreeVector Ta = G4ThreeVector(0., 0., -zpos);
554 av->AddPlacedVolume(coneLogVol, Ta, &Ra);
585 const double sFlgExtThick = 1 *
mm;
586 const double sFlgIntThick = 1.5 *
mm;
587 const double sFlgSringLen = 4.5 *
mm;
588 const double sFlgLringLen = 7.5 *
mm;
589 const double sFlgRmin = 23.6 *
mm;
590 const double sFlgRmax = 52.8 *
mm;
591 const double sFlgSringRmin = 46.4 *
mm;
592 const double sFlgSringRmax = 47.4 *
mm;
593 const double sFlgLringRmin = 50.6 *
mm;
594 const double sFlgLringRmax = 51.5 *
mm;
596 const int nZplanes = 4;
597 const double zPlane_1[nZplanes] = {0. *
mm,
602 const double rInner_1[nZplanes] = {sFlgRmin,
607 const double rOuter_1[nZplanes] = {sFlgLringRmin,
612 const double zPlane_2[nZplanes] = {0. *
mm,
617 const double rInner_2[nZplanes] = {sFlgLringRmin,
622 const double rOuter_2[nZplanes] = {sFlgRmax,
627 auto flangeSolid_1 =
new G4Polycone(
"cyssFlangeNorth_1", 0., 2. * M_PI *
rad,
628 nZplanes, zPlane_1, rInner_1, rOuter_1);
630 auto flangeSolid_2 =
new G4Polycone(
"cyssFlangeNorth_2", 0., 2. * M_PI * rad,
631 nZplanes, zPlane_2, rInner_2, rOuter_2);
635 auto cyssFlangeLogVol_1 =
new G4LogicalVolume(flangeSolid_1, matAl,
636 "cyssFlangeNorth_1_LOGIC",
637 nullptr,
nullptr,
nullptr);
642 auto cyssFlangeLogVol_2 =
new G4LogicalVolume(flangeSolid_2, matAl,
643 "cyssFlangeNorth_2_LOGIC",
644 nullptr,
nullptr,
nullptr);
650 G4ThreeVector Ta = G4ThreeVector(0., 0., zpos);
651 G4RotationMatrix
Ra(0, M_PI * rad, 0.);
652 av->AddPlacedVolume(cyssFlangeLogVol_1, Ta, &Ra);
653 av->AddPlacedVolume(cyssFlangeLogVol_2, Ta, &Ra);
656 const double sCYSScylRmax = 52.82 *
mm;
657 const double sCYSScylRmin = 51.70 *
mm;
658 const double sCYSScylLen = 425.77 *
mm;
660 auto cyssCylSol =
new G4Tubs(
"CYSScyl_SOLID", sCYSScylRmin, sCYSScylRmax, sCYSScylLen / 2,
664 auto cyssCylLog =
new G4LogicalVolume(cyssCylSol, matCF,
"CYSScyl_LOGIC",
665 nullptr,
nullptr,
nullptr);
670 Ta.set(0., 0., zpos);
672 av->AddPlacedVolume(cyssCylLog, Ta, &Ra);
675 const double sCYSSconFlgDmin = 106.03 *
mm;
676 const double sCYSSconIntDmin = 211.00 *
mm;
677 const double sCYSSconFlgThick = 1.12 *
mm;
678 const double sCYSSconFlgLen = 13.48 *
mm;
679 const double sCYSSconNoseLen = 24.39 *
mm;
680 const double sCYSSconThick = 2.16 *
mm;
681 const double sCYSSconSlopeLen = 95.0 *
mm;
682 const double sCYSSconLen = 200.28 *
mm;
684 const int nZplanesCone = 5;
686 const double zPlanesCone[nZplanesCone] = {0 *
mm,
692 const double rInnerCone[nZplanesCone] = {sCYSSconFlgDmin / 2,
696 sCYSSconIntDmin / 2};
698 const double rOuterCone[nZplanesCone] = {(sCYSSconFlgDmin + sCYSSconFlgThick) / 2,
699 (sCYSSconFlgDmin + sCYSSconThick) / 2,
700 (sCYSSconFlgDmin + sCYSSconThick) / 2,
701 (sCYSSconIntDmin + sCYSSconThick) / 2,
702 (sCYSSconIntDmin + sCYSSconThick) / 2};
704 auto cyssConeSol =
new G4Polycone(
"cyssConeSol", 0., 2. * M_PI * rad,
705 nZplanesCone, zPlanesCone, rInnerCone, rOuterCone);
707 auto cyssConeLog =
new G4LogicalVolume(cyssConeSol, matCF,
"CYSScone_LOGIC",
708 nullptr,
nullptr,
nullptr);
713 Ta.set(0., 0., zpos);
714 Ra.set(0, M_PI * rad, 0.);
715 av->AddPlacedVolume(cyssConeLog, Ta, &Ra);
718 const double sCYSSribRint = 97.62 *
mm;
719 const double sCYSSribRext = 99.32 *
mm;
720 const double sCYSSribRmax = 105.30 *
mm;
721 const double sCYSSribWidth = 55.23 *
mm;
722 const double sCYSSribStep1pos = (15.6 + 7.7) / 2 *
mm;
723 const double sCYSSribStep2pos = (47.6 + 39.7) / 2 *
mm;
724 const double sCYSSribThick = 1.7 *
mm;
726 const int nZplanesRib = 10;
727 const double zPlanesRib[nZplanesRib] = {0. *
mm,
730 sCYSSribStep1pos + sCYSSribThick,
731 sCYSSribStep1pos + sCYSSribThick,
734 sCYSSribStep2pos + sCYSSribThick,
735 sCYSSribStep2pos + sCYSSribThick,
738 const double rInnerRib[nZplanesRib] = {sCYSSribRint,
742 sCYSSribRmax - sCYSSribThick,
743 sCYSSribRmax - sCYSSribThick,
749 const double rOuterRib[nZplanesRib] = {sCYSSribRext,
760 auto cyssRibSol =
new G4Polycone(
"cyssRibSol", 0., 2. * M_PI * rad,
761 nZplanesRib, zPlanesRib, rInnerRib, rOuterRib);
763 auto cyssRibLog =
new G4LogicalVolume(cyssRibSol, matCF,
"CYSSrib_LOGIC",
764 nullptr,
nullptr,
nullptr);
769 Ta.set(0., 0., zpos);
771 av->AddPlacedVolume(cyssRibLog, Ta, &Ra);
774 const double sFlgSRmax = 107.7 *
mm;
775 const double sFlgSRmin = 95.0 *
mm;
776 const double sFlgSRstep = 105.3 *
mm;
777 const double sFlgSChamfeEnd = 9. *
mm;
778 const double sFlgSTotalWidth = 20. *
mm;
779 const double sFlgSRimWidth = 7. *
mm;
781 const int nZplanesFlgS = 4;
782 const double zPlanesFlgS[nZplanesFlgS] = {0. *
mm,
787 const double rInnerFlgS[nZplanesFlgS] = {sFlgSRmin,
790 sFlgSRstep - sFlgSChamfeEnd};
792 const double rOuterFlgS[nZplanesFlgS] = {sFlgSRmax,
797 auto cyssFlgSSol =
new G4Polycone(
"cyssFlgSSol", 0., 2. * M_PI * rad,
798 nZplanesFlgS, zPlanesFlgS, rInnerFlgS, rOuterFlgS);
800 auto cyssFlgSLog =
new G4LogicalVolume(cyssFlgSSol, matAl,
"CYSSFlgS_LOGIC",
801 nullptr,
nullptr,
nullptr);
806 Ta.set(0., 0., zpos);
808 av->AddPlacedVolume(cyssFlgSLog, Ta, &Ra);
839 const double sSBFlgNRmax = 107.7 *
mm;
840 const double sSBFlgNRmin = 95.0 *
mm;
841 const double sSBFlgNRimRmax = 105.3 *
mm;
842 const double sSBFlgNRimRmin = 103.3 *
mm;
843 const double sSBFlgNIntThick = 4.92 *
mm;
844 const double sSBFlgNExtThick = 7.00 *
mm;
845 const double sSBFlgNTotThick = 16.0 *
mm;
847 const int nZplanesFlgN = 5;
848 const double zPlanesFlgN[nZplanesFlgN] = {0. *
mm,
854 const double rInnerFlgN[nZplanesFlgN] = {sSBFlgNRmin,
860 const double rOuterFlgN[nZplanesFlgN] = {sSBFlgNRmax,
866 auto sbFlgNSol =
new G4Polycone(
"sbFlgNSol", 0., 2. * M_PI * rad,
867 nZplanesFlgN, zPlanesFlgN, rInnerFlgN, rOuterFlgN);
871 auto sbFlgNLog =
new G4LogicalVolume(sbFlgNSol, matAl,
"sbFlgN_LOGIC",
872 nullptr,
nullptr,
nullptr);
877 Ta.set(0., 0., zpos);
878 Ra.set(0, M_PI * rad, 0.);
879 av->AddPlacedVolume(sbFlgNLog, Ta, &Ra);
882 const double sSBcylRmin = 105.5 *
mm;
883 const double sSBcylRmax = 107.66 *
mm;
884 const double sSBcylLen = 1197.0 *
mm;
886 auto sbCylSol =
new G4Tubs(
"SBcyl_SOLID", sSBcylRmin, sSBcylRmax,
887 sSBcylLen / 2, 0., 2 * M_PI);
890 auto sbCylLog =
new G4LogicalVolume(sbCylSol, matCF,
"SBcyl_LOGIC",
891 nullptr,
nullptr,
nullptr);
895 zpos -= (sSBcylLen / 2 + sSBFlgNExtThick);
896 Ta.set(0., 0., zpos);
898 av->AddPlacedVolume(sbCylLog, Ta, &Ra);
906 std::string cableMaterials[2] = {
object->get_coreMaterial(),
"G4_POLYETHYLENE"};
908 double dX =
object->get_xNorth() -
object->get_xSouth();
909 double dY =
object->get_yNorth() -
object->get_ySouth();
910 double dZ =
object->get_zNorth() -
object->get_zSouth();
912 double rotY = dZ != 0. ? std::atan(dX / dZ) : 0.;
913 double rotZ = dX != 0. ? std::atan(dY / dX) : 0.;
915 double setX = (
object->get_xSouth() +
object->get_xNorth()) / 2;
916 double setY = (
object->get_ySouth() +
object->get_yNorth()) / 2;
917 double setZ = (
object->get_zSouth() +
object->get_zNorth()) / 2;
919 double length = std::sqrt(dX * dX + dY * dY + dZ * dZ);
920 double IR[2] = {0,
object->get_coreRadius()};
921 double OR[2] = {
object->get_coreRadius(),
object->get_sheathRadius()};
923 G4RotationMatrix rot;
932 static G4UserLimits *g4userLimits =
new G4UserLimits(0.01);
934 for (
int i = 0;
i < 2; ++
i)
938 G4VSolid *cylinderSolid =
new G4Tubs(G4String(object->
get_name() +
"_SOLID"),
939 IR[i], OR[i], (length / 2.), 0, 2 * M_PI);
941 G4LogicalVolume *cylinderLogic =
new G4LogicalVolume(cylinderSolid, trackerMaterial,
942 G4String(object->
get_name() +
"_LOGIC"),
nullptr,
nullptr, g4userLimits);
954 assemblyVolume.AddPlacedVolume(cylinderLogic, transform);
960 bool enableSignal,
bool enableCooling,
bool enablePower,
961 double x1,
double x2,
double y1,
double y2,
double z1,
double z2)
964 double samtecCoreRadius = 0.01275 *
cm;
965 double samtecSheathRadius = 0.05 *
cm;
966 double coolingStaveCoreRadius = 0.056 *
cm;
967 double coolingStaveSheathRadius = 0.1 *
cm;
968 double coolingCoreRadius = 0.125 *
cm;
969 double coolingSheathRadius = 0.2 *
cm;
970 double powerLargeCoreRadius = 0.069 *
cm;
971 double powerLargeSheathRadius = 0.158 *
cm;
972 double powerMediumCoreRadius = 0.033 *
cm;
973 double powerMediumSheathRadius = 0.082 *
cm;
974 double powerSmallCoreRadius = 0.028 *
cm;
975 double powerSmallSheathRadius = 0.0573 *
cm;
977 double globalShiftX = 0.;
978 double globalShiftY = -0.0984 *
cm;
979 double samtecShiftX = -6 * samtecSheathRadius + globalShiftX;
980 double samtecShiftY = 1 * samtecSheathRadius + globalShiftY;
981 double coolingShiftX = -3 * coolingSheathRadius + globalShiftX;
982 double coolingShiftY = -1 * coolingSheathRadius + globalShiftY;
983 double powerShiftX = 3.5 * powerLargeSheathRadius + globalShiftX;
984 double powerShiftY = 6.1 * powerLargeSheathRadius + globalShiftY;
989 unsigned int nSamtecWires = 24;
990 unsigned int nRow = 8;
991 unsigned int nCol = nSamtecWires / nRow;
992 for (
unsigned int iRow = 0; iRow < nRow; ++iRow)
994 for (
unsigned int iCol = 0; iCol < nCol; ++iCol)
996 double deltaX = samtecShiftX + ((iCol + 1) * (samtecSheathRadius * 2.6));
997 double deltaY = samtecShiftY - ((iRow + 1) * (samtecSheathRadius * 2.1));
999 "G4_Cu", samtecCoreRadius, samtecSheathRadius,
1000 x1 + deltaX, x2 + deltaX, y1 + deltaY,
1001 y2 + deltaY, z1, z2,
"blue");
1011 unsigned int nCool = 2;
1014 auto rx = std::regex{
"MVTX_L([0-2])", std::regex_constants::icase};
1015 bool smallCooling = std::regex_search(superName, rx);
1017 for (
unsigned int iCool = 0; iCool < nCool; ++iCool)
1019 double coreRadius = smallCooling ? coolingStaveCoreRadius : coolingCoreRadius;
1020 double sheathRadius = smallCooling ? coolingStaveSheathRadius : coolingSheathRadius;
1023 double deltaX = coolingShiftX + ((iCool + 1) * (sheathRadius * 2));
1024 double deltaY = coolingShiftY + (sheathRadius * 2);
1026 "G4_WATER", coreRadius, sheathRadius,
1027 x1 + deltaX, x2 + deltaX, y1 + deltaY,
1028 y2 + deltaY, z1, z2, cooling_color[iCool]);
1032 double deltaX = coolingShiftX + (sheathRadius * 2);
1033 double deltaY = coolingShiftY + ((iCool + 1) * (sheathRadius * 2));
1035 "G4_WATER", coreRadius, sheathRadius,
1036 x1 + deltaX, x2 + deltaX, y1 + deltaY,
1037 y2 + deltaY, z1, z2, cooling_color[iCool]);
1047 using PowerCableParameters = std::pair<std::pair<std::string, std::string>, std::pair<double, double>>;
1048 std::vector<PowerCableParameters> powerCables;
1049 std::vector<std::vector<double>> powerCableColors;
1051 powerCables.emplace_back(std::make_pair(
boost::str(
boost::format(
"%s_digiReturn") % superName.c_str()),
"Large"), std::make_pair((-2.5 * powerLargeSheathRadius) + powerShiftX, (-2.5 * powerLargeSheathRadius) + powerShiftY));
1052 powerCables.emplace_back(std::make_pair(
boost::str(
boost::format(
"%s_digiSupply") % superName.c_str()),
"Large"), std::make_pair((-4.5 * powerLargeSheathRadius) + powerShiftX, (-1.5 * powerLargeSheathRadius) + powerShiftY));
1053 powerCables.emplace_back(std::make_pair(
boost::str(
boost::format(
"%s_anaReturn") % superName.c_str()),
"Medium"), std::make_pair((-4 * powerLargeSheathRadius) + powerShiftX, (-5.75 * powerMediumSheathRadius) + powerShiftY));
1054 powerCables.emplace_back(std::make_pair(
boost::str(
boost::format(
"%s_anaSupply") % superName.c_str()),
"Medium"), std::make_pair((-5.1 * powerLargeSheathRadius) + powerShiftX, (-5.75 * powerMediumSheathRadius) + powerShiftY));
1055 powerCables.emplace_back(std::make_pair(
boost::str(
boost::format(
"%s_digiSense") % superName.c_str()),
"Small"), std::make_pair((-10 * powerSmallSheathRadius) + powerShiftX, (-1 * powerSmallSheathRadius) + powerShiftY));
1056 powerCables.emplace_back(std::make_pair(
boost::str(
boost::format(
"%s_anaSense") % superName.c_str()),
"Small"), std::make_pair((-8 * powerSmallSheathRadius) + powerShiftX, (-2 * powerSmallSheathRadius) + powerShiftY));
1057 powerCables.emplace_back(std::make_pair(
boost::str(
boost::format(
"%s_bias") % superName.c_str()),
"Small"), std::make_pair((-6 * powerSmallSheathRadius) + powerShiftX, (-3 * powerSmallSheathRadius) + powerShiftY));
1058 powerCables.emplace_back(std::make_pair(
boost::str(
boost::format(
"%s_ground") % superName.c_str()),
"Small"), std::make_pair((-4 * powerSmallSheathRadius) + powerShiftX, (-4 * powerSmallSheathRadius) + powerShiftY));
1060 for (PowerCableParameters &powerCable : powerCables)
1062 double coreRad, sheathRad;
1066 if (cableType ==
"Small")
1068 coreRad = powerSmallCoreRadius;
1069 sheathRad = powerSmallSheathRadius;
1071 else if (cableType ==
"Medium")
1073 coreRad = powerMediumCoreRadius;
1074 sheathRad = powerMediumSheathRadius;
1078 coreRad = powerLargeCoreRadius;
1079 sheathRad = powerLargeSheathRadius;
1084 cableColor =
"black";
1092 cableColor =
"black";
1100 cableColor =
"white";
1104 cableColor =
"green";
1108 cableColor =
"white";
1112 cableColor =
"green";
1116 (x1 + powerCable.second.first), (x2 + powerCable.second.first),
1117 (y1 + powerCable.second.second), (y2 + powerCable.second.second), z1, z2, cableColor);
1127 G4AssemblyVolume *av =
new G4AssemblyVolume();
1140 G4AssemblyVolume *av =
new G4AssemblyVolume();
1142 double rOuter[3] = {(103 - 2.) / 2 *
mm, (149 - 2.24) / 2 *
mm, (195 - 2.24) / 2 *
mm};
1143 double zConeLen[3] = {186.8 *
mm, 179.74 *
mm, 223 *
mm};
1147 rOuter[lay] - 3 *
mm, rOuter[lay] - 5 *
mm, 0, 0,
1172 G4RotationMatrix
Ra;
1173 G4ThreeVector Ta = G4ThreeVector();
1174 G4Transform3D Tr(Ra, Ta);
1178 unsigned int totStaves = 0;
1182 totStaves += nStaves[
i];
1186 G4ThreeVector placeBarrelCable;
1187 for (
unsigned int i = 0;
i < totStaves; ++
i)
1189 double phi = (2.0 * M_PI / totStaves) *
i;
1192 G4RotationMatrix rotBarrelCable;
1193 rotBarrelCable.rotateZ(phi + (-90. *
deg));
1194 G4Transform3D transformBarrelCable(rotBarrelCable, placeBarrelCable);
1201 for (
unsigned int iStave = 0; iStave < nStaves[iLayer]; ++iStave)
1203 G4RotationMatrix rotCable;
1204 G4ThreeVector placeCable;
1205 double phi = (2.0 * M_PI / nStaves[iLayer]) * iStave;
1206 placeCable.setX(std::cos(phi));
1207 placeCable.setY(std::sin(phi));
1209 G4Transform3D transformCable(rotCable, placeCable);