Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/medical/dna/microdosimetry/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 publication:
29 // Med. Phys. 37 (2010) 4692-4708
30 // The Geant4-DNA web site is available at http://geant4-dna.org
31 //
32 // $ID$
35 
36 #include "DetectorConstruction.hh"
37 
38 #include "G4SystemOfUnits.hh"
39 #include "G4Region.hh"
40 #include "G4ProductionCuts.hh"
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
46  fpWaterMaterial(0),fpRegion(0)
47 {}
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
52 {}
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
57 
58 {
60  return ConstructDetector();
61 }
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64 
66 {
67 
68  // Water is defined from NIST material database
70  G4Material * H2O = man->FindOrBuildMaterial("G4_WATER");
71 
72  // Default materials in setup.
73  fpWaterMaterial = H2O;
74 
75 }
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
80 {
81  // WORLD VOLUME
82 
84  G4double worldSizeY = 1*mm;
85  G4double worldSizeZ = 1*mm;
86 
87  G4VSolid* solidWorld = new G4Box("World", //its name
88  worldSizeX/2,
89  worldSizeY/2,
90  worldSizeZ/2); //its size
91 
92  G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, //its solid
93  fpWaterMaterial, //its material
94  "World"); //its name
95 
96  G4VPhysicalVolume* physiWorld = new G4PVPlacement(0, //no rotation
97  G4ThreeVector(), //at (0,0,0)
98  "World", //its name
99  logicWorld, //its logical volume
100  0, //its mother volume
101  false, //no boolean operation
102  0); //copy number
103 
104  G4double TargetSizeZ = worldSizeZ*0.05;
105 
106  G4Box* targetSolid = new G4Box("Target", //its name
107  worldSizeX/2,
108  worldSizeY/2,
109  TargetSizeZ/2); //its size
110 
111  G4LogicalVolume* logicTarget =
112  new G4LogicalVolume(targetSolid, //its solid
113  fpWaterMaterial, //its material
114  "Target"); //its name
115 
116  new G4PVPlacement(0, //no rotation
117  G4ThreeVector(), //at (0,0,0)
118  "Target", //its name
119  logicTarget, //its logical volume
120  physiWorld, //its mother volume
121  false, //no boolean operation
122  0); //copy number
123 
124  // Visualization attributes
125 
126  G4VisAttributes* worldVisAtt =
127  new G4VisAttributes(G4Colour(1.0,1.0,1.0)); //White
128  worldVisAtt->SetVisibility(true);
129  logicWorld->SetVisAttributes(worldVisAtt);
130 
131  G4VisAttributes* worldVisAtt1 = new G4VisAttributes(G4Colour(1.0,0.0,0.0));
132  worldVisAtt1->SetVisibility(true);
133  logicTarget->SetVisAttributes(worldVisAtt1);
134 
135  // Create Target G4Region and add logical volume
136 
137  fpRegion = new G4Region("Target");
138 
139  G4ProductionCuts* cuts = new G4ProductionCuts();
140 
141  G4double defCut = 1*nanometer;
142  cuts->SetProductionCut(defCut,"gamma");
143  cuts->SetProductionCut(defCut,"e-");
144  cuts->SetProductionCut(defCut,"e+");
145  cuts->SetProductionCut(defCut,"proton");
146 
148  fpRegion->AddRootLogicalVolume(logicTarget);
149 
150  return physiWorld;
151 }
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:290
void SetProductionCut(G4double cut, G4int index=-1)
CLHEP::Hep3Vector G4ThreeVector
static constexpr double mm
Definition: G4SIunits.hh:115
void SetProductionCuts(G4ProductionCuts *cut)
double G4double
Definition: G4Types.hh:76
Definition: G4Box.hh:64
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
void SetVisAttributes(const G4VisAttributes *pVA)
void SetVisibility(G4bool=true)
static constexpr double nanometer
Definition: G4SIunits.hh:101
static G4NistManager * Instance()