Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/medical/fanoCavity2/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 103507 2017-04-11 14:15:33Z gcosmo $
30 
31 //
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #include "DetectorConstruction.hh"
36 #include "DetectorMessenger.hh"
37 
38 #include "G4Material.hh"
39 #include "G4Tubs.hh"
40 #include "G4LogicalVolume.hh"
41 #include "G4VPhysicalVolume.hh"
42 #include "G4PVPlacement.hh"
43 
44 #include "G4GeometryManager.hh"
45 #include "G4PhysicalVolumeStore.hh"
46 #include "G4LogicalVolumeStore.hh"
47 #include "G4SolidStore.hh"
48 
49 #include "G4UnitsTable.hh"
50 #include "G4PhysicalConstants.hh"
51 #include "G4SystemOfUnits.hh"
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
56 :fWallMaterial(0),fWall(0),fCavityMaterial(0),fCavity(0),fDetectorMessenger(0)
57 {
58  // default parameter values
59  fWallThickness = 5*cm;
60  fCavityThickness = 2*mm;
61  fWorldRadius = 10*m;
62 
64  SetWallMaterial("Water");
65 
66  // create commands for interactive definition of the detector
68 }
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71 
73 { delete fDetectorMessenger;}
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78 {
79  return ConstructVolumes();
80 }
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
85 {
86 // //
87 // // define Elements - based on a full description of elements and materials
88 // //
89 // G4double z,a;
90 
91 // G4Element* H = new G4Element("Hydrogen" ,"H" , z= 1., a= 1.01*g/mole);
92 // G4Element* O = new G4Element("Oxygen" ,"O" , z= 8., a= 16.00*g/mole);
93 
94 // //
95 // // define materials
96 // //
97 // G4Material* H2O =
98 // new G4Material("Water", 1.0*g/cm3, 2);
99 // H2O->AddElement(H, 2);
100 // H2O->AddElement(O, 1);
101 // H2O->GetIonisation()->SetMeanExcitationEnergy(78.0*eV);
102 
103 // G4Material* gas =
104 // new G4Material("Water_gas", 1.0*mg/cm3, 2);
105 // gas->AddElement(H, 2);
106 // gas->AddElement(O, 1);
107 // gas->GetIonisation()->SetMeanExcitationEnergy(78.0*eV);
108 
109 // new G4Material("Graphite", 6, 12.01*g/mole, 2.265*g/cm3);
110 // new G4Material("Graphite_gas", 6, 12.01*g/mole, 2.265*mg/cm3);
111 
112 // new G4Material("Aluminium", 13, 26.98*g/mole, 2.700*g/cm3);
113 // new G4Material("Aluminium_gas", 13, 26.98*g/mole, 2.700*mg/cm3);
114 
115  // define Elements - using NIST material database
116 
118  H2O->SetName("Water");
120 
122  "Water_gas","G4_WATER_VAPOR", 1.0*mg/cm3);
124 
126  Air->SetName("Air");
127 
129  "G4_GRAPHITE",
130  2.265*g/cm3);
132  "G4_GRAPHITE",
133  2.265*mg/cm3);
134 
136  2.7*g/cm3);
138  "G4_Al", 2.7*mg/cm3);
139 
140 
141 
142 
143 
145 }
146 
147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
148 
150 {
155 
156  // Wall
157  //
159 
160  G4Tubs*
161  sWall = new G4Tubs("Wall", //name
162  0.,fWorldRadius,0.5*fWorldThickness,0.,twopi); //size
163 
165  lWall = new G4LogicalVolume(sWall, //solid
166  fWallMaterial, //material
167  "Wall"); //name
168 
169  fWall = new G4PVPlacement(0, //no rotation
170  G4ThreeVector(), //at (0,0,0)
171  lWall, //logical volume
172  "Wall", //name
173  0, //mother volume
174  false, //no boolean operation
175  0); //copy number
176 
177  // Cavity
178  //
179  G4Tubs*
180  sCavity = new G4Tubs("Cavity",
182 
184  lCavity = new G4LogicalVolume(sCavity, //shape
185  fCavityMaterial, //material
186  "Cavity"); //name
187 
188  fCavity = new G4PVPlacement(0, //no rotation
189  G4ThreeVector(), //at (0,0,0)
190  lCavity, //logical volume
191  "Cavity", //name
192  lWall, //mother volume
193  false, //no boolean operation
194  1); //copy number
195 
196  PrintParameters();
197 
198  //
199  //always return the root volume
200  //
201  return fWall;
202 }
203 
204 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
205 
207 {
208  G4cout << "\n---------------------------------------------------------\n";
209  G4cout << "---> The Wall is " << G4BestUnit(fWallThickness,"Length")
210  << " of " << fWallMaterial->GetName() << " ( "
211  << G4BestUnit(fWallMaterial->GetDensity(),"Volumic Mass") << " )\n";
212  G4cout << " The Cavity is " << G4BestUnit(fCavityThickness,"Length")
213  << " of " << fCavityMaterial->GetName() << " ( "
214  << G4BestUnit(fCavityMaterial->GetDensity(),"Volumic Mass") << " )";
215  G4cout << "\n---------------------------------------------------------\n";
216  G4cout << G4endl;
217 }
218 
219 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
220 
222 {
223  // search the material by its name
224  G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
225  if (pttoMaterial) fWallMaterial = pttoMaterial;
226 
227  pttoMaterial = G4Material::GetMaterial(materialChoice + "_gas");
228  if (pttoMaterial) fCavityMaterial = pttoMaterial;
229 }
230 
231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
232 
234 {
235  fWallThickness = value;
236 }
237 
238 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
239 
241 {
243 
244 }
245 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
246 
248 {
250 }
251 
252 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
253 
254 #include "G4RunManager.hh"
255 
257 {
259 }
260 
261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
static void Clean()
Definition: G4SolidStore.cc:73
CLHEP::Hep3Vector G4ThreeVector
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:593
static constexpr double mm
Definition: G4SIunits.hh:115
Definition: G4Tubs.hh:85
void SetName(const G4String &name)
Definition: G4Material.hh:279
#define G4endl
Definition: G4ios.hh:61
void SetMeanExcitationEnergy(G4double value)
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:608
G4Material * BuildMaterialWithNewDensity(const G4String &name, const G4String &basename, G4double density=0.0, G4double temp=NTP_Temperature, G4double pres=CLHEP::STP_Pressure)
const G4String & GetName() const
Definition: G4Material.hh:179
static constexpr double g
Definition: G4SIunits.hh:183
static constexpr double m
Definition: G4SIunits.hh:129
double G4double
Definition: G4Types.hh:76
const XML_Char int const XML_Char * value
Definition: expat.h:331
static constexpr double mg
Definition: G4SIunits.hh:184
static G4GeometryManager * GetInstance()
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static constexpr double twopi
Definition: G4SIunits.hh:76
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()
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:227
G4GLOB_DLL std::ostream G4cout
static constexpr double cm
Definition: G4SIunits.hh:119
static constexpr double cm3
Definition: G4SIunits.hh:121
static G4LogicalVolumeStore * GetInstance()
static G4NistManager * Instance()
G4double GetDensity() const
Definition: G4Material.hh:181