Belle II Software development
GeoEKLMCreator Class Reference

Class GeoEKLMCreator. More...

#include <GeoEKLMCreator.h>

Inheritance diagram for GeoEKLMCreator:
CreatorBase

Public Member Functions

 GeoEKLMCreator ()
 Constructor.
 
 ~GeoEKLMCreator ()
 Destructor.
 
void create (const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
 Creation of the detector geometry from Gearbox (XML).
 
void createFromDB (const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
 Creation of the detector geometry from database.
 
void createPayloads (const GearDir &content, const IntervalOfValidity &iov) override
 Creation of payloads.
 
 BELLE2_DEFINE_EXCEPTION (DBNotImplemented, "Cannot create geometry from Database.")
 Exception that will be thrown in createFromDB if member is not yet implemented by creator.
 

Private Member Functions

void createMaterials ()
 Creation of materials.
 
void readXMLDataStrips ()
 Read strip parameters from XML database.
 
void createSectionSolid ()
 Create section solid.
 
G4LogicalVolume * createLayerLogicalVolume (const char *name) const
 Create layer logical volume.
 
void createLayerSolid ()
 Create layer solid.
 
G4LogicalVolume * createSectorLogicalVolume (const char *name) const
 Create sector logical volume.
 
void createSectorSolid ()
 Create sector solid.
 
void createSectorCoverLogicalVolume ()
 Create sector cover solid.
 
G4Tubs * createSectorSupportInnerTube ()
 Create inner tube of sector support structure.
 
G4Tubs * createSectorSupportOuterTube ()
 Create outer tube of sector support structure.
 
G4Box * createSectorSupportBoxX (G4Transform3D &t)
 Create X side of sector support structure.
 
G4Box * createSectorSupportBoxY (G4Transform3D &t)
 Create Y side of sector support structure.
 
G4Box * createSectorSupportBoxTop (G4Transform3D &t)
 Create box in the cutted corner of sector support structure.
 
void createSectorSupportLogicalVolume ()
 Create sector support logical volume.
 
void createSectorSupportCorner1LogicalVolume ()
 Create sector support corner 1 logical volume.
 
void createSectorSupportCorner2LogicalVolume ()
 Create sector support corner 2 logical volume.
 
void createSectorSupportCorner3LogicalVolume ()
 Create sector support corner 3 logical volume.
 
void createSectorSupportCorner4LogicalVolume ()
 Create sector support corner 4 logical volume.
 
void createSubtractionBoxSolid ()
 Create subtraction box 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.
 
G4SubtractionSolid * cutSolidCorner (const char *name, G4VSolid *solid, G4Box *subtractionBox, const HepGeom::Transform3D &transf, bool largerAngles, double x, double y, double ang)
 Cut corner of a solid.
 
void createPlaneSolid (int n)
 Create plane solid.
 
void createSegmentSupportLogicalVolume (int iPlane, int iSegmentSupport)
 Create segment support logical volume.
 
G4VSolid * unifySolids (G4VSolid **solids, HepGeom::Transform3D *transf, int nSolids, const std::string &name)
 Unify a group of solids.
 
void createPlasticSheetLogicalVolume (int iSegment)
 Create plastic sheet logical volume.
 
void createStripSegmentLogicalVolume (int iSegment)
 Create strip segment logical volume.
 
void createSegmentLogicalVolume (int iSegment)
 Create segment logical volume (strips + plastic sheets).
 
void createStripLogicalVolume (int iStrip)
 Create strip logical volume.
 
void createStripGrooveLogicalVolume (int iStrip)
 Create strip groove logical volume.
 
void createScintillatorLogicalVolume (int iStrip)
 Create scintillator logical volume.
 
void createShieldDetailALogicalVolume ()
 Create shield detail A logical volume.
 
void createShieldDetailBLogicalVolume ()
 Create shield detail B logical volume.
 
void createShieldDetailCLogicalVolume ()
 Create shield detail C logical volume.
 
void createShieldDetailDLogicalVolume ()
 Create shield detail D logical volume.
 
void createSolids ()
 Create solids (or logical volumes which must be created only once).
 
bool detectorLayer (int section, int layer) const
 Check if a given layer is a detector layer.
 
G4LogicalVolume * createSection (G4LogicalVolume *topVolume) const
 Create section.
 
G4LogicalVolume * createLayer (G4LogicalVolume *section) const
 Create layer.
 
G4LogicalVolume * createSector (G4LogicalVolume *layer) const
 Create sector.
 
void createSectorCover (int iCover, G4LogicalVolume *sector) const
 Create sector cover.
 
void createSectorSupport (G4LogicalVolume *sector) const
 Create sector support structure (main part without corners).
 
void createSectorSupportCorner1 (G4LogicalVolume *sector) const
 Create sector support corner 1.
 
void createSectorSupportCorner2 (G4LogicalVolume *sector) const
 Create sector support corner 2.
 
void createSectorSupportCorner3 (G4LogicalVolume *sector) const
 Create sector support corner 3.
 
void createSectorSupportCorner4 (G4LogicalVolume *sector) const
 Create sector support corner 4.
 
G4LogicalVolume * createPlane (G4LogicalVolume *sector) const
 Create plane.
 
void createSegmentSupport (int iSegmentSupport, G4LogicalVolume *plane) const
 Create segment support.
 
void createPlasticSheet (int iSheetPlane, int iSheet) const
 Create plastic sheet.
 
void createStripSegment (int iSegment) const
 Create strip segment.
 
void createSegment (G4LogicalVolume *plane) const
 Create segment (strips + plastic sheets).
 
void createStrip (G4LogicalVolume *segment) const
 Create strip.
 
void createStripGroove (int iStrip) const
 Create strip groove.
 
void createScintillator (int iStrip) const
 Create scintillator.
 
void createShield (G4LogicalVolume *sector) const
 Create shield.
 
void newVolumes ()
 Create new volumes.
 
void newSensitive ()
 Create new sensitive detectors.
 
void deleteVolumes ()
 Delete volumes.
 
void deleteSensitive ()
 Delete sensitive detectors.
 
double getSectorSupportCornerAngle ()
 Get cutted corner angle.
 
void create (G4LogicalVolume &topVolume)
 Creation of the detector geometry.
 

Private Attributes

struct Solids m_Solids
 Solids.
 
struct LogicalVolumes m_LogVol
 Logical volumes.
 
struct Materials m_Materials
 Materials.
 
struct VolumeNumbers m_CurVol
 Current volumes.
 
const EKLMElementNumbersm_ElementNumbers
 Element numbers.
 
TransformDatam_TransformData
 Transformation data.
 
const GeometryDatam_GeoDat
 Geometry data.
 
KLM::SensitiveDetectorm_Sensitive
 Sensitive detector.
 

Detailed Description

Class GeoEKLMCreator.

The creator for the EKLM geometry of the Belle II detector.

Definition at line 205 of file GeoEKLMCreator.h.

Constructor & Destructor Documentation

◆ GeoEKLMCreator()

Constructor.

Definition at line 45 of file GeoEKLMCreator.cc.

46{
47 m_Materials.air = nullptr;
48 m_CurVol.section = 1;
49 m_GeoDat = nullptr;
50 m_TransformData = nullptr;
51 m_Solids.plane = nullptr;
52 m_Solids.psheet = nullptr;
53 m_LogVol.psheet = nullptr;
54 m_LogVol.strip = nullptr;
55 m_Solids.groove = nullptr;
56 m_LogVol.groove = nullptr;
57 m_LogVol.scint = nullptr;
58 m_LogVol.segmentsup = nullptr;
60 m_Sensitive = nullptr;
61}
static const EKLMElementNumbers & Instance()
Instantiation.
struct Solids m_Solids
Solids.
struct LogicalVolumes m_LogVol
Logical volumes.
TransformData * m_TransformData
Transformation data.
struct VolumeNumbers m_CurVol
Current volumes.
struct Materials m_Materials
Materials.
KLM::SensitiveDetector * m_Sensitive
Sensitive detector.
const EKLMElementNumbers * m_ElementNumbers
Element numbers.
const GeometryData * m_GeoDat
Geometry data.
G4LogicalVolume ** strip
Strips.
G4LogicalVolume ** scint
Scintillator.
G4LogicalVolume ** groove
Strip grooves.
G4LogicalVolume *** segmentsup
Segment support.
G4LogicalVolume ** psheet
Plastic sheet.
G4Material * air
Air.
G4VSolid ** plane
Plane.
G4VSolid ** groove
Strip grooves.
G4VSolid ** psheet
Plastic sheets (combined).

◆ ~GeoEKLMCreator()

Destructor.

Definition at line 63 of file GeoEKLMCreator.cc.

64{
65 delete m_TransformData;
66 if (m_Solids.plane != nullptr)
68 if (m_Sensitive != nullptr)
70}
void deleteSensitive()
Delete sensitive detectors.
void deleteVolumes()
Delete volumes.

Member Function Documentation

◆ create() [1/2]

void create ( const GearDir content,
G4LogicalVolume &  topVolume,
geometry::GeometryTypes  type 
)
overridevirtual

Creation of the detector geometry from Gearbox (XML).

Parameters
[in]contentXML data directory.
[in]topVolumeGeant world volume.
[in]typeGeometry type.

Implements CreatorBase.

Definition at line 1928 of file GeoEKLMCreator.cc.

1931{
1932 (void)content;
1933 (void)type;
1935 try {
1938 } catch (std::bad_alloc& ba) {
1939 B2FATAL(MemErr);
1940 }
1941 newVolumes();
1942 newSensitive();
1943 create(topVolume);
1944}
void newVolumes()
Create new volumes.
void newSensitive()
Create new sensitive detectors.
void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creation of the detector geometry from Gearbox (XML).
static const GeometryData & Instance(enum DataSource dataSource=c_Database, const GearDir *gearDir=nullptr)
Instantiation.
Definition: GeometryData.cc:33
@ c_Gearbox
Gearbox (XML).
Definition: GeometryData.h:46
Transformation data.
Definition: TransformData.h:35
@ c_Displacement
Use displacement data (for geometry).
Definition: TransformData.h:44

◆ create() [2/2]

void create ( G4LogicalVolume &  topVolume)
private

Creation of the detector geometry.

Parameters
[in]topVolumeGeant world volume.

Definition at line 1860 of file GeoEKLMCreator.cc.

1861{
1862 /* cppcheck-suppress variableScope */
1863 int i, j, imin, imax;
1864 /* cppcheck-suppress variableScope */
1865 G4LogicalVolume* section, *layer, *sector, *plane;
1867 createSolids();
1868 /* Create physical volumes which are used only once. */
1869 for (i = 0; i < m_GeoDat->getNStripsDifferentLength(); i++) {
1872 }
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++)
1878 }
1879 for (i = 1; i <= m_GeoDat->getNSegments(); i++) {
1880 for (j = 1; j <= 2; j++)
1881 createPlasticSheet(j, i);
1883 }
1884 /* Create other volumes. */
1885 /* Set up region for production cuts. */
1886 G4Region* aRegion = 0;
1888 m_CurVol.section++) {
1889 section = createSection(&topVolume);
1890 /* Assign same region to each section. */
1891 if (not aRegion) aRegion = new G4Region("EKLMEnvelope");
1892 section->SetRegion(aRegion);
1893 aRegion->AddRootLogicalVolume(section);
1895 m_CurVol.layer++) {
1896 layer = createLayer(section);
1898 m_CurVol.sector++) {
1899 sector = createSector(layer);
1900 createSectorSupport(sector);
1905 for (i = 1; i <= 2; i++)
1906 createSectorCover(i, sector);
1908 /* Detector layer. */
1910 m_CurVol.plane++) {
1911 plane = createPlane(sector);
1912 for (i = 1; i <= m_GeoDat->getNSegments() + 1; i++)
1913 createSegmentSupport(i, plane);
1914 for (m_CurVol.segment = 1;
1916 m_CurVol.segment++)
1917 createSegment(plane);
1918 }
1919 } else {
1920 /* Shield layer. */
1921 createShield(sector);
1922 }
1923 }
1924 }
1925 }
1926}
static constexpr int getNStripsSegment()
Get number of strips in a segment.
int getNPlanes() const
Get number of planes.
int getNSections() const
Get number of sections.
int getNLayers() const
Get number of layers.
int getNSegments() const
Get number of segments.
int getNSectors() const
Get number of sectors.
void createSegment(G4LogicalVolume *plane) const
Create segment (strips + plastic sheets).
void createMaterials()
Creation of materials.
void createSectorSupportCorner4(G4LogicalVolume *sector) const
Create sector support corner 4.
void createScintillator(int iStrip) const
Create scintillator.
G4LogicalVolume * createSection(G4LogicalVolume *topVolume) const
Create section.
G4LogicalVolume * createSector(G4LogicalVolume *layer) const
Create sector.
void createSectorSupportCorner1(G4LogicalVolume *sector) const
Create sector support corner 1.
void createSectorSupportCorner3(G4LogicalVolume *sector) const
Create sector support corner 3.
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 createShield(G4LogicalVolume *sector) const
Create shield.
void createPlasticSheet(int iSheetPlane, int iSheet) const
Create plastic sheet.
void createSolids()
Create solids (or logical volumes which must be created only once).
void createSectorSupportCorner2(G4LogicalVolume *sector) const
Create sector support corner 2.
bool detectorLayer(int section, int layer) const
Check if a given layer is a detector layer.
void createStripGroove(int iStrip) const
Create strip groove.
G4LogicalVolume * createLayer(G4LogicalVolume *section) const
Create layer.
void createStrip(G4LogicalVolume *segment) const
Create strip.
void createSectorSupport(G4LogicalVolume *sector) const
Create sector support structure (main part without corners).
void createSegmentSupport(int iSegmentSupport, G4LogicalVolume *plane) const
Create segment support.
int getNStripsDifferentLength() const
Get number of strips with different lengths.
Definition: GeometryData.h:88
G4LogicalVolume ** stripSegment
Strip segments.

◆ createFromDB()

void createFromDB ( const std::string &  name,
G4LogicalVolume &  topVolume,
geometry::GeometryTypes  type 
)
overridevirtual

Creation of the detector geometry from database.

Parameters
[in]nameName of the component in the database.
[in]topVolumeGeant world volume.
[in]typeGeometry type.

Reimplemented from CreatorBase.

Definition at line 1946 of file GeoEKLMCreator.cc.

1949{
1950 (void)name;
1951 (void)type;
1953 try {
1956 } catch (std::bad_alloc& ba) {
1957 B2FATAL(MemErr);
1958 }
1959 newVolumes();
1960 newSensitive();
1961 create(topVolume);
1962}

◆ createLayer()

G4LogicalVolume * createLayer ( G4LogicalVolume *  section) const
private

Create layer.

Parameters
[in]sectionSection logical volume.
Returns
Layer logical volume.

Definition at line 1495 of file GeoEKLMCreator.cc.

1497{
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());
1504 try {
1505 new G4PVPlacement(*t, logicLayer, logicLayer->GetName(), section, false,
1506 m_CurVol.layer, false);
1507 } catch (std::bad_alloc& ba) {
1508 B2FATAL(MemErr);
1509 }
1510 return logicLayer;
1511}
G4LogicalVolume * createLayerLogicalVolume(const char *name) const
Create layer logical volume.
const HepGeom::Transform3D * getLayerTransform(int section, int layer) const
Get layer transformation.

◆ createLayerLogicalVolume()

G4LogicalVolume * createLayerLogicalVolume ( const char *  name) const
private

Create layer logical volume.

Parameters
[in]nameLayer logical volume name.
Returns
Layer logical volume.

Definition at line 228 of file GeoEKLMCreator.cc.

229{
230 G4LogicalVolume* logicLayer = nullptr;
231 try {
232 logicLayer = new G4LogicalVolume(m_Solids.layer, m_Materials.air, name);
233 } catch (std::bad_alloc& ba) {
234 B2FATAL(MemErr);
235 }
236 geometry::setVisibility(*logicLayer, false);
237 return logicLayer;
238}
void setVisibility(G4LogicalVolume &volume, bool visible)
Helper function to quickly set the visibility of a given volume.
Definition: utilities.cc:108
G4VSolid * layer
Layer.

◆ createLayerSolid()

void createLayerSolid ( )
private

Create layer solid.

Definition at line 240 of file GeoEKLMCreator.cc.

241{
243 try {
245 new G4Tubs("Layer", layerPos->getInnerR(), layerPos->getOuterR(),
246 layerPos->getLength() / 2.0, 0.0, 360. * CLHEP::deg);
247 } catch (std::bad_alloc& ba) {
248 B2FATAL(MemErr);
249 }
250}
Position information for the elements of detector.
Definition: EKLMGeometry.h:100
double getOuterR() const
Get outer radius.
Definition: EKLMGeometry.h:129
double getInnerR() const
Get inner radius.
Definition: EKLMGeometry.h:112
double getLength() const
Get length.
Definition: EKLMGeometry.h:146
const ElementPosition * getLayerPosition() const
Get position data for layers.

◆ createMaterials()

void createMaterials ( )
private

Creation of materials.

Definition at line 176 of file GeoEKLMCreator.cc.

177{
186}
static G4Material * get(const std::string &name)
Find given material.
Definition: Materials.h:63
G4Material * iron
Iron.
G4Material * silicon
Silicon.
G4Material * duralumin
Duralumin.
G4Material * polystyrene
Polystyrene.
G4Material * polyethylene
Polyethylene.
G4Material * gel
Gel.
G4Material * polystyrol
Polystyrol.

◆ createPayloads()

void createPayloads ( const GearDir content,
const IntervalOfValidity iov 
)
overridevirtual

Creation of payloads.

Parameters
contentXML data directory.
iovInterval of validity.

Reimplemented from CreatorBase.

Definition at line 1964 of file GeoEKLMCreator.cc.

1966{
1967 (void)content;
1969 try {
1972 } catch (std::bad_alloc& ba) {
1973 B2FATAL(MemErr);
1974 }
1976}
void saveToDatabase(const IntervalOfValidity &iov) const
Save geometry data to database.

◆ createPlane()

G4LogicalVolume * createPlane ( G4LogicalVolume *  sector) const
private

Create plane.

Parameters
[in]sectorSector logical volume.
Returns
Plane logical volume.

Definition at line 1641 of file GeoEKLMCreator.cc.

1642{
1643 G4LogicalVolume* logicPlane = nullptr;
1644 const HepGeom::Transform3D* t;
1645 std::string planeName =
1646 "Plane_" + std::to_string(m_CurVol.plane) + "_" + sector->GetName();
1647 try {
1648 logicPlane = new G4LogicalVolume(m_Solids.plane[m_CurVol.plane - 1],
1649 m_Materials.air, planeName);
1650 } catch (std::bad_alloc& ba) {
1651 B2FATAL(MemErr);
1652 }
1653 geometry::setVisibility(*logicPlane, false);
1656 try {
1657 new G4PVPlacement(*t, logicPlane, planeName, sector, false,
1658 m_CurVol.plane, false);
1659 } catch (std::bad_alloc& ba) {
1660 B2FATAL(MemErr);
1661 }
1662 return logicPlane;
1663}
const HepGeom::Transform3D * getPlaneTransform(int section, int layer, int sector, int plane) const
Get plane transformation.

◆ createPlaneSolid()

void createPlaneSolid ( int  n)
private

Create plane solid.

Parameters
[in]nNumber of plane, from 0 to 1.

Definition at line 794 of file GeoEKLMCreator.cc.

795{
796 double box_x;
797 double box_y;
798 HepGeom::Transform3D t;
799 HepGeom::Transform3D t1;
800 char name[128];
801 G4Tubs* tb = nullptr;
802 G4IntersectionSolid* is = nullptr;
803 G4SubtractionSolid* ss1, *ss2, *ss3, *ss4;
804 const EKLMGeometry::ElementPosition* sectorSupportPos =
806 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
809 /* Basic solids. */
810 snprintf(name, 128, "Plane_%d_Tube", n + 1);
811 try {
812 tb = new G4Tubs(name, planePos->getInnerR(), planePos->getOuterR(),
813 0.5 * planePos->getLength(), 0.0, 90.0 * CLHEP::deg);
814 } catch (std::bad_alloc& ba) {
815 B2FATAL(MemErr);
816 }
817 snprintf(name, 128, "Plane_%d_Box", n + 1);
818 box_x = sectorSupportPos->getX() + sectorSupportGeometry->getThickness();
819 box_y = sectorSupportPos->getY() + sectorSupportGeometry->getThickness();
820 /* Calculate transformations for boolean solids. */
821 t1 = HepGeom::Translate3D(m_Solids.subtractionBox->GetXHalfLength() + box_x,
822 m_Solids.subtractionBox->GetXHalfLength() + box_y,
823 0.);
824 /* For rotated plane. */
825 if (n == 0) {
826 t = HepGeom::Rotate3D(180. * CLHEP::deg,
827 HepGeom::Vector3D<double>(1., 1., 0.));
828 t1 = t * t1;
829 } else
830 t = HepGeom::Translate3D(0, 0, 0);
831 /* Boolean solids. */
832 snprintf(name, 128, "Plane_%d_Intersection", n + 1);
833 try {
834 is = new G4IntersectionSolid(name, tb, m_Solids.subtractionBox, t1);
835 } catch (std::bad_alloc& ba) {
836 B2FATAL(MemErr);
837 }
838 snprintf(name, 128, "Plane_%d_Subtraction_1", n + 1);
839 ss1 = cutSolidCorner(name, is, m_Solids.subtractionBox, t, true,
840 sectorSupportGeometry->getCorner1AInner().x(),
841 sectorSupportGeometry->getCorner1AInner().y(),
842 sectorSupportGeometry->getCornerAngle());
843 snprintf(name, 128, "Plane_%d_Subtraction_2", n + 1);
844 ss2 = cutSolidCorner(
845 name, ss1, m_Solids.subtractionBox, t, false,
846 sectorSupportGeometry->getCorner2Inner().x() -
847 sectorSupportGeometry->getCorner2LX(),
848 sectorSupportGeometry->getCorner2Inner().y(),
849 sectorSupportGeometry->getCorner2Inner().x(),
850 sectorSupportGeometry->getCorner2Inner().y() +
851 sectorSupportGeometry->getCorner2LY());
852 snprintf(name, 128, "Plane_%d_Subtraction_3", n + 1);
853 ss3 = cutSolidCorner(
854 name, ss2, m_Solids.subtractionBox, t, false,
855 sectorSupportGeometry->getCorner3Prism().x(),
856 sectorSupportGeometry->getCorner3Prism().y() +
857 sectorSupportGeometry->getCorner3LY(),
858 sectorSupportGeometry->getCorner3Prism().x() +
859 sectorSupportGeometry->getCorner3LX(),
860 sectorSupportGeometry->getCorner3Prism().y());
861 snprintf(name, 128, "Plane_%d_Subtraction_4", n + 1);
862 ss4 = cutSolidCorner(
863 name, ss3, m_Solids.subtractionBox, t, true,
864 sectorSupportGeometry->getCorner4Prism().x() +
865 sectorSupportGeometry->getCorner4LX(),
866 sectorSupportGeometry->getCorner4Prism().y(),
867 sectorSupportGeometry->getCorner4Prism().x(),
868 sectorSupportGeometry->getCorner4Prism().y() +
869 sectorSupportGeometry->getCorner4LY());
870 snprintf(name, 128, "Plane_%d", n + 1);
871 m_Solids.plane[n] = ss4;
872}
double getX() const
Get X coordinate.
Definition: EKLMGeometry.h:163
double getY() const
Get Y coordinate.
Definition: EKLMGeometry.h:180
Sector support geometry data.
Definition: EKLMGeometry.h:239
double getCorner2LY() const
Get corner 2 Y length.
Definition: EKLMGeometry.h:387
double getCorner4LX() const
Get corner 4 X length.
Definition: EKLMGeometry.h:506
double getCorner3LX() const
Get corner 3 X length.
Definition: EKLMGeometry.h:438
double getCornerAngle() const
Get corner 1 angle.
Definition: EKLMGeometry.h:574
double getCorner4LY() const
Get corner 4 Y length.
Definition: EKLMGeometry.h:523
const HepGeom::Point3D< double > & getCorner3Prism() const
Get coordinates of the corner of corner 3 prism.
Definition: EKLMGeometry.h:710
double getCorner2LX() const
Get corner 2 X length.
Definition: EKLMGeometry.h:370
const HepGeom::Point3D< double > & getCorner4Prism() const
Get coordinates of the corner of corner 4 prism.
Definition: EKLMGeometry.h:761
double getThickness() const
Get thickness.
Definition: EKLMGeometry.h:251
const HepGeom::Point3D< double > & getCorner1AInner() const
Get corner 1A coordinates (inner side).
Definition: EKLMGeometry.h:608
const HepGeom::Point3D< double > & getCorner2Inner() const
Get corner 2 coordinates (inner side).
Definition: EKLMGeometry.h:659
double getCorner3LY() const
Get corner 3 Y length.
Definition: EKLMGeometry.h:455
const ElementPosition * getPlanePosition() const
Get position data for planes.
const SectorSupportGeometry * getSectorSupportGeometry() const
Get sector support geometry data.
const ElementPosition * getSectorSupportPosition() const
Get position data for sector support structure.
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.
G4Box * subtractionBox
Box used for subtractions.

◆ createPlasticSheet()

void createPlasticSheet ( int  iSheetPlane,
int  iSheet 
) const
private

Create plastic sheet.

Parameters
[in]iSheetPlaneNumber of sheet plane.
[in]iSheetNumber of sheet (segment).

Definition at line 1689 of file GeoEKLMCreator.cc.

1690{
1691 double z;
1692 HepGeom::Transform3D t;
1693 const EKLMGeometry::PlasticSheetGeometry* plasticSheetGeometry =
1695 const EKLMGeometry::StripGeometry* stripGeometry =
1697 std::string sheetName =
1698 "Sheet_" + std::to_string(iSheet) +
1699 "_SheetPlane_" + std::to_string(iSheetPlane);
1700 z = 0.5 * (stripGeometry->getThickness() + plasticSheetGeometry->getWidth());
1701 if (iSheetPlane == 2)
1702 z = -z;
1703 t = HepGeom::Translate3D(0, 0, z);
1704 try {
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) {
1709 B2FATAL(MemErr);
1710 }
1711}
Plastic sheet geometry data.
Definition: EKLMGeometry.h:880
double getThickness() const
Get thickness.
const PlasticSheetGeometry * getPlasticSheetGeometry() const
Get plastic sheet geometry data.
const StripGeometry * getStripGeometry() const
Get strip geometry data.
G4LogicalVolume ** segment
Segments.

◆ createPlasticSheetLogicalVolume()

void createPlasticSheetLogicalVolume ( int  iSegment)
private

Create plastic sheet logical volume.

Parameters
[in]iSegmentNumber of segment (0-based).

Definition at line 1026 of file GeoEKLMCreator.cc.

1027{
1028 int i, m, nStrip;
1029 /* cppcheck-suppress variableScope */
1030 double ly;
1031 char name[128];
1032 G4VSolid** elements;
1033 HepGeom::Transform3D* t;
1034 const EKLMGeometry::PlasticSheetGeometry* plasticSheetGeometry =
1036 const EKLMGeometry::StripGeometry* stripGeometry =
1039 elements = new G4VSolid*[nStrip];
1040 t = new HepGeom::Transform3D[nStrip];
1041 /* Transformations. */
1042 for (i = 0; i < nStrip; i++) {
1043 m = nStrip * iSegment + i;
1044 m_GeoDat->getSheetTransform(&(t[i]), m);
1045 }
1046 /* Sheet elements. */
1047 for (i = 0; i < nStrip; i++) {
1048 snprintf(name, 128, "PlasticSheet_%d_Element_%d", iSegment + 1, i + 1);
1049 ly = stripGeometry->getWidth();
1050 if (i == 0 || i == nStrip - 1)
1051 ly = ly - plasticSheetGeometry->getDeltaL();
1052 m = nStrip * iSegment + i;
1053 const EKLMGeometry::ElementPosition* stripPos =
1054 m_GeoDat->getStripPosition(m + 1);
1055 try {
1057 new G4Box(name, 0.5 * stripPos->getLength(), 0.5 * ly,
1058 0.5 * plasticSheetGeometry->getWidth());
1059 } catch (std::bad_alloc& ba) {
1060 B2FATAL(MemErr);
1061 }
1062 elements[i] = m_Solids.plasticSheetElement[m];
1063 }
1064 /* Union. */
1065 snprintf(name, 128, "PlasticSheet_%d", iSegment + 1);
1066 m_Solids.psheet[iSegment] = unifySolids(elements, t, nStrip, name);
1067 try {
1068 m_LogVol.psheet[iSegment] =
1069 new G4LogicalVolume(m_Solids.psheet[iSegment],
1070 m_Materials.polystyrol, name);
1071 } catch (std::bad_alloc& ba) {
1072 B2FATAL(MemErr);
1073 }
1074 geometry::setVisibility(*m_LogVol.psheet[iSegment], false);
1075 geometry::setColor(*m_LogVol.psheet[iSegment], "#00ff00ff");
1076 delete[] elements;
1077 delete[] t;
1078}
double getDeltaL() const
Get Delta L (edge of last strip - edge of plastic sheet distance).
Definition: EKLMGeometry.h:909
double getWidth() const
Get width.
const ElementPosition * getStripPosition(int strip) const
Get position data for strips.
G4VSolid * unifySolids(G4VSolid **solids, HepGeom::Transform3D *transf, int nSolids, const std::string &name)
Unify a group of solids.
void getSheetTransform(HepGeom::Transform3D *t, int n) const
Get plastic sheet element transformation.
void setColor(G4LogicalVolume &volume, const std::string &color)
Set the color of a logical volume.
Definition: utilities.cc:100
G4VSolid ** plasticSheetElement
Plastic sheet element.

◆ createScintillator()

void createScintillator ( int  iStrip) const
private

Create scintillator.

Parameters
[in]iStripNumber of strip in the length-based array.

Definition at line 1779 of file GeoEKLMCreator.cc.

1780{
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];
1787 try {
1788 new G4PVPlacement(t, lv, lv->GetName(), lvm, false, 1, false);
1789 } catch (std::bad_alloc& ba) {
1790 B2FATAL(MemErr);
1791 }
1792}

◆ createScintillatorLogicalVolume()

void createScintillatorLogicalVolume ( int  iStrip)
private

Create scintillator logical volume.

Parameters
[in]iStripNumber of strip in length-based array.

Definition at line 1201 of file GeoEKLMCreator.cc.

1202{
1203 int iPos;
1204 char name[128];
1205 const EKLMGeometry::ElementPosition* stripPos;
1206 const EKLMGeometry::StripGeometry* stripGeometry =
1208 HepGeom::Transform3D t;
1209 G4Box* b;
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);
1214 try {
1215 b = new G4Box(name,
1216 0.5 * stripPos->getLength() -
1217 stripGeometry->getNoScintillationThickness(),
1218 0.5 * stripGeometry->getWidth() -
1219 stripGeometry->getNoScintillationThickness(),
1220 0.5 * stripGeometry->getThickness() -
1221 stripGeometry->getNoScintillationThickness());
1222 } catch (std::bad_alloc& ba) {
1223 B2FATAL(MemErr);
1224 }
1225 snprintf(name, 128, "StripSensitive_%d", iStrip + 1);
1226 t = HepGeom::Translate3D(0., 0., 0.5 * (stripGeometry->getThickness() -
1227 stripGeometry->getGrooveDepth()));
1228 try {
1229 scintillatorSolid =
1230 new G4SubtractionSolid(name, b, m_Solids.groove[iStrip], t);
1231 } catch (std::bad_alloc& ba) {
1232 B2FATAL(MemErr);
1233 }
1234 try {
1235 m_LogVol.scint[iStrip] =
1236 new G4LogicalVolume(scintillatorSolid, m_Materials.polystyrene,
1237 name, 0, m_Sensitive, 0);
1238 } catch (std::bad_alloc& ba) {
1239 B2FATAL(MemErr);
1240 }
1241 geometry::setVisibility(*m_LogVol.scint[iStrip], false);
1242 geometry::setColor(*m_LogVol.scint[iStrip], "#ffffffff");
1243}
double getNoScintillationThickness() const
Get nonscintillating layer thickness.
double getGrooveDepth() const
Get groove depth.
int getStripPositionIndex(int lengthIndex) const
Get index in position-based array.
Definition: GeometryData.h:106

◆ createSection()

G4LogicalVolume * createSection ( G4LogicalVolume *  topVolume) const
private

Create section.

Parameters
[in]topVolumeGeant world volume.
Returns
Section logical volume.

Definition at line 1472 of file GeoEKLMCreator.cc.

1473{
1474 G4LogicalVolume* logicSection = nullptr;
1475 const HepGeom::Transform3D* t;
1476 std::string sectionName = "Section_" + std::to_string(m_CurVol.section);
1477 try {
1478 logicSection = new G4LogicalVolume(m_Solids.section, m_Materials.iron,
1479 sectionName);
1480 } catch (std::bad_alloc& ba) {
1481 B2FATAL(MemErr);
1482 }
1483 geometry::setVisibility(*logicSection, true);
1484 geometry::setColor(*logicSection, "#ffffff22");
1486 try {
1487 new G4PVPlacement(*t, logicSection, sectionName, topVolume, false,
1488 m_CurVol.section, false);
1489 } catch (std::bad_alloc& ba) {
1490 B2FATAL(MemErr);
1491 }
1492 return logicSection;
1493}
const HepGeom::Transform3D * getSectionTransform(int section) const
Get section transformation.
G4VSolid * section
Section.

◆ createSectionSolid()

void createSectionSolid ( )
private

Create section solid.

Definition at line 190 of file GeoEKLMCreator.cc.

191{
192 const EKLMGeometry::EndcapStructureGeometry* sectionStructureGeometry =
194 const EKLMGeometry::ElementPosition* sectionPos =
196 const double z[2] = { -sectionPos->getLength() / 2,
197 sectionPos->getLength() / 2
198 };
199 const double rMin[2] = {0, 0};
200 const double rMax[2] = {sectionPos->getOuterR(), sectionPos->getOuterR()};
201 G4Polyhedra* op = nullptr;
202 G4Tubs* tb = nullptr;
203 try {
204 op = new G4Polyhedra("Section_Octagonal_Prism",
205 sectionStructureGeometry->getPhi(),
206 360. * CLHEP::deg,
207 sectionStructureGeometry->getNSides(),
208 2, z, rMin, rMax);
209 } catch (std::bad_alloc& ba) {
210 B2FATAL(MemErr);
211 }
212 /* Subtraction tube has slightly larger Z size. */
213 try {
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) {
218 B2FATAL(MemErr);
219 }
220 try {
221 m_Solids.section = new G4SubtractionSolid("Section", op, tb);
222 } catch (std::bad_alloc& ba) {
223 B2FATAL(MemErr);
224 }
225}
Endcap srtucture geometry parameters.
Definition: EKLMGeometry.h:36
double getPhi() const
Get starting angle of the octagonal endcap structure shape.
Definition: EKLMGeometry.h:53
int getNSides() const
Get number of sides.
Definition: EKLMGeometry.h:70
const EndcapStructureGeometry * getEndcapStructureGeometry() const
Get endcap structure geometry data.
const ElementPosition * getSectionPosition() const
Get position data for sections.

◆ createSector()

G4LogicalVolume * createSector ( G4LogicalVolume *  layer) const
private

Create sector.

Parameters
[in]layerLayer logical volume.
Returns
Sector logical volume.

Definition at line 1513 of file GeoEKLMCreator.cc.

1515{
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());
1523 try {
1524 new G4PVPlacement(*t, logicSector, logicSector->GetName(), layer, false,
1525 m_CurVol.sector, false);
1526 } catch (std::bad_alloc& ba) {
1527 B2FATAL(MemErr);
1528 }
1529 return logicSector;
1530}
G4LogicalVolume * createSectorLogicalVolume(const char *name) const
Create sector logical volume.
const HepGeom::Transform3D * getSectorTransform(int section, int layer, int sector) const
Get sector transformation.

◆ createSectorCover()

void createSectorCover ( int  iCover,
G4LogicalVolume *  sector 
) const
private

Create sector cover.

Parameters
[in]iCoverNumber of cover.
[in]sectorSector logical volume.

Definition at line 1532 of file GeoEKLMCreator.cc.

1534{
1535 double z;
1536 HepGeom::Transform3D t;
1537 G4LogicalVolume* lv = m_LogVol.cover;
1538 const EKLMGeometry::ElementPosition* sectorPos =
1540 const EKLMGeometry::ElementPosition* sectorSupportPos =
1542 z = 0.25 * (sectorPos->getLength() + sectorSupportPos->getLength());
1543 if (iCover == 2)
1544 z = -z;
1545 t = HepGeom::Translate3D(0., 0., z);
1546 try {
1547 new G4PVPlacement(t, lv, lv->GetName() + "_" + sector->GetName(), sector,
1548 false, 1, false);
1549 } catch (std::bad_alloc& ba) {
1550 B2FATAL(MemErr);
1551 }
1552}
const ElementPosition * getSectorPosition() const
Get position data for sectors.
G4LogicalVolume * cover
Sector cover.

◆ createSectorCoverLogicalVolume()

void createSectorCoverLogicalVolume ( )
private

Create sector cover solid.

Definition at line 278 of file GeoEKLMCreator.cc.

279{
280 double lz, ang;
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;
288 const EKLMGeometry::ElementPosition* sectorPos =
290 const EKLMGeometry::ElementPosition* sectorSupportPos =
292 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
295 lz = 0.5 * (sectorPos->getLength() - sectorSupportPos->getLength());
296 try {
297 solidCoverTube = new G4Tubs("Cover_Tube", sectorSupportPos->getInnerR(),
298 sectorSupportPos->getOuterR(), 0.5 * lz, 0.0,
299 90.0 * CLHEP::deg);
300 } catch (std::bad_alloc& ba) {
301 B2FATAL(MemErr);
302 }
303 try {
304 solidCoverBox = new G4Box("Cover_Box", 0.5 * sectorSupportPos->getOuterR(),
305 0.5 * sectorSupportPos->getOuterR(), 0.5 * lz);
306 } catch (std::bad_alloc& ba) {
307 B2FATAL(MemErr);
308 }
309 try {
310 box = new G4Box("Cover_SubtractionBox", 0.5 * sectorSupportPos->getOuterR(),
311 0.5 * sectorSupportPos->getOuterR(), lz);
312 } catch (std::bad_alloc& ba) {
313 B2FATAL(MemErr);
314 }
315 t1 = HepGeom::Translate3D(
316 0.5 * planePos->getOuterR() + sectorSupportPos->getX(),
317 0.5 * planePos->getOuterR() + sectorSupportPos->getY(), 0.);
318 ang = sectorSupportGeometry->getCornerAngle();
319 t2 = HepGeom::Translate3D(
320 sectorSupportPos->getX() +
321 0.5 * sectorSupportPos->getOuterR() * cos(ang) -
322 0.5 * sectorSupportPos->getOuterR() * sin(ang),
323 sectorSupportPos->getOuterR() -
324 sectorSupportGeometry->getDeltaLY() +
325 0.5 * sectorSupportPos->getOuterR() * cos(ang) +
326 0.5 * sectorSupportPos->getOuterR() * sin(ang),
327 0.) * HepGeom::RotateZ3D(ang);
328 try {
329 is = new G4IntersectionSolid("Cover_Intersection",
330 solidCoverTube, solidCoverBox, t1);
331 } catch (std::bad_alloc& ba) {
332 B2FATAL(MemErr);
333 }
334 try {
335 solidCover = new G4SubtractionSolid("Cover", is, box, t2);
336 } catch (std::bad_alloc& ba) {
337 B2FATAL(MemErr);
338 }
339 try {
341 new G4LogicalVolume(solidCover, m_Materials.duralumin, "Cover");
342 } catch (std::bad_alloc& ba) {
343 B2FATAL(MemErr);
344 }
346 geometry::setColor(*m_LogVol.cover, "#ff000022");
347}
double getDeltaLY() const
Get outerR - Y of upper edge of BoxY.
Definition: EKLMGeometry.h:268

◆ createSectorLogicalVolume()

G4LogicalVolume * createSectorLogicalVolume ( const char *  name) const
private

Create sector logical volume.

Parameters
[in]nameSector logical volume name.
Returns
Sector logical volume.

Definition at line 253 of file GeoEKLMCreator.cc.

254{
255 G4LogicalVolume* logicSector = nullptr;
256 try {
257 logicSector = new G4LogicalVolume(m_Solids.sector, m_Materials.air, name);
258 } catch (std::bad_alloc& ba) {
259 B2FATAL(MemErr);
260 }
261 geometry::setVisibility(*logicSector, false);
262 return logicSector;
263}
G4VSolid * sector
Sector.

◆ createSectorSolid()

void createSectorSolid ( )
private

Create sector solid.

Definition at line 265 of file GeoEKLMCreator.cc.

266{
267 const EKLMGeometry::ElementPosition* sectorPos =
269 try {
271 new G4Tubs("Sector", sectorPos->getInnerR(), sectorPos->getOuterR(),
272 0.5 * sectorPos->getLength(), 0.0, 90. * CLHEP::deg);
273 } catch (std::bad_alloc& ba) {
274 B2FATAL(MemErr);
275 }
276}

◆ createSectorSupport()

void createSectorSupport ( G4LogicalVolume *  sector) const
private

Create sector support structure (main part without corners).

Parameters
[in]sectorSector logical volume.

Definition at line 1624 of file GeoEKLMCreator.cc.

1626{
1627 HepGeom::Transform3D t;
1628 G4LogicalVolume* lv = m_LogVol.sectorsup.supp;
1629 const EKLMGeometry::ElementPosition* sectorSupportPos =
1631 t = HepGeom::Translate3D(0., 0., sectorSupportPos->getZ());
1632 try {
1633 new G4PVPlacement(t, lv, lv->GetName() + "_" + sector->GetName(), sector,
1634 false, 1, false);
1635 } catch (std::bad_alloc& ba) {
1636 B2FATAL(MemErr);
1637 }
1638}
double getZ() const
Get Z coordinate.
Definition: EKLMGeometry.h:197
struct SectorSupportLogicalVolumes sectorsup
Sector support.

◆ createSectorSupportBoxTop()

G4Box * createSectorSupportBoxTop ( G4Transform3D &  t)
private

Create box in the cutted corner of sector support structure.

Parameters
[out]tTransformation.

Sets t to the transformation of the box.

Definition at line 397 of file GeoEKLMCreator.cc.

398{
399 double dx;
400 double dy;
401 G4Box* res = nullptr;
402 const EKLMGeometry::ElementPosition* sectorSupportPos =
404 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
406 t = HepGeom::Translate3D(
407 0.5 * (sectorSupportGeometry->getCorner1A().x() +
408 sectorSupportGeometry->getCorner1B().x() +
409 sectorSupportGeometry->getThickness() *
410 sin(sectorSupportGeometry->getCornerAngle())),
411 0.5 * (sectorSupportGeometry->getCorner1A().y() +
412 sectorSupportGeometry->getCorner1B().y() -
413 sectorSupportGeometry->getThickness() *
414 cos(sectorSupportGeometry->getCornerAngle())),
415 0.) * HepGeom::RotateZ3D(sectorSupportGeometry->getCornerAngle());
416 dx = sectorSupportGeometry->getCorner1B().x() -
417 sectorSupportGeometry->getCorner1A().x();
418 dy = sectorSupportGeometry->getCorner1B().y() -
419 sectorSupportGeometry->getCorner1B().y();
420 try {
421 res = new G4Box("SectorSupport_BoxTop", 0.5 * sqrt(dx * dx + dy * dy),
422 0.5 * sectorSupportGeometry->getThickness(),
423 0.5 * sectorSupportPos->getLength());
424 } catch (std::bad_alloc& ba) {
425 B2FATAL(MemErr);
426 }
427 return res;
428}
const HepGeom::Point3D< double > & getCorner1B() const
Get corner 1B coordinates.
Definition: EKLMGeometry.h:625
const HepGeom::Point3D< double > & getCorner1A() const
Get corner 1A coordinates.
Definition: EKLMGeometry.h:591
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

◆ createSectorSupportBoxX()

G4Box * createSectorSupportBoxX ( G4Transform3D &  t)
private

Create X side of sector support structure.

Parameters
[out]tTransformation.

Sets t to the transformation of the box.

Definition at line 349 of file GeoEKLMCreator.cc.

350{
351 double x;
352 G4Box* res = nullptr;
353 const EKLMGeometry::ElementPosition* sectorSupportPos =
355 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
357 x = sqrt(sectorSupportPos->getOuterR() * sectorSupportPos->getOuterR() -
358 sectorSupportPos->getY() * sectorSupportPos->getY());
359 t = HepGeom::Translate3D(0.5 * (x + sectorSupportGeometry->getCorner3().x()),
360 sectorSupportPos->getY() +
361 0.5 * sectorSupportGeometry->getThickness(), 0.);
362 try {
363 res = new G4Box("SectorSupport_BoxX",
364 0.5 * (x - sectorSupportGeometry->getCorner3().x()),
365 0.5 * sectorSupportGeometry->getThickness(),
366 0.5 * sectorSupportPos->getLength());
367 } catch (std::bad_alloc& ba) {
368 B2FATAL(MemErr);
369 }
370 return res;
371}
const HepGeom::Point3D< double > & getCorner3() const
Get corner 3 coordinates.
Definition: EKLMGeometry.h:676

◆ createSectorSupportBoxY()

G4Box * createSectorSupportBoxY ( G4Transform3D &  t)
private

Create Y side of sector support structure.

Parameters
[out]tTransformation.

Sets t to the transformation of the box.

Definition at line 373 of file GeoEKLMCreator.cc.

374{
375 G4Box* res = nullptr;
376 const EKLMGeometry::ElementPosition* sectorSupportPos =
378 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
380 t = HepGeom::Translate3D(sectorSupportPos->getX() +
381 0.5 * sectorSupportGeometry->getThickness(),
382 0.5 * (sectorSupportGeometry->getCorner4().y() +
383 sectorSupportGeometry->getCorner1A().y()),
384 0.) * HepGeom::RotateZ3D(90. * CLHEP::deg);
385 try {
386 res = new G4Box("SectorSupport_BoxY",
387 0.5 * (sectorSupportGeometry->getCorner1A().y() -
388 sectorSupportGeometry->getCorner4().y()),
389 0.5 * sectorSupportGeometry->getThickness(),
390 0.5 * sectorSupportPos->getLength());
391 } catch (std::bad_alloc& ba) {
392 B2FATAL(MemErr);
393 }
394 return res;
395}
const HepGeom::Point3D< double > & getCorner4() const
Get corner 4 coordinates.
Definition: EKLMGeometry.h:727

◆ createSectorSupportCorner1()

void createSectorSupportCorner1 ( G4LogicalVolume *  sector) const
private

Create sector support corner 1.

Parameters
[in]sectorSector logical volume.

Definition at line 1554 of file GeoEKLMCreator.cc.

1556{
1557 HepGeom::Transform3D t;
1558 G4LogicalVolume* lv = m_LogVol.sectorsup.corn1;
1559 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
1561 t = HepGeom::Translate3D(0., 0., sectorSupportGeometry->getCorner1Z());
1562 try {
1563 new G4PVPlacement(t, lv, lv->GetName() + "_" + sector->GetName(), sector,
1564 false, 1, false);
1565 } catch (std::bad_alloc& ba) {
1566 B2FATAL(MemErr);
1567 }
1568}
double getCorner1Z() const
Get corner 1 Z coordinate.
Definition: EKLMGeometry.h:353

◆ createSectorSupportCorner1LogicalVolume()

void createSectorSupportCorner1LogicalVolume ( )
private

Create sector support corner 1 logical volume.

Definition at line 482 of file GeoEKLMCreator.cc.

483{
484 double lx;
485 double x;
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;
493 const EKLMGeometry::ElementPosition* sectorSupportPos =
495 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
497 lx = sectorSupportGeometry->getCornerX() +
498 sectorSupportGeometry->getCorner1LX() -
499 sectorSupportGeometry->getThickness();
500 try {
501 solidCorner1Tube = new G4Tubs(
502 "SectorSupport_Corner1_Tube", 0.,
503 sectorSupportPos->getOuterR() - sectorSupportGeometry->getThickness(),
504 0.5 * sectorSupportGeometry->getCorner1Thickness(),
505 0., 90. * CLHEP::deg);
506 } catch (std::bad_alloc& ba) {
507 B2FATAL(MemErr);
508 }
509 try {
510 solidCorner1Box1 = new G4Box(
511 "SectorSupport_Corner1_Box1", 0.5 * lx,
512 0.5 * sectorSupportPos->getOuterR(),
513 0.5 * sectorSupportGeometry->getCorner1Thickness());
514 } catch (std::bad_alloc& ba) {
515 B2FATAL(MemErr);
516 }
517 try {
518 solidCorner1Box2 =
519 new G4Box("SectorSupport_Corner1_Box2",
520 0.5 * (lx / cos(sectorSupportGeometry->getCornerAngle()) +
521 sectorSupportGeometry->getCorner1Width() *
522 tan(sectorSupportGeometry->getCornerAngle())),
523 0.5 * sectorSupportGeometry->getCorner1Width(),
524 0.5 * sectorSupportGeometry->getCorner1Thickness());
525 } catch (std::bad_alloc& ba) {
526 B2FATAL(MemErr);
527 }
528 x = sectorSupportPos->getX() + 0.5 * (sectorSupportGeometry->getCornerX() +
529 sectorSupportGeometry->getCorner1LX() +
530 sectorSupportGeometry->getThickness());
531 t1 = HepGeom::Translate3D(x, 0.5 * sectorSupportPos->getOuterR(), 0.);
532 t2 = HepGeom::Translate3D(
533 x, sectorSupportGeometry->getCorner1AInner().y() -
534 0.5 * sectorSupportGeometry->getCorner1Width() /
535 cos(sectorSupportGeometry->getCornerAngle()) +
536 0.5 * lx * tan(sectorSupportGeometry->getCornerAngle()), 0.) *
537 HepGeom::RotateZ3D(sectorSupportGeometry->getCornerAngle());
538 try {
539 is1 = new G4IntersectionSolid("SectorSupport_Corner1_Intersection1",
540 solidCorner1Tube, solidCorner1Box1, t1);
541 } catch (std::bad_alloc& ba) {
542 B2FATAL(MemErr);
543 }
544 try {
545 solidCorner1 = new G4IntersectionSolid("SectorSupport_Corner1", is1,
546 solidCorner1Box2, t2);
547 } catch (std::bad_alloc& ba) {
548 B2FATAL(MemErr);
549 }
550 try {
552 new G4LogicalVolume(solidCorner1, m_Materials.duralumin, "Corner1");
553 } catch (std::bad_alloc& ba) {
554 B2FATAL(MemErr);
555 }
558}
double getCornerX() const
Get coordinate X of corner 1.
Definition: EKLMGeometry.h:285
double getCorner1LX() const
Get corner 1 X length.
Definition: EKLMGeometry.h:302
double getCorner1Width() const
Get corner 1 width.
Definition: EKLMGeometry.h:319
double getCorner1Thickness() const
Get corner 1 thickness.
Definition: EKLMGeometry.h:336

◆ createSectorSupportCorner2()

void createSectorSupportCorner2 ( G4LogicalVolume *  sector) const
private

Create sector support corner 2.

Parameters
[in]sectorSector logical volume.

Definition at line 1570 of file GeoEKLMCreator.cc.

1572{
1573 HepGeom::Transform3D t;
1574 G4LogicalVolume* lv = m_LogVol.sectorsup.corn2;
1575 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
1577 t = HepGeom::Translate3D(sectorSupportGeometry->getCorner2Inner().x(),
1578 sectorSupportGeometry->getCorner2Inner().y(),
1579 sectorSupportGeometry->getCorner2Z());
1580 try {
1581 new G4PVPlacement(t, lv, lv->GetName() + "_" + sector->GetName(), sector,
1582 false, 1, false);
1583 } catch (std::bad_alloc& ba) {
1584 B2FATAL(MemErr);
1585 }
1586}
double getCorner2Z() const
Get corner 2 Z coordinate.
Definition: EKLMGeometry.h:421

◆ createSectorSupportCorner2LogicalVolume()

void createSectorSupportCorner2LogicalVolume ( )
private

Create sector support corner 2 logical volume.

Definition at line 560 of file GeoEKLMCreator.cc.

561{
562 G4TriangularPrism* solidCorner2Prism = nullptr;
563 G4SubtractionSolid* solidCorner2 = nullptr;
564 HepGeom::Transform3D t1;
565 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
567 try {
568 solidCorner2Prism =
569 new G4TriangularPrism("SectorSupport_Corner2_Prism",
570 sectorSupportGeometry->getCorner2LY(),
571 90. * CLHEP::deg,
572 sectorSupportGeometry->getCorner2LX(),
573 180. * CLHEP::deg,
574 0.5 * sectorSupportGeometry->getCorner2Thickness());
575 } catch (std::bad_alloc& ba) {
576 B2FATAL(MemErr);
577 }
578 t1 = HepGeom::Translate3D(-sectorSupportGeometry->getCorner2Inner().x(),
579 -sectorSupportGeometry->getCorner2Inner().y(), 0);
580 try {
581 solidCorner2 = new G4SubtractionSolid("SectorSupport_Corner2",
582 solidCorner2Prism->getSolid(),
584 } catch (std::bad_alloc& ba) {
585 B2FATAL(MemErr);
586 }
587 delete solidCorner2Prism;
588 try {
590 new G4LogicalVolume(solidCorner2, m_Materials.duralumin, "Corner2");
591 } catch (std::bad_alloc& ba) {
592 B2FATAL(MemErr);
593 }
596}
double getCorner2Thickness() const
Get corner 2 thickness.
Definition: EKLMGeometry.h:404
G4VSolid * getSolid()
Get solid.
struct SectorSupportSolids sectorsup
Sector support.

◆ createSectorSupportCorner3()

void createSectorSupportCorner3 ( G4LogicalVolume *  sector) const
private

Create sector support corner 3.

Parameters
[in]sectorSector logical volume.

Definition at line 1588 of file GeoEKLMCreator.cc.

1590{
1591 HepGeom::Transform3D t;
1592 G4LogicalVolume* lv = m_LogVol.sectorsup.corn3;
1593 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
1595 t = HepGeom::Translate3D(sectorSupportGeometry->getCorner3Prism().x(),
1596 sectorSupportGeometry->getCorner3Prism().y(),
1597 sectorSupportGeometry->getCorner3Z());
1598 try {
1599 new G4PVPlacement(t, lv, lv->GetName() + "_" + sector->GetName(), sector,
1600 false, 1, false);
1601 } catch (std::bad_alloc& ba) {
1602 B2FATAL(MemErr);
1603 }
1604}
double getCorner3Z() const
Get corner 3 Z coordinate.
Definition: EKLMGeometry.h:489

◆ createSectorSupportCorner3LogicalVolume()

void createSectorSupportCorner3LogicalVolume ( )
private

Create sector support corner 3 logical volume.

Definition at line 598 of file GeoEKLMCreator.cc.

599{
600 G4TriangularPrism* solidCorner3Prism = nullptr;
601 G4SubtractionSolid* solidCorner3 = nullptr;
602 HepGeom::Transform3D t1;
603 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
605 try {
606 solidCorner3Prism =
607 new G4TriangularPrism("SectorSupport_Corner3_Prism",
608 sectorSupportGeometry->getCorner3LX(), 0.,
609 sectorSupportGeometry->getCorner3LY(),
610 90. * CLHEP::deg,
611 0.5 * sectorSupportGeometry->getCorner3Thickness());
612 } catch (std::bad_alloc& ba) {
613 B2FATAL(MemErr);
614 }
615 t1 = HepGeom::Translate3D(-sectorSupportGeometry->getCorner3Prism().x(),
616 -sectorSupportGeometry->getCorner3Prism().y(), 0.);
617 try {
618 solidCorner3 = new G4SubtractionSolid("SectorSupport_Corner3",
619 solidCorner3Prism->getSolid(),
621 } catch (std::bad_alloc& ba) {
622 B2FATAL(MemErr);
623 }
624 delete solidCorner3Prism;
625 try {
627 new G4LogicalVolume(solidCorner3, m_Materials.duralumin, "Corner3");
628 } catch (std::bad_alloc& ba) {
629 B2FATAL(MemErr);
630 }
633}
double getCorner3Thickness() const
Get corner 3 thickness.
Definition: EKLMGeometry.h:472

◆ createSectorSupportCorner4()

void createSectorSupportCorner4 ( G4LogicalVolume *  sector) const
private

Create sector support corner 4.

Parameters
[in]sectorSector logical volume.

Definition at line 1606 of file GeoEKLMCreator.cc.

1608{
1609 HepGeom::Transform3D t;
1610 G4LogicalVolume* lv = m_LogVol.sectorsup.corn4;
1611 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
1613 t = HepGeom::Translate3D(sectorSupportGeometry->getCorner4Prism().x(),
1614 sectorSupportGeometry->getCorner4Prism().y(),
1615 sectorSupportGeometry->getCorner4Z());
1616 try {
1617 new G4PVPlacement(t, lv, lv->GetName() + "_" + sector->GetName(), sector,
1618 false, 1, false);
1619 } catch (std::bad_alloc& ba) {
1620 B2FATAL(MemErr);
1621 }
1622}
double getCorner4Z() const
Get corner 4 Z coordinate.
Definition: EKLMGeometry.h:557

◆ createSectorSupportCorner4LogicalVolume()

void createSectorSupportCorner4LogicalVolume ( )
private

Create sector support corner 4 logical volume.

Definition at line 635 of file GeoEKLMCreator.cc.

636{
637 G4TriangularPrism* solidCorner4Prism = nullptr;
638 G4SubtractionSolid* solidCorner4 = nullptr;
639 HepGeom::Transform3D t1;
640 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
642 try {
643 solidCorner4Prism =
644 new G4TriangularPrism("SectorSupport_Corner4_Prism",
645 sectorSupportGeometry->getCorner4LX(), 0.,
646 sectorSupportGeometry->getCorner4LY(),
647 90. * CLHEP::deg,
648 0.5 * sectorSupportGeometry->getCorner4Thickness());
649 } catch (std::bad_alloc& ba) {
650 B2FATAL(MemErr);
651 }
652 t1 = HepGeom::Translate3D(-sectorSupportGeometry->getCorner4Prism().x(),
653 -sectorSupportGeometry->getCorner4Prism().y(), 0.);
654 try {
655 solidCorner4 = new G4SubtractionSolid("SectorSupport_Corner4",
656 solidCorner4Prism->getSolid(),
658 } catch (std::bad_alloc& ba) {
659 B2FATAL(MemErr);
660 }
661 delete solidCorner4Prism;
662 try {
664 new G4LogicalVolume(solidCorner4, m_Materials.duralumin, "Corner4");
665 } catch (std::bad_alloc& ba) {
666 B2FATAL(MemErr);
667 }
670}
double getCorner4Thickness() const
Get corner 4 thickness.
Definition: EKLMGeometry.h:540

◆ createSectorSupportInnerTube()

G4Tubs * createSectorSupportInnerTube ( )
private

Create inner tube of sector support structure.

Definition at line 430 of file GeoEKLMCreator.cc.

431{
432 double ang1;
433 double ang2;
434 G4Tubs* res = nullptr;
435 const EKLMGeometry::ElementPosition* sectorSupportPos =
437 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
439 ang1 = atan2(sectorSupportGeometry->getCorner3().y(),
440 sectorSupportGeometry->getCorner3().x());
441 ang2 = atan2(sectorSupportGeometry->getCorner4().y(),
442 sectorSupportGeometry->getCorner4().x());
443 try {
444 res = new G4Tubs("SectorSupport_InnerTube", sectorSupportPos->getInnerR(),
445 sectorSupportPos->getInnerR() +
446 sectorSupportGeometry->getThickness(),
447 0.5 * sectorSupportPos->getLength(),
448 ang1 * CLHEP::rad, (ang2 - ang1) * CLHEP::rad);
449 } catch (std::bad_alloc& ba) {
450 B2FATAL(MemErr);
451 }
452 return res;
453}

◆ createSectorSupportLogicalVolume()

void createSectorSupportLogicalVolume ( )
private

Create sector support logical volume.

Definition at line 672 of file GeoEKLMCreator.cc.

673{
674 G4Box* solidBoxX;
675 G4Box* solidBoxY;
676 G4Box* solidBoxTop;
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;
686 const EKLMGeometry::ElementPosition* sectorSupportPos =
688 solidBoxX = createSectorSupportBoxX(tbx);
689 solidBoxY = createSectorSupportBoxY(tby);
690 solidBoxTop = createSectorSupportBoxTop(tbt);
693 try {
694 solidLimitationTube = new G4Tubs("SectorSupport_LimitationTube",
695 0., sectorSupportPos->getOuterR(),
696 0.5 * sectorSupportPos->getLength(),
697 0., 90.*CLHEP::deg);
698 } catch (std::bad_alloc& ba) {
699 B2FATAL(MemErr);
700 }
701 try {
702 us1 = new G4UnionSolid("SectorSupport_Union1",
703 m_Solids.sectorsup.itube, solidBoxY, tby);
704 } catch (std::bad_alloc& ba) {
705 B2FATAL(MemErr);
706 }
707 try {
708 us2 = new G4UnionSolid("SectorSupport_Union2",
709 us1, solidBoxX, tbx);
710 } catch (std::bad_alloc& ba) {
711 B2FATAL(MemErr);
712 }
713 try {
714 us3 = new G4UnionSolid("SectorSupport_Union3", us2,
716 HepGeom::Translate3D(0., 0., 0.));
717 } catch (std::bad_alloc& ba) {
718 B2FATAL(MemErr);
719 }
720 try {
721 us4 = new G4UnionSolid("SectorSupport_Union4",
722 us3, solidBoxTop, tbt);
723 } catch (std::bad_alloc& ba) {
724 B2FATAL(MemErr);
725 }
726 try {
727 solidSectorSupport =
728 new G4IntersectionSolid("SectorSupport", us4, solidLimitationTube,
729 HepGeom::Translate3D(0., 0., 0.));
730 } catch (std::bad_alloc& ba) {
731 B2FATAL(MemErr);
732 }
733 try {
735 new G4LogicalVolume(solidSectorSupport, m_Materials.duralumin, "Support");
736 } catch (std::bad_alloc& ba) {
737 B2FATAL(MemErr);
738 }
741}
G4Box * createSectorSupportBoxY(G4Transform3D &t)
Create Y side of sector support structure.
G4Tubs * createSectorSupportOuterTube()
Create outer tube of sector support structure.
G4Box * createSectorSupportBoxTop(G4Transform3D &t)
Create box in the cutted corner of sector support structure.
G4Box * createSectorSupportBoxX(G4Transform3D &t)
Create X side of sector support structure.
G4Tubs * createSectorSupportInnerTube()
Create inner tube of sector support structure.

◆ createSectorSupportOuterTube()

G4Tubs * createSectorSupportOuterTube ( )
private

Create outer tube of sector support structure.

Definition at line 455 of file GeoEKLMCreator.cc.

456{
457 double x;
458 double ang1;
459 double ang2;
460 double r;
461 G4Tubs* res = nullptr;
462 const EKLMGeometry::ElementPosition* sectorSupportPos =
464 const EKLMGeometry::SectorSupportGeometry* sectorSupportGeometry =
466 r = sectorSupportPos->getOuterR() - sectorSupportGeometry->getThickness();
467 x = sqrt(r * r - sectorSupportPos->getY() * sectorSupportPos->getY());
468 ang1 = atan2(sectorSupportPos->getY(), x);
469 ang2 = atan2(sectorSupportGeometry->getCorner1B().y(),
470 sectorSupportGeometry->getCorner1B().x());
471 try {
472 res = new G4Tubs("SectorSupport_OuterTube", r,
473 sectorSupportPos->getOuterR(),
474 0.5 * sectorSupportPos->getLength(),
475 ang1 * CLHEP::rad, (ang2 - ang1) * CLHEP::rad);
476 } catch (std::bad_alloc& ba) {
477 B2FATAL(MemErr);
478 }
479 return res;
480}

◆ createSegment()

void createSegment ( G4LogicalVolume *  plane) const
private

Create segment (strips + plastic sheets).

Parameters
[in]planePlane logical volume.

Definition at line 1726 of file GeoEKLMCreator.cc.

1727{
1728 HepGeom::Transform3D t;
1729 std::string segmentName =
1730 "Segment_" + std::to_string(m_CurVol.segment) + "_" + plane->GetName();
1735 m_CurVol.segment));
1736 try {
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) {
1740 B2FATAL(MemErr);
1741 }
1742}
const HepGeom::Transform3D * getPlaneDisplacement(int section, int layer, int sector, int plane) const
Get additional displacement for plane internal volumes.
const HepGeom::Transform3D * getSegmentTransform(int section, int layer, int sector, int plane, int segment) const
Get segment transformation.

◆ createSegmentLogicalVolume()

void createSegmentLogicalVolume ( int  iSegment)
private

Create segment logical volume (strips + plastic sheets).

Parameters
[in]iSegmentNumber of segment (0-based).

Definition at line 1110 of file GeoEKLMCreator.cc.

1111{
1112 double z;
1113 char name[128];
1114 G4UnionSolid* u1, *u2;
1115 HepGeom::Transform3D t;
1116 const EKLMGeometry::PlasticSheetGeometry* plasticSheetGeometry =
1118 const EKLMGeometry::StripGeometry* stripGeometry =
1120 z = 0.5 * (stripGeometry->getThickness() + plasticSheetGeometry->getWidth());
1121 snprintf(name, 128, "Segment_%d_Union_1", iSegment + 1);
1122 t = HepGeom::Translate3D(0, 0, -z);
1123 try {
1124 u1 = new G4UnionSolid(name, m_Solids.stripSegment[iSegment],
1125 m_Solids.psheet[iSegment], t);
1126 } catch (std::bad_alloc& ba) {
1127 B2FATAL(MemErr);
1128 }
1129 snprintf(name, 128, "Segment_%d", iSegment + 1);
1130 t = HepGeom::Translate3D(0, 0, z);
1131 try {
1132 u2 = new G4UnionSolid(name, u1, m_Solids.psheet[iSegment], t);
1133 } catch (std::bad_alloc& ba) {
1134 B2FATAL(MemErr);
1135 }
1136 try {
1137 m_LogVol.segment[iSegment] =
1138 new G4LogicalVolume(u2, m_Materials.air, name);
1139 } catch (std::bad_alloc& ba) {
1140 B2FATAL(MemErr);
1141 }
1142 geometry::setVisibility(*m_LogVol.segment[iSegment], false);
1143 geometry::setColor(*m_LogVol.segment[iSegment], "#00ff00ff");
1144}
G4VSolid ** stripSegment
Strip segment.

◆ createSegmentSupport()

void createSegmentSupport ( int  iSegmentSupport,
G4LogicalVolume *  plane 
) const
private

Create segment support.

Parameters
[in]iSegmentSupportNumber of segment support.
[in]planePlane logical volume.

Definition at line 1665 of file GeoEKLMCreator.cc.

1667{
1668 HepGeom::Transform3D t;
1669 G4LogicalVolume* lv =
1670 m_LogVol.segmentsup[m_CurVol.plane - 1][iSegmentSupport - 1];
1671 const EKLMGeometry::SegmentSupportPosition* segmentSupportPos =
1675 HepGeom::Translate3D(
1676 0.5 * (segmentSupportPos->getDeltaLLeft() -
1677 segmentSupportPos->getDeltaLRight()) +
1678 segmentSupportPos->getX(), segmentSupportPos->getY(),
1679 segmentSupportPos->getZ()) *
1680 HepGeom::RotateX3D(180.0 * CLHEP::deg);
1681 try {
1682 new G4PVPlacement(t, lv, lv->GetName() + "_" + plane->GetName(), plane,
1683 false, 1, false);
1684 } catch (std::bad_alloc& ba) {
1685 B2FATAL(MemErr);
1686 }
1687}
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.
const SegmentSupportPosition * getSegmentSupportPosition(int plane, int support) const
Get position data for segment support structure.

◆ createSegmentSupportLogicalVolume()

void createSegmentSupportLogicalVolume ( int  iPlane,
int  iSegmentSupport 
)
private

Create segment support logical volume.

Parameters
[in]iPlaneNumber of plane.
[in]iSegmentSupportNumber of segment support.

Definition at line 874 of file GeoEKLMCreator.cc.

876{
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);
886 const EKLMGeometry::SegmentSupportPosition* segmentSupportPos =
887 m_GeoDat->getSegmentSupportPosition(iPlane, iSegmentSupport);
888 const EKLMGeometry::SegmentSupportGeometry* segmentSupportGeometry =
890 try {
891 topBox = new G4Box("BoxTop_" + segmentSupportName,
892 0.5 * (segmentSupportPos->getLength() -
893 segmentSupportPos->getDeltaLLeft() -
894 segmentSupportPos->getDeltaLRight()),
895 0.5 * segmentSupportGeometry->getTopWidth(),
896 0.5 * segmentSupportGeometry->getTopThickness());
897 } catch (std::bad_alloc& ba) {
898 B2FATAL(MemErr);
899 }
900 try {
901 midBox = new G4Box("BoxMiddle_" + segmentSupportName,
902 0.5 * (segmentSupportPos->getLength() -
903 segmentSupportPos->getDeltaLLeft() -
904 segmentSupportPos->getDeltaLRight()),
905 0.5 * segmentSupportGeometry->getMiddleWidth(),
906 0.5 * segmentSupportGeometry->getMiddleThickness());
907 } catch (std::bad_alloc& ba) {
908 B2FATAL(MemErr);
909 }
910 try {
911 botBox = new G4Box("BoxBottom_" + segmentSupportName,
912 0.5 * segmentSupportPos->getLength(),
913 0.5 * segmentSupportGeometry->getTopWidth(),
914 0.5 * segmentSupportGeometry->getTopThickness());
915 } catch (std::bad_alloc& ba) {
916 B2FATAL(MemErr);
917 }
918 t1 = HepGeom::Translate3D(
919 0., 0., 0.5 * (segmentSupportGeometry->getMiddleThickness() +
920 segmentSupportGeometry->getTopThickness()));
921 t2 = HepGeom::Translate3D(
922 0.5 * (segmentSupportPos->getDeltaLRight() -
923 segmentSupportPos->getDeltaLLeft()), 0.,
924 -0.5 * (segmentSupportGeometry->getMiddleThickness() +
925 segmentSupportGeometry->getTopThickness()));
926 try {
927 us = new G4UnionSolid("Union1_" + segmentSupportName, midBox, topBox, t1);
928 } catch (std::bad_alloc& ba) {
929 B2FATAL(MemErr);
930 }
931 try {
932 solidSegmentSupport = new G4UnionSolid(segmentSupportName, us, botBox, t2);
933 } catch (std::bad_alloc& ba) {
934 B2FATAL(MemErr);
935 }
936 try {
937 m_LogVol.segmentsup[iPlane - 1][iSegmentSupport - 1] =
938 new G4LogicalVolume(solidSegmentSupport, m_Materials.duralumin,
939 segmentSupportName);
940 } catch (std::bad_alloc& ba) {
941 B2FATAL(MemErr);
942 }
943 geometry::setVisibility(*m_LogVol.segmentsup[iPlane - 1][iSegmentSupport - 1],
944 true);
945 geometry::setColor(*m_LogVol.segmentsup[iPlane - 1][iSegmentSupport - 1],
946 "#ff0000ff");
947}
Segment support geometry data.
Definition: EKLMGeometry.h:939
double getMiddleWidth() const
Get middle part width.
Definition: EKLMGeometry.h:985
double getTopThickness() const
Get top part thickness.
Definition: EKLMGeometry.h:968
double getTopWidth() const
Get top part width.
Definition: EKLMGeometry.h:951
double getMiddleThickness() const
Get middle part thickness.
const SegmentSupportGeometry * getSegmentSupportGeometry() const
Get segment support geometry data.

◆ createShield()

void createShield ( G4LogicalVolume *  sector) const
private

Create shield.

Parameters
[in]sectorSector logical volume.

Definition at line 1794 of file GeoEKLMCreator.cc.

1795{
1796 HepGeom::Transform3D ta, tb, tc, td, te;
1797 G4LogicalVolume* lv;
1798 double lx, ly;
1799 const double asqrt2 = 1.0 / sqrt(2.0);
1800 const EKLMGeometry::ShieldGeometry* shieldGeometry =
1802 lx = shieldGeometry->getDetailB()->getLengthX() / 2;
1803 ly = shieldGeometry->getDetailB()->getLengthY() / 2;
1804 ta = HepGeom::Translate3D(shieldGeometry->getDetailACenter()->getX(),
1805 shieldGeometry->getDetailACenter()->getY(), 0) *
1806 HepGeom::RotateZ3D(-45.0 * CLHEP::deg);
1807 tb = HepGeom::Translate3D(shieldGeometry->getDetailBCenter()->getX(),
1808 shieldGeometry->getDetailBCenter()->getY(), 0) *
1809 HepGeom::RotateZ3D(-45.0 * CLHEP::deg);
1810 tc = HepGeom::Translate3D(shieldGeometry->getDetailCCenter()->getX(),
1811 shieldGeometry->getDetailCCenter()->getY(), 0) *
1812 HepGeom::RotateZ3D(-45.0 * CLHEP::deg) *
1813 HepGeom::RotateY3D(180.0 * CLHEP::deg);
1814 td = HepGeom::Translate3D(
1815 shieldGeometry->getDetailBCenter()->getX() + asqrt2 * (-lx - ly),
1816 shieldGeometry->getDetailBCenter()->getY() + asqrt2 * (lx - ly), 0) *
1817 HepGeom::RotateZ3D(-45.0 * CLHEP::deg) *
1818 HepGeom::RotateX3D(180.0 * CLHEP::deg);
1819 te = HepGeom::Translate3D(
1820 shieldGeometry->getDetailBCenter()->getX() + asqrt2 * (lx - ly),
1821 shieldGeometry->getDetailBCenter()->getY() + asqrt2 * (-lx - ly), 0) *
1822 HepGeom::RotateZ3D(135.0 * CLHEP::deg);
1823 lv = m_LogVol.shield.detailA;
1824 try {
1825 new G4PVPlacement(ta, lv, lv->GetName(), sector, false, 1, false);
1826 } catch (std::bad_alloc& ba) {
1827 B2FATAL(MemErr);
1828 }
1829 lv = m_LogVol.shield.detailB;
1830 try {
1831 new G4PVPlacement(tb, lv, lv->GetName(), sector, false, 1, false);
1832 } catch (std::bad_alloc& ba) {
1833 B2FATAL(MemErr);
1834 }
1835 lv = m_LogVol.shield.detailC;
1836 try {
1837 new G4PVPlacement(tc, lv, lv->GetName(), sector, false, 1, false);
1838 } catch (std::bad_alloc& ba) {
1839 B2FATAL(MemErr);
1840 }
1841 lv = m_LogVol.shield.detailD;
1842 try {
1843 new G4PVPlacement(td, lv, lv->GetName(), sector, false, 1, false);
1844 } catch (std::bad_alloc& ba) {
1845 B2FATAL(MemErr);
1846 }
1847 try {
1848 new G4PVPlacement(te, lv, "ShieldDetailE", sector, false, 1, false);
1849 } catch (std::bad_alloc& ba) {
1850 B2FATAL(MemErr);
1851 }
1852}
double getX() const
Get X coordinate.
double getY() const
Get Y coordinate.
double getLengthY() const
Get Y length.
double getLengthX() const
Get X length.
Shield layer geometry data.
const ShieldDetailGeometry * getDetailB() const
Get detail B geometry.
const Point * getDetailCCenter() const
Get detail C center.
const Point * getDetailACenter() const
Get detail A center.
const Point * getDetailBCenter() const
Get detail B center.
const ShieldGeometry * getShieldGeometry() const
Get shield layer details geometry data.
struct ShieldLogicalVolumes shield
Shield.
G4LogicalVolume * detailC
Detail C.
G4LogicalVolume * detailD
Detail D.
G4LogicalVolume * detailA
Detail A.
G4LogicalVolume * detailB
Detail B.

◆ createShieldDetailALogicalVolume()

void createShieldDetailALogicalVolume ( )
private

Create shield detail A logical volume.

Definition at line 1245 of file GeoEKLMCreator.cc.

1246{
1247 G4Box* box = nullptr;
1248 G4SubtractionSolid* ss1, *ss2, *ss3, *solidDetailA;
1249 double lx, ly;
1250 const EKLMGeometry::ShieldGeometry* shieldGeometry =
1252 const EKLMGeometry::ShieldDetailGeometry* detailA =
1253 shieldGeometry->getDetailA();
1254 HepGeom::Transform3D t = HepGeom::Translate3D(0, 0, 0);
1255 lx = detailA->getLengthX() / 2;
1256 ly = detailA->getLengthY() / 2;
1257 try {
1258 box = new G4Box("ShieldDetailA_Box", lx, ly,
1259 shieldGeometry->getThickness() / 2);
1260 } catch (std::bad_alloc& ba) {
1261 B2FATAL(MemErr);
1262 }
1263 ss1 = cutSolidCorner("ShieldDetailA_Subtraction_1", box,
1264 m_Solids.subtractionBox, t, false,
1265 detailA->getPoint(0)->getX() - lx,
1266 detailA->getPoint(0)->getY() - ly,
1267 detailA->getPoint(1)->getX() - lx,
1268 detailA->getPoint(1)->getY() - ly);
1269 ss2 = cutSolidCorner("ShieldDetailA_Subtraction_2", ss1,
1270 m_Solids.subtractionBox, t, true,
1271 detailA->getPoint(3)->getX() - lx,
1272 detailA->getPoint(3)->getY() - ly,
1273 detailA->getPoint(2)->getX() - lx,
1274 detailA->getPoint(2)->getY() - ly);
1275 ss3 = cutSolidCorner("ShieldDetailA_Subtraction_3", ss2,
1276 m_Solids.subtractionBox, t, false,
1277 detailA->getPoint(3)->getX() - lx,
1278 detailA->getPoint(3)->getY() - ly,
1279 detailA->getPoint(4)->getX() - lx,
1280 detailA->getPoint(4)->getY() - ly);
1281 solidDetailA = cutSolidCorner("ShieldDetailA", ss3,
1282 m_Solids.subtractionBox, t, false,
1283 detailA->getPoint(5)->getX() - lx,
1284 detailA->getPoint(5)->getY() - ly,
1285 detailA->getPoint(6)->getX() - lx,
1286 detailA->getPoint(6)->getY() - ly);
1287 try {
1289 new G4LogicalVolume(solidDetailA, m_Materials.polyethylene,
1290 "ShieldDetailA");
1291 } catch (std::bad_alloc& ba) {
1292 B2FATAL(MemErr);
1293 }
1296}
Shield layer detail geometry data.
const Point * getPoint(int i) const
Get point.
const ShieldDetailGeometry * getDetailA() const
Get detail A geometry.
double getThickness() const
Get thickness.

◆ createShieldDetailBLogicalVolume()

void createShieldDetailBLogicalVolume ( )
private

Create shield detail B logical volume.

Definition at line 1298 of file GeoEKLMCreator.cc.

1299{
1300 G4Box* box = nullptr;
1301 G4SubtractionSolid* ss1, *solidDetailB;
1302 double lx, ly;
1303 const EKLMGeometry::ShieldGeometry* shieldGeometry =
1305 const EKLMGeometry::ShieldDetailGeometry* detailB =
1306 shieldGeometry->getDetailB();
1307 HepGeom::Transform3D t = HepGeom::Translate3D(0, 0, 0);
1308 lx = detailB->getLengthX() / 2;
1309 ly = detailB->getLengthY() / 2;
1310 try {
1311 box = new G4Box("ShieldDetailB_Box", lx, ly,
1312 shieldGeometry->getThickness() / 2);
1313 } catch (std::bad_alloc& ba) {
1314 B2FATAL(MemErr);
1315 }
1316 ss1 = cutSolidCorner("ShieldDetailB_Subtraction_1", box,
1317 m_Solids.subtractionBox, t, false,
1318 detailB->getPoint(0)->getX() - lx,
1319 detailB->getPoint(0)->getY() - ly,
1320 detailB->getPoint(1)->getX() - lx,
1321 detailB->getPoint(1)->getY() - ly);
1322 solidDetailB = cutSolidCorner("ShieldDetailB", ss1,
1323 m_Solids.subtractionBox, t, false,
1324 detailB->getPoint(2)->getX() - lx,
1325 detailB->getPoint(2)->getY() - ly,
1326 detailB->getPoint(3)->getX() - lx,
1327 detailB->getPoint(3)->getY() - ly);
1328 try {
1330 new G4LogicalVolume(solidDetailB, m_Materials.polyethylene,
1331 "ShieldDetailB");
1332 } catch (std::bad_alloc& ba) {
1333 B2FATAL(MemErr);
1334 }
1337}

◆ createShieldDetailCLogicalVolume()

void createShieldDetailCLogicalVolume ( )
private

Create shield detail C logical volume.

Definition at line 1339 of file GeoEKLMCreator.cc.

1340{
1341 G4Box* box = nullptr;
1342 G4SubtractionSolid* ss1, *ss2, *ss3, *solidDetailC;
1343 double lx, ly;
1344 const EKLMGeometry::ShieldGeometry* shieldGeometry =
1346 const EKLMGeometry::ShieldDetailGeometry* detailC =
1347 shieldGeometry->getDetailC();
1348 HepGeom::Transform3D t = HepGeom::Translate3D(0, 0, 0);
1349 lx = detailC->getLengthX() / 2;
1350 ly = detailC->getLengthY() / 2;
1351 try {
1352 box = new G4Box("ShieldDetailC_Box", lx, ly,
1353 shieldGeometry->getThickness() / 2);
1354 } catch (std::bad_alloc& ba) {
1355 B2FATAL(MemErr);
1356 }
1357 ss1 = cutSolidCorner("ShieldDetailC_Subtraction_1", box,
1358 m_Solids.subtractionBox, t, false,
1359 detailC->getPoint(0)->getX() - lx,
1360 detailC->getPoint(0)->getY() - ly,
1361 detailC->getPoint(1)->getX() - lx,
1362 detailC->getPoint(1)->getY() - ly);
1363 ss2 = cutSolidCorner("ShieldDetailC_Subtraction_2", ss1,
1364 m_Solids.subtractionBox, t, true,
1365 detailC->getPoint(3)->getX() - lx,
1366 detailC->getPoint(3)->getY() - ly,
1367 detailC->getPoint(2)->getX() - lx,
1368 detailC->getPoint(2)->getY() - ly);
1369 ss3 = cutSolidCorner("ShieldDetailC_Subtraction_3", ss2,
1370 m_Solids.subtractionBox, t, false,
1371 detailC->getPoint(3)->getX() - lx,
1372 detailC->getPoint(3)->getY() - ly,
1373 detailC->getPoint(4)->getX() - lx,
1374 detailC->getPoint(4)->getY() - ly);
1375 solidDetailC = cutSolidCorner("ShieldDetailC", ss3,
1376 m_Solids.subtractionBox, t, false,
1377 detailC->getPoint(5)->getX() - lx,
1378 detailC->getPoint(5)->getY() - ly,
1379 detailC->getPoint(6)->getX() - lx,
1380 detailC->getPoint(6)->getY() - ly);
1381 try {
1383 new G4LogicalVolume(solidDetailC, m_Materials.polyethylene,
1384 "ShieldDetailC");
1385 } catch (std::bad_alloc& ba) {
1386 B2FATAL(MemErr);
1387 }
1390}
const ShieldDetailGeometry * getDetailC() const
Get detail C geometry.

◆ createShieldDetailDLogicalVolume()

void createShieldDetailDLogicalVolume ( )
private

Create shield detail D logical volume.

Definition at line 1392 of file GeoEKLMCreator.cc.

1393{
1394 G4TriangularPrism* solidDetailDPrism;
1395 const EKLMGeometry::ShieldGeometry* shieldGeometry =
1397 const EKLMGeometry::ShieldDetailGeometry* detailD =
1398 shieldGeometry->getDetailD();
1399 try {
1400 solidDetailDPrism =
1401 new G4TriangularPrism("ShieldDetailD_Prism",
1402 detailD->getLengthX(), 0.,
1403 detailD->getLengthY(), 90. * CLHEP::deg,
1404 shieldGeometry->getThickness() / 2);
1405 } catch (std::bad_alloc& ba) {
1406 B2FATAL(MemErr);
1407 }
1408 try {
1410 new G4LogicalVolume(solidDetailDPrism->getSolid(),
1411 m_Materials.polyethylene, "ShieldDetailD");
1412 } catch (std::bad_alloc& ba) {
1413 B2FATAL(MemErr);
1414 }
1417 delete solidDetailDPrism;
1418}
const ShieldDetailGeometry * getDetailD() const
Get detail D geometry.

◆ createSolids()

void createSolids ( )
private

Create solids (or logical volumes which must be created only once).

createSectorSupportCornerXSolid() must be called after createSectorSupportSolid()

Definition at line 1420 of file GeoEKLMCreator.cc.

1421{
1422 int i, j, n;
1423 HepGeom::Transform3D t;
1424 /* Section, layer, sector. */
1438 /* Plane. */
1440 for (i = 0; i < m_GeoDat->getNPlanes(); i++) {
1442 /* Segment support. */
1443 for (j = 1; j <= m_GeoDat->getNSegments() + 1; j++)
1445 }
1446 /* Strips. */
1448 for (i = 0; i < n; i++) {
1452 }
1453 /* Plastic sheet elements. */
1454 for (i = 0; i < m_GeoDat->getNSegments(); i++)
1456 /* Strip segments. */
1457 for (i = 0; i < m_GeoDat->getNSegments(); i++)
1459 /* Segments. */
1460 for (i = 0; i < m_GeoDat->getNSegments(); i++)
1462 /* Shield layer details. */
1467}
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 createShieldDetailBLogicalVolume()
Create shield detail B logical volume.
void createSectorSupportCorner1LogicalVolume()
Create sector support corner 1 logical volume.
void createPlaneSolid(int n)
Create plane solid.
void createSectorSupportCorner2LogicalVolume()
Create sector support corner 2 logical volume.
void createSubtractionBoxSolid()
Create subtraction box solid.
void createScintillatorLogicalVolume(int iStrip)
Create scintillator logical volume.
void createSegmentSupportLogicalVolume(int iPlane, int iSegmentSupport)
Create segment support logical volume.
void createSectorSupportCorner4LogicalVolume()
Create sector support corner 4 logical volume.
void createSegmentLogicalVolume(int iSegment)
Create segment logical volume (strips + plastic sheets).
void createPlasticSheetLogicalVolume(int iSegment)
Create plastic sheet logical volume.
void createSectorSupportLogicalVolume()
Create sector support logical volume.
void createLayerSolid()
Create layer solid.
void createSectorCoverLogicalVolume()
Create sector cover solid.
void createStripGrooveLogicalVolume(int iStrip)
Create strip groove logical volume.
void createSectorSupportCorner3LogicalVolume()
Create sector support corner 3 logical volume.
void createSectionSolid()
Create section solid.
void createSectorSolid()
Create sector solid.
void createStripLogicalVolume(int iStrip)
Create strip logical volume.
void createStripSegmentLogicalVolume(int iSegment)
Create strip segment logical volume.

◆ createStrip()

void createStrip ( G4LogicalVolume *  segment) const
private

Create strip.

Parameters
[in]segmentSegment logical volume.

Definition at line 1744 of file GeoEKLMCreator.cc.

1745{
1746 int n;
1747 HepGeom::Transform3D t, t2;
1748 G4LogicalVolume* lv;
1751 t2 = t * HepGeom::RotateX3D(180.0 * CLHEP::deg);
1752 lv = m_LogVol.strip[n];
1753 try {
1754 new G4PVPlacement(t2, lv, lv->GetName(), segment, false, m_CurVol.strip,
1755 false);
1756 } catch (std::bad_alloc& ba) {
1757 B2FATAL(MemErr);
1758 }
1759}
void getStripTransform(HepGeom::Transform3D *t, int n) const
Get strip transformation.
int getStripLengthIndex(int positionIndex) const
Get index in length-based array.
Definition: GeometryData.h:97

◆ createStripGroove()

void createStripGroove ( int  iStrip) const
private

Create strip groove.

Parameters
[in]iStripNumber of strip in the length-based array.

Definition at line 1761 of file GeoEKLMCreator.cc.

1762{
1763 HepGeom::Transform3D t;
1764 G4LogicalVolume* lv;
1765 G4LogicalVolume* lvm;
1766 const EKLMGeometry::StripGeometry* stripGeometry =
1768 t = HepGeom::Translate3D(0., 0., 0.5 * (stripGeometry->getThickness() -
1769 stripGeometry->getGrooveDepth()));
1770 lvm = m_LogVol.strip[iStrip];
1771 lv = m_LogVol.groove[iStrip];
1772 try {
1773 new G4PVPlacement(t, lv, lv->GetName(), lvm, false, 1, false);
1774 } catch (std::bad_alloc& ba) {
1775 B2FATAL(MemErr);
1776 }
1777}

◆ createStripGrooveLogicalVolume()

void createStripGrooveLogicalVolume ( int  iStrip)
private

Create strip groove logical volume.

Parameters
[in]iStripNumber of strip in length-based array.

Definition at line 1174 of file GeoEKLMCreator.cc.

1175{
1176 int iPos;
1177 char name[128];
1178 const EKLMGeometry::ElementPosition* stripPos;
1179 const EKLMGeometry::StripGeometry* stripGeometry =
1181 iPos = m_GeoDat->getStripPositionIndex(iStrip);
1182 stripPos = m_GeoDat->getStripPosition(iPos + 1);
1183 snprintf(name, 128, "Groove_%d", iStrip + 1);
1184 try {
1185 m_Solids.groove[iStrip] = new G4Box(name, 0.5 * stripPos->getLength(),
1186 0.5 * stripGeometry->getGrooveWidth(),
1187 0.5 * stripGeometry->getGrooveDepth());
1188 } catch (std::bad_alloc& ba) {
1189 B2FATAL(MemErr);
1190 }
1191 try {
1192 m_LogVol.groove[iStrip] =
1193 new G4LogicalVolume(m_Solids.groove[iStrip], m_Materials.gel, name);
1194 } catch (std::bad_alloc& ba) {
1195 B2FATAL(MemErr);
1196 }
1197 geometry::setVisibility(*m_LogVol.groove[iStrip], true);
1198 geometry::setColor(*m_LogVol.groove[iStrip], "#00ff00ff");
1199}
double getGrooveWidth() const
Get groove width.

◆ createStripLogicalVolume()

void createStripLogicalVolume ( int  iStrip)
private

Create strip logical volume.

Parameters
[in]iStripNumber of strip in length-based array.

Definition at line 1146 of file GeoEKLMCreator.cc.

1147{
1148 int iPos;
1149 char name[128];
1150 const EKLMGeometry::ElementPosition* stripPos;
1151 const EKLMGeometry::StripGeometry* stripGeometry =
1153 iPos = m_GeoDat->getStripPositionIndex(iStrip);
1154 stripPos = m_GeoDat->getStripPosition(iPos + 1);
1155 snprintf(name, 128, "Strip_%d", iStrip + 1);
1156 try {
1157 m_Solids.strip[iStrip] = new G4Box(name, 0.5 * stripPos->getLength(),
1158 0.5 * stripGeometry->getWidth(),
1159 0.5 * stripGeometry->getThickness());
1160 } catch (std::bad_alloc& ba) {
1161 B2FATAL(MemErr);
1162 }
1163 try {
1164 m_LogVol.strip[iStrip] =
1165 new G4LogicalVolume(m_Solids.strip[iStrip], m_Materials.polystyrene,
1166 name);
1167 } catch (std::bad_alloc& ba) {
1168 B2FATAL(MemErr);
1169 }
1170 geometry::setVisibility(*m_LogVol.strip[iStrip], true);
1171 geometry::setColor(*m_LogVol.strip[iStrip], "#ffffffff");
1172}
G4VSolid ** strip
Strips.

◆ createStripSegment()

void createStripSegment ( int  iSegment) const
private

Create strip segment.

Parameters
[in]iSegmentNumber of segment.

Definition at line 1713 of file GeoEKLMCreator.cc.

1714{
1715 HepGeom::Transform3D t;
1716 std::string segmentName = "StripSegment_" + std::to_string(iSegment);
1717 t = HepGeom::Translate3D(0, 0, 0);
1718 try {
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) {
1722 B2FATAL(MemErr);
1723 }
1724}

◆ createStripSegmentLogicalVolume()

void createStripSegmentLogicalVolume ( int  iSegment)
private

Create strip segment logical volume.

Parameters
[in]iSegmentNumber of segment (0-based).

Definition at line 1080 of file GeoEKLMCreator.cc.

1081{
1082 /* cppcheck-suppress variableScope */
1083 int i, m, nStrip;
1084 char name[128];
1085 G4VSolid** strips;
1086 HepGeom::Transform3D* t;
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)];
1094 }
1095 snprintf(name, 128, "StripSegment_%d", iSegment + 1);
1096 m_Solids.stripSegment[iSegment] = unifySolids(strips, t, nStrip, name);
1097 try {
1098 m_LogVol.stripSegment[iSegment] =
1099 new G4LogicalVolume(m_Solids.stripSegment[iSegment], m_Materials.air,
1100 name);
1101 } catch (std::bad_alloc& ba) {
1102 B2FATAL(MemErr);
1103 }
1105 geometry::setColor(*m_LogVol.stripSegment[iSegment], "#00ff00ff");
1106 delete[] strips;
1107 delete[] t;
1108}

◆ createSubtractionBoxSolid()

void createSubtractionBoxSolid ( )
private

Create subtraction box solid.

Definition at line 743 of file GeoEKLMCreator.cc.

744{
746 const EKLMGeometry::ElementPosition* sectorSupportPos =
748 try {
750 new G4Box("SubractionBox", 0.5 * sectorSupportPos->getOuterR(),
751 0.5 * sectorSupportPos->getOuterR(), layerPos->getLength());
752 } catch (std::bad_alloc& ba) {
753 B2FATAL(MemErr);
754 }
755}

◆ cutSolidCorner() [1/2]

G4SubtractionSolid * cutSolidCorner ( const char *  name,
G4VSolid *  solid,
G4Box *  subtractionBox,
const HepGeom::Transform3D &  transf,
bool  largerAngles,
double  x,
double  y,
double  ang 
)
private

Cut corner of a solid.

Parameters
[in]nameName of resulting solid.
[in]solidSolid.
[in]subtractionBoxBox used for subtractions.
[in]transfAdditional transformation of subtraction box.
[in]largerAnglesIf true then cut larger angles.
[in]xInitial point x coordinate.
[in]yInitial point y coordinate.
[in]angAngle.

Definition at line 768 of file GeoEKLMCreator.cc.

772{
773 double lx, ly;
774 HepGeom::Transform3D t;
775 G4SubtractionSolid* ss = nullptr;
776 lx = subtractionBox->GetXHalfLength();
777 ly = subtractionBox->GetYHalfLength();
778 if (largerAngles)
779 t = HepGeom::Translate3D(x + lx * cos(ang) - ly * sin(ang),
780 y + lx * sin(ang) + ly * cos(ang), 0) *
781 HepGeom::RotateZ3D(ang);
782 else
783 t = HepGeom::Translate3D(x + lx * cos(ang) + ly * sin(ang),
784 y + lx * sin(ang) - ly * cos(ang), 0) *
785 HepGeom::RotateZ3D(ang);
786 try {
787 ss = new G4SubtractionSolid(name, solid, subtractionBox, transf * t);
788 } catch (std::bad_alloc& ba) {
789 B2FATAL(MemErr);
790 }
791 return ss;
792}

◆ cutSolidCorner() [2/2]

G4SubtractionSolid * cutSolidCorner ( const char *  name,
G4VSolid *  solid,
G4Box *  subtractionBox,
const HepGeom::Transform3D &  transf,
bool  largerAngles,
double  x1,
double  y1,
double  x2,
double  y2 
)
private

Cut corner of a solid.

Parameters
[in]nameName of resulting solid.
[in]solidSolid.
[in]subtractionBoxBox used for subtractions.
[in]transfAdditional transformation of subtraction box.
[in]largerAnglesIf true then cut larger angles.
[in]x1First point x coordinate.
[in]y1First point y coordinate.
[in]x2Second point x coordinate.
[in]y2Second point y coordinate.

Definition at line 757 of file GeoEKLMCreator.cc.

761{
762 double ang;
763 ang = atan2(y2 - y1, x2 - x1);
764 return cutSolidCorner(name, solid, subtractionBox, transf, largerAngles,
765 x1, y1, ang);
766}

◆ deleteSensitive()

void deleteSensitive ( )
private

Delete sensitive detectors.

Definition at line 169 of file GeoEKLMCreator.cc.

170{
171 delete m_Sensitive;
172}

◆ deleteVolumes()

void deleteVolumes ( )
private

Delete volumes.

Definition at line 149 of file GeoEKLMCreator.cc.

150{
151 int i;
152 free(m_Solids.plane);
154 free(m_Solids.psheet);
155 free(m_LogVol.psheet);
156 free(m_LogVol.segment);
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);
167}

◆ detectorLayer()

bool detectorLayer ( int  section,
int  layer 
) const
private

Check if a given layer is a detector layer.

Parameters
[in]sectionSection number.
[in]layerLayer number.
Returns
True if this layer is a detector layer.

Definition at line 1854 of file GeoEKLMCreator.cc.

1855{
1856 return ((section == 1 && layer <= m_GeoDat->getNDetectorLayers(1)) ||
1857 (section == 2 && layer <= m_GeoDat->getNDetectorLayers(2)));
1858}

◆ getSectorSupportCornerAngle()

double getSectorSupportCornerAngle ( )
private

Get cutted corner angle.

Returns
Angle.

◆ newSensitive()

void newSensitive ( )
private

Create new sensitive detectors.

Definition at line 139 of file GeoEKLMCreator.cc.

140{
141 try {
142 m_Sensitive = new KLM::SensitiveDetector("EKLMSensitiveStrip",
144 } catch (std::bad_alloc& ba) {
145 B2FATAL(MemErr);
146 }
147}
KLM sensitive-detector class.

◆ newVolumes()

void newVolumes ( )
private

Create new volumes.

Definition at line 74 of file GeoEKLMCreator.cc.

75{
76 int i, nDiff;
78 (G4VSolid**)malloc(m_GeoDat->getNPlanes() * sizeof(G4VSolid*));
79 if (m_Solids.plane == nullptr)
80 B2FATAL(MemErr);
82 (G4VSolid**)malloc(m_GeoDat->getNStrips() * sizeof(G4VSolid*));
83 if (m_Solids.plasticSheetElement == nullptr)
84 B2FATAL(MemErr);
86 (G4VSolid**)malloc(m_GeoDat->getNSegments() * sizeof(G4VSolid*));
87 if (m_Solids.psheet == nullptr)
88 B2FATAL(MemErr);
89 m_LogVol.psheet = (G4LogicalVolume**)
90 malloc(m_GeoDat->getNSegments() * sizeof(G4LogicalVolume*));
91 if (m_LogVol.psheet == nullptr)
92 B2FATAL(MemErr);
94 (G4LogicalVolume**)malloc(m_GeoDat->getNSegments() *
95 sizeof(G4LogicalVolume*));
96 if (m_LogVol.segment == nullptr)
97 B2FATAL(MemErr);
99 (G4VSolid**)malloc(m_GeoDat->getNSegments() * sizeof(G4VSolid*));
100 if (m_Solids.stripSegment == nullptr)
101 B2FATAL(MemErr);
103 (G4LogicalVolume**)malloc(m_GeoDat->getNSegments() *
104 sizeof(G4LogicalVolume*));
105 if (m_LogVol.stripSegment == nullptr)
106 B2FATAL(MemErr);
108 m_Solids.strip = (G4VSolid**)malloc(nDiff * sizeof(G4VSolid*));
109 if (m_Solids.strip == nullptr)
110 B2FATAL(MemErr);
111 m_LogVol.strip = (G4LogicalVolume**)malloc(nDiff * sizeof(G4LogicalVolume*));
112 if (m_LogVol.strip == nullptr)
113 B2FATAL(MemErr);
114 m_Solids.groove = (G4VSolid**)malloc(nDiff * sizeof(G4VSolid*));
115 if (m_Solids.groove == nullptr)
116 B2FATAL(MemErr);
117 m_LogVol.groove = (G4LogicalVolume**)malloc(nDiff * sizeof(G4LogicalVolume*));
118 if (m_LogVol.groove == nullptr)
119 B2FATAL(MemErr);
120 m_LogVol.scint = (G4LogicalVolume**)malloc(nDiff * sizeof(G4LogicalVolume*));
121 if (m_LogVol.scint == nullptr)
122 B2FATAL(MemErr);
124 (G4LogicalVolume***)malloc(m_GeoDat->getNPlanes() *
125 sizeof(G4LogicalVolume**));
126 if (m_LogVol.segmentsup == nullptr)
127 B2FATAL(MemErr);
128 for (i = 0; i < m_GeoDat->getNPlanes(); i++) {
130 (G4LogicalVolume**)malloc((m_GeoDat->getNSegments() + 1) *
131 sizeof(G4LogicalVolume*));
132 if (m_LogVol.segmentsup[i] == nullptr)
133 B2FATAL(MemErr);
134 }
135 for (i = 0; i < m_GeoDat->getNSegments(); i++)
136 m_LogVol.psheet[i] = nullptr;
137}
int getNStrips() const
Get number of strips.

◆ unifySolids()

G4VSolid * unifySolids ( G4VSolid **  solids,
HepGeom::Transform3D *  transf,
int  nSolids,
const std::string &  name 
)
private

Unify a group of solids.

Parameters
[in]solidsSolids.
[in]transfTransformations.
[in]nSolidsNumber of solids.
[in]nameFirst part of solid names.

Definition at line 949 of file GeoEKLMCreator.cc.

952{
953 G4UnionSolid** u;
954 G4DisplacedSolid* d;
955 G4VSolid** solidArray;
956 HepGeom::Transform3D* inverseTransf;
957 HepGeom::Transform3D t;
958 char str[128];
959 /* cppcheck-suppress variableScope */
960 int n, nUnions, i, i1, i2, k, k1, k2, l, dl;
961 if (nSolids <= 1)
962 B2FATAL("Number of solids to be unified must be greater than 1.");
963 try {
964 inverseTransf = new HepGeom::Transform3D[nSolids];
965 } catch (std::bad_alloc& ba) {
966 B2FATAL(MemErr);
967 }
968 for (i = 0; i < nSolids; i++)
969 inverseTransf[i] = transf[i].inverse();
970 n = nSolids;
971 nUnions = 0;
972 while (n > 1) {
973 if (n % 2 == 0)
974 n = n / 2;
975 else
976 n = n / 2 + 1;
977 nUnions = nUnions + n;
978 }
979 u = (G4UnionSolid**)malloc(sizeof(G4UnionSolid*) * nUnions);
980 if (u == nullptr)
981 B2FATAL(MemErr);
982 n = nSolids;
983 i2 = 0;
984 solidArray = solids;
985 k1 = 0;
986 k2 = nSolids;
987 dl = 1;
988 while (n > 1) {
989 i1 = i2;
990 if (n % 2 == 0)
991 n = n / 2;
992 else
993 n = n / 2 + 1;
994 i2 = i1 + n;
995 k = k1;
996 l = 0;
997 for (i = i1; i < i2; i++) {
998 if (k != k2 - 1) {
999 /* Unify k and k + 1 -> i */
1000 t = inverseTransf[l] * transf[l + dl];
1001 try {
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) {
1006 B2FATAL(MemErr);
1007 }
1008 } else {
1009 /* Copy k -> i */
1010 u[i] = (G4UnionSolid*)solids[k];
1011 }
1012 k = k + 2;
1013 l = l + dl * 2;
1014 }
1015 solidArray = (G4VSolid**)u;
1016 k1 = i1;
1017 k2 = i2;
1018 dl = dl * 2;
1019 }
1020 d = new G4DisplacedSolid(name + "_Displaced", u[nUnions - 1], transf[0]);
1021 free(u);
1022 delete[] inverseTransf;
1023 return d;
1024}

Member Data Documentation

◆ m_CurVol

struct VolumeNumbers m_CurVol
private

Current volumes.

Definition at line 638 of file GeoEKLMCreator.h.

◆ m_ElementNumbers

const EKLMElementNumbers* m_ElementNumbers
private

Element numbers.

Definition at line 641 of file GeoEKLMCreator.h.

◆ m_GeoDat

const GeometryData* m_GeoDat
private

Geometry data.

Definition at line 647 of file GeoEKLMCreator.h.

◆ m_LogVol

struct LogicalVolumes m_LogVol
private

Logical volumes.

Definition at line 632 of file GeoEKLMCreator.h.

◆ m_Materials

struct Materials m_Materials
private

Materials.

Definition at line 635 of file GeoEKLMCreator.h.

◆ m_Sensitive

KLM::SensitiveDetector* m_Sensitive
private

Sensitive detector.

Definition at line 650 of file GeoEKLMCreator.h.

◆ m_Solids

struct Solids m_Solids
private

Solids.

Definition at line 629 of file GeoEKLMCreator.h.

◆ m_TransformData

TransformData* m_TransformData
private

Transformation data.

Definition at line 644 of file GeoEKLMCreator.h.


The documentation for this class was generated from the following files: