10 #include <klm/eklm/geometry/GeoEKLMCreator.h>
13 #include <klm/eklm/geometry/G4TriangularPrism.h>
14 #include <klm/eklm/simulation/EKLMSensitiveDetector.h>
17 #include <geometry/CreatorFactory.h>
18 #include <geometry/Materials.h>
19 #include <geometry/utilities.h>
23 #include <G4Polyhedra.hh>
24 #include <G4PVPlacement.hh>
25 #include <G4Region.hh>
27 #include <G4UnionSolid.hh>
30 #include <CLHEP/Units/SystemOfUnits.h>
38 static const char MemErr[] =
"Memory allocation error.";
41 geometry::CreatorFactory<EKLM::GeoEKLMCreator> GeoEKLMFactory(
"EKLMCreator");
65 delete m_TransformData;
66 if (m_Solids.plane !=
nullptr)
68 if (m_Sensitive !=
nullptr)
78 (G4VSolid**)malloc(m_GeoDat->getNPlanes() *
sizeof(G4VSolid*));
79 if (m_Solids.plane ==
nullptr)
81 m_Solids.plasticSheetElement =
82 (G4VSolid**)malloc(m_GeoDat->getNStrips() *
sizeof(G4VSolid*));
83 if (m_Solids.plasticSheetElement ==
nullptr)
86 (G4VSolid**)malloc(m_GeoDat->getNSegments() *
sizeof(G4VSolid*));
87 if (m_Solids.psheet ==
nullptr)
89 m_LogVol.psheet = (G4LogicalVolume**)
90 malloc(m_GeoDat->getNSegments() *
sizeof(G4LogicalVolume*));
91 if (m_LogVol.psheet ==
nullptr)
94 (G4LogicalVolume**)malloc(m_GeoDat->getNSegments() *
95 sizeof(G4LogicalVolume*));
96 if (m_LogVol.segment ==
nullptr)
98 m_Solids.stripSegment =
99 (G4VSolid**)malloc(m_GeoDat->getNSegments() *
sizeof(G4VSolid*));
100 if (m_Solids.stripSegment ==
nullptr)
102 m_LogVol.stripSegment =
103 (G4LogicalVolume**)malloc(m_GeoDat->getNSegments() *
104 sizeof(G4LogicalVolume*));
105 if (m_LogVol.stripSegment ==
nullptr)
107 nDiff = m_GeoDat->getNStripsDifferentLength();
108 m_Solids.strip = (G4VSolid**)malloc(nDiff *
sizeof(G4VSolid*));
109 if (m_Solids.strip ==
nullptr)
111 m_LogVol.strip = (G4LogicalVolume**)malloc(nDiff *
sizeof(G4LogicalVolume*));
112 if (m_LogVol.strip ==
nullptr)
114 m_Solids.groove = (G4VSolid**)malloc(nDiff *
sizeof(G4VSolid*));
115 if (m_Solids.groove ==
nullptr)
117 m_LogVol.groove = (G4LogicalVolume**)malloc(nDiff *
sizeof(G4LogicalVolume*));
118 if (m_LogVol.groove ==
nullptr)
120 m_LogVol.scint = (G4LogicalVolume**)malloc(nDiff *
sizeof(G4LogicalVolume*));
121 if (m_LogVol.scint ==
nullptr)
123 m_LogVol.segmentsup =
124 (G4LogicalVolume***)malloc(m_GeoDat->getNPlanes() *
125 sizeof(G4LogicalVolume**));
126 if (m_LogVol.segmentsup ==
nullptr)
128 for (i = 0; i < m_GeoDat->getNPlanes(); i++) {
129 m_LogVol.segmentsup[i] =
130 (G4LogicalVolume**)malloc((m_GeoDat->getNSegments() + 1) *
131 sizeof(G4LogicalVolume*));
132 if (m_LogVol.segmentsup[i] ==
nullptr)
135 for (i = 0; i < m_GeoDat->getNSegments(); i++)
136 m_LogVol.psheet[i] =
nullptr;
144 }
catch (std::bad_alloc& ba) {
152 free(m_Solids.plane);
153 free(m_Solids.plasticSheetElement);
154 free(m_Solids.psheet);
155 free(m_LogVol.psheet);
156 free(m_LogVol.segment);
157 free(m_Solids.stripSegment);
158 free(m_LogVol.stripSegment);
159 free(m_Solids.strip);
160 free(m_LogVol.strip);
161 free(m_Solids.groove);
162 free(m_LogVol.groove);
163 free(m_LogVol.scint);
164 for (i = 0; i < m_GeoDat->getNPlanes(); i++)
165 free(m_LogVol.segmentsup[i]);
166 free(m_LogVol.segmentsup);
193 m_GeoDat->getEndcapStructureGeometry();
195 m_GeoDat->getSectionPosition();
196 const double z[2] = { -sectionPos->
getLength() / 2,
199 const double rMin[2] = {0, 0};
201 G4Polyhedra* op =
nullptr;
202 G4Tubs* tb =
nullptr;
204 op =
new G4Polyhedra(
"Section_Octagonal_Prism",
205 sectionStructureGeometry->
getPhi(),
209 }
catch (std::bad_alloc& ba) {
214 tb =
new G4Tubs(
"Section_Tube", 0, sectionPos->
getInnerR(),
215 sectionPos->
getLength() / 2.0 + 1.0 * CLHEP::mm,
216 0.0, 360.0 * CLHEP::deg);
217 }
catch (std::bad_alloc& ba) {
221 m_Solids.section =
new G4SubtractionSolid(
"Section", op, tb);
222 }
catch (std::bad_alloc& ba) {
230 G4LogicalVolume* logicLayer =
nullptr;
232 logicLayer =
new G4LogicalVolume(m_Solids.layer, m_Materials.air, name);
233 }
catch (std::bad_alloc& ba) {
246 layerPos->
getLength() / 2.0, 0.0, 360. * CLHEP::deg);
247 }
catch (std::bad_alloc& ba) {
255 G4LogicalVolume* logicSector =
nullptr;
257 logicSector =
new G4LogicalVolume(m_Solids.sector, m_Materials.air, name);
258 }
catch (std::bad_alloc& ba) {
268 m_GeoDat->getSectorPosition();
272 0.5 * sectorPos->
getLength(), 0.0, 90. * CLHEP::deg);
273 }
catch (std::bad_alloc& ba) {
281 HepGeom::Transform3D t1;
282 HepGeom::Transform3D t2;
283 G4Tubs* solidCoverTube =
nullptr;
284 G4Box* solidCoverBox =
nullptr;
285 G4Box* box =
nullptr;
286 G4IntersectionSolid* is =
nullptr;
287 G4SubtractionSolid* solidCover =
nullptr;
289 m_GeoDat->getSectorPosition();
291 m_GeoDat->getSectorSupportPosition();
293 m_GeoDat->getSectorSupportGeometry();
297 solidCoverTube =
new G4Tubs(
"Cover_Tube", sectorSupportPos->
getInnerR(),
298 sectorSupportPos->
getOuterR(), 0.5 * lz, 0.0,
300 }
catch (std::bad_alloc& ba) {
304 solidCoverBox =
new G4Box(
"Cover_Box", 0.5 * sectorSupportPos->
getOuterR(),
305 0.5 * sectorSupportPos->
getOuterR(), 0.5 * lz);
306 }
catch (std::bad_alloc& ba) {
310 box =
new G4Box(
"Cover_SubtractionBox", 0.5 * sectorSupportPos->
getOuterR(),
311 0.5 * sectorSupportPos->
getOuterR(), lz);
312 }
catch (std::bad_alloc& ba) {
315 t1 = HepGeom::Translate3D(
319 t2 = HepGeom::Translate3D(
320 sectorSupportPos->
getX() +
321 0.5 * sectorSupportPos->
getOuterR() * cos(ang) -
322 0.5 * sectorSupportPos->
getOuterR() * sin(ang),
325 0.5 * sectorSupportPos->
getOuterR() * cos(ang) +
326 0.5 * sectorSupportPos->
getOuterR() * sin(ang),
327 0.) * HepGeom::RotateZ3D(ang);
329 is =
new G4IntersectionSolid(
"Cover_Intersection",
330 solidCoverTube, solidCoverBox, t1);
331 }
catch (std::bad_alloc& ba) {
335 solidCover =
new G4SubtractionSolid(
"Cover", is, box, t2);
336 }
catch (std::bad_alloc& ba) {
341 new G4LogicalVolume(solidCover, m_Materials.duralumin,
"Cover");
342 }
catch (std::bad_alloc& ba) {
352 G4Box* res =
nullptr;
354 m_GeoDat->getSectorSupportPosition();
356 m_GeoDat->getSectorSupportGeometry();
358 sectorSupportPos->
getY() * sectorSupportPos->
getY());
359 t = HepGeom::Translate3D(0.5 * (x + sectorSupportGeometry->
getCorner3().x()),
360 sectorSupportPos->
getY() +
363 res =
new G4Box(
"SectorSupport_BoxX",
364 0.5 * (x - sectorSupportGeometry->
getCorner3().x()),
367 }
catch (std::bad_alloc& ba) {
375 G4Box* res =
nullptr;
377 m_GeoDat->getSectorSupportPosition();
379 m_GeoDat->getSectorSupportGeometry();
380 t = HepGeom::Translate3D(sectorSupportPos->
getX() +
382 0.5 * (sectorSupportGeometry->
getCorner4().y() +
384 0.) * HepGeom::RotateZ3D(90. * CLHEP::deg);
386 res =
new G4Box(
"SectorSupport_BoxY",
391 }
catch (std::bad_alloc& ba) {
401 G4Box* res =
nullptr;
403 m_GeoDat->getSectorSupportPosition();
405 m_GeoDat->getSectorSupportGeometry();
406 t = HepGeom::Translate3D(
415 0.) * HepGeom::RotateZ3D(sectorSupportGeometry->
getCornerAngle());
421 res =
new G4Box(
"SectorSupport_BoxTop", 0.5 * sqrt(dx * dx + dy * dy),
424 }
catch (std::bad_alloc& ba) {
434 G4Tubs* res =
nullptr;
436 m_GeoDat->getSectorSupportPosition();
438 m_GeoDat->getSectorSupportGeometry();
439 ang1 = atan2(sectorSupportGeometry->
getCorner3().y(),
441 ang2 = atan2(sectorSupportGeometry->
getCorner4().y(),
444 res =
new G4Tubs(
"SectorSupport_InnerTube", sectorSupportPos->
getInnerR(),
448 ang1 * CLHEP::rad, (ang2 - ang1) * CLHEP::rad);
449 }
catch (std::bad_alloc& ba) {
461 G4Tubs* res =
nullptr;
463 m_GeoDat->getSectorSupportPosition();
465 m_GeoDat->getSectorSupportGeometry();
467 x = sqrt(r * r - sectorSupportPos->
getY() * sectorSupportPos->
getY());
468 ang1 = atan2(sectorSupportPos->
getY(), x);
469 ang2 = atan2(sectorSupportGeometry->
getCorner1B().y(),
472 res =
new G4Tubs(
"SectorSupport_OuterTube", r,
475 ang1 * CLHEP::rad, (ang2 - ang1) * CLHEP::rad);
476 }
catch (std::bad_alloc& ba) {
486 G4Tubs* solidCorner1Tube =
nullptr;
487 G4Box* solidCorner1Box1 =
nullptr;
488 G4Box* solidCorner1Box2 =
nullptr;
489 G4IntersectionSolid* is1 =
nullptr;
490 G4IntersectionSolid* solidCorner1 =
nullptr;
491 HepGeom::Transform3D t1;
492 HepGeom::Transform3D t2;
494 m_GeoDat->getSectorSupportPosition();
496 m_GeoDat->getSectorSupportGeometry();
501 solidCorner1Tube =
new G4Tubs(
502 "SectorSupport_Corner1_Tube", 0.,
505 0., 90. * CLHEP::deg);
506 }
catch (std::bad_alloc& ba) {
510 solidCorner1Box1 =
new G4Box(
511 "SectorSupport_Corner1_Box1", 0.5 * lx,
514 }
catch (std::bad_alloc& ba) {
519 new G4Box(
"SectorSupport_Corner1_Box2",
525 }
catch (std::bad_alloc& ba) {
528 x = sectorSupportPos->
getX() + 0.5 * (sectorSupportGeometry->
getCornerX() +
531 t1 = HepGeom::Translate3D(x, 0.5 * sectorSupportPos->
getOuterR(), 0.);
532 t2 = HepGeom::Translate3D(
539 is1 =
new G4IntersectionSolid(
"SectorSupport_Corner1_Intersection1",
540 solidCorner1Tube, solidCorner1Box1, t1);
541 }
catch (std::bad_alloc& ba) {
545 solidCorner1 =
new G4IntersectionSolid(
"SectorSupport_Corner1", is1,
546 solidCorner1Box2, t2);
547 }
catch (std::bad_alloc& ba) {
551 m_LogVol.sectorsup.corn1 =
552 new G4LogicalVolume(solidCorner1, m_Materials.duralumin,
"Corner1");
553 }
catch (std::bad_alloc& ba) {
563 G4SubtractionSolid* solidCorner2 =
nullptr;
564 HepGeom::Transform3D t1;
566 m_GeoDat->getSectorSupportGeometry();
575 }
catch (std::bad_alloc& ba) {
578 t1 = HepGeom::Translate3D(-sectorSupportGeometry->
getCorner2Inner().x(),
581 solidCorner2 =
new G4SubtractionSolid(
"SectorSupport_Corner2",
583 m_Solids.sectorsup.otube, t1);
584 }
catch (std::bad_alloc& ba) {
587 delete solidCorner2Prism;
589 m_LogVol.sectorsup.corn2 =
590 new G4LogicalVolume(solidCorner2, m_Materials.duralumin,
"Corner2");
591 }
catch (std::bad_alloc& ba) {
601 G4SubtractionSolid* solidCorner3 =
nullptr;
602 HepGeom::Transform3D t1;
604 m_GeoDat->getSectorSupportGeometry();
612 }
catch (std::bad_alloc& ba) {
615 t1 = HepGeom::Translate3D(-sectorSupportGeometry->
getCorner3Prism().x(),
618 solidCorner3 =
new G4SubtractionSolid(
"SectorSupport_Corner3",
620 m_Solids.sectorsup.itube, t1);
621 }
catch (std::bad_alloc& ba) {
624 delete solidCorner3Prism;
626 m_LogVol.sectorsup.corn3 =
627 new G4LogicalVolume(solidCorner3, m_Materials.duralumin,
"Corner3");
628 }
catch (std::bad_alloc& ba) {
638 G4SubtractionSolid* solidCorner4 =
nullptr;
639 HepGeom::Transform3D t1;
641 m_GeoDat->getSectorSupportGeometry();
649 }
catch (std::bad_alloc& ba) {
652 t1 = HepGeom::Translate3D(-sectorSupportGeometry->
getCorner4Prism().x(),
655 solidCorner4 =
new G4SubtractionSolid(
"SectorSupport_Corner4",
657 m_Solids.sectorsup.itube, t1);
658 }
catch (std::bad_alloc& ba) {
661 delete solidCorner4Prism;
663 m_LogVol.sectorsup.corn4 =
664 new G4LogicalVolume(solidCorner4, m_Materials.duralumin,
"Corner4");
665 }
catch (std::bad_alloc& ba) {
677 G4Tubs* solidLimitationTube =
nullptr;
678 G4UnionSolid* us1 =
nullptr;
679 G4UnionSolid* us2 =
nullptr;
680 G4UnionSolid* us3 =
nullptr;
681 G4UnionSolid* us4 =
nullptr;
682 G4IntersectionSolid* solidSectorSupport =
nullptr;
683 HepGeom::Transform3D tbx;
684 HepGeom::Transform3D tby;
685 HepGeom::Transform3D tbt;
687 m_GeoDat->getSectorSupportPosition();
688 solidBoxX = createSectorSupportBoxX(tbx);
689 solidBoxY = createSectorSupportBoxY(tby);
690 solidBoxTop = createSectorSupportBoxTop(tbt);
691 m_Solids.sectorsup.otube = createSectorSupportOuterTube();
692 m_Solids.sectorsup.itube = createSectorSupportInnerTube();
694 solidLimitationTube =
new G4Tubs(
"SectorSupport_LimitationTube",
698 }
catch (std::bad_alloc& ba) {
702 us1 =
new G4UnionSolid(
"SectorSupport_Union1",
703 m_Solids.sectorsup.itube, solidBoxY, tby);
704 }
catch (std::bad_alloc& ba) {
708 us2 =
new G4UnionSolid(
"SectorSupport_Union2",
709 us1, solidBoxX, tbx);
710 }
catch (std::bad_alloc& ba) {
714 us3 =
new G4UnionSolid(
"SectorSupport_Union3", us2,
715 m_Solids.sectorsup.otube,
716 HepGeom::Translate3D(0., 0., 0.));
717 }
catch (std::bad_alloc& ba) {
721 us4 =
new G4UnionSolid(
"SectorSupport_Union4",
722 us3, solidBoxTop, tbt);
723 }
catch (std::bad_alloc& ba) {
728 new G4IntersectionSolid(
"SectorSupport", us4, solidLimitationTube,
729 HepGeom::Translate3D(0., 0., 0.));
730 }
catch (std::bad_alloc& ba) {
734 m_LogVol.sectorsup.supp =
735 new G4LogicalVolume(solidSectorSupport, m_Materials.duralumin,
"Support");
736 }
catch (std::bad_alloc& ba) {
747 m_GeoDat->getSectorSupportPosition();
749 m_Solids.subtractionBox =
750 new G4Box(
"SubractionBox", 0.5 * sectorSupportPos->
getOuterR(),
752 }
catch (std::bad_alloc& ba) {
758 cutSolidCorner(
const char* name, G4VSolid* solid, G4Box* subtractionBox,
759 const HepGeom::Transform3D& transf,
bool largerAngles,
760 double x1,
double y1,
double x2,
double y2)
763 ang = atan2(y2 - y1, x2 - x1);
764 return cutSolidCorner(name, solid, subtractionBox, transf, largerAngles,
769 cutSolidCorner(
const char* name, G4VSolid* solid, G4Box* subtractionBox,
770 const HepGeom::Transform3D& transf,
bool largerAngles,
771 double x,
double y,
double ang)
774 HepGeom::Transform3D t;
775 G4SubtractionSolid* ss =
nullptr;
776 lx = subtractionBox->GetXHalfLength();
777 ly = subtractionBox->GetYHalfLength();
779 t = HepGeom::Translate3D(x + lx * cos(ang) - ly * sin(ang),
780 y + lx * sin(ang) + ly * cos(ang), 0) *
781 HepGeom::RotateZ3D(ang);
783 t = HepGeom::Translate3D(x + lx * cos(ang) + ly * sin(ang),
784 y + lx * sin(ang) - ly * cos(ang), 0) *
785 HepGeom::RotateZ3D(ang);
787 ss =
new G4SubtractionSolid(name, solid, subtractionBox, transf * t);
788 }
catch (std::bad_alloc& ba) {
798 HepGeom::Transform3D t;
799 HepGeom::Transform3D t1;
801 G4Tubs* tb =
nullptr;
802 G4IntersectionSolid* is =
nullptr;
803 G4SubtractionSolid* ss1, *ss2, *ss3, *ss4;
805 m_GeoDat->getSectorSupportPosition();
807 m_GeoDat->getSectorSupportGeometry();
810 snprintf(name, 128,
"Plane_%d_Tube", n + 1);
813 0.5 * planePos->
getLength(), 0.0, 90.0 * CLHEP::deg);
814 }
catch (std::bad_alloc& ba) {
817 snprintf(name, 128,
"Plane_%d_Box", n + 1);
821 t1 = HepGeom::Translate3D(m_Solids.subtractionBox->GetXHalfLength() + box_x,
822 m_Solids.subtractionBox->GetXHalfLength() + box_y,
826 t = HepGeom::Rotate3D(180. * CLHEP::deg,
827 HepGeom::Vector3D<double>(1., 1., 0.));
830 t = HepGeom::Translate3D(0, 0, 0);
832 snprintf(name, 128,
"Plane_%d_Intersection", n + 1);
834 is =
new G4IntersectionSolid(name, tb, m_Solids.subtractionBox, t1);
835 }
catch (std::bad_alloc& ba) {
838 snprintf(name, 128,
"Plane_%d_Subtraction_1", n + 1);
839 ss1 = cutSolidCorner(name, is, m_Solids.subtractionBox, t,
true,
843 snprintf(name, 128,
"Plane_%d_Subtraction_2", n + 1);
844 ss2 = cutSolidCorner(
845 name, ss1, m_Solids.subtractionBox, t,
false,
852 snprintf(name, 128,
"Plane_%d_Subtraction_3", n + 1);
853 ss3 = cutSolidCorner(
854 name, ss2, m_Solids.subtractionBox, t,
false,
861 snprintf(name, 128,
"Plane_%d_Subtraction_4", n + 1);
862 ss4 = cutSolidCorner(
863 name, ss3, m_Solids.subtractionBox, t,
true,
870 snprintf(name, 128,
"Plane_%d", n + 1);
871 m_Solids.plane[n] = ss4;
877 HepGeom::Transform3D t1, t2;
878 G4Box* topBox =
nullptr;
879 G4Box* midBox =
nullptr;
880 G4Box* botBox =
nullptr;
881 G4UnionSolid* us =
nullptr;
882 G4UnionSolid* solidSegmentSupport =
nullptr;
883 std::string segmentSupportName =
884 "SegmentSupport_" + std::to_string(iSegmentSupport) +
885 "_Plane_" + std::to_string(iPlane);
887 m_GeoDat->getSegmentSupportPosition(iPlane, iSegmentSupport);
889 m_GeoDat->getSegmentSupportGeometry();
891 topBox =
new G4Box(
"BoxTop_" + segmentSupportName,
897 }
catch (std::bad_alloc& ba) {
901 midBox =
new G4Box(
"BoxMiddle_" + segmentSupportName,
907 }
catch (std::bad_alloc& ba) {
911 botBox =
new G4Box(
"BoxBottom_" + segmentSupportName,
915 }
catch (std::bad_alloc& ba) {
918 t1 = HepGeom::Translate3D(
921 t2 = HepGeom::Translate3D(
927 us =
new G4UnionSolid(
"Union1_" + segmentSupportName, midBox, topBox, t1);
928 }
catch (std::bad_alloc& ba) {
932 solidSegmentSupport =
new G4UnionSolid(segmentSupportName, us, botBox, t2);
933 }
catch (std::bad_alloc& ba) {
937 m_LogVol.segmentsup[iPlane - 1][iSegmentSupport - 1] =
938 new G4LogicalVolume(solidSegmentSupport, m_Materials.duralumin,
940 }
catch (std::bad_alloc& ba) {
950 unifySolids(G4VSolid** solids, HepGeom::Transform3D* transf,
951 int nSolids,
const std::string& name)
955 G4VSolid** solidArray;
956 HepGeom::Transform3D* inverseTransf;
957 HepGeom::Transform3D t;
960 int n, nUnions, i, i1, i2, k, k1, k2, l, dl;
962 B2FATAL(
"Number of solids to be unified must be greater than 1.");
964 inverseTransf =
new HepGeom::Transform3D[nSolids];
965 }
catch (std::bad_alloc& ba) {
968 for (i = 0; i < nSolids; i++)
969 inverseTransf[i] = transf[i].inverse();
977 nUnions = nUnions + n;
979 u = (G4UnionSolid**)malloc(
sizeof(G4UnionSolid*) * nUnions);
997 for (i = i1; i < i2; i++) {
1000 t = inverseTransf[l] * transf[l + dl];
1002 snprintf(str, 128,
"_Union_%d", i + 1);
1003 u[i] =
new G4UnionSolid(name + str, solidArray[k],
1004 solidArray[k + 1], t);
1005 }
catch (std::bad_alloc& ba) {
1010 u[i] = (G4UnionSolid*)solids[k];
1015 solidArray = (G4VSolid**)u;
1020 d =
new G4DisplacedSolid(name +
"_Displaced", u[nUnions - 1], transf[0]);
1022 delete[] inverseTransf;
1032 G4VSolid** elements;
1033 HepGeom::Transform3D* t;
1035 m_GeoDat->getPlasticSheetGeometry();
1037 m_GeoDat->getStripGeometry();
1038 nStrip = m_ElementNumbers->getNStripsSegment();
1039 elements =
new G4VSolid*[nStrip];
1040 t =
new HepGeom::Transform3D[nStrip];
1042 for (i = 0; i < nStrip; i++) {
1043 m = nStrip * iSegment + i;
1044 m_GeoDat->getSheetTransform(&(t[i]), m);
1047 for (i = 0; i < nStrip; i++) {
1048 snprintf(name, 128,
"PlasticSheet_%d_Element_%d", iSegment + 1, i + 1);
1050 if (i == 0 || i == nStrip - 1)
1051 ly = ly - plasticSheetGeometry->
getDeltaL();
1052 m = nStrip * iSegment + i;
1054 m_GeoDat->getStripPosition(m + 1);
1056 m_Solids.plasticSheetElement[m] =
1057 new G4Box(name, 0.5 * stripPos->
getLength(), 0.5 * ly,
1058 0.5 * plasticSheetGeometry->
getWidth());
1059 }
catch (std::bad_alloc& ba) {
1062 elements[i] = m_Solids.plasticSheetElement[m];
1065 snprintf(name, 128,
"PlasticSheet_%d", iSegment + 1);
1066 m_Solids.psheet[iSegment] = unifySolids(elements, t, nStrip, name);
1068 m_LogVol.psheet[iSegment] =
1069 new G4LogicalVolume(m_Solids.psheet[iSegment],
1070 m_Materials.polystyrol, name);
1071 }
catch (std::bad_alloc& ba) {
1086 HepGeom::Transform3D* t;
1087 nStrip = m_ElementNumbers->getNStripsSegment();
1088 strips =
new G4VSolid*[nStrip];
1089 t =
new HepGeom::Transform3D[nStrip];
1090 for (i = 0; i < nStrip; i++) {
1091 m = nStrip * iSegment + i;
1092 m_GeoDat->getStripTransform(&(t[i]), m);
1093 strips[i] = m_Solids.strip[m_GeoDat->getStripLengthIndex(m)];
1095 snprintf(name, 128,
"StripSegment_%d", iSegment + 1);
1096 m_Solids.stripSegment[iSegment] = unifySolids(strips, t, nStrip, name);
1098 m_LogVol.stripSegment[iSegment] =
1099 new G4LogicalVolume(m_Solids.stripSegment[iSegment], m_Materials.air,
1101 }
catch (std::bad_alloc& ba) {
1114 G4UnionSolid* u1, *u2;
1115 HepGeom::Transform3D t;
1117 m_GeoDat->getPlasticSheetGeometry();
1119 m_GeoDat->getStripGeometry();
1121 snprintf(name, 128,
"Segment_%d_Union_1", iSegment + 1);
1122 t = HepGeom::Translate3D(0, 0, -z);
1124 u1 =
new G4UnionSolid(name, m_Solids.stripSegment[iSegment],
1125 m_Solids.psheet[iSegment], t);
1126 }
catch (std::bad_alloc& ba) {
1129 snprintf(name, 128,
"Segment_%d", iSegment + 1);
1130 t = HepGeom::Translate3D(0, 0, z);
1132 u2 =
new G4UnionSolid(name, u1, m_Solids.psheet[iSegment], t);
1133 }
catch (std::bad_alloc& ba) {
1137 m_LogVol.segment[iSegment] =
1138 new G4LogicalVolume(u2, m_Materials.air, name);
1139 }
catch (std::bad_alloc& ba) {
1152 m_GeoDat->getStripGeometry();
1153 iPos = m_GeoDat->getStripPositionIndex(iStrip);
1154 stripPos = m_GeoDat->getStripPosition(iPos + 1);
1155 snprintf(name, 128,
"Strip_%d", iStrip + 1);
1157 m_Solids.strip[iStrip] =
new G4Box(name, 0.5 * stripPos->
getLength(),
1160 }
catch (std::bad_alloc& ba) {
1164 m_LogVol.strip[iStrip] =
1165 new G4LogicalVolume(m_Solids.strip[iStrip], m_Materials.polystyrene,
1167 }
catch (std::bad_alloc& ba) {
1180 m_GeoDat->getStripGeometry();
1181 iPos = m_GeoDat->getStripPositionIndex(iStrip);
1182 stripPos = m_GeoDat->getStripPosition(iPos + 1);
1183 snprintf(name, 128,
"Groove_%d", iStrip + 1);
1185 m_Solids.groove[iStrip] =
new G4Box(name, 0.5 * stripPos->
getLength(),
1188 }
catch (std::bad_alloc& ba) {
1192 m_LogVol.groove[iStrip] =
1193 new G4LogicalVolume(m_Solids.groove[iStrip], m_Materials.gel, name);
1194 }
catch (std::bad_alloc& ba) {
1207 m_GeoDat->getStripGeometry();
1208 HepGeom::Transform3D t;
1210 G4SubtractionSolid* scintillatorSolid;
1211 iPos = m_GeoDat->getStripPositionIndex(iStrip);
1212 stripPos = m_GeoDat->getStripPosition(iPos + 1);
1213 snprintf(name, 128,
"StripSensitive_%d_Box", iStrip + 1);
1222 }
catch (std::bad_alloc& ba) {
1225 snprintf(name, 128,
"StripSensitive_%d", iStrip + 1);
1226 t = HepGeom::Translate3D(0., 0., 0.5 * (stripGeometry->
getThickness() -
1230 new G4SubtractionSolid(name, b, m_Solids.groove[iStrip], t);
1231 }
catch (std::bad_alloc& ba) {
1235 m_LogVol.scint[iStrip] =
1236 new G4LogicalVolume(scintillatorSolid, m_Materials.polystyrene,
1237 name, 0, m_Sensitive, 0);
1238 }
catch (std::bad_alloc& ba) {
1247 G4Box* box =
nullptr;
1248 G4SubtractionSolid* ss1, *ss2, *ss3, *solidDetailA;
1251 m_GeoDat->getShieldGeometry();
1254 HepGeom::Transform3D t = HepGeom::Translate3D(0, 0, 0);
1258 box =
new G4Box(
"ShieldDetailA_Box", lx, ly,
1260 }
catch (std::bad_alloc& ba) {
1263 ss1 = cutSolidCorner(
"ShieldDetailA_Subtraction_1", box,
1264 m_Solids.subtractionBox, t,
false,
1269 ss2 = cutSolidCorner(
"ShieldDetailA_Subtraction_2", ss1,
1270 m_Solids.subtractionBox, t,
true,
1275 ss3 = cutSolidCorner(
"ShieldDetailA_Subtraction_3", ss2,
1276 m_Solids.subtractionBox, t,
false,
1281 solidDetailA = cutSolidCorner(
"ShieldDetailA", ss3,
1282 m_Solids.subtractionBox, t,
false,
1288 m_LogVol.shield.detailA =
1289 new G4LogicalVolume(solidDetailA, m_Materials.polyethylene,
1291 }
catch (std::bad_alloc& ba) {
1300 G4Box* box =
nullptr;
1301 G4SubtractionSolid* ss1, *solidDetailB;
1304 m_GeoDat->getShieldGeometry();
1307 HepGeom::Transform3D t = HepGeom::Translate3D(0, 0, 0);
1311 box =
new G4Box(
"ShieldDetailB_Box", lx, ly,
1313 }
catch (std::bad_alloc& ba) {
1316 ss1 = cutSolidCorner(
"ShieldDetailB_Subtraction_1", box,
1317 m_Solids.subtractionBox, t,
false,
1322 solidDetailB = cutSolidCorner(
"ShieldDetailB", ss1,
1323 m_Solids.subtractionBox, t,
false,
1329 m_LogVol.shield.detailB =
1330 new G4LogicalVolume(solidDetailB, m_Materials.polyethylene,
1332 }
catch (std::bad_alloc& ba) {
1341 G4Box* box =
nullptr;
1342 G4SubtractionSolid* ss1, *ss2, *ss3, *solidDetailC;
1345 m_GeoDat->getShieldGeometry();
1348 HepGeom::Transform3D t = HepGeom::Translate3D(0, 0, 0);
1352 box =
new G4Box(
"ShieldDetailC_Box", lx, ly,
1354 }
catch (std::bad_alloc& ba) {
1357 ss1 = cutSolidCorner(
"ShieldDetailC_Subtraction_1", box,
1358 m_Solids.subtractionBox, t,
false,
1363 ss2 = cutSolidCorner(
"ShieldDetailC_Subtraction_2", ss1,
1364 m_Solids.subtractionBox, t,
true,
1369 ss3 = cutSolidCorner(
"ShieldDetailC_Subtraction_3", ss2,
1370 m_Solids.subtractionBox, t,
false,
1375 solidDetailC = cutSolidCorner(
"ShieldDetailC", ss3,
1376 m_Solids.subtractionBox, t,
false,
1382 m_LogVol.shield.detailC =
1383 new G4LogicalVolume(solidDetailC, m_Materials.polyethylene,
1385 }
catch (std::bad_alloc& ba) {
1396 m_GeoDat->getShieldGeometry();
1405 }
catch (std::bad_alloc& ba) {
1409 m_LogVol.shield.detailD =
1410 new G4LogicalVolume(solidDetailDPrism->
getSolid(),
1411 m_Materials.polyethylene,
"ShieldDetailD");
1412 }
catch (std::bad_alloc& ba) {
1417 delete solidDetailDPrism;
1423 HepGeom::Transform3D t;
1425 createSectionSolid();
1427 m_LogVol.shieldLayer = createLayerLogicalVolume(
"ShieldLayer");
1428 createSectorSolid();
1429 m_LogVol.shieldLayerSector = createSectorLogicalVolume(
"ShieldLayerSector");
1430 createSectorCoverLogicalVolume();
1431 createSectorSupportLogicalVolume();
1436 createSectorSupportCorner1LogicalVolume();
1437 createSectorSupportCorner2LogicalVolume();
1438 createSectorSupportCorner3LogicalVolume();
1439 createSectorSupportCorner4LogicalVolume();
1441 createSubtractionBoxSolid();
1442 for (i = 0; i < m_GeoDat->getNPlanes(); i++) {
1443 createPlaneSolid(i);
1445 for (j = 1; j <= m_GeoDat->getNSegments() + 1; j++)
1446 createSegmentSupportLogicalVolume(i + 1, j);
1449 n = m_GeoDat->getNStripsDifferentLength();
1450 for (i = 0; i < n; i++) {
1451 createStripLogicalVolume(i);
1452 createStripGrooveLogicalVolume(i);
1453 createScintillatorLogicalVolume(i);
1456 for (i = 0; i < m_GeoDat->getNSegments(); i++)
1457 createPlasticSheetLogicalVolume(i);
1459 for (i = 0; i < m_GeoDat->getNSegments(); i++)
1460 createStripSegmentLogicalVolume(i);
1462 for (i = 0; i < m_GeoDat->getNSegments(); i++)
1463 createSegmentLogicalVolume(i);
1465 createShieldDetailALogicalVolume();
1466 createShieldDetailBLogicalVolume();
1467 createShieldDetailCLogicalVolume();
1468 createShieldDetailDLogicalVolume();
1476 G4LogicalVolume* logicSection =
nullptr;
1477 const HepGeom::Transform3D* t;
1478 std::string sectionName =
"Section_" + std::to_string(m_CurVol.section);
1480 logicSection =
new G4LogicalVolume(m_Solids.section, m_Materials.iron,
1482 }
catch (std::bad_alloc& ba) {
1487 t = m_TransformData->getSectionTransform(m_CurVol.section);
1489 new G4PVPlacement(*t, logicSection, sectionName, topVolume,
false,
1490 m_CurVol.section,
false);
1491 }
catch (std::bad_alloc& ba) {
1494 return logicSection;
1498 createLayer(G4LogicalVolume* section, G4LogicalVolume* layer)
const
1500 G4LogicalVolume* logicLayer;
1501 const HepGeom::Transform3D* t;
1502 if (layer ==
nullptr) {
1503 std::string layerName =
"Layer_" + std::to_string(m_CurVol.layer) +
1504 "_" + section->GetName();
1505 logicLayer = createLayerLogicalVolume(layerName.c_str());
1508 t = m_TransformData->getLayerTransform(m_CurVol.section, m_CurVol.layer);
1510 new G4PVPlacement(*t, logicLayer, logicLayer->GetName(), section,
false,
1511 m_CurVol.layer,
false);
1512 }
catch (std::bad_alloc& ba) {
1519 createSector(G4LogicalVolume* layer, G4LogicalVolume* sector)
const
1521 G4LogicalVolume* logicSector;
1522 const HepGeom::Transform3D* t;
1523 if (sector ==
nullptr) {
1524 std::string sectorName =
"Sector_" + std::to_string(m_CurVol.sector) +
1525 "_" + layer->GetName();
1526 logicSector = createSectorLogicalVolume(sectorName.c_str());
1528 logicSector = sector;
1529 t = m_TransformData->getSectorTransform(m_CurVol.section, m_CurVol.layer,
1532 new G4PVPlacement(*t, logicSector, logicSector->GetName(), layer,
false,
1533 m_CurVol.sector,
false);
1534 }
catch (std::bad_alloc& ba) {
1544 HepGeom::Transform3D t;
1545 G4LogicalVolume* lv = m_LogVol.cover;
1547 m_GeoDat->getSectorPosition();
1549 m_GeoDat->getSectorSupportPosition();
1553 t = HepGeom::Translate3D(0., 0., z);
1555 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1557 }
catch (std::bad_alloc& ba) {
1565 HepGeom::Transform3D t;
1566 G4LogicalVolume* lv = m_LogVol.sectorsup.corn1;
1568 m_GeoDat->getSectorSupportGeometry();
1569 t = HepGeom::Translate3D(0., 0., sectorSupportGeometry->
getCorner1Z());
1571 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1573 }
catch (std::bad_alloc& ba) {
1581 HepGeom::Transform3D t;
1582 G4LogicalVolume* lv = m_LogVol.sectorsup.corn2;
1584 m_GeoDat->getSectorSupportGeometry();
1585 t = HepGeom::Translate3D(sectorSupportGeometry->
getCorner2Inner().x(),
1589 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1591 }
catch (std::bad_alloc& ba) {
1599 HepGeom::Transform3D t;
1600 G4LogicalVolume* lv = m_LogVol.sectorsup.corn3;
1602 m_GeoDat->getSectorSupportGeometry();
1603 t = HepGeom::Translate3D(sectorSupportGeometry->
getCorner3Prism().x(),
1607 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1609 }
catch (std::bad_alloc& ba) {
1617 HepGeom::Transform3D t;
1618 G4LogicalVolume* lv = m_LogVol.sectorsup.corn4;
1620 m_GeoDat->getSectorSupportGeometry();
1621 t = HepGeom::Translate3D(sectorSupportGeometry->
getCorner4Prism().x(),
1625 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1627 }
catch (std::bad_alloc& ba) {
1635 HepGeom::Transform3D t;
1636 G4LogicalVolume* lv = m_LogVol.sectorsup.supp;
1638 m_GeoDat->getSectorSupportPosition();
1639 t = HepGeom::Translate3D(0., 0., sectorSupportPos->
getZ());
1641 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1643 }
catch (std::bad_alloc& ba) {
1651 G4LogicalVolume* logicPlane =
nullptr;
1652 const HepGeom::Transform3D* t;
1653 std::string planeName =
1654 "Plane_" + std::to_string(m_CurVol.plane) +
"_" + sector->GetName();
1656 logicPlane =
new G4LogicalVolume(m_Solids.plane[m_CurVol.plane - 1],
1657 m_Materials.air, planeName);
1658 }
catch (std::bad_alloc& ba) {
1662 t = m_TransformData->getPlaneTransform(m_CurVol.section, m_CurVol.layer,
1663 m_CurVol.sector, m_CurVol.plane);
1665 new G4PVPlacement(*t, logicPlane, planeName, sector,
false,
1666 m_CurVol.plane,
false);
1667 }
catch (std::bad_alloc& ba) {
1676 HepGeom::Transform3D t;
1677 G4LogicalVolume* lv =
1678 m_LogVol.segmentsup[m_CurVol.plane - 1][iSegmentSupport - 1];
1680 m_GeoDat->getSegmentSupportPosition(m_CurVol.plane, iSegmentSupport);
1681 t = (*m_TransformData->getPlaneDisplacement(m_CurVol.section, m_CurVol.layer,
1682 m_CurVol.sector, m_CurVol.plane)) *
1683 HepGeom::Translate3D(
1686 segmentSupportPos->
getX(), segmentSupportPos->
getY(),
1687 segmentSupportPos->
getZ()) *
1688 HepGeom::RotateX3D(180.0 * CLHEP::deg);
1690 new G4PVPlacement(t, lv, lv->GetName() +
"_" + plane->GetName(), plane,
1692 }
catch (std::bad_alloc& ba) {
1700 HepGeom::Transform3D t;
1702 m_GeoDat->getPlasticSheetGeometry();
1704 m_GeoDat->getStripGeometry();
1705 std::string sheetName =
1706 "Sheet_" + std::to_string(iSheet) +
1707 "_SheetPlane_" + std::to_string(iSheetPlane);
1709 if (iSheetPlane == 2)
1711 t = HepGeom::Translate3D(0, 0, z);
1713 new G4PVPlacement(t, m_LogVol.psheet[iSheet - 1], sheetName,
1714 m_LogVol.segment[iSheet - 1],
false, (iSheetPlane - 1) *
1715 m_GeoDat->getNSegments() + iSheet,
false);
1716 }
catch (std::bad_alloc& ba) {
1723 HepGeom::Transform3D t;
1724 std::string segmentName =
"StripSegment_" + std::to_string(iSegment);
1725 t = HepGeom::Translate3D(0, 0, 0);
1727 new G4PVPlacement(t, m_LogVol.stripSegment[iSegment - 1], segmentName,
1728 m_LogVol.segment[iSegment - 1],
false, iSegment,
false);
1729 }
catch (std::bad_alloc& ba) {
1736 HepGeom::Transform3D t;
1737 std::string segmentName =
1738 "Segment_" + std::to_string(m_CurVol.segment) +
"_" + plane->GetName();
1739 t = (*m_TransformData->getPlaneDisplacement(m_CurVol.section, m_CurVol.layer,
1740 m_CurVol.sector, m_CurVol.plane)) *
1741 (*m_TransformData->getSegmentTransform(
1742 m_CurVol.section, m_CurVol.layer, m_CurVol.sector, m_CurVol.plane,
1745 new G4PVPlacement(t, m_LogVol.segment[m_CurVol.segment - 1], segmentName,
1746 plane,
false, m_CurVol.segment,
false);
1747 }
catch (std::bad_alloc& ba) {
1755 HepGeom::Transform3D t, t2;
1756 G4LogicalVolume* lv;
1757 n = m_GeoDat->getStripLengthIndex(m_CurVol.strip - 1);
1758 m_GeoDat->getStripTransform(&t, m_CurVol.strip - 1);
1759 t2 = t * HepGeom::RotateX3D(180.0 * CLHEP::deg);
1760 lv = m_LogVol.strip[n];
1762 new G4PVPlacement(t2, lv, lv->GetName(), segment,
false, m_CurVol.strip,
1764 }
catch (std::bad_alloc& ba) {
1771 HepGeom::Transform3D t;
1772 G4LogicalVolume* lv;
1773 G4LogicalVolume* lvm;
1775 m_GeoDat->getStripGeometry();
1776 t = HepGeom::Translate3D(0., 0., 0.5 * (stripGeometry->
getThickness() -
1778 lvm = m_LogVol.strip[iStrip];
1779 lv = m_LogVol.groove[iStrip];
1781 new G4PVPlacement(t, lv, lv->GetName(), lvm,
false, 1,
false);
1782 }
catch (std::bad_alloc& ba) {
1789 HepGeom::Transform3D t;
1790 G4LogicalVolume* lv;
1791 G4LogicalVolume* lvm;
1792 t = HepGeom::Translate3D(0., 0., 0.);
1793 lvm = m_LogVol.strip[iStrip];
1794 lv = m_LogVol.scint[iStrip];
1796 new G4PVPlacement(t, lv, lv->GetName(), lvm,
false, 1,
false);
1797 }
catch (std::bad_alloc& ba) {
1804 HepGeom::Transform3D ta, tb, tc, td, te;
1805 G4LogicalVolume* lv;
1807 const double asqrt2 = 1.0 / sqrt(2.0);
1809 m_GeoDat->getShieldGeometry();
1814 HepGeom::RotateZ3D(-45.0 * CLHEP::deg);
1817 HepGeom::RotateZ3D(-45.0 * CLHEP::deg);
1820 HepGeom::RotateZ3D(-45.0 * CLHEP::deg) *
1821 HepGeom::RotateY3D(180.0 * CLHEP::deg);
1822 td = HepGeom::Translate3D(
1825 HepGeom::RotateZ3D(-45.0 * CLHEP::deg) *
1826 HepGeom::RotateX3D(180.0 * CLHEP::deg);
1827 te = HepGeom::Translate3D(
1830 HepGeom::RotateZ3D(135.0 * CLHEP::deg);
1831 lv = m_LogVol.shield.detailA;
1833 new G4PVPlacement(ta, lv, lv->GetName(), sector,
false, 1,
false);
1834 }
catch (std::bad_alloc& ba) {
1837 lv = m_LogVol.shield.detailB;
1839 new G4PVPlacement(tb, lv, lv->GetName(), sector,
false, 1,
false);
1840 }
catch (std::bad_alloc& ba) {
1843 lv = m_LogVol.shield.detailC;
1845 new G4PVPlacement(tc, lv, lv->GetName(), sector,
false, 1,
false);
1846 }
catch (std::bad_alloc& ba) {
1849 lv = m_LogVol.shield.detailD;
1851 new G4PVPlacement(td, lv, lv->GetName(), sector,
false, 1,
false);
1852 }
catch (std::bad_alloc& ba) {
1856 new G4PVPlacement(te, lv,
"ShieldDetailE", sector,
false, 1,
false);
1857 }
catch (std::bad_alloc& ba) {
1864 return ((section == 1 && layer <= m_GeoDat->getNDetectorLayers(1)) ||
1865 (section == 2 && layer <= m_GeoDat->getNDetectorLayers(2)));
1871 int i, j, imin, imax;
1873 G4LogicalVolume* section, *layer, *sector, *plane;
1877 for (i = 0; i < m_GeoDat->getNStripsDifferentLength(); i++) {
1878 createStripGroove(i);
1879 createScintillator(i);
1881 for (i = 0; i < m_GeoDat->getNSegments(); i++) {
1882 imin = i * m_ElementNumbers->getNStripsSegment();
1883 imax = (i + 1) * m_ElementNumbers->getNStripsSegment();
1884 for (m_CurVol.strip = imin + 1; m_CurVol.strip <= imax; m_CurVol.strip++)
1885 createStrip(m_LogVol.stripSegment[i]);
1887 for (i = 1; i <= m_GeoDat->getNSegments(); i++) {
1888 for (j = 1; j <= 2; j++)
1889 createPlasticSheet(j, i);
1890 createStripSegment(i);
1894 G4Region* aRegion =
new G4Region(
"EKLMEnvelope");
1895 for (m_CurVol.section = 1; m_CurVol.section <= m_GeoDat->getNSections();
1896 m_CurVol.section++) {
1897 section = createSection(&topVolume);
1899 section->SetRegion(aRegion);
1900 aRegion->AddRootLogicalVolume(section);
1901 for (m_CurVol.layer = 1; m_CurVol.layer <= m_GeoDat->getNLayers();
1903 if (detectorLayer(m_CurVol.section, m_CurVol.layer)) {
1905 layer = createLayer(section,
nullptr);
1906 for (m_CurVol.sector = 1; m_CurVol.sector <= m_GeoDat->getNSectors();
1907 m_CurVol.sector++) {
1908 sector = createSector(layer,
nullptr);
1909 createSectorSupport(sector);
1910 createSectorSupportCorner1(sector);
1911 createSectorSupportCorner2(sector);
1912 createSectorSupportCorner3(sector);
1913 createSectorSupportCorner4(sector);
1914 for (i = 1; i <= 2; i++)
1915 createSectorCover(i, sector);
1916 for (m_CurVol.plane = 1; m_CurVol.plane <= m_GeoDat->getNPlanes();
1918 plane = createPlane(sector);
1919 for (i = 1; i <= m_GeoDat->getNSegments() + 1; i++)
1920 createSegmentSupport(i, plane);
1921 for (m_CurVol.segment = 1;
1922 m_CurVol.segment <= m_GeoDat->getNSegments();
1924 createSegment(plane);
1929 layer = createLayer(section, m_LogVol.shieldLayer);
1930 for (m_CurVol.sector = 1; m_CurVol.sector <= m_GeoDat->getNSectors();
1932 createSector(layer, m_LogVol.shieldLayerSector);
1933 createSectorSupport(m_LogVol.shieldLayerSector);
1934 createSectorSupportCorner1(m_LogVol.shieldLayerSector);
1935 createSectorSupportCorner2(m_LogVol.shieldLayerSector);
1936 createSectorSupportCorner3(m_LogVol.shieldLayerSector);
1937 createSectorSupportCorner4(m_LogVol.shieldLayerSector);
1938 for (i = 1; i <= 2; i++)
1939 createSectorCover(i, m_LogVol.shieldLayerSector);
1940 createShield(m_LogVol.shieldLayerSector);
1947 G4LogicalVolume& topVolume,
1956 }
catch (std::bad_alloc& ba) {
1965 G4LogicalVolume& topVolume,
1974 }
catch (std::bad_alloc& ba) {
1990 }
catch (std::bad_alloc& ba) {
1993 m_GeoDat->saveToDatabase(iov);
static const EKLMElementNumbers & Instance()
Instantiation.
Position information for the elements of detector.
double getX() const
Get X coordinate.
double getOuterR() const
Get outer radius.
double getInnerR() const
Get inner radius.
double getZ() const
Get Z coordinate.
double getY() const
Get Y coordinate.
double getLength() const
Get length.
Endcap srtucture geometry parameters.
double getPhi() const
Get starting angle of the octagonal endcap structure shape.
int getNSides() const
Get number of sides.
Plastic sheet geometry data.
double getWidth() const
Get width.
double getDeltaL() const
Get Delta L (edge of last strip - edge of plastic sheet distance).
double getX() const
Get X coordinate.
double getY() const
Get Y coordinate.
Sector support geometry data.
double getCorner2Thickness() const
Get corner 2 thickness.
double getCorner2LY() const
Get corner 2 Y length.
double getCorner4Thickness() const
Get corner 4 thickness.
const HepGeom::Point3D< double > & getCorner3() const
Get corner 3 coordinates.
double getCorner1Z() const
Get corner 1 Z coordinate.
double getCornerX() const
Get coordinate X of corner 1.
double getCorner4LX() const
Get corner 4 X length.
double getCorner1LX() const
Get corner 1 X length.
const HepGeom::Point3D< double > & getCorner1B() const
Get corner 1B coordinates.
double getCorner3LX() const
Get corner 3 X length.
double getCornerAngle() const
Get corner 1 angle.
double getCorner4LY() const
Get corner 4 Y length.
const HepGeom::Point3D< double > & getCorner2Inner() const
Get corner 2 coordinates (inner side).
double getCorner2LX() const
Get corner 2 X length.
const HepGeom::Point3D< double > & getCorner4Prism() const
Get coordinates of the corner of corner 4 prism.
double getThickness() const
Get thickness.
const HepGeom::Point3D< double > & getCorner1AInner() const
Get corner 1A coordinates (inner side).
double getCorner4Z() const
Get corner 4 Z coordinate.
double getCorner3Z() const
Get corner 3 Z coordinate.
const HepGeom::Point3D< double > & getCorner4() const
Get corner 4 coordinates.
double getCorner3Thickness() const
Get corner 3 thickness.
double getDeltaLY() const
Get outerR - Y of upper edge of BoxY.
double getCorner3LY() const
Get corner 3 Y length.
double getCorner1Width() const
Get corner 1 width.
const HepGeom::Point3D< double > & getCorner1A() const
Get corner 1A coordinates.
double getCorner1Thickness() const
Get corner 1 thickness.
const HepGeom::Point3D< double > & getCorner3Prism() const
Get coordinates of the corner of corner 3 prism.
double getCorner2Z() const
Get corner 2 Z coordinate.
Segment support geometry data.
double getMiddleWidth() const
Get middle part width.
double getTopThickness() const
Get top part thickness.
double getTopWidth() const
Get top part width.
double getMiddleThickness() const
Get middle part thickness.
Segment support position.
double getX() const
Get X coordinate.
double getZ() const
Get Z coordinate.
double getY() const
Get Y coordinate.
double getDeltaLRight() const
Get right Delta L.
double getDeltaLLeft() const
Get left Delta L.
double getLength() const
Get length.
Shield layer detail geometry data.
const Point * getPoint(int i) const
Get point.
double getLengthY() const
Get Y length.
double getLengthX() const
Get X length.
Shield layer geometry data.
const Point * getDetailBCenter() const
Get detail B center.
const ShieldDetailGeometry * getDetailB() const
Get detail B geometry.
const Point * getDetailCCenter() const
Get detail C center.
const ShieldDetailGeometry * getDetailC() const
Get detail C geometry.
double getThickness() const
Get thickness.
const Point * getDetailACenter() const
Get detail A center.
const ShieldDetailGeometry * getDetailA() const
Get detail A geometry.
const ShieldDetailGeometry * getDetailD() const
Get detail D geometry.
double getWidth() const
Get width.
double getNoScintillationThickness() const
Get nonscintillating layer thickness.
double getGrooveDepth() const
Get groove depth.
double getThickness() const
Get thickness.
double getGrooveWidth() const
Get groove width.
The Class for EKLM Sensitive Detector.
GeoEKLMCreator()
Constructor.
G4Box * createSectorSupportBoxY(G4Transform3D &t)
Create Y side of sector support structure.
struct Solids m_Solids
Solids.
void createShieldDetailDLogicalVolume()
Create shield detail D logical volume.
void createShieldDetailALogicalVolume()
Create shield detail A logical volume.
G4LogicalVolume * createSector(G4LogicalVolume *layer, G4LogicalVolume *sector) const
Create sector.
void createShieldDetailCLogicalVolume()
Create shield detail C logical volume.
void createSegment(G4LogicalVolume *plane) const
Create segment (strips + plastic sheets).
void createMaterials()
Creation of materials.
G4Tubs * createSectorSupportOuterTube()
Create outer tube of sector support structure.
struct LogicalVolumes m_LogVol
Logical volumes.
TransformData * m_TransformData
Transformation data.
struct VolumeNumbers m_CurVol
Current volumes.
void createSectorSupportCorner4(G4LogicalVolume *sector) const
Create sector support corner 4.
struct Materials m_Materials
Materials.
void createShieldDetailBLogicalVolume()
Create shield detail B logical volume.
void createScintillator(int iStrip) const
Create scintillator.
G4LogicalVolume * createSection(G4LogicalVolume *topVolume) const
Create section.
void createSectorSupportCorner1LogicalVolume()
Create sector support corner 1 logical volume.
G4LogicalVolume * createLayer(G4LogicalVolume *section, G4LogicalVolume *layer) const
Create layer.
void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creation of the detector geometry from database.
void createPlaneSolid(int n)
Create plane solid.
G4SubtractionSolid * cutSolidCorner(const char *name, G4VSolid *solid, G4Box *subtractionBox, const HepGeom::Transform3D &transf, bool largerAngles, double x1, double y1, double x2, double y2)
Cut corner of a solid.
void createSectorSupportCorner2LogicalVolume()
Create sector support corner 2 logical volume.
void newVolumes()
Create new volumes.
void createSubtractionBoxSolid()
Create subtraction box solid.
G4Box * createSectorSupportBoxTop(G4Transform3D &t)
Create box in the cutted corner of sector support structure.
void newSensitive()
Create new sensitive detectors.
void createSectorSupportCorner1(G4LogicalVolume *sector) const
Create sector support corner 1.
void createSectorSupportCorner3(G4LogicalVolume *sector) const
Create sector support corner 3.
void deleteSensitive()
Delete sensitive detectors.
G4LogicalVolume * createLayerLogicalVolume(const char *name) const
Create layer logical volume.
void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
Creation of payloads.
void createSectorCover(int iCover, G4LogicalVolume *sector) const
Create sector cover.
void createStripSegment(int iSegment) const
Create strip segment.
G4LogicalVolume * createPlane(G4LogicalVolume *sector) const
Create plane.
EKLMSensitiveDetector * m_Sensitive
Sensitive detector.
void createScintillatorLogicalVolume(int iStrip)
Create scintillator logical volume.
void createSegmentSupportLogicalVolume(int iPlane, int iSegmentSupport)
Create segment support logical volume.
void createShield(G4LogicalVolume *sector) const
Create shield.
void createPlasticSheet(int iSheetPlane, int iSheet) const
Create plastic sheet.
const EKLMElementNumbers * m_ElementNumbers
Element numbers.
void createSectorSupportCorner4LogicalVolume()
Create sector support corner 4 logical volume.
void createSegmentLogicalVolume(int iSegment)
Create segment logical volume (strips + plastic sheets).
void createSolids()
Create solids (or logical volumes which must be created only once).
void createPlasticSheetLogicalVolume(int iSegment)
Create plastic sheet logical volume.
void createSectorSupportLogicalVolume()
Create sector support logical volume.
void createLayerSolid()
Create layer solid.
G4Box * createSectorSupportBoxX(G4Transform3D &t)
Create X side of sector support structure.
void createSectorCoverLogicalVolume()
Create sector cover solid.
void createSectorSupportCorner2(G4LogicalVolume *sector) const
Create sector support corner 2.
void createStripGrooveLogicalVolume(int iStrip)
Create strip groove logical volume.
bool detectorLayer(int section, int layer) const
Check if a given layer is a detector layer.
void createStripGroove(int iStrip) const
Create strip groove.
void createSectorSupportCorner3LogicalVolume()
Create sector support corner 3 logical volume.
G4VSolid * unifySolids(G4VSolid **solids, HepGeom::Transform3D *transf, int nSolids, const std::string &name)
Unify a group of solids.
void createSectionSolid()
Create section solid.
G4LogicalVolume * createSectorLogicalVolume(const char *name) const
Create sector logical volume.
void createStrip(G4LogicalVolume *segment) const
Create strip.
void createSectorSolid()
Create sector solid.
void createStripLogicalVolume(int iStrip)
Create strip logical volume.
void deleteVolumes()
Delete volumes.
void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creation of the detector geometry from Gearbox (XML).
void createSectorSupport(G4LogicalVolume *sector) const
Create sector support structure (main part without corners).
const GeometryData * m_GeoDat
Geometry data.
void createStripSegmentLogicalVolume(int iSegment)
Create strip segment logical volume.
void createSegmentSupport(int iSegmentSupport, G4LogicalVolume *plane) const
Create segment support.
G4Tubs * createSectorSupportInnerTube()
Create inner tube of sector support structure.
~GeoEKLMCreator()
Destructor.
static const GeometryData & Instance(enum DataSource dataSource=c_Database, const GearDir *gearDir=nullptr)
Instantiation.
@ c_Gearbox
Gearbox (XML).
G4VSolid * getSolid()
Get solid.
GearDir is the basic class used for accessing the parameter store.
A class that describes the interval of experiments/runs for which an object in the database is valid.
static G4Material * get(const std::string &name)
Find given material.
void setVisibility(G4LogicalVolume &volume, bool visible)
Helper function to quickly set the visibility of a given volume.
void setColor(G4LogicalVolume &volume, const std::string &color)
Set the color of a logical volume.
GeometryTypes
Flag indiciating the type of geometry to be used.
Abstract base class for different kinds of events.
G4LogicalVolume ** strip
Strips.
G4LogicalVolume ** scint
Scintillator.
G4LogicalVolume ** groove
Strip grooves.
G4LogicalVolume *** segmentsup
Segment support.
G4LogicalVolume ** psheet
Plastic sheet.
G4VSolid ** groove
Strip grooves.
G4VSolid ** psheet
Plastic sheets (combined).