Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
B4b/src/B4DetectorConstruction.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 // $Id: B4DetectorConstruction.cc 101905 2016-12-07 11:34:39Z gunter $
27 //
30 
31 #include "B4DetectorConstruction.hh"
32 
33 #include "G4Material.hh"
34 #include "G4NistManager.hh"
35 
36 #include "G4Box.hh"
37 #include "G4LogicalVolume.hh"
38 #include "G4PVPlacement.hh"
39 #include "G4PVReplica.hh"
41 #include "G4AutoDelete.hh"
42 
43 #include "G4GeometryManager.hh"
44 #include "G4PhysicalVolumeStore.hh"
45 #include "G4LogicalVolumeStore.hh"
46 #include "G4SolidStore.hh"
47 
48 #include "G4VisAttributes.hh"
49 #include "G4Colour.hh"
50 
51 #include "G4PhysicalConstants.hh"
52 #include "G4SystemOfUnits.hh"
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60 
63  fAbsorberPV(nullptr),
64  fGapPV(nullptr),
65  fCheckOverlaps(true)
66 {
67 }
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
72 {
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78 {
79  // Define materials
81 
82  // Define volumes
83  return DefineVolumes();
84 }
85 
86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87 
89 {
90  // Lead material defined using NIST Manager
91  auto nistManager = G4NistManager::Instance();
92  nistManager->FindOrBuildMaterial("G4_Pb");
93 
94  // Liquid argon material
95  G4double a; // mass of a mole;
96  G4double z; // z=mean number of protons;
97  G4double density;
98  new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
99  // The argon by NIST Manager is a gas with a different density
100 
101  // Vacuum
102  new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
103  kStateGas, 2.73*kelvin, 3.e-18*pascal);
104 
105  // Print materials
107 }
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
110 
112 {
113  // Geometry parameters
114  G4int nofLayers = 10;
115  G4double absoThickness = 10.*mm;
116  G4double gapThickness = 5.*mm;
117  G4double calorSizeXY = 10.*cm;
118 
119  auto layerThickness = absoThickness + gapThickness;
120  auto calorThickness = nofLayers * layerThickness;
121  auto worldSizeXY = 1.2 * calorSizeXY;
122  auto worldSizeZ = 1.2 * calorThickness;
123 
124  // Get materials
125  auto defaultMaterial = G4Material::GetMaterial("Galactic");
126  auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
127  auto gapMaterial = G4Material::GetMaterial("liquidArgon");
128 
129  if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
131  msg << "Cannot retrieve materials already defined.";
132  G4Exception("B4DetectorConstruction::DefineVolumes()",
133  "MyCode0001", FatalException, msg);
134  }
135 
136  //
137  // World
138  //
139  auto worldS
140  = new G4Box("World", // its name
141  worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
142 
143  auto worldLV
144  = new G4LogicalVolume(
145  worldS, // its solid
146  defaultMaterial, // its material
147  "World"); // its name
148 
149  auto worldPV
150  = new G4PVPlacement(
151  0, // no rotation
152  G4ThreeVector(), // at (0,0,0)
153  worldLV, // its logical volume
154  "World", // its name
155  0, // its mother volume
156  false, // no boolean operation
157  0, // copy number
158  fCheckOverlaps); // checking overlaps
159 
160  //
161  // Calorimeter
162  //
163  auto calorimeterS
164  = new G4Box("Calorimeter", // its name
165  calorSizeXY/2, calorSizeXY/2, calorThickness/2); // its size
166 
167  auto calorLV
168  = new G4LogicalVolume(
169  calorimeterS, // its solid
170  defaultMaterial, // its material
171  "Calorimeter"); // its name
172 
173  new G4PVPlacement(
174  0, // no rotation
175  G4ThreeVector(), // at (0,0,0)
176  calorLV, // its logical volume
177  "Calorimeter", // its name
178  worldLV, // its mother volume
179  false, // no boolean operation
180  0, // copy number
181  fCheckOverlaps); // checking overlaps
182 
183  //
184  // Layer
185  //
186  auto layerS
187  = new G4Box("Layer", // its name
188  calorSizeXY/2, calorSizeXY/2, layerThickness/2); // its size
189 
190  auto layerLV
191  = new G4LogicalVolume(
192  layerS, // its solid
193  defaultMaterial, // its material
194  "Layer"); // its name
195 
196  new G4PVReplica(
197  "Layer", // its name
198  layerLV, // its logical volume
199  calorLV, // its mother
200  kZAxis, // axis of replication
201  nofLayers, // number of replica
202  layerThickness); // witdth of replica
203 
204  //
205  // Absorber
206  //
207  auto absorberS
208  = new G4Box("Abso", // its name
209  calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
210 
211  auto absorberLV
212  = new G4LogicalVolume(
213  absorberS, // its solid
214  absorberMaterial, // its material
215  "Abso"); // its name
216 
218  = new G4PVPlacement(
219  0, // no rotation
220  G4ThreeVector(0., 0., -gapThickness/2), // its position
221  absorberLV, // its logical volume
222  "Abso", // its name
223  layerLV, // its mother volume
224  false, // no boolean operation
225  0, // copy number
226  fCheckOverlaps); // checking overlaps
227 
228  //
229  // Gap
230  //
231  auto gapS
232  = new G4Box("Gap", // its name
233  calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
234 
235  auto gapLV
236  = new G4LogicalVolume(
237  gapS, // its solid
238  gapMaterial, // its material
239  "Gap"); // its name
240 
241  fGapPV
242  = new G4PVPlacement(
243  0, // no rotation
244  G4ThreeVector(0., 0., absoThickness/2), // its position
245  gapLV, // its logical volume
246  "Gap", // its name
247  layerLV, // its mother volume
248  false, // no boolean operation
249  0, // copy number
250  fCheckOverlaps); // checking overlaps
251 
252  //
253  // print parameters
254  //
255  G4cout
256  << G4endl
257  << "------------------------------------------------------------" << G4endl
258  << "---> The calorimeter is " << nofLayers << " layers of: [ "
259  << absoThickness/mm << "mm of " << absorberMaterial->GetName()
260  << " + "
261  << gapThickness/mm << "mm of " << gapMaterial->GetName() << " ] " << G4endl
262  << "------------------------------------------------------------" << G4endl;
263 
264  //
265  // Visualization attributes
266  //
267  worldLV->SetVisAttributes (G4VisAttributes::GetInvisible());
268 
269  auto simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
270  simpleBoxVisAtt->SetVisibility(true);
271  calorLV->SetVisAttributes(simpleBoxVisAtt);
272 
273  //
274  // Always return the physical World
275  //
276  return worldPV;
277 }
278 
279 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
280 
282 {
283  // Create global magnetic field messenger.
284  // Uniform magnetic field is then created automatically if
285  // the field value is not zero.
286  G4ThreeVector fieldValue;
289 
290  // Register the field messenger for deleting
292 }
293 
294 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static constexpr double kelvin
Definition: G4SIunits.hh:281
static G4ThreadLocal G4GlobalMagFieldMessenger * fMagFieldMessenger
CLHEP::Hep3Vector G4ThreeVector
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:45
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
virtual G4VPhysicalVolume * Construct()
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:593
static constexpr double mm
Definition: G4SIunits.hh:115
#define G4endl
Definition: G4ios.hh:61
Double_t z
void SetVerboseLevel(G4int verboseLevel)
static constexpr double universe_mean_density
#define G4ThreadLocal
Definition: tls.hh:69
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:608
void Register(T *inst)
Definition: G4AutoDelete.hh:65
static const G4VisAttributes & GetInvisible()
static constexpr double g
Definition: G4SIunits.hh:183
double G4double
Definition: G4Types.hh:76
Definition: G4Box.hh:64
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
int G4int
Definition: G4Types.hh:78
static constexpr double cm
Definition: G4SIunits.hh:119
G4GLOB_DLL std::ostream G4cout
static constexpr double mole
Definition: G4SIunits.hh:286
#define pascal
static constexpr double cm3
Definition: G4SIunits.hh:121
static G4NistManager * Instance()