Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
B1::DetectorConstruction Class Reference

Detector construction class to define materials and geometry. More...

#include <Doxymodules_basic.h>

Inheritance diagram for B1::DetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 DetectorConstruction ()=default
 
 ~DetectorConstruction () override=default
 
G4VPhysicalVolumeConstruct () override
 
G4LogicalVolumeGetScoringVolume () const
 

Protected Attributes

G4LogicalVolumefScoringVolume = nullptr
 

Detailed Description

Detector construction class to define materials and geometry.

Definition at line 20 of file Doxymodules_basic.h.

Constructor & Destructor Documentation

◆ DetectorConstruction()

B1::DetectorConstruction::DetectorConstruction ( )
default

◆ ~DetectorConstruction()

B1::DetectorConstruction::~DetectorConstruction ( )
overridedefault

Member Function Documentation

◆ Construct()

G4VPhysicalVolume * B1::DetectorConstruction::Construct ( )
override

Definition at line 48 of file DetectorConstruction.cc.

49{
50 // Get nist material manager
51 G4NistManager* nist = G4NistManager::Instance();
52
53 // Envelope parameters
54 //
55 G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm;
56 G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER");
57
58 // Option to switch on/off checking of volumes overlaps
59 //
60 G4bool checkOverlaps = true;
61
62 //
63 // World
64 //
65 G4double world_sizeXY = 1.2*env_sizeXY;
66 G4double world_sizeZ = 1.2*env_sizeZ;
67 G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
68
69 auto solidWorld = new G4Box("World", // its name
70 0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size
71
72 auto logicWorld = new G4LogicalVolume(solidWorld, // its solid
73 world_mat, // its material
74 "World"); // its name
75
76 auto physWorld = new G4PVPlacement(nullptr, // no rotation
77 G4ThreeVector(), // at (0,0,0)
78 logicWorld, // its logical volume
79 "World", // its name
80 nullptr, // its mother volume
81 false, // no boolean operation
82 0, // copy number
83 checkOverlaps); // overlaps checking
84
85 //
86 // Envelope
87 //
88 auto solidEnv = new G4Box("Envelope", // its name
89 0.5 * env_sizeXY, 0.5 * env_sizeXY, 0.5 * env_sizeZ); // its size
90
91 auto logicEnv = new G4LogicalVolume(solidEnv, // its solid
92 env_mat, // its material
93 "Envelope"); // its name
94
95 new G4PVPlacement(nullptr, // no rotation
96 G4ThreeVector(), // at (0,0,0)
97 logicEnv, // its logical volume
98 "Envelope", // its name
99 logicWorld, // its mother volume
100 false, // no boolean operation
101 0, // copy number
102 checkOverlaps); // overlaps checking
103
104 //
105 // Shape 1
106 //
107 G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_A-150_TISSUE");
108 G4ThreeVector pos1 = G4ThreeVector(0, 2*cm, -7*cm);
109
110 // Conical section shape
111 G4double shape1_rmina = 0.*cm, shape1_rmaxa = 2.*cm;
112 G4double shape1_rminb = 0.*cm, shape1_rmaxb = 4.*cm;
113 G4double shape1_hz = 3.*cm;
114 G4double shape1_phimin = 0.*deg, shape1_phimax = 360.*deg;
115 auto solidShape1 = new G4Cons("Shape1", shape1_rmina, shape1_rmaxa, shape1_rminb, shape1_rmaxb,
116 shape1_hz, shape1_phimin, shape1_phimax);
117
118 auto logicShape1 = new G4LogicalVolume(solidShape1, // its solid
119 shape1_mat, // its material
120 "Shape1"); // its name
121
122 new G4PVPlacement(nullptr, // no rotation
123 pos1, // at position
124 logicShape1, // its logical volume
125 "Shape1", // its name
126 logicEnv, // its mother volume
127 false, // no boolean operation
128 0, // copy number
129 checkOverlaps); // overlaps checking
130
131 //
132 // Shape 2
133 //
134 G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_BONE_COMPACT_ICRU");
135 G4ThreeVector pos2 = G4ThreeVector(0, -1*cm, 7*cm);
136
137 // Trapezoid shape
138 G4double shape2_dxa = 12*cm, shape2_dxb = 12*cm;
139 G4double shape2_dya = 10*cm, shape2_dyb = 16*cm;
140 G4double shape2_dz = 6*cm;
141 auto solidShape2 = new G4Trd("Shape2", // its name
142 0.5 * shape2_dxa, 0.5 * shape2_dxb, 0.5 * shape2_dya, 0.5 * shape2_dyb,
143 0.5 * shape2_dz); // its size
144
145 auto logicShape2 = new G4LogicalVolume(solidShape2, // its solid
146 shape2_mat, // its material
147 "Shape2"); // its name
148
149 new G4PVPlacement(nullptr, // no rotation
150 pos2, // at position
151 logicShape2, // its logical volume
152 "Shape2", // its name
153 logicEnv, // its mother volume
154 false, // no boolean operation
155 0, // copy number
156 checkOverlaps); // overlaps checking
157
158 // Set Shape2 as scoring volume
159 //
160 fScoringVolume = logicShape2;
161
162 //
163 //always return the physical World
164 //
165 return physWorld;
166}

◆ GetScoringVolume()

G4LogicalVolume * B1::DetectorConstruction::GetScoringVolume ( ) const
inline

Definition at line 52 of file DetectorConstruction.hh.

52{ return fScoringVolume; }

Member Data Documentation

◆ fScoringVolume

G4LogicalVolume* B1::DetectorConstruction::fScoringVolume = nullptr
protected

Definition at line 55 of file DetectorConstruction.hh.


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

Applications | User Support | Publications | Collaboration