Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/medical/fanoCavity/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 103257 2017-03-23 08:54:31Z 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  fCavityThickness = 2*mm;
60  fCavityRadius = 1*cm;
61 
62  fWallThickness = 5*mm;
63 
65  SetWallMaterial("Water");
66  SetCavityMaterial("Water_vapor");
67 
68  // create commands for interactive definition of the detector
70 }
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 { delete fDetectorMessenger;}
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
80 {
81  return ConstructVolumes();
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
87 {
88  //
89  // define materials
90  //
91 
93  H2O->SetName("Water");
95 
97  "Water_vapor","G4_WATER_VAPOR", 1.0*mg/cm3);
99 
101  Air->SetName("Air");
102 
104  "G4_GRAPHITE",
105  2.265*g/cm3);
107  "G4_GRAPHITE",
108  2.265*mg/cm3);
109 
111  2.7*g/cm3);
113  "G4_Al", 2.7*mg/cm3);
114 
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {
126 
127  // Chamber
128  //
131 
132  G4Tubs*
133  sChamber = new G4Tubs("Chamber", //name
134  0.,fWallRadius,0.5*fTotalThickness,0.,twopi); //size
135 
137  lChamber = new G4LogicalVolume(sChamber, //solid
138  fWallMaterial, //material
139  "Chamber"); //name
140 
141  fWall = new G4PVPlacement(0, //no rotation
142  G4ThreeVector(), //at (0,0,0)
143  lChamber, //logical volume
144  "Wall", //name
145  0, //mother volume
146  false, //no boolean operation
147  0); //copy number
148 
149  // Cavity
150  //
151  G4Tubs*
152  sCavity = new G4Tubs("Cavity",
154 
156  lCavity = new G4LogicalVolume(sCavity, //shape
157  fCavityMaterial, //material
158  "Cavity"); //name
159 
160  fCavity = new G4PVPlacement(0, //no rotation
161  G4ThreeVector(), //at (0,0,0)
162  lCavity, //logical volume
163  "Cavity", //name
164  lChamber, //mother volume
165  false, //no boolean operation
166  1); //copy number
167 
168  PrintParameters();
169 
170  //
171  //always return the root volume
172  //
173  return fWall;
174 }
175 
176 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
177 
179 {
180  G4cout << "\n---------------------------------------------------------\n";
181  G4cout << "---> The Wall is " << G4BestUnit(fWallThickness,"Length")
182  << " of " << fWallMaterial->GetName() << " ( "
183  << G4BestUnit(fWallMaterial->GetDensity(),"Volumic Mass") << " )\n";
184  G4cout << " The Cavity is " << G4BestUnit(fCavityThickness,"Length")
185  << " of " << fCavityMaterial->GetName() << " ( "
186  << G4BestUnit(fCavityMaterial->GetDensity(),"Volumic Mass") << " )";
187  G4cout << "\n---------------------------------------------------------\n";
188  G4cout << G4endl;
189 }
190 
191 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
192 
194 {
195  fWallThickness = value;
196 }
197 
198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
199 
201 {
202  // search the material by its name
203  G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
204  if (pttoMaterial) fWallMaterial = pttoMaterial;
205 }
206 
207 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
208 
210 {
212 }
213 
214 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
215 
217 {
219 }
220 
221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
222 
224 {
225  // search the material by its name
226  G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
227  if (pttoMaterial) fCavityMaterial = pttoMaterial;
228 }
229 
230 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
231 
232 #include "G4RunManager.hh"
233 
235 {
237 }
238 
239 //....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
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