Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/hadronic/Hadr00/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 109182 2018-04-03 07:18:45Z gcosmo $
30 //
32 //
33 // DetectorConstruction
34 //
35 // Created: 20.06.2008 V.Ivanchenko
36 //
37 // Modified:
38 //
40 //
41 
42 #include "DetectorConstruction.hh"
43 #include "DetectorMessenger.hh"
44 
45 #include "G4Tubs.hh"
46 #include "G4LogicalVolume.hh"
47 #include "G4PVPlacement.hh"
48 
49 #include "G4RunManager.hh"
50 
51 #include "G4GeometryManager.hh"
52 #include "G4PhysicalVolumeStore.hh"
53 #include "G4LogicalVolumeStore.hh"
54 #include "G4SolidStore.hh"
55 
56 #include "G4VisAttributes.hh"
57 #include "G4Colour.hh"
58 
59 #include "G4UnitsTable.hh"
60 #include "G4ios.hh"
61 
62 #include "G4NistManager.hh"
63 
64 #include "G4PhysicalConstants.hh"
65 #include "G4SystemOfUnits.hh"
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
71  fTargetMaterial(nullptr), fWorldMaterial(nullptr),
72  fSolidW(nullptr), fSolidA(nullptr),
73  fLogicTarget(nullptr), fLogicWorld(nullptr),
74  fPhysWorld(nullptr), fPhysList(nullptr)
75 {
77 
78  fRadius = 5.*cm;
79  fLength = 10.*cm;
80 
84 
86 }
87 
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89 
91 {
92  delete fDetectorMessenger;
93 }
94 
96 {
97  // Sizes
100  if(fPhysWorld) {
105  }
106 }
107 
109 {
110  if(fPhysWorld) { return fPhysWorld; }
112 
113  //
114  // World
115  //
116  fSolidW = new G4Tubs("World", 0., fWorldR, 0.5*fWorldZ, 0., twopi);
118  fPhysWorld = new G4PVPlacement(nullptr, G4ThreeVector(0.,0.,0.),
119  fLogicWorld, "World",
120  nullptr, false, 0);
121 
122  //
123  // Target volume
124  //
125  fSolidA = new G4Tubs("Target", 0., fRadius, 0.5*fLength, 0.,twopi);
127  new G4PVPlacement(nullptr, G4ThreeVector(), fLogicTarget, "Target",
128  fLogicWorld, false, 0);
129 
130  G4cout << "### Target consist of "
131  << fTargetMaterial->GetName()
132  << " disks with R(mm)= " << fRadius/mm
133  << " fLength(mm)= " << fLength/mm
134  << " ###" << G4endl;
135 
136  // colors
138 
139  G4VisAttributes* regCcolor = new G4VisAttributes(G4Colour(0., 0.3, 0.7));
140  fLogicTarget->SetVisAttributes(regCcolor);
141 
142  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
143 
144  return fPhysWorld;
145 }
146 
147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
148 
150 {
151  // search the material by its name
153 
154  if (material && material != fTargetMaterial) {
155  fTargetMaterial = material;
158  }
159 }
160 
161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
162 
164 {
165  // search the material by its name
167 
168  if (material && material != fWorldMaterial) {
169  fWorldMaterial = material;
172  }
173 }
174 
176 {
177  if(val > 0.0 && val != fRadius) {
178  fRadius = val;
180  }
181 }
182 
183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
184 
186 {
187  if(val > 0.0 && val != fLength) {
188  fLength = val;
190  }
191 }
192 
193 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
CLHEP::Hep3Vector G4ThreeVector
void SetOuterRadius(G4double newRMax)
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:593
static constexpr double mm
Definition: G4SIunits.hh:115
Definition: G4Tubs.hh:85
#define G4endl
Definition: G4ios.hh:61
static const G4VisAttributes & GetInvisible()
const G4String & GetName() const
Definition: G4Material.hh:179
void SetWorldMaterial(const G4String &materialName)
static constexpr double cm
Definition: SystemOfUnits.h:99
double G4double
Definition: G4Types.hh:76
void SetZHalfLength(G4double newDz)
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static constexpr double twopi
Definition: G4SIunits.hh:76
Float_t mat
void SetVisAttributes(const G4VisAttributes *pVA)
void PhysicsHasBeenModified()
G4GLOB_DLL std::ostream G4cout
static constexpr double cm
Definition: G4SIunits.hh:119
void SetMaterial(G4Material *pMaterial)
static G4NistManager * Instance()