Geant4  10.02.p03
B4cDetectorConstruction Class Reference

#include <B4cDetectorConstruction.hh>

Inheritance diagram for B4cDetectorConstruction:
Collaboration diagram for B4cDetectorConstruction:

Public Member Functions

 B4cDetectorConstruction ()
 
virtual ~B4cDetectorConstruction ()
 
virtual G4VPhysicalVolume * Construct ()
 
virtual void ConstructSDandField ()
 
- 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
 
G4VUserParallelWorld * GetParallelWorld (G4int i) const
 

Private Member Functions

void DefineMaterials ()
 
G4VPhysicalVolume * DefineVolumes ()
 

Private Attributes

G4bool fCheckOverlaps
 
G4int fNofLayers
 

Static Private Attributes

static G4ThreadLocal G4GlobalMagFieldMessenger * fMagFieldMessenger = 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 ConstructSDandField() sensitive detectors of B4cCalorimeterSD 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 56 of file B4cDetectorConstruction.hh.

Constructor & Destructor Documentation

◆ B4cDetectorConstruction()

B4cDetectorConstruction::B4cDetectorConstruction ( )

◆ ~B4cDetectorConstruction()

B4cDetectorConstruction::~B4cDetectorConstruction ( )
virtual

Definition at line 67 of file B4cDetectorConstruction.cc.

68 {
69 }

Member Function Documentation

◆ Construct()

G4VPhysicalVolume * B4cDetectorConstruction::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 73 of file B4cDetectorConstruction.cc.

74 {
75  // Define materials
77 
78  // Define volumes
79  return DefineVolumes();
80 }
G4VPhysicalVolume * DefineVolumes()
Here is the call graph for this function:

◆ ConstructSDandField()

void B4cDetectorConstruction::ConstructSDandField ( )
virtual

Reimplemented from G4VUserDetectorConstruction.

Definition at line 275 of file B4cDetectorConstruction.cc.

276 {
277  // G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
278 
279  //
280  // Sensitive detectors
281  //
282  B4cCalorimeterSD* absoSD
283  = new B4cCalorimeterSD("AbsorberSD", "AbsorberHitsCollection", fNofLayers);
284  SetSensitiveDetector("AbsoLV",absoSD);
285 
286  B4cCalorimeterSD* gapSD
287  = new B4cCalorimeterSD("GapSD", "GapHitsCollection", fNofLayers);
288  SetSensitiveDetector("GapLV",gapSD);
289 
290  //
291  // Magnetic field
292  //
293  // Create global magnetic field messenger.
294  // Uniform magnetic field is then created automatically if
295  // the field value is not zero.
296  G4ThreeVector fieldValue = G4ThreeVector();
299 
300  // Register the field messenger for deleting
302 }
void SetVerboseLevel(G4int verboseLevel)
CLHEP::Hep3Vector G4ThreeVector
static G4ThreadLocal G4GlobalMagFieldMessenger * fMagFieldMessenger
void Register(T *inst)
Definition: G4AutoDelete.hh:65
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
Here is the call graph for this function:

◆ DefineMaterials()

void B4cDetectorConstruction::DefineMaterials ( )
private

Definition at line 84 of file B4cDetectorConstruction.cc.

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

G4VPhysicalVolume * B4cDetectorConstruction::DefineVolumes ( )
private

Definition at line 107 of file B4cDetectorConstruction.cc.

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

Member Data Documentation

◆ fCheckOverlaps

G4bool B4cDetectorConstruction::fCheckOverlaps
private

Definition at line 77 of file B4cDetectorConstruction.hh.

◆ fMagFieldMessenger

G4ThreadLocal G4GlobalMagFieldMessenger * B4cDetectorConstruction::fMagFieldMessenger = 0
staticprivate

Definition at line 74 of file B4cDetectorConstruction.hh.

◆ fNofLayers

G4int B4cDetectorConstruction::fNofLayers
private

Definition at line 78 of file B4cDetectorConstruction.hh.


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