Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
B4c::DetectorConstruction Class Reference
basic » B4 » B4c

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

#include <Doxymodules_basic.h>

Inheritance diagram for B4c::DetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 DetectorConstruction ()=default
 
 ~DetectorConstruction () override=default
 
G4VPhysicalVolumeConstruct () override
 
void ConstructSDandField () override
 

Private Member Functions

void DefineMaterials ()
 
G4VPhysicalVolumeDefineVolumes ()
 

Private Attributes

G4bool fCheckOverlaps = true
 
G4int fNofLayers = -1
 

Static Private Attributes

static G4ThreadLocal G4GlobalMagFieldMessengerfMagFieldMessenger = nullptr
 

Detailed Description

Detector construction class to define materials and geometry.

The calorimeter is a box made of a given number of layers. A layer consists of an absorber plate and of a detection gap. The layer is replicated.

Four parameters define the geometry of the calorimeter :

In ConstructSDandField() sensitive detectors of CalorimeterSD type are created and associated with the Absorber and Gap volumes. In addition a transverse uniform magnetic field is defined via G4GlobalMagFieldMessenger class.

Definition at line 159 of file Doxymodules_basic.h.

Constructor & Destructor Documentation

◆ DetectorConstruction()

B4c::DetectorConstruction::DetectorConstruction ( )
default

◆ ~DetectorConstruction()

B4c::DetectorConstruction::~DetectorConstruction ( )
overridedefault

Member Function Documentation

◆ Construct()

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

Definition at line 60 of file DetectorConstruction.cc.

61{
62 // Define materials
64
65 // Define volumes
66 return DefineVolumes();
67}
G4VPhysicalVolume * DefineVolumes()

◆ ConstructSDandField()

void B4c::DetectorConstruction::ConstructSDandField ( )
override

Definition at line 254 of file DetectorConstruction.cc.

255{
256 // G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
257
258 //
259 // Sensitive detectors
260 //
261 auto absoSD
262 = new CalorimeterSD("AbsorberSD", "AbsorberHitsCollection", fNofLayers);
263 G4SDManager::GetSDMpointer()->AddNewDetector(absoSD);
264 SetSensitiveDetector("AbsoLV",absoSD);
265
266 auto gapSD
267 = new CalorimeterSD("GapSD", "GapHitsCollection", fNofLayers);
268 G4SDManager::GetSDMpointer()->AddNewDetector(gapSD);
269 SetSensitiveDetector("GapLV",gapSD);
270
271 //
272 // Magnetic field
273 //
274 // Create global magnetic field messenger.
275 // Uniform magnetic field is then created automatically if
276 // the field value is not zero.
277 G4ThreeVector fieldValue;
279 fMagFieldMessenger->SetVerboseLevel(1);
280
281 // Register the field messenger for deleting
282 G4AutoDelete::Register(fMagFieldMessenger);
283}
static G4ThreadLocal G4GlobalMagFieldMessenger * fMagFieldMessenger

◆ DefineMaterials()

void B4c::DetectorConstruction::DefineMaterials ( )
private

Definition at line 71 of file DetectorConstruction.cc.

72{
73 // Lead material defined using NIST Manager
74 auto nistManager = G4NistManager::Instance();
75 nistManager->FindOrBuildMaterial("G4_Pb");
76
77 // Liquid argon material
78 G4double a; // mass of a mole;
79 G4double z; // z=mean number of protons;
80 G4double density;
81 new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
82 // The argon by NIST Manager is a gas with a different density
83
84 // Vacuum
85 new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
86 kStateGas, 2.73*kelvin, 3.e-18*pascal);
87
88 // Print materials
89 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
90}
std::vector< ExP01TrackerHit * > a

◆ DefineVolumes()

G4VPhysicalVolume * B4c::DetectorConstruction::DefineVolumes ( )
private

Definition at line 94 of file DetectorConstruction.cc.

95{
96 // Geometry parameters
97 fNofLayers = 10;
98 G4double absoThickness = 10.*mm;
99 G4double gapThickness = 5.*mm;
100 G4double calorSizeXY = 10.*cm;
101
102 auto layerThickness = absoThickness + gapThickness;
103 auto calorThickness = fNofLayers * layerThickness;
104 auto worldSizeXY = 1.2 * calorSizeXY;
105 auto worldSizeZ = 1.2 * calorThickness;
106
107 // Get materials
108 auto defaultMaterial = G4Material::GetMaterial("Galactic");
109 auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
110 auto gapMaterial = G4Material::GetMaterial("liquidArgon");
111
112 if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
113 G4ExceptionDescription msg;
114 msg << "Cannot retrieve materials already defined.";
115 G4Exception("DetectorConstruction::DefineVolumes()",
116 "MyCode0001", FatalException, msg);
117 }
118
119 //
120 // World
121 //
122 auto worldS
123 = new G4Box("World", // its name
124 worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
125
126 auto worldLV
127 = new G4LogicalVolume(
128 worldS, // its solid
129 defaultMaterial, // its material
130 "World"); // its name
131
132 auto worldPV = new G4PVPlacement(nullptr, // no rotation
133 G4ThreeVector(), // at (0,0,0)
134 worldLV, // its logical volume
135 "World", // its name
136 nullptr, // its mother volume
137 false, // no boolean operation
138 0, // copy number
139 fCheckOverlaps); // checking overlaps
140
141 //
142 // Calorimeter
143 //
144 auto calorimeterS
145 = new G4Box("Calorimeter", // its name
146 calorSizeXY/2, calorSizeXY/2, calorThickness/2); // its size
147
148 auto calorLV
149 = new G4LogicalVolume(
150 calorimeterS, // its solid
151 defaultMaterial, // its material
152 "Calorimeter"); // its name
153
154 new G4PVPlacement(nullptr, // no rotation
155 G4ThreeVector(), // at (0,0,0)
156 calorLV, // its logical volume
157 "Calorimeter", // its name
158 worldLV, // its mother volume
159 false, // no boolean operation
160 0, // copy number
161 fCheckOverlaps); // checking overlaps
162
163 //
164 // Layer
165 //
166 auto layerS
167 = new G4Box("Layer", // its name
168 calorSizeXY/2, calorSizeXY/2, layerThickness/2); //its size
169
170 auto layerLV
171 = new G4LogicalVolume(
172 layerS, // its solid
173 defaultMaterial, // its material
174 "Layer"); // its name
175
176 new G4PVReplica(
177 "Layer", // its name
178 layerLV, // its logical volume
179 calorLV, // its mother
180 kZAxis, // axis of replication
181 fNofLayers, // number of replica
182 layerThickness); // witdth of replica
183
184 //
185 // Absorber
186 //
187 auto absorberS
188 = new G4Box("Abso", // its name
189 calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
190
191 auto absorberLV
192 = new G4LogicalVolume(
193 absorberS, // its solid
194 absorberMaterial, // its material
195 "AbsoLV"); // its name
196
197 new G4PVPlacement(nullptr, // no rotation
198 G4ThreeVector(0., 0., -gapThickness / 2), // its position
199 absorberLV, // its logical volume
200 "Abso", // its name
201 layerLV, // its mother volume
202 false, // no boolean operation
203 0, // copy number
204 fCheckOverlaps); // checking overlaps
205
206 //
207 // Gap
208 //
209 auto gapS
210 = new G4Box("Gap", // its name
211 calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
212
213 auto gapLV
214 = new G4LogicalVolume(
215 gapS, // its solid
216 gapMaterial, // its material
217 "GapLV"); // its name
218
219 new G4PVPlacement(nullptr, // no rotation
220 G4ThreeVector(0., 0., absoThickness / 2), // its position
221 gapLV, // its logical volume
222 "Gap", // its name
223 layerLV, // its mother volume
224 false, // no boolean operation
225 0, // copy number
226 fCheckOverlaps); // checking overlaps
227
228 //
229 // print parameters
230 //
231 G4cout
232 << G4endl
233 << "------------------------------------------------------------" << G4endl
234 << "---> The calorimeter is " << fNofLayers << " layers of: [ "
235 << absoThickness/mm << "mm of " << absorberMaterial->GetName()
236 << " + "
237 << gapThickness/mm << "mm of " << gapMaterial->GetName() << " ] " << G4endl
238 << "------------------------------------------------------------" << G4endl;
239
240 //
241 // Visualization attributes
242 //
243 worldLV->SetVisAttributes(G4VisAttributes::GetInvisible());
244 calorLV->SetVisAttributes(G4VisAttributes(G4Colour::White()));
245
246 //
247 // Always return the physical World
248 //
249 return worldPV;
250}

Member Data Documentation

◆ fMagFieldMessenger

G4ThreadLocal G4GlobalMagFieldMessenger * B4c::DetectorConstruction::fMagFieldMessenger = nullptr
staticprivate

Definition at line 76 of file DetectorConstruction.hh.

◆ fCheckOverlaps

G4bool B4c::DetectorConstruction::fCheckOverlaps = true
private

Definition at line 79 of file DetectorConstruction.hh.

◆ fNofLayers

G4int B4c::DetectorConstruction::fNofLayers = -1
private

Definition at line 80 of file DetectorConstruction.hh.


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

Applications | User Support | Publications | Collaboration