Warning, file /geant4/examples/extended/runAndEvent/RE04/src/RE04DetectorContruction.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "RE04DetectorConstruction.hh"
0030
0031 #include "G4Box.hh"
0032 #include "G4Colour.hh"
0033 #include "G4FieldManager.hh"
0034 #include "G4LogicalVolume.hh"
0035 #include "G4Material.hh"
0036 #include "G4NistManager.hh"
0037 #include "G4PVPlacement.hh"
0038 #include "G4SystemOfUnits.hh"
0039 #include "G4TransportationManager.hh"
0040 #include "G4UniformMagField.hh"
0041 #include "G4VisAttributes.hh"
0042 #include "G4ios.hh"
0043
0044
0045 RE04DetectorConstruction::RE04DetectorConstruction()
0046 : G4VUserDetectorConstruction(), fAir(0), fWater(0), fPb(0), fWorldPhys(0), fConstructed(false)
0047 {
0048 ;
0049 }
0050
0051
0052 RE04DetectorConstruction::~RE04DetectorConstruction()
0053 {
0054 ;
0055 }
0056
0057
0058 G4VPhysicalVolume* RE04DetectorConstruction::Construct()
0059 {
0060 if (!fConstructed) {
0061 fConstructed = true;
0062 DefineMaterials();
0063 SetupGeometry();
0064 }
0065 return fWorldPhys;
0066 }
0067
0068
0069 void RE04DetectorConstruction::DefineMaterials()
0070 {
0071
0072
0073
0074
0075
0076
0077
0078 G4NistManager* pNISTman = G4NistManager::Instance();
0079 fAir = pNISTman->FindOrBuildMaterial("G4_AIR");
0080 fWater = pNISTman->FindOrBuildMaterial("G4_WATER");
0081 fPb = pNISTman->FindOrBuildMaterial("G4_Pb");
0082
0083
0084
0085 G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
0086 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
0087 }
0088
0089
0090 void RE04DetectorConstruction::SetupGeometry()
0091 {
0092
0093
0094
0095 G4VSolid* worldSolid = new G4Box("World", 1. * m, 1. * m, 1. * m);
0096 G4LogicalVolume* worldLogical = new G4LogicalVolume(worldSolid, fAir, "World");
0097 fWorldPhys = new G4PVPlacement(0, G4ThreeVector(), worldLogical, "World", 0, false, 0);
0098
0099
0100
0101
0102 G4VSolid* phantomSolid = new G4Box("Phantom", 50. * cm, 50. * cm, 50. * cm);
0103 G4LogicalVolume* phantomLogical = new G4LogicalVolume(phantomSolid, fAir, "Phantom");
0104 new G4PVPlacement(0, G4ThreeVector(), phantomLogical, "Phantom", worldLogical, false, 0);
0105
0106
0107
0108
0109 worldLogical->SetVisAttributes(G4VisAttributes::GetInvisible());
0110 G4VisAttributes* simpleBoxVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
0111 simpleBoxVisAtt->SetVisibility(true);
0112 phantomLogical->SetVisAttributes(simpleBoxVisAtt);
0113 }