Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
extended/analysis/B1Con/src/B1DetectorConstruction.cc
Go to the documentation of this file.
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: B1DetectorConstruction.cc 69565 2013-05-08 12:35:31Z gcosmo $
27 //
28 /// \file B1DetectorConstruction.cc
29 /// \brief Implementation of the B1DetectorConstruction class
30 
31 #include "B1DetectorConstruction.hh"
32 
33 #include "G4RunManager.hh"
34 #include "G4NistManager.hh"
35 #include "G4Box.hh"
36 #include "G4Cons.hh"
37 #include "G4Orb.hh"
38 #include "G4Sphere.hh"
39 #include "G4Trd.hh"
40 #include "G4LogicalVolume.hh"
41 #include "G4PVPlacement.hh"
42 #include "G4SystemOfUnits.hh"
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 
48  fScoringVolume(0)
49 { }
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52 
54 { }
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59 {
60  // Get nist material manager
62 
63  // Envelope parameters
64  //
65  G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm;
66  G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER");
67 
68  // Option to switch on/off checking of volumes overlaps
69  //
70  G4bool checkOverlaps = true;
71 
72  //
73  // World
74  //
75  G4double world_sizeXY = 1.2*env_sizeXY;
76  G4double world_sizeZ = 1.2*env_sizeZ;
77  G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
78 
79  G4Box* solidWorld =
80  new G4Box("World", //its name
81  0.5*world_sizeXY, 0.5*world_sizeXY, 0.5*world_sizeZ); //its size
82 
83  G4LogicalVolume* logicWorld =
84  new G4LogicalVolume(solidWorld, //its solid
85  world_mat, //its material
86  "World"); //its name
87 
88  G4VPhysicalVolume* physWorld =
89  new G4PVPlacement(0, //no rotation
90  G4ThreeVector(), //at (0,0,0)
91  logicWorld, //its logical volume
92  "World", //its name
93  0, //its mother volume
94  false, //no boolean operation
95  0, //copy number
96  checkOverlaps); //overlaps checking
97 
98  //
99  // Envelope
100  //
101  G4Box* solidEnv =
102  new G4Box("Envelope", //its name
103  0.5*env_sizeXY, 0.5*env_sizeXY, 0.5*env_sizeZ); //its size
104 
105  G4LogicalVolume* logicEnv =
106  new G4LogicalVolume(solidEnv, //its solid
107  env_mat, //its material
108  "Envelope"); //its name
109 
110  new G4PVPlacement(0, //no rotation
111  G4ThreeVector(), //at (0,0,0)
112  logicEnv, //its logical volume
113  "Envelope", //its name
114  logicWorld, //its mother volume
115  false, //no boolean operation
116  0, //copy number
117  checkOverlaps); //overlaps checking
118 
119  //
120  // Shape 1
121  //
122 
123  G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_A-150_TISSUE");
124  G4ThreeVector pos1 = G4ThreeVector(0, 2*cm, -7*cm);
125 
126  // Conical section shape
127  G4double shape1_rmina = 0.*cm, shape1_rmaxa = 2.*cm;
128  G4double shape1_rminb = 0.*cm, shape1_rmaxb = 4.*cm;
129  G4double shape1_hz = 3.*cm;
130  G4double shape1_phimin = 0.*deg, shape1_phimax = 360.*deg;
131  G4Cons* solidShape1 =
132  new G4Cons("Shape1",
133  shape1_rmina, shape1_rmaxa, shape1_rminb, shape1_rmaxb, shape1_hz,
134  shape1_phimin, shape1_phimax);
135 /*
136  // Full sphere shape
137  G4double shape1_rmax = 4*cm;
138  G4Orb* solidShape1 =
139  new G4Orb("Shape1", //its name
140  shape1_rmax); //its size
141 
142  // Sphere shape
143  G4double shape1_rmin = 0*cm, shape1_rmax = 4*cm;
144  G4double shape1_thetamin = 0.*deg, shape1_thetamax = 180.*deg;
145  G4double shape1_phimin = 0.*deg, shape1_phimax = 360.*deg;
146  G4Sphere* solidShape1 =
147  new G4Sphere("Shape1", //its name
148  shape1_rmin, shape1_rmax, //its size
149  shape1_phimin, shape1_phimax, //phi angle
150  shape1_thetamin, shape1_thetamax); //theta angle
151 
152  // Box shape
153  G4double shape1_dx = 8*cm, shape1_dy = 8*cm, shape1_dz = 8*cm;
154  G4Box* solidShape1 =
155  new G4Box("Shape1", //its name
156  0.5*shape1_dx, 0.5*shape1_dy, 0.5*shape1_dz); //its size
157 */
158 
159  G4LogicalVolume* logicShape1 =
160  new G4LogicalVolume(solidShape1, //its solid
161  shape1_mat, //its material
162  "Shape1"); //its name
163 
164  new G4PVPlacement(0, //no rotation
165  pos1, //at position
166  logicShape1, //its logical volume
167  "Shape1", //its name
168  logicEnv, //its mother volume
169  false, //no boolean operation
170  0, //copy number
171  checkOverlaps); //overlaps checking
172 
173 
174  //
175  // Shape 2
176  //
177  G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_BONE_COMPACT_ICRU");
178  G4ThreeVector pos2 = G4ThreeVector(0, -1*cm, 7*cm);
179 /*
180  // Shape 2 - conical section shape
181  G4double shape2_rmina = 0.*cm, shape2_rmaxa = 5.*cm;
182  G4double shape2_rminb = 0.*cm, shape2_rmaxb = 8.*cm;
183  G4double shape2_hz = 3.*cm;
184  G4double shape2_phimin = 0.*deg, shape2_phimax = 360.*deg;
185  G4Cons* solidShape2 =
186  new G4Cons("Shape2",
187  shape2_rmina, shape2_rmaxa, shape2_rminb, shape2_rmaxb, shape2_hz,
188  shape2_phimin, shape2_phimax);
189 */
190 
191  // Trapezoid shape
192  G4double shape2_dxa = 12*cm, shape2_dxb = 12*cm;
193  G4double shape2_dya = 10*cm, shape2_dyb = 16*cm;
194  G4double shape2_dz = 6*cm;
195  G4Trd* solidShape2 =
196  new G4Trd("Shape2", //its name
197  0.5*shape2_dxa, 0.5*shape2_dxb,
198  0.5*shape2_dya, 0.5*shape2_dyb, 0.5*shape2_dz); //its size
199 
200  G4LogicalVolume* logicShape2 =
201  new G4LogicalVolume(solidShape2, //its solid
202  shape2_mat, //its material
203  "Shape2"); //its name
204 
205  new G4PVPlacement(0, //no rotation
206  pos2, //at position
207  logicShape2, //its logical volume
208  "Shape2", //its name
209  logicEnv, //its mother volume
210  false, //no boolean operation
211  0, //copy number
212  checkOverlaps); //overlaps checking
213 
214  // Set Shape2 as scoring volume
215  //
216  fScoringVolume = logicShape2;
217 
218  //
219  //always return the physical World
220  //
221  return physWorld;
222 }
223 
224 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:63
Definition: G4Trd.hh:71
static G4NistManager * Instance()
bool G4bool
Definition: G4Types.hh:79
Definition: G4Cons.hh:82
virtual G4VPhysicalVolume * Construct()
double G4double
Definition: G4Types.hh:76