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