Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/medical/dna/microyz/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 //
26 // This example is provided by the Geant4-DNA collaboration
27 // Any report or published results obtained using the Geant4-DNA software
28 // shall cite the following Geant4-DNA collaboration publications:
29 // Phys. Med. 31 (2015) 861-874
30 // Med. Phys. 37 (2010) 4692-4708
31 // The Geant4-DNA web site is available at http://geant4-dna.org
32 //
35 
36 #include "DetectorConstruction.hh"
37 #include "TrackerSD.hh"
38 
39 #include "G4Material.hh"
40 #include "G4NistManager.hh"
41 
42 #include "G4Box.hh"
43 #include "G4PVPlacement.hh"
44 
45 #include "G4GeometryTolerance.hh"
46 #include "G4GeometryManager.hh"
47 
48 #include "G4SystemOfUnits.hh"
49 #include "G4UserLimits.hh"
50 #include "G4UnitsTable.hh"
51 
52 #include "G4SDManager.hh"
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
58 {
59  fpTrackingCut = 11.*eV;
60 }
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
65 {}
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
70 {
71  // Define materials
73 
74  // Define volumes
75  return DefineVolumes();
76 }
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79 
81 {
82  // Water is defined from NIST material database
84 
85  G4Material * H2O = man->FindOrBuildMaterial("G4_WATER");
86 
87  fpWaterMaterial = H2O;
88 
89  // Print materials
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94 
96 {
97  G4double worldLength = 10*m;
98 
99  // World
100 
102 
103  G4cout << "Computed tolerance = "
105  << " nm" << G4endl;
106 
107  G4Box* worldS
108  = new G4Box("world", //its name
109  worldLength/2,worldLength/2,worldLength/2); //its size
110 
111  G4LogicalVolume* worldLV
112  = new G4LogicalVolume(
113  worldS, //its solid
114  fpWaterMaterial, //its material
115  "World_LV"); //its name
116 
117  G4VPhysicalVolume* worldPV
118  = new G4PVPlacement(
119  0, // no rotation
120  G4ThreeVector(), // at (0,0,0)
121  worldLV, // its logical volume
122  "World", // its name
123  0, // its mother volume
124  false, // no boolean operations
125  0, // copy number
126  false); // checking overlaps
127 
129  fpTrackingCut));
130 
131  PrintParameters();
132 
133  return worldPV;
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137 
139 {
140  // Sensitive detectors
141 
142  G4String trackerChamberSDname = "TrackerChamberSD";
143 
144  TrackerSD* aTrackerSD = new TrackerSD(trackerChamberSDname,
145  "TrackerHitsCollection");
146 
148 
149  // Setting aTrackerSD to all logical volumes with the same name
150  // of "Chamber_LV".
151  SetSensitiveDetector("World_LV", aTrackerSD, true);
152 
153 }
154 
155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
156 
158 {
159  G4cout << "\n---------------------------------------------------------\n";
160  G4cout << "---> The tracking cut is set to "
161  << G4BestUnit(fpTrackingCut,"Energy") << G4endl;
162  G4cout << "\n---------------------------------------------------------\n";
163 }
164 
165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
166 
CLHEP::Hep3Vector G4ThreeVector
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:593
static constexpr double nm
Definition: G4SIunits.hh:112
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
#define G4endl
Definition: G4ios.hh:61
static constexpr double m
Definition: G4SIunits.hh:129
double G4double
Definition: G4Types.hh:76
static G4GeometryManager * GetInstance()
Definition: G4Box.hh:64
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static constexpr double eV
Definition: G4SIunits.hh:215
void SetWorldMaximumExtent(G4double worldExtent)
void SetUserLimits(G4UserLimits *pULimits)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
G4GLOB_DLL std::ostream G4cout
static G4GeometryTolerance * GetInstance()
#define DBL_MAX
Definition: templates.hh:83
G4double GetSurfaceTolerance() const
static G4NistManager * Instance()
Definition of the TrackerSD class.