Geant4  10.02.p03
B4DetectorConstruction Class Reference

#include <B4DetectorConstruction.hh>

Inheritance diagram for B4DetectorConstruction:
Collaboration diagram for B4DetectorConstruction:

Public Member Functions

 B4DetectorConstruction ()
 
virtual ~B4DetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct ()
 
virtual void ConstructSDandField ()
 
const G4VPhysicalVolumeGetAbsorberPV () const
 
const G4VPhysicalVolumeGetGapPV () const
 
 B4DetectorConstruction ()
 
virtual ~B4DetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct ()
 
virtual void ConstructSDandField ()
 
const G4VPhysicalVolumeGetAbsorberPV () const
 
const G4VPhysicalVolumeGetGapPV () const
 
- Public Member Functions inherited from G4VUserDetectorConstruction
 G4VUserDetectorConstruction ()
 
virtual ~G4VUserDetectorConstruction ()
 
virtual void CloneSD ()
 
virtual void CloneF ()
 
void RegisterParallelWorld (G4VUserParallelWorld *)
 
G4int ConstructParallelGeometries ()
 
void ConstructParallelSD ()
 
G4int GetNumberOfParallelWorld () const
 
G4VUserParallelWorldGetParallelWorld (G4int i) const
 

Private Member Functions

void DefineMaterials ()
 
G4VPhysicalVolumeDefineVolumes ()
 
void DefineMaterials ()
 
G4VPhysicalVolumeDefineVolumes ()
 

Private Attributes

G4VPhysicalVolumefAbsorberPV
 
G4VPhysicalVolumefGapPV
 
G4bool fCheckOverlaps
 

Static Private Attributes

static G4ThreadLocal G4GlobalMagFieldMessengerfMagFieldMessenger = 0
 

Additional Inherited Members

- Protected Member Functions inherited from G4VUserDetectorConstruction
void SetSensitiveDetector (const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
 
void SetSensitiveDetector (G4LogicalVolume *logVol, G4VSensitiveDetector *aSD)
 

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 B4a/include/B4DetectorConstruction.hh.

Constructor & Destructor Documentation

◆ B4DetectorConstruction() [1/2]

B4DetectorConstruction::B4DetectorConstruction ( )

◆ ~B4DetectorConstruction() [1/2]

B4DetectorConstruction::~B4DetectorConstruction ( )
virtual

Definition at line 71 of file B4a/src/B4DetectorConstruction.cc.

72 {
73 }

◆ B4DetectorConstruction() [2/2]

B4DetectorConstruction::B4DetectorConstruction ( )

◆ ~B4DetectorConstruction() [2/2]

virtual B4DetectorConstruction::~B4DetectorConstruction ( )
virtual

Member Function Documentation

◆ Construct() [1/2]

G4VPhysicalVolume * B4DetectorConstruction::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 77 of file B4a/src/B4DetectorConstruction.cc.

78 {
79  // Define materials
81 
82  // Define volumes
83  return DefineVolumes();
84 }
Here is the call graph for this function:

◆ Construct() [2/2]

virtual G4VPhysicalVolume* B4DetectorConstruction::Construct ( )
virtual

◆ ConstructSDandField() [1/2]

void B4DetectorConstruction::ConstructSDandField ( )
virtual

Reimplemented from G4VUserDetectorConstruction.

Definition at line 281 of file B4a/src/B4DetectorConstruction.cc.

282 {
283  // Create global magnetic field messenger.
284  // Uniform magnetic field is then created automatically if
285  // the field value is not zero.
286  G4ThreeVector fieldValue = G4ThreeVector();
289 
290  // Register the field messenger for deleting
292 }
void SetVerboseLevel(G4int verboseLevel)
CLHEP::Hep3Vector G4ThreeVector
void Register(T *inst)
Definition: G4AutoDelete.hh:65
static G4ThreadLocal G4GlobalMagFieldMessenger * fMagFieldMessenger
Here is the call graph for this function:

◆ ConstructSDandField() [2/2]

virtual void B4DetectorConstruction::ConstructSDandField ( )
virtual

Reimplemented from G4VUserDetectorConstruction.

◆ DefineMaterials() [1/2]

void B4DetectorConstruction::DefineMaterials ( )
private

◆ DefineMaterials() [2/2]

void B4DetectorConstruction::DefineMaterials ( )
private

Definition at line 88 of file B4a/src/B4DetectorConstruction.cc.

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;
98  new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
99  // The argon by NIST Manager is a gas with a different density
100 
101  // Vacuum
102  new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
103  kStateGas, 2.73*kelvin, 3.e-18*pascal);
104 
105  // Print materials
107 }
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
int universe_mean_density
Definition: hepunit.py:307
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:589
static G4NistManager * Instance()
G4double density
Definition: TRTMaterials.hh:39
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5206
G4GLOB_DLL std::ostream G4cout
#define pascal
static const double cm3
Definition: G4SIunits.hh:120
static const double kelvin
Definition: G4SIunits.hh:278
static const double mole
Definition: G4SIunits.hh:283
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DefineVolumes() [1/2]

G4VPhysicalVolume * B4DetectorConstruction::DefineVolumes ( )
private

Definition at line 111 of file B4a/src/B4DetectorConstruction.cc.

112 {
113  // Geometry parameters
114  G4int nofLayers = 10;
115  G4double absoThickness = 10.*mm;
116  G4double gapThickness = 5.*mm;
117  G4double calorSizeXY = 10.*cm;
118 
119  G4double layerThickness = absoThickness + gapThickness;
120  G4double calorThickness = nofLayers * layerThickness;
121  G4double worldSizeXY = 1.2 * calorSizeXY;
122  G4double worldSizeZ = 1.2 * calorThickness;
123 
124  // Get materials
125  G4Material* defaultMaterial = G4Material::GetMaterial("Galactic");
126  G4Material* absorberMaterial = G4Material::GetMaterial("G4_Pb");
127  G4Material* gapMaterial = G4Material::GetMaterial("liquidArgon");
128 
129  if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
131  msg << "Cannot retrieve materials already defined.";
132  G4Exception("B4DetectorConstruction::DefineVolumes()",
133  "MyCode0001", FatalException, msg);
134  }
135 
136  //
137  // World
138  //
139  G4VSolid* worldS
140  = new G4Box("World", // its name
141  worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
142 
143  G4LogicalVolume* worldLV
144  = new G4LogicalVolume(
145  worldS, // its solid
146  defaultMaterial, // its material
147  "World"); // its name
148 
149  G4VPhysicalVolume* worldPV
150  = new G4PVPlacement(
151  0, // no rotation
152  G4ThreeVector(), // at (0,0,0)
153  worldLV, // its logical volume
154  "World", // its name
155  0, // its mother volume
156  false, // no boolean operation
157  0, // copy number
158  fCheckOverlaps); // checking overlaps
159 
160  //
161  // Calorimeter
162  //
163  G4VSolid* calorimeterS
164  = new G4Box("Calorimeter", // its name
165  calorSizeXY/2, calorSizeXY/2, calorThickness/2); // its size
166 
167  G4LogicalVolume* calorLV
168  = new G4LogicalVolume(
169  calorimeterS, // its solid
170  defaultMaterial, // its material
171  "Calorimeter"); // its name
172 
173  new G4PVPlacement(
174  0, // no rotation
175  G4ThreeVector(), // at (0,0,0)
176  calorLV, // its logical volume
177  "Calorimeter", // its name
178  worldLV, // its mother volume
179  false, // no boolean operation
180  0, // copy number
181  fCheckOverlaps); // checking overlaps
182 
183  //
184  // Layer
185  //
186  G4VSolid* layerS
187  = new G4Box("Layer", // its name
188  calorSizeXY/2, calorSizeXY/2, layerThickness/2); // its size
189 
190  G4LogicalVolume* layerLV
191  = new G4LogicalVolume(
192  layerS, // its solid
193  defaultMaterial, // its material
194  "Layer"); // its name
195 
196  new G4PVReplica(
197  "Layer", // its name
198  layerLV, // its logical volume
199  calorLV, // its mother
200  kZAxis, // axis of replication
201  nofLayers, // number of replica
202  layerThickness); // witdth of replica
203 
204  //
205  // Absorber
206  //
207  G4VSolid* absorberS
208  = new G4Box("Abso", // its name
209  calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
210 
211  G4LogicalVolume* absorberLV
212  = new G4LogicalVolume(
213  absorberS, // its solid
214  absorberMaterial, // its material
215  "Abso"); // its name
216 
218  = new G4PVPlacement(
219  0, // no rotation
220  G4ThreeVector(0., 0., -gapThickness/2), // its position
221  absorberLV, // its logical volume
222  "Abso", // its name
223  layerLV, // its mother volume
224  false, // no boolean operation
225  0, // copy number
226  fCheckOverlaps); // checking overlaps
227 
228  //
229  // Gap
230  //
231  G4VSolid* gapS
232  = new G4Box("Gap", // its name
233  calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
234 
235  G4LogicalVolume* gapLV
236  = new G4LogicalVolume(
237  gapS, // its solid
238  gapMaterial, // its material
239  "Gap"); // its name
240 
241  fGapPV
242  = new G4PVPlacement(
243  0, // no rotation
244  G4ThreeVector(0., 0., absoThickness/2), // its position
245  gapLV, // its logical volume
246  "Gap", // its name
247  layerLV, // its mother volume
248  false, // no boolean operation
249  0, // copy number
250  fCheckOverlaps); // checking overlaps
251 
252  //
253  // print parameters
254  //
255  G4cout
256  << G4endl
257  << "------------------------------------------------------------" << G4endl
258  << "---> The calorimeter is " << nofLayers << " layers of: [ "
259  << absoThickness/mm << "mm of " << absorberMaterial->GetName()
260  << " + "
261  << gapThickness/mm << "mm of " << gapMaterial->GetName() << " ] " << G4endl
262  << "------------------------------------------------------------" << G4endl;
263 
264  //
265  // Visualization attributes
266  //
268 
269  G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
270  simpleBoxVisAtt->SetVisibility(true);
271  calorLV->SetVisAttributes(simpleBoxVisAtt);
272 
273  //
274  // Always return the physical World
275  //
276  return worldPV;
277 }
static const double cm
Definition: G4SIunits.hh:118
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
CLHEP::Hep3Vector G4ThreeVector
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:604
Definition: G4Box.hh:64
void SetVisibility(G4bool)
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static const G4VisAttributes Invisible
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
const G4String & GetName() const
Definition: G4Material.hh:178
static const double mm
Definition: G4SIunits.hh:114
void SetVisAttributes(const G4VisAttributes *pVA)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DefineVolumes() [2/2]

G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes ( )
private

◆ GetAbsorberPV() [1/2]

const G4VPhysicalVolume* B4DetectorConstruction::GetAbsorberPV ( ) const

◆ GetAbsorberPV() [2/2]

const G4VPhysicalVolume * B4DetectorConstruction::GetAbsorberPV ( ) const
inline

Definition at line 88 of file B4a/include/B4DetectorConstruction.hh.

88  {
89  return fAbsorberPV;
90 }
Here is the caller graph for this function:

◆ GetGapPV() [1/2]

const G4VPhysicalVolume * B4DetectorConstruction::GetGapPV ( ) const
inline

Definition at line 92 of file B4a/include/B4DetectorConstruction.hh.

92  {
93  return fGapPV;
94 }
Here is the caller graph for this function:

◆ GetGapPV() [2/2]

const G4VPhysicalVolume* B4DetectorConstruction::GetGapPV ( ) const

Member Data Documentation

◆ fAbsorberPV

G4VPhysicalVolume * B4DetectorConstruction::fAbsorberPV
private

Definition at line 80 of file B4a/include/B4DetectorConstruction.hh.

◆ fCheckOverlaps

G4bool B4DetectorConstruction::fCheckOverlaps
private

Definition at line 83 of file B4a/include/B4DetectorConstruction.hh.

◆ fGapPV

G4VPhysicalVolume * B4DetectorConstruction::fGapPV
private

Definition at line 81 of file B4a/include/B4DetectorConstruction.hh.

◆ fMagFieldMessenger

G4ThreadLocal G4GlobalMagFieldMessenger * B4DetectorConstruction::fMagFieldMessenger = 0
staticprivate

Definition at line 77 of file B4a/include/B4DetectorConstruction.hh.


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