Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/radioactivedecay/Activation/src/DetectorConstruction.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 // $Id: DetectorConstruction.cc 70755 2013-06-05 12:17:48Z ihrivnac $
30 //
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #include "DetectorConstruction.hh"
36 #include "DetectorMessenger.hh"
37 #include "G4Material.hh"
38 #include "G4NistManager.hh"
39 
40 #include "G4Box.hh"
41 #include "G4LogicalVolume.hh"
42 #include "G4PVPlacement.hh"
43 
44 #include "G4GeometryManager.hh"
45 #include "G4PhysicalVolumeStore.hh"
46 #include "G4LogicalVolumeStore.hh"
47 #include "G4SolidStore.hh"
48 #include "G4RunManager.hh"
49 
50 #include "G4SystemOfUnits.hh"
51 #include "G4PhysicalConstants.hh"
52 #include "G4UnitsTable.hh"
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
58  fAbsorMaterial(nullptr), fLAbsor(nullptr), fWorldMaterial(nullptr),
59  fWorldVolume(nullptr), fDetectorMessenger(nullptr)
60 {
61  // default geometrical parameters
62  fAbsorThickness = 1*cm;
63  fAbsorSizeYZ = 1*cm;
66 
67  // materials
69  SetAbsorMaterial("G4_Co");
70 
71  // create commands for interactive definition of the geometry
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78 { delete fDetectorMessenger;}
79 
80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
81 
83 {
84  return ConstructVolumes();
85 }
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88 
90 {
91  // specific element name for thermal neutronHP
92  // (see G4ParticleHPThermalScatteringNames.cc)
93 
94  G4int ncomponents, natoms;
95 
96  // pressurized water
97  G4Element* H = new G4Element("TS_H_of_Water" ,"H" , 1., 1.0079*g/mole);
98  G4Element* O = new G4Element("Oxygen" ,"O" , 8., 16.00*g/mole);
99  G4Material* H2O =
100  new G4Material("Water_ts", 1.000*g/cm3, ncomponents=2,
101  kStateLiquid, 593*kelvin, 150*bar);
102  H2O->AddElement(H, natoms=2);
103  H2O->AddElement(O, natoms=1);
105 
106  // heavy water
107  G4Isotope* H2 = new G4Isotope("H2",1,2);
108  G4Element* D = new G4Element("TS_D_of_Heavy_Water", "D", 1);
109  D->AddIsotope(H2, 100*perCent);
110  G4Material* D2O = new G4Material("HeavyWater", 1.11*g/cm3, ncomponents=2,
111  kStateLiquid, 293.15*kelvin, 1*atmosphere);
112  D2O->AddElement(D, natoms=2);
113  D2O->AddElement(O, natoms=1);
114 
115  // graphite
116  G4Isotope* C12 = new G4Isotope("C12", 6, 12);
117  G4Element* C = new G4Element("TS_C_of_Graphite","C", ncomponents=1);
118  C->AddIsotope(C12, 100.*perCent);
119  G4Material* graphite =
120  new G4Material("graphite", 2.27*g/cm3, ncomponents=1,
121  kStateSolid, 293*kelvin, 1*atmosphere);
122  graphite->AddElement(C, natoms=1);
123 
124  // example of vacuum
125  fWorldMaterial = new G4Material("Galactic", 1, 1.01*g/mole,
127 
129 }
130 
131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
132 
134  G4String symbol, G4double density, G4int Z, G4int A)
135 {
136  // define a material from an isotope
137  //
138  G4int ncomponents;
139  G4double abundance, massfraction;
140 
141  G4Isotope* isotope = new G4Isotope(symbol, Z, A);
142 
143  G4Element* element = new G4Element(name, symbol, ncomponents=1);
144  element->AddIsotope(isotope, abundance= 100.*perCent);
145 
146  G4Material* material = new G4Material(name, density, ncomponents=1);
147  material->AddElement(element, massfraction=100.*perCent);
148 
149  return material;
150 }
151 
152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
153 
155 {
156  // Cleanup old geometry
161 
162  // World
163  //
166 
167  G4Box*
168  sWorld = new G4Box("World", //name
169  fWorldSizeX/2,fWorldSizeYZ/2,fWorldSizeYZ/2); //dimensions
170 
172  lWorld = new G4LogicalVolume(sWorld, //shape
173  fWorldMaterial, //material
174  "World"); //name
175 
176  fWorldVolume = new G4PVPlacement(0, //no rotation
177  G4ThreeVector(), //at (0,0,0)
178  lWorld, //logical volume
179  "World", //name
180  0, //mother volume
181  false, //no boolean operation
182  0); //copy number
183 
184  // Absorber
185  //
186  G4Box* sAbsor = new G4Box("Absorber", //name
187  fAbsorThickness/2, fAbsorSizeYZ/2, fAbsorSizeYZ/2); //dimensions
188 
189  fLAbsor = new G4LogicalVolume(sAbsor, //shape
190  fAbsorMaterial, //material
191  fAbsorMaterial->GetName()); //name
192 
193  new G4PVPlacement(0, //no rotation
194  G4ThreeVector(), //at (0,0,0)
195  fLAbsor, //logical volume
196  fAbsorMaterial->GetName(), //name
197  lWorld, //mother volume
198  false, //no boolean operation
199  0); //copy number
200 
201  PrintParameters();
202 
203  //always return the root volume
204  //
205  return fWorldVolume;
206 }
207 
208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
209 
211 {
212  G4cout << "\n The Absorber is " << G4BestUnit(fAbsorThickness,"Length")
213  << " of " << fAbsorMaterial->GetName()
214  << "\n \n" << fAbsorMaterial << G4endl;
215 }
216 
217 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
218 
220 {
221  // search the material by its name
222  G4Material* pttoMaterial =
223  G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
224 
225  if (pttoMaterial) {
226  fAbsorMaterial = pttoMaterial;
229  } else {
230  G4cout << "\n--> warning from DetectorConstruction::SetMaterial : "
231  << materialChoice << " not found" << G4endl;
232  }
233 }
234 
235 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
236 
238 {
241 }
242 
243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
244 
246 {
249 }
250 
251 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static constexpr double kelvin
Definition: G4SIunits.hh:281
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
const XML_Char * name
Definition: expat.h:151
static constexpr double atmosphere
Definition: G4SIunits.hh:237
static void Clean()
Definition: G4SolidStore.cc:73
CLHEP::Hep3Vector G4ThreeVector
#define G4endl
Definition: G4ios.hh:61
double D(double temp)
static constexpr double perCent
Definition: G4SIunits.hh:332
void SetMeanExcitationEnergy(G4double value)
static constexpr double universe_mean_density
const G4String & GetName() const
Definition: G4Material.hh:179
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
Definition: G4Element.cc:152
Float_t Z
static constexpr double g
Definition: G4SIunits.hh:183
double G4double
Definition: G4Types.hh:76
const XML_Char int const XML_Char * value
Definition: expat.h:331
static G4GeometryManager * GetInstance()
Definition: G4Box.hh:64
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
double A(double temperature)
static constexpr double eV
Definition: G4SIunits.hh:215
void OpenGeometry(G4VPhysicalVolume *vol=0)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static G4SolidStore * GetInstance()
static G4PhysicalVolumeStore * GetInstance()
int G4int
Definition: G4Types.hh:78
void ReinitializeGeometry(G4bool destroyFirst=false, G4bool prop=true)
double C(double temp)
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:368
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:227
void PhysicsHasBeenModified()
G4GLOB_DLL std::ostream G4cout
static constexpr double cm
Definition: G4SIunits.hh:119
void SetMaterial(G4Material *pMaterial)
static constexpr double mole
Definition: G4SIunits.hh:286
#define pascal
static constexpr double bar
Definition: G4SIunits.hh:236
static constexpr double cm3
Definition: G4SIunits.hh:121
static G4LogicalVolumeStore * GetInstance()
static G4NistManager * Instance()
G4Material * MaterialWithSingleIsotope(G4String, G4String, G4double, G4int, G4int)