Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/radioactivedecay/rdecay02/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 
38 #include "G4Material.hh"
39 #include "G4NistManager.hh"
40 
41 #include "G4Tubs.hh"
42 #include "G4LogicalVolume.hh"
43 #include "G4PVPlacement.hh"
44 
45 #include "G4GeometryManager.hh"
46 #include "G4PhysicalVolumeStore.hh"
47 #include "G4LogicalVolumeStore.hh"
48 #include "G4SolidStore.hh"
49 #include "G4RunManager.hh"
50 
51 #include "G4SystemOfUnits.hh"
52 #include "G4PhysicalConstants.hh"
53 #include "G4UnitsTable.hh"
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56 
59  fTargetMater(0), fLogicTarget(0),
60  fDetectorMater(0), fLogicDetector(0),
61  fWorldMater(0), fPhysiWorld(0),
62  fDetectorMessenger(0)
63 {
64  fTargetLength = 1*cm;
65  fTargetRadius = 0.5*cm;
66  fDetectorLength = 5*cm;
68 
71 
73 
75 }
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
80 { delete fDetectorMessenger;}
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
85 {
86  return ConstructVolumes();
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
90 
92 {
93  // build materials
94  //
96  new G4Material("Germanium", 32, 72.61*g/mole, 5.323*g/cm3);
97 
98 
99  G4Element* N = new G4Element("Nitrogen", "N", 7, 14.01*g/mole);
100  G4Element* O = new G4Element("Oxygen", "O", 8, 16.00*g/mole);
101  //
102  G4int ncomponents; G4double fractionmass;
103  G4Material* Air20 = new G4Material("Air", 1.205*mg/cm3, ncomponents=2,
104  kStateGas, 293.*kelvin, 1.*atmosphere);
105  Air20->AddElement(N, fractionmass=0.7);
106  Air20->AddElement(O, fractionmass=0.3);
107  //
108  fWorldMater = Air20;
109 
110  // or use G4 materials data base
111  //
113  fTargetMater = man->FindOrBuildMaterial("G4_CESIUM_IODIDE");
114 
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {
122  // Cleanup old geometry
127 
128  // World
129  //
130  // (re) compute World dimensions if necessary
133 
134  G4Tubs*
135  sWorld = new G4Tubs("World", //name
136  0.,fWorldRadius, 0.5*fWorldLength, 0.,twopi); //dimensions
137 
139  lWorld = new G4LogicalVolume(sWorld, //shape
140  fWorldMater, //material
141  "World"); //name
142 
143  fPhysiWorld = new G4PVPlacement(0, //no rotation
144  G4ThreeVector(), //at (0,0,0)
145  lWorld, //logical volume
146  "World", //name
147  0, //mother volume
148  false, //no boolean operation
149  0); //copy number
150 
151  // Target
152  //
153  G4Tubs*
154  sTarget = new G4Tubs("Target", //name
155  0., fTargetRadius, 0.5*fTargetLength, 0.,twopi); //dimensions
156 
157 
158  fLogicTarget = new G4LogicalVolume(sTarget, //shape
159  fTargetMater, //material
160  "Target"); //name
161 
162  new G4PVPlacement(0, //no rotation
163  G4ThreeVector(), //at (0,0,0)
164  fLogicTarget, //logical volume
165  "Target", //name
166  lWorld, //mother volume
167  false, //no boolean operation
168  0); //copy number
169 
170  // Detector
171  //
172  G4Tubs*
173  sDetector = new G4Tubs("Detector",
175 
176 
177  fLogicDetector = new G4LogicalVolume(sDetector, //shape
178  fDetectorMater, //material
179  "Detector"); //name
180 
181  new G4PVPlacement(0, //no rotation
182  G4ThreeVector(), //at (0,0,0)
183  fLogicDetector, //logical volume
184  "Detector", //name
185  lWorld, //mother volume
186  false, //no boolean operation
187  0); //copy number
188 
189 
190  PrintParameters();
191 
192  //always return the root volume
193  //
194  return fPhysiWorld;
195 }
196 
197 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
198 
200 {
201  G4cout << "\n Target : Length = " << G4BestUnit(fTargetLength,"Length")
202  << " Radius = " << G4BestUnit(fTargetRadius,"Length")
203  << " Material = " << fTargetMater->GetName();
204  G4cout << "\n Detector : Length = " << G4BestUnit(fDetectorLength,"Length")
205  << " Tickness = " << G4BestUnit(fDetectorThickness,"Length")
206  << " Material = " << fDetectorMater->GetName() << G4endl;
207  G4cout << "\n" << fTargetMater << "\n" << fDetectorMater << G4endl;
208 }
209 
210 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
211 
213 {
214  // search the material by its name
215  G4Material* pttoMaterial =
216  G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
217 
218  if (pttoMaterial) {
219  fTargetMater = pttoMaterial;
222  } else {
223  G4cout << "\n--> warning from DetectorConstruction::SetTargetMaterial : "
224  << materialChoice << " not found" << G4endl;
225  }
226 }
227 
228 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
229 
231 {
232  // search the material by its name
233  G4Material* pttoMaterial =
234  G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
235 
236  if (pttoMaterial) {
237  fDetectorMater = pttoMaterial;
240  } else {
241  G4cout << "\n--> warning from DetectorConstruction::SetDetectorMaterial : "
242  << materialChoice << " not found" << G4endl;
243  }
244 }
245 
246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
247 
249 {
252 }
253 
254 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
255 
257 {
260 }
261 
262 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
263 
265 {
266  fDetectorThickness = value;
268 }
269 
270 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
271 
273 {
276 }
277 
278 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
279 
281 {
282  return fTargetLength;
283 }
284 
285 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
286 
288 {
289  return fTargetRadius;
290 }
291 
292 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
293 
295 {
296  return fTargetMater;
297 }
298 
299 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
300 
302 {
303  return fLogicTarget;
304 }
305 
306 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
307 
309 {
310  return fDetectorLength;
311 }
312 
313 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
314 
316 {
317  return fDetectorThickness;
318 }
319 
320 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
321 
323 {
324  return fDetectorMater;
325 }
326 
327 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
328 
330 {
331  return fLogicDetector;
332 }
333 
334 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static constexpr double kelvin
Definition: G4SIunits.hh:281
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
T max(const T t1, const T t2)
brief Return the largest of the two arguments
static constexpr double atmosphere
Definition: G4SIunits.hh:237
static void Clean()
Definition: G4SolidStore.cc:73
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Tubs.hh:85
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
Definition: G4Material.hh:179
static constexpr double g
Definition: G4SIunits.hh:183
double G4double
Definition: G4Types.hh:76
**D E S C R I P T I O N
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
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)
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:368
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
static constexpr double cm3
Definition: G4SIunits.hh:121
static G4LogicalVolumeStore * GetInstance()
static G4NistManager * Instance()