10#include <klm/eklm/geometry/GeoEKLMCreator.h>
13#include <klm/eklm/geometry/G4TriangularPrism.h>
14#include <klm/simulation/SensitiveDetector.h>
17#include <geometry/CreatorFactory.h>
18#include <geometry/Materials.h>
19#include <geometry/utilities.h>
23#include <G4Polyhedra.hh>
24#include <G4PVPlacement.hh>
27#include <G4UnionSolid.hh>
30#include <CLHEP/Units/SystemOfUnits.h>
38static const char MemErr[] =
"Memory allocation error.";
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) {
758cutSolidCorner(
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,
769cutSolidCorner(
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) {
950unifySolids(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 createSectorSolid();
1428 createSectorCoverLogicalVolume();
1429 createSectorSupportLogicalVolume();
1434 createSectorSupportCorner1LogicalVolume();
1435 createSectorSupportCorner2LogicalVolume();
1436 createSectorSupportCorner3LogicalVolume();
1437 createSectorSupportCorner4LogicalVolume();
1439 createSubtractionBoxSolid();
1440 for (i = 0; i < m_GeoDat->getNPlanes(); i++) {
1441 createPlaneSolid(i);
1443 for (j = 1; j <= m_GeoDat->getNSegments() + 1; j++)
1444 createSegmentSupportLogicalVolume(i + 1, j);
1447 n = m_GeoDat->getNStripsDifferentLength();
1448 for (i = 0; i < n; i++) {
1449 createStripLogicalVolume(i);
1450 createStripGrooveLogicalVolume(i);
1451 createScintillatorLogicalVolume(i);
1454 for (i = 0; i < m_GeoDat->getNSegments(); i++)
1455 createPlasticSheetLogicalVolume(i);
1457 for (i = 0; i < m_GeoDat->getNSegments(); i++)
1458 createStripSegmentLogicalVolume(i);
1460 for (i = 0; i < m_GeoDat->getNSegments(); i++)
1461 createSegmentLogicalVolume(i);
1463 createShieldDetailALogicalVolume();
1464 createShieldDetailBLogicalVolume();
1465 createShieldDetailCLogicalVolume();
1466 createShieldDetailDLogicalVolume();
1474 G4LogicalVolume* logicSection =
nullptr;
1475 const HepGeom::Transform3D* t;
1476 std::string sectionName =
"Section_" + std::to_string(m_CurVol.section);
1478 logicSection =
new G4LogicalVolume(m_Solids.section, m_Materials.iron,
1480 }
catch (std::bad_alloc& ba) {
1485 t = m_TransformData->getSectionTransform(m_CurVol.section);
1487 new G4PVPlacement(*t, logicSection, sectionName, topVolume,
false,
1488 m_CurVol.section,
false);
1489 }
catch (std::bad_alloc& ba) {
1492 return logicSection;
1498 G4LogicalVolume* logicLayer;
1499 const HepGeom::Transform3D* t;
1500 std::string layerName =
"Layer_" + std::to_string(m_CurVol.layer) +
1501 "_" + section->GetName();
1502 logicLayer = createLayerLogicalVolume(layerName.c_str());
1503 t = m_TransformData->getLayerTransform(m_CurVol.section, m_CurVol.layer);
1505 new G4PVPlacement(*t, logicLayer, logicLayer->GetName(), section,
false,
1506 m_CurVol.layer,
false);
1507 }
catch (std::bad_alloc& ba) {
1516 G4LogicalVolume* logicSector;
1517 const HepGeom::Transform3D* t;
1518 std::string sectorName =
"Sector_" + std::to_string(m_CurVol.sector) +
1519 "_" + layer->GetName();
1520 logicSector = createSectorLogicalVolume(sectorName.c_str());
1521 t = m_TransformData->getSectorTransform(m_CurVol.section, m_CurVol.layer,
1524 new G4PVPlacement(*t, logicSector, logicSector->GetName(), layer,
false,
1525 m_CurVol.sector,
false);
1526 }
catch (std::bad_alloc& ba) {
1536 HepGeom::Transform3D t;
1537 G4LogicalVolume* lv = m_LogVol.cover;
1539 m_GeoDat->getSectorPosition();
1541 m_GeoDat->getSectorSupportPosition();
1545 t = HepGeom::Translate3D(0., 0., z);
1547 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1549 }
catch (std::bad_alloc& ba) {
1557 HepGeom::Transform3D t;
1558 G4LogicalVolume* lv = m_LogVol.sectorsup.corn1;
1560 m_GeoDat->getSectorSupportGeometry();
1561 t = HepGeom::Translate3D(0., 0., sectorSupportGeometry->
getCorner1Z());
1563 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1565 }
catch (std::bad_alloc& ba) {
1573 HepGeom::Transform3D t;
1574 G4LogicalVolume* lv = m_LogVol.sectorsup.corn2;
1576 m_GeoDat->getSectorSupportGeometry();
1577 t = HepGeom::Translate3D(sectorSupportGeometry->
getCorner2Inner().x(),
1581 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1583 }
catch (std::bad_alloc& ba) {
1591 HepGeom::Transform3D t;
1592 G4LogicalVolume* lv = m_LogVol.sectorsup.corn3;
1594 m_GeoDat->getSectorSupportGeometry();
1595 t = HepGeom::Translate3D(sectorSupportGeometry->
getCorner3Prism().x(),
1599 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1601 }
catch (std::bad_alloc& ba) {
1609 HepGeom::Transform3D t;
1610 G4LogicalVolume* lv = m_LogVol.sectorsup.corn4;
1612 m_GeoDat->getSectorSupportGeometry();
1613 t = HepGeom::Translate3D(sectorSupportGeometry->
getCorner4Prism().x(),
1617 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1619 }
catch (std::bad_alloc& ba) {
1627 HepGeom::Transform3D t;
1628 G4LogicalVolume* lv = m_LogVol.sectorsup.supp;
1630 m_GeoDat->getSectorSupportPosition();
1631 t = HepGeom::Translate3D(0., 0., sectorSupportPos->
getZ());
1633 new G4PVPlacement(t, lv, lv->GetName() +
"_" + sector->GetName(), sector,
1635 }
catch (std::bad_alloc& ba) {
1643 G4LogicalVolume* logicPlane =
nullptr;
1644 const HepGeom::Transform3D* t;
1645 std::string planeName =
1646 "Plane_" + std::to_string(m_CurVol.plane) +
"_" + sector->GetName();
1648 logicPlane =
new G4LogicalVolume(m_Solids.plane[m_CurVol.plane - 1],
1649 m_Materials.air, planeName);
1650 }
catch (std::bad_alloc& ba) {
1654 t = m_TransformData->getPlaneTransform(m_CurVol.section, m_CurVol.layer,
1655 m_CurVol.sector, m_CurVol.plane);
1657 new G4PVPlacement(*t, logicPlane, planeName, sector,
false,
1658 m_CurVol.plane,
false);
1659 }
catch (std::bad_alloc& ba) {
1668 HepGeom::Transform3D t;
1669 G4LogicalVolume* lv =
1670 m_LogVol.segmentsup[m_CurVol.plane - 1][iSegmentSupport - 1];
1672 m_GeoDat->getSegmentSupportPosition(m_CurVol.plane, iSegmentSupport);
1673 t = (*m_TransformData->getPlaneDisplacement(m_CurVol.section, m_CurVol.layer,
1674 m_CurVol.sector, m_CurVol.plane)) *
1675 HepGeom::Translate3D(
1678 segmentSupportPos->
getX(), segmentSupportPos->
getY(),
1679 segmentSupportPos->
getZ()) *
1680 HepGeom::RotateX3D(180.0 * CLHEP::deg);
1682 new G4PVPlacement(t, lv, lv->GetName() +
"_" + plane->GetName(), plane,
1684 }
catch (std::bad_alloc& ba) {
1692 HepGeom::Transform3D t;
1694 m_GeoDat->getPlasticSheetGeometry();
1696 m_GeoDat->getStripGeometry();
1697 std::string sheetName =
1698 "Sheet_" + std::to_string(iSheet) +
1699 "_SheetPlane_" + std::to_string(iSheetPlane);
1701 if (iSheetPlane == 2)
1703 t = HepGeom::Translate3D(0, 0, z);
1705 new G4PVPlacement(t, m_LogVol.psheet[iSheet - 1], sheetName,
1706 m_LogVol.segment[iSheet - 1],
false, (iSheetPlane - 1) *
1707 m_GeoDat->getNSegments() + iSheet,
false);
1708 }
catch (std::bad_alloc& ba) {
1715 HepGeom::Transform3D t;
1716 std::string segmentName =
"StripSegment_" + std::to_string(iSegment);
1717 t = HepGeom::Translate3D(0, 0, 0);
1719 new G4PVPlacement(t, m_LogVol.stripSegment[iSegment - 1], segmentName,
1720 m_LogVol.segment[iSegment - 1],
false, iSegment,
false);
1721 }
catch (std::bad_alloc& ba) {
1728 HepGeom::Transform3D t;
1729 std::string segmentName =
1730 "Segment_" + std::to_string(m_CurVol.segment) +
"_" + plane->GetName();
1731 t = (*m_TransformData->getPlaneDisplacement(m_CurVol.section, m_CurVol.layer,
1732 m_CurVol.sector, m_CurVol.plane)) *
1733 (*m_TransformData->getSegmentTransform(
1734 m_CurVol.section, m_CurVol.layer, m_CurVol.sector, m_CurVol.plane,
1737 new G4PVPlacement(t, m_LogVol.segment[m_CurVol.segment - 1], segmentName,
1738 plane,
false, m_CurVol.segment,
false);
1739 }
catch (std::bad_alloc& ba) {
1747 HepGeom::Transform3D t, t2;
1748 G4LogicalVolume* lv;
1749 n = m_GeoDat->getStripLengthIndex(m_CurVol.strip - 1);
1750 m_GeoDat->getStripTransform(&t, m_CurVol.strip - 1);
1751 t2 = t * HepGeom::RotateX3D(180.0 * CLHEP::deg);
1752 lv = m_LogVol.strip[n];
1754 new G4PVPlacement(t2, lv, lv->GetName(), segment,
false, m_CurVol.strip,
1756 }
catch (std::bad_alloc& ba) {
1763 HepGeom::Transform3D t;
1764 G4LogicalVolume* lv;
1765 G4LogicalVolume* lvm;
1767 m_GeoDat->getStripGeometry();
1768 t = HepGeom::Translate3D(0., 0., 0.5 * (stripGeometry->
getThickness() -
1770 lvm = m_LogVol.strip[iStrip];
1771 lv = m_LogVol.groove[iStrip];
1773 new G4PVPlacement(t, lv, lv->GetName(), lvm,
false, 1,
false);
1774 }
catch (std::bad_alloc& ba) {
1781 HepGeom::Transform3D t;
1782 G4LogicalVolume* lv;
1783 G4LogicalVolume* lvm;
1784 t = HepGeom::Translate3D(0., 0., 0.);
1785 lvm = m_LogVol.strip[iStrip];
1786 lv = m_LogVol.scint[iStrip];
1788 new G4PVPlacement(t, lv, lv->GetName(), lvm,
false, 1,
false);
1789 }
catch (std::bad_alloc& ba) {
1796 HepGeom::Transform3D ta, tb, tc, td, te;
1797 G4LogicalVolume* lv;
1799 const double asqrt2 = 1.0 /
sqrt(2.0);
1801 m_GeoDat->getShieldGeometry();
1806 HepGeom::RotateZ3D(-45.0 * CLHEP::deg);
1809 HepGeom::RotateZ3D(-45.0 * CLHEP::deg);
1812 HepGeom::RotateZ3D(-45.0 * CLHEP::deg) *
1813 HepGeom::RotateY3D(180.0 * CLHEP::deg);
1814 td = HepGeom::Translate3D(
1817 HepGeom::RotateZ3D(-45.0 * CLHEP::deg) *
1818 HepGeom::RotateX3D(180.0 * CLHEP::deg);
1819 te = HepGeom::Translate3D(
1822 HepGeom::RotateZ3D(135.0 * CLHEP::deg);
1823 lv = m_LogVol.shield.detailA;
1825 new G4PVPlacement(ta, lv, lv->GetName(), sector,
false, 1,
false);
1826 }
catch (std::bad_alloc& ba) {
1829 lv = m_LogVol.shield.detailB;
1831 new G4PVPlacement(tb, lv, lv->GetName(), sector,
false, 1,
false);
1832 }
catch (std::bad_alloc& ba) {
1835 lv = m_LogVol.shield.detailC;
1837 new G4PVPlacement(tc, lv, lv->GetName(), sector,
false, 1,
false);
1838 }
catch (std::bad_alloc& ba) {
1841 lv = m_LogVol.shield.detailD;
1843 new G4PVPlacement(td, lv, lv->GetName(), sector,
false, 1,
false);
1844 }
catch (std::bad_alloc& ba) {
1848 new G4PVPlacement(te, lv,
"ShieldDetailE", sector,
false, 1,
false);
1849 }
catch (std::bad_alloc& ba) {
1856 return ((section == 1 && layer <= m_GeoDat->getNDetectorLayers(1)) ||
1857 (section == 2 && layer <= m_GeoDat->getNDetectorLayers(2)));
1863 int i, j, imin, imax;
1865 G4LogicalVolume* section, *layer, *sector, *plane;
1869 for (i = 0; i < m_GeoDat->getNStripsDifferentLength(); i++) {
1870 createStripGroove(i);
1871 createScintillator(i);
1873 for (i = 0; i < m_GeoDat->getNSegments(); i++) {
1874 imin = i * m_ElementNumbers->getNStripsSegment();
1875 imax = (i + 1) * m_ElementNumbers->getNStripsSegment();
1876 for (m_CurVol.strip = imin + 1; m_CurVol.strip <= imax; m_CurVol.strip++)
1877 createStrip(m_LogVol.stripSegment[i]);
1879 for (i = 1; i <= m_GeoDat->getNSegments(); i++) {
1880 for (j = 1; j <= 2; j++)
1881 createPlasticSheet(j, i);
1882 createStripSegment(i);
1886 G4Region* aRegion = 0;
1887 for (m_CurVol.section = 1; m_CurVol.section <= m_GeoDat->getNSections();
1888 m_CurVol.section++) {
1889 section = createSection(&topVolume);
1891 if (not aRegion) aRegion =
new G4Region(
"EKLMEnvelope");
1892 section->SetRegion(aRegion);
1893 aRegion->AddRootLogicalVolume(section);
1894 for (m_CurVol.layer = 1; m_CurVol.layer <= m_GeoDat->getNLayers();
1896 layer = createLayer(section);
1897 for (m_CurVol.sector = 1; m_CurVol.sector <= m_GeoDat->getNSectors();
1898 m_CurVol.sector++) {
1899 sector = createSector(layer);
1900 createSectorSupport(sector);
1901 createSectorSupportCorner1(sector);
1902 createSectorSupportCorner2(sector);
1903 createSectorSupportCorner3(sector);
1904 createSectorSupportCorner4(sector);
1905 for (i = 1; i <= 2; i++)
1906 createSectorCover(i, sector);
1907 if (detectorLayer(m_CurVol.section, m_CurVol.layer)) {
1909 for (m_CurVol.plane = 1; m_CurVol.plane <= m_GeoDat->getNPlanes();
1911 plane = createPlane(sector);
1912 for (i = 1; i <= m_GeoDat->getNSegments() + 1; i++)
1913 createSegmentSupport(i, plane);
1914 for (m_CurVol.segment = 1;
1915 m_CurVol.segment <= m_GeoDat->getNSegments();
1917 createSegment(plane);
1921 createShield(sector);
1929 G4LogicalVolume& topVolume,
1938 }
catch (std::bad_alloc& ba) {
1947 G4LogicalVolume& topVolume,
1956 }
catch (std::bad_alloc& ba) {
1972 }
catch (std::bad_alloc& ba) {
1975 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.
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.
double getCorner3LX() const
Get corner 3 X length.
const HepGeom::Point3D< double > & getCorner1B() const
Get corner 1B coordinates.
double getCornerAngle() const
Get corner 1 angle.
double getCorner4LY() const
Get corner 4 Y length.
const HepGeom::Point3D< double > & getCorner3Prism() const
Get coordinates of the corner of corner 3 prism.
const HepGeom::Point3D< double > & getCorner4() const
Get corner 4 coordinates.
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 > & getCorner3() const
Get corner 3 coordinates.
double getCorner4Z() const
Get corner 4 Z coordinate.
double getCorner3Z() const
Get corner 3 Z coordinate.
const HepGeom::Point3D< double > & getCorner1A() const
Get corner 1A coordinates.
double getCorner3Thickness() const
Get corner 3 thickness.
double getDeltaLY() const
Get outerR - Y of upper edge of BoxY.
const HepGeom::Point3D< double > & getCorner1AInner() const
Get corner 1A coordinates (inner side).
const HepGeom::Point3D< double > & getCorner2Inner() const
Get corner 2 coordinates (inner side).
double getCorner3LY() const
Get corner 3 Y length.
double getCorner1Width() const
Get corner 1 width.
double getCorner1Thickness() const
Get corner 1 thickness.
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 ShieldDetailGeometry * getDetailA() const
Get detail A geometry.
const ShieldDetailGeometry * getDetailB() const
Get detail B geometry.
const Point * getDetailCCenter() const
Get detail C center.
double getThickness() const
Get thickness.
const ShieldDetailGeometry * getDetailD() const
Get detail D geometry.
const Point * getDetailACenter() const
Get detail A center.
const Point * getDetailBCenter() const
Get detail B center.
const ShieldDetailGeometry * getDetailC() const
Get detail C 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.
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.
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.
void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creation of the detector geometry from database.
KLM::SensitiveDetector * m_Sensitive
Sensitive detector.
G4LogicalVolume * createSector(G4LogicalVolume *layer) const
Create sector.
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.
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.
G4LogicalVolume * createLayer(G4LogicalVolume *section) const
Create layer.
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.
KLM sensitive-detector class.
static G4Material * get(const std::string &name)
Find given material.
double sqrt(double a)
sqrt for double
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).
Very simple class to provide an easy way to register creators with the CreatorManager.