Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/medical/dna/dnaphysics/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$
33 //
36 
37 #include "DetectorConstruction.hh"
38 #include "DetectorMessenger.hh"
39 
40 #include "G4SystemOfUnits.hh"
41 #include "G4UserLimits.hh"
42 #include "G4NistManager.hh"
43 #include "G4RunManager.hh"
44 #include "G4LogicalVolumeStore.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47 
49  G4VUserDetectorConstruction(), fpWaterMaterial(nullptr),
50  fLogicWorld(nullptr),fPhysiWorld(nullptr)
51 {
52  // create commands for interactive definition of the detector
54 }
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
57 
59 {
60  delete fDetectorMessenger;
61 }
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64 
66 
67 {
68  if(fPhysiWorld) { return fPhysiWorld; }
70  return ConstructDetector();
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
74 
76 {
77 
78  // Water is defined from NIST material database
80 
81  G4Material * H2O = man->FindOrBuildMaterial("G4_WATER");
82 
83  /*
84  If one wishes to test other density value for water material,
85  one should use instead:
86  G4Material * H2O = man->BuildMaterialWithNewDensity("G4_WATER_MODIFIED",
87  "G4_WATER",1.100*g/cm3);
88 
89  Note: any string for "G4_WATER_MODIFIED" parameter is accepted
90  and "G4_WATER" parameter should not be changed
91  Both materials are created and can be selected from dna.mac
92  */
93  fpWaterMaterial = H2O;
94 
95  //G4cout << "-> Density of water material (g/cm3)="
96  // << fpWaterMaterial->GetDensity()/(g/cm/cm/cm) << G4endl;
97 
99 }
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
103 {
104  // WORLD VOLUME
106  G4double worldSizeY = worldSizeX;
107  G4double worldSizeZ = worldSizeX;
108 
109  G4Box* solidWorld = new G4Box("World", //its name
110  worldSizeX / 2, worldSizeY / 2, worldSizeZ / 2); //its size
111 
112  fLogicWorld = new G4LogicalVolume(solidWorld, //its solid
113  fpWaterMaterial, //its material
114  "World"); //its name
115 
116  fPhysiWorld = new G4PVPlacement(0, //no rotation
117  G4ThreeVector(), //at (0,0,0)
118  "World", //its name
119  fLogicWorld, //its logical volume
120  0, //its mother volume
121  false, //no boolean operation
122  0); //copy number
123 
124  // Visualization attributes - white
125  G4VisAttributes* worldVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
126  worldVisAtt->SetVisibility(true);
127  fLogicWorld->SetVisAttributes(worldVisAtt);
128 
129  G4VisAttributes* worldVisAtt1 = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0));
130  worldVisAtt1->SetVisibility(true);
131 
132  //
133  // Shows how to introduce a 20 eV tracking cut
134  //
135  //logicWorld->SetUserLimits(new G4UserLimits(DBL_MAX,DBL_MAX,DBL_MAX,20*eV));
136 
137  return fPhysiWorld;
138 }
139 
140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
141 
142 void DetectorConstruction::SetMaterial(G4String materialChoice)
143 {
144  // Search the material by its name
146  materialChoice);
147 
148  if (pttoMaterial)
149  {
150  fpWaterMaterial = pttoMaterial;
151  if(fLogicWorld) {
153  }
155  }
156 }
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
static constexpr double micrometer
Definition: G4SIunits.hh:100
CLHEP::Hep3Vector G4ThreeVector
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:593
#define G4endl
Definition: G4ios.hh:61
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 GeometryHasBeenModified(G4bool prop=true)
void SetVisibility(G4bool=true)
G4GLOB_DLL std::ostream G4cout
void SetMaterial(G4Material *pMaterial)
static G4NistManager * Instance()