VMC Examples Version 6.6
Loading...
Searching...
No Matches
B4DetectorConstruction Class Reference

#include <B4DetectorConstruction.hh>

Inheritance diagram for B4DetectorConstruction:

Public Member Functions

 B4DetectorConstruction ()
 
virtual ~B4DetectorConstruction ()
 
virtual G4VPhysicalVolume * Construct ()
 
virtual void ConstructSDandField ()
 
const G4VPhysicalVolume * GetAbsorberPV () const
 
const G4VPhysicalVolume * GetGapPV () const
 
 B4DetectorConstruction ()
 
virtual ~B4DetectorConstruction ()
 
virtual G4VPhysicalVolume * Construct ()
 
virtual void ConstructSDandField ()
 
const G4VPhysicalVolume * GetAbsorberPV () const
 
const G4VPhysicalVolume * GetGapPV () const
 
 B4DetectorConstruction ()
 
virtual ~B4DetectorConstruction ()
 
virtual G4VPhysicalVolume * Construct ()
 
virtual void ConstructSDandField ()
 
const G4VPhysicalVolume * GetAbsorberPV () const
 
const G4VPhysicalVolume * GetGapPV () const
 

Private Member Functions

void DefineMaterials ()
 
G4VPhysicalVolume * DefineVolumes ()
 
void DefineMaterials ()
 
G4VPhysicalVolume * DefineVolumes ()
 
void DefineMaterials ()
 
G4VPhysicalVolume * DefineVolumes ()
 

Private Attributes

G4VPhysicalVolume * fAbsorberPV
 
G4VPhysicalVolume * fGapPV
 
G4bool fCheckOverlaps
 

Static Private Attributes

static G4ThreadLocal G4GlobalMagFieldMessenger * fMagFieldMessenger = 0
 

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 :

  • the thickness of an absorber plate,
  • the thickness of a gap,
  • the number of layers,
  • the transverse size of the calorimeter (the input face is a square).

In addition a transverse uniform magnetic field is defined via G4GlobalMagFieldMessenger class.

Definition at line 54 of file B4DetectorConstruction.hh.

Constructor & Destructor Documentation

◆ B4DetectorConstruction() [1/3]

B4DetectorConstruction::B4DetectorConstruction ( )

◆ ~B4DetectorConstruction() [1/3]

B4DetectorConstruction::~B4DetectorConstruction ( )
virtual

Definition at line 73 of file B4DetectorConstruction.cxx.

73{}

◆ B4DetectorConstruction() [2/3]

B4DetectorConstruction::B4DetectorConstruction ( )

◆ ~B4DetectorConstruction() [2/3]

virtual B4DetectorConstruction::~B4DetectorConstruction ( )
virtual

◆ B4DetectorConstruction() [3/3]

B4DetectorConstruction::B4DetectorConstruction ( )

◆ ~B4DetectorConstruction() [3/3]

virtual B4DetectorConstruction::~B4DetectorConstruction ( )
virtual

Member Function Documentation

◆ Construct() [1/3]

G4VPhysicalVolume * B4DetectorConstruction::Construct ( )
virtual

Definition at line 77 of file B4DetectorConstruction.cxx.

78{
79 // Define materials
81
82 // Define volumes
83 return DefineVolumes();
84}
G4VPhysicalVolume * DefineVolumes()

◆ ConstructSDandField() [1/3]

void B4DetectorConstruction::ConstructSDandField ( )
virtual

Definition at line 258 of file B4DetectorConstruction.cxx.

259{
260 // Added for VMC
261 TG4GeometryManager::Instance()->ConstructSDandField();
262 /*
263 // Create global magnetic field messenger.
264 // Uniform magnetic field is then created automatically if
265 // the field value is not zero.
266 G4ThreeVector fieldValue = G4ThreeVector();
267 fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
268 fMagFieldMessenger->SetVerboseLevel(1);
269
270 // Register the field messenger for deleting
271 G4AutoDelete::Register(fMagFieldMessenger);
272 */
273}

◆ GetAbsorberPV() [1/3]

const G4VPhysicalVolume * B4DetectorConstruction::GetAbsorberPV ( ) const
inline

Definition at line 88 of file B4DetectorConstruction.hh.

88 {
89 return fAbsorberPV;
90}

◆ GetGapPV() [1/3]

const G4VPhysicalVolume * B4DetectorConstruction::GetGapPV ( ) const
inline

Definition at line 92 of file B4DetectorConstruction.hh.

92 {
93 return fGapPV;
94}

◆ DefineMaterials() [1/3]

void B4DetectorConstruction::DefineMaterials ( )
private

Definition at line 88 of file B4DetectorConstruction.cxx.

89{
90 // Lead material defined using NIST Manager
91 G4NistManager* nistManager = G4NistManager::Instance();
92 nistManager->FindOrBuildMaterial("G4_Pb");
93
94 // Liquid argon material
95 G4double a; // mass of a mole;
96 G4double z; // z=mean number of protons;
97 G4double density;
98 new G4Material(
99 "liquidArgon", z = 18., a = 39.95 * g / mole, density = 1.390 * g / cm3);
100 // The argon by NIST Manager is a gas with a different density
101
102 // Vacuum
103 new G4Material("Galactic", z = 1., a = 1.01 * g / mole,
104 density = universe_mean_density, kStateGas, 2.73 * kelvin, 3.e-18 * pascal);
105
106 // Print materials
107 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
108}

◆ DefineVolumes() [1/3]

G4VPhysicalVolume * B4DetectorConstruction::DefineVolumes ( )
private

Definition at line 112 of file B4DetectorConstruction.cxx.

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

◆ Construct() [2/3]

virtual G4VPhysicalVolume * B4DetectorConstruction::Construct ( )
virtual

◆ ConstructSDandField() [2/3]

virtual void B4DetectorConstruction::ConstructSDandField ( )
virtual

◆ GetAbsorberPV() [2/3]

const G4VPhysicalVolume * B4DetectorConstruction::GetAbsorberPV ( ) const

◆ GetGapPV() [2/3]

const G4VPhysicalVolume * B4DetectorConstruction::GetGapPV ( ) const

◆ DefineMaterials() [2/3]

void B4DetectorConstruction::DefineMaterials ( )
private

◆ DefineVolumes() [2/3]

G4VPhysicalVolume * B4DetectorConstruction::DefineVolumes ( )
private

◆ Construct() [3/3]

virtual G4VPhysicalVolume * B4DetectorConstruction::Construct ( )
virtual

◆ ConstructSDandField() [3/3]

virtual void B4DetectorConstruction::ConstructSDandField ( )
virtual

◆ GetAbsorberPV() [3/3]

const G4VPhysicalVolume * B4DetectorConstruction::GetAbsorberPV ( ) const

◆ GetGapPV() [3/3]

const G4VPhysicalVolume * B4DetectorConstruction::GetGapPV ( ) const

◆ DefineMaterials() [3/3]

void B4DetectorConstruction::DefineMaterials ( )
private

◆ DefineVolumes() [3/3]

G4VPhysicalVolume * B4DetectorConstruction::DefineVolumes ( )
private

Member Data Documentation

◆ fMagFieldMessenger

G4ThreadLocal G4GlobalMagFieldMessenger * B4DetectorConstruction::fMagFieldMessenger = 0
staticprivate

Definition at line 77 of file B4DetectorConstruction.hh.

◆ fAbsorberPV

G4VPhysicalVolume * B4DetectorConstruction::fAbsorberPV
private

Definition at line 80 of file B4DetectorConstruction.hh.

◆ fGapPV

G4VPhysicalVolume * B4DetectorConstruction::fGapPV
private

Definition at line 81 of file B4DetectorConstruction.hh.

◆ fCheckOverlaps

G4bool B4DetectorConstruction::fCheckOverlaps
private

Definition at line 83 of file B4DetectorConstruction.hh.


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