ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 //
26 // This example is provided by the Geant4-DNA collaboration
27 // Any report or published results obtained using the Geant4-DNA software
28 // shall cite the following Geant4-DNA collaboration publications:
29 // Med. Phys. 37 (2010) 4692-4708
30 // Phys. Med. 31 (2015) 861-874
31 // The Geant4-DNA web site is available at http://geant4-dna.org
32 //
35 
36 #include "DetectorConstruction.hh"
37 #include "DetectorMessenger.hh"
38 
39 #include "G4NistManager.hh"
40 #include "G4Sphere.hh"
41 #include "G4LogicalVolume.hh"
42 #include "G4VPhysicalVolume.hh"
43 #include "G4PVPlacement.hh"
44 #include "G4PVReplica.hh"
45 
46 #include "G4GeometryManager.hh"
47 #include "G4PhysicalVolumeStore.hh"
48 #include "G4LogicalVolumeStore.hh"
49 #include "G4SolidStore.hh"
50 #include "G4RunManager.hh"
51 
52 #include "G4UnitsTable.hh"
53 #include "G4PhysicalConstants.hh"
54 #include "G4SystemOfUnits.hh"
55 #include "G4UserLimits.hh"
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
61  fNuclMaterial(0),
62  fCytoMaterial(0),
63  fWorldMaterial(0),
64  fNucl(0),
65  fCyto(0),
66  fWorld(0),
67  fDetectorMessenger(0)
68 
69 {
70  //default tracking cut
71  fTrackingCut = 7.4*eV;
72 
73  // default parameter values
74  fWorldRadius = 10*m;
75  fCytoThickness = 20*nm;
76  fNuclRadius = 10*nm;
77 
79  SetWorldMaterial("G4_WATER");
80  //SetWorldMaterial("G4_Galactic");
81  SetCytoMaterial("G4_WATER");
82  SetNuclMaterial("G4_WATER");
83 
84  // create commands for interactive definition of the detector
86 }
87 
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89 
91 { delete fDetectorMessenger;}
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94 
96 {
97  return ConstructVolumes();
98 }
99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101 
103 {
105 
106  man->FindOrBuildMaterial("G4_WATER");
107  man->FindOrBuildMaterial("G4_Galactic");
108 }
109 
110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
111 
113 {
118 
119  // Spherical world
120  //
121  G4Sphere*
122  sWorld = new G4Sphere("World",
123  0.,
124  1000*fNuclRadius,
125  0.,
126  twopi,
127  0.,
128  pi);
129 
130  fLogicalWorld = new G4LogicalVolume(sWorld,
132  "World");
133 
134  fWorld = new G4PVPlacement(0,
135  G4ThreeVector(),
136  fLogicalWorld,
137  "World",
138  0,
139  false,
140  0);
141 
142  // Spherical nucleus
143  //
144  G4Sphere*
145  sNucl = new G4Sphere("Nucl",
146  0.,
147  fNuclRadius,
148  0.,
149  twopi,
150  0.,
151  pi);
152 
153  fLogicalNucl = new G4LogicalVolume(sNucl,
154  fNuclMaterial,
155  "Nucl");
156 
157  fNucl = new G4PVPlacement(0,
158  G4ThreeVector(),
159  "Nucl",
160  fLogicalNucl,
161  fWorld,
162  false,
163  0);
164 
165  // Spherical shell for cytoplasm
166  //
167  G4Sphere*
168  sCyto = new G4Sphere("Cyto",
169  fNuclRadius,
171  0.,
172  twopi,
173  0.,
174  pi);
175 
176  fLogicalCyto = new G4LogicalVolume(sCyto,
177  fCytoMaterial,
178  "Cyto");
179 
180  fCyto = new G4PVPlacement(0,
181  G4ThreeVector(),
182  "Cyto",
183  fLogicalCyto,
184  fWorld,
185  false,
186  0);
187  //
188 
189  PrintParameters();
190 
191  // Tracking cut
192  //
194  fTrackingCut));
196  fTrackingCut));
198  fTrackingCut));
199 
200  //
201  //always return the root volume
202  //
203  return fWorld;
204 }
205 
206 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
207 
209 {
210  G4cout << "\n---------------------------------------------------------\n";
211  G4cout << "---> The tracking cut is set to "
212  << G4BestUnit(fTrackingCut,"Energy") << G4endl;
213  G4cout << "---> The World is a sphere of "
214  << G4BestUnit(1000*fNuclRadius,"Length") << "radius of "
215  << fWorldMaterial->GetName() << G4endl;
216  G4cout << "---> The Nucleus is a sphere of "
217  << G4BestUnit(fNuclRadius,"Length") << "radius of "
218  << fWorldMaterial->GetName() << " of mass "
219  << G4BestUnit(GetNuclMass(),"Mass") << G4endl;
220  G4cout << "---> The Cytoplasm is a spherical shell of thickness "
221  << G4BestUnit(fCytoThickness,"Length") << "of "
222  << fWorldMaterial->GetName() << " of mass "
223  << G4BestUnit(GetCytoMass(),"Mass") << G4endl;
224  G4cout << "\n---------------------------------------------------------\n";
225 }
226 
227 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
228 
230 {
233 }
234 
235 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
236 
238 {
239  fNuclRadius = value;
241 }
242 
243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
244 
246 {
249 }
250 
251 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
252 
254 {
255  // search the material by its name
256  G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
257  if (pttoMaterial) fWorldMaterial = pttoMaterial;
260 }
261 
262 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
263 
265 {
266  // search the material by its name
267  G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
268  if (pttoMaterial) fCytoMaterial = pttoMaterial;
271 }
272 
273 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
274 
276 {
277  // search the material by its name
278  G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
279  if (pttoMaterial) fNuclMaterial = pttoMaterial;
282 }
283