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