ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PhantomBuilder.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4PhantomBuilder.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 // Previous authors: G. Guerrieri, S. Guatelli and M. G. Pia, INFN Genova, Italy
27 // Authors (since 2007): S. Guatelli, University of Wollongong, Australia
28 //
29 //
30 #include "G4PhantomBuilder.hh"
31 #include "G4VBodyFactory.hh"
32 #include "G4MIRDBodyFactory.hh"
34 #include "G4ORNLMaleBodyFactory.hh"
35 #include "G4RunManager.hh"
36 #include "G4Element.hh"
37 #include "G4Material.hh"
38 #include "G4Box.hh"
39 #include "G4LogicalVolume.hh"
40 #include "G4PVPlacement.hh"
41 #include "G4Colour.hh"
42 #include "G4VisAttributes.hh"
43 
45 {
46  // sex can be "female" or "male"
47  body = 0;
48  motherVolume = 0;
49  headVolume = 0;
50  trunkVolume = 0;
51  leftLegVolume =0;
52  rightLegVolume =0;
54 }
55 
57 {
58 }
60 {
61  if (motherVolume == 0)
62  G4Exception("G4PhantomBuilder::BuildTrunk()", "human_phantom0014", FatalException, "The world volume is missing !!!!!");
63 
64  G4cout <<"MotherVolume: " << motherVolume -> GetName()<< G4endl;
65  G4cout << "sensitivity : "<< sensitivity << G4endl;
66  trunkVolume = body -> CreateOrgan("Trunk", motherVolume, colourName, solidVis, sensitivity);
67 }
68 
70 {
71  if (motherVolume == 0)
72  G4Exception("G4PhantomBuilder::BuildLeftLeg()", "human_phantom0015", FatalException, "The world volume is missing !!!!!");
73 
74  G4cout <<"MotherVolume: " << motherVolume -> GetName()<< G4endl;
75  G4cout << "sensitivity : "<< sensitivity << G4endl;
76  leftLegVolume = body -> CreateOrgan("LeftLeg", motherVolume, colourName, solidVis, sensitivity);
77 }
79 {
80  if (motherVolume == 0)
81  G4Exception("G4PhantomBuilder::BuildRightLeg()", "human_phantom0016", FatalException, "The world volume is missing !!!!!");
82 
83  G4cout <<"MotherVolume: " << motherVolume -> GetName()<< G4endl;
84  G4cout << "sensitivity : "<< sensitivity << G4endl;
85  rightLegVolume = body -> CreateOrgan("RightLeg", motherVolume, colourName, solidVis, sensitivity);
86 }
87 
89 {
90  if (leftLegVolume == 0)
91  G4Exception("G4PhantomBuilder::BuildLeftLegBone()", "human_phantom0017", FatalException, "The left leg volume is missing !!!!!");
92 
93  G4cout <<"MotherVolume: " << leftLegVolume -> GetName()<< G4endl;
94  G4cout << "sensitivity : "<< sensitivity << G4endl;
95  body -> CreateOrgan("LeftLegBone", leftLegVolume,colourName, solidVis, sensitivity);
96 }
97 
99 {
100  if (trunkVolume == 0)
101  G4Exception("G4PhantomBuilder::BuildRightLegBone()", "human_phantom0018", FatalException, "The right leg volume is missing !!!!!");
102 
103  G4cout <<"MotherVolume: " << rightLegVolume -> GetName()<< G4endl;
104  G4cout << "sensitivity : "<< sensitivity << G4endl;
105  body -> CreateOrgan("RightLegBone", rightLegVolume, colourName, solidVis, sensitivity);
106 }
107 
109 {
110  if (trunkVolume == 0)
111  G4Exception("G4PhantomBuilder::BuildLeftArmBone()", "human_phantom0019", FatalException, "The world volume is missing !!!!!");
112 
113  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
114  G4cout << "sensitivity : "<< sensitivity << G4endl;
115  body -> CreateOrgan("LeftArmBone" ,trunkVolume,colourName,solidVis, sensitivity);
116 }
118 {
119  if (trunkVolume == 0)
120  G4Exception("G4PhantomBuilder::BuildRightArmBone()", "human_phantom0020", FatalException, "The trunk volume is missing !!!!!");
121 
122  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
123  G4cout << "sensitivity : "<< sensitivity << G4endl;
124  body -> CreateOrgan("RightArmBone",trunkVolume,colourName,solidVis, sensitivity);
125 }
126 
128 {
129  if (trunkVolume == 0)
130  G4Exception("G4PhantomBuilder::BuildLeftScapula()", "human_phantom0021", FatalException, "The trunk volume is missing !!!!!");
131 
132  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
133  G4cout << "sensitivity : "<< sensitivity << G4endl;
134  body -> CreateOrgan("LeftScapula",trunkVolume,colourName,solidVis, sensitivity);
135 }
136 
138 {
139  if (trunkVolume == 0)
140  G4Exception("G4PhantomBuilder::BuildRightScapula()", "human_phantom0022", FatalException, "The trunk volume is missing !!!!!");
141 
142  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
143  G4cout << "sensitivity : "<< sensitivity << G4endl;
144  body -> CreateOrgan("RightScapula",trunkVolume,colourName,solidVis, sensitivity);
145 }
146 
148 {
149  if (trunkVolume == 0)
150  G4Exception("G4PhantomBuilder::BuildLeftClavicle()", "human_phantom0023", FatalException, "The trunk volume is missing !!!!!");
151 
152  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
153  G4cout << "sensitivity : "<< sensitivity << G4endl;
154  body -> CreateOrgan("LeftClavicle",trunkVolume,colourName,solidVis, sensitivity);
155 }
156 
158 {
159  if (trunkVolume == 0)
160  G4Exception("G4PhantomBuilder::BuildRightClavicle()", "human_phantom0024", FatalException, "The trunk volume is missing !!!!!");
161 
162  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
163  G4cout << "sensitivity : "<< sensitivity << G4endl;
164  body -> CreateOrgan("RightClavicle",trunkVolume,colourName,solidVis, sensitivity);
165 }
166 
167 
169 {
170  if (motherVolume == 0)
171  G4Exception("G4PhantomBuilder::BuildHead()", "human_phantom0025", FatalException, "The mother volume is missing !!!!!");
172 
173  G4cout <<"MotherVolume: " << motherVolume -> GetName()<< G4endl;
174  G4cout << "sensitivity : "<< sensitivity << G4endl;
175  headVolume = body -> CreateOrgan("Head",motherVolume, colourName, solidVis, sensitivity);
176 }
177 
179 {
180  if (headVolume == 0)
181  G4Exception("G4PhantomBuilder::BuildSkull()", "human_phantom0026", FatalException, "The head volume is missing !!!!!");
182 
183  G4cout <<"MotherVolume: " << headVolume -> GetName()<< G4endl;
184  G4cout << "sensitivity : "<< sensitivity << G4endl;
185  body -> CreateOrgan( "Skull",headVolume, colourName, solidVis, sensitivity);
186 }
187 
189 {
190  if (headVolume == 0)
191  G4Exception("G4PhantomBuilder::BuildUpperSpine()", "human_phantom0027", FatalException, "The head volume is missing !!!!!");
192 
193  G4cout <<"MotherVolume: " << headVolume -> GetName()<< G4endl;
194  G4cout << "sensitivity : "<< sensitivity << G4endl;
195  body -> CreateOrgan("UpperSpine",headVolume,colourName, solidVis, sensitivity);
196 }
197 
199 {
200  if (trunkVolume == 0)
201  G4Exception("G4PhantomBuilder::BuildMiddleLowerSpine()", "human_phantom0028", FatalException, "The trunk volume is missing !!!!!");
202 
203  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
204  G4cout << "sensitivity : "<< sensitivity << G4endl;
205  body -> CreateOrgan("MiddleLowerSpine",trunkVolume, colourName, solidVis, sensitivity);
206 }
207 
209 {
210  if (trunkVolume == 0)
211  G4Exception("G4PhantomBuilder::BuildPelvis()", "human_phantom0029", FatalException, "The trunk volume is missing !!!!!");
212 
213  body -> CreateOrgan( "Pelvis",trunkVolume, colourName, solidVis, sensitivity);
214 }
215 
217 {
218  if (headVolume == 0)
219  G4Exception("G4PhantomBuilder::BuildBrain()", "human_phantom0030", FatalException, "The head volume is missing !!!!!");
220 
221  body -> CreateOrgan("Brain",headVolume, colourName, solidVis, sensitivity);
222 }
223 
225 {
226  if (trunkVolume == 0)
227  G4Exception("G4PhantomBuilder::BuildHeart()", "human_phantom0031", FatalException, "The trunk volume is missing !!!!!");
228  body -> CreateOrgan("Heart", trunkVolume,colourName, solidVis, sensitivity);
229 }
230 
232 {
233  if (trunkVolume == 0)
234  G4Exception("G4PhantomBuilder::BuildLeftLung()", "human_phantom0032", FatalException, "The trunk volume is missing !!!!!");
235 
236  body -> CreateOrgan("LeftLung",trunkVolume,colourName,solidVis, sensitivity);
237 }
238 
240 {
241  if (trunkVolume == 0)
242  G4Exception("G4PhantomBuilder::BuildRightLung()", "human_phantom0033", FatalException, "The trunk volume is missing !!!!!");
243 
244  body -> CreateOrgan("RightLung",trunkVolume,colourName, solidVis, sensitivity);
245 }
246 
248 {
249  if (trunkVolume == 0)
250  G4Exception("G4PhantomBuilder::BuildStomach()", "human_phantom0034", FatalException, "The trunk volume is missing !!!!!");
251 
252  body -> CreateOrgan("Stomach",trunkVolume,colourName, solidVis, sensitivity);
253 }
254 
256 {
257  if (trunkVolume == 0)
258  G4Exception("G4PhantomBuilder::BuildRibCage()", "human_phantom0035", FatalException, "The trunk volume is missing !!!!!");
259 
260  body -> CreateOrgan("RibCage",trunkVolume,colourName, solidVis, sensitivity);
261 }
262 
264 {
265  if (trunkVolume == 0)
266  G4Exception("G4PhantomBuilder::BuildSpleen()", "human_phantom0036", FatalException, "The trunk volume is missing !!!!!");
267 
268  body -> CreateOrgan("Spleen", trunkVolume,colourName, solidVis, sensitivity);
269 }
270 
272 {
273  if (trunkVolume == 0)
274  G4Exception("G4PhantomBuilder::BuildUpperLargeIntestine()", "human_phantom0037", FatalException, "The trunk volume is missing !!!!!");
275 
276  body -> CreateOrgan("UpperLargeIntestine",trunkVolume, colourName, solidVis, sensitivity);
277 }
278 
280 {
281  if (trunkVolume == 0)
282  G4Exception("G4PhantomBuilder::BuildLowerLargeIntestine()", "human_phantom0038", FatalException, "The trunk volume is missing !!!!!");
283 
284  body -> CreateOrgan("LowerLargeIntestine", trunkVolume, colourName,solidVis, sensitivity);
285 }
286 
288 {
289  if (trunkVolume == 0)
290  G4Exception("G4PhantomBuilder::BuildSamllIntestine()", "human_phantom0039", FatalException, "The trunk volume is missing !!!!!");
291 
292  body -> CreateOrgan("SmallIntestine",trunkVolume, colourName, solidVis, sensitivity);
293 }
294 
296 {
297  if (trunkVolume == 0)
298  G4Exception("G4PhantomBuilder::BuildLeftKidney()", "human_phantom0040", FatalException, "The trunk volume is missing !!!!!");
299 
300  body -> CreateOrgan("LeftKidney", trunkVolume,colourName, solidVis, sensitivity);
301 }
303 {
304  if (trunkVolume == 0)
305  G4Exception("G4PhantomBuilder::BuildRightKidney()", "human_phantom0041", FatalException, "The trunk volume is missing !!!!!");
306 
307  body -> CreateOrgan("RightKidney",trunkVolume,colourName, solidVis, sensitivity);
308 }
309 
311 {
312  if (trunkVolume == 0)
313  G4Exception("G4PhantomBuilder::BuildLeftAdrenal()", "human_phantom0042", FatalException, "The trunk volume is missing !!!!!");
314 
315  body -> CreateOrgan("LeftAdrenal", trunkVolume,colourName, solidVis, sensitivity);
316 }
317 
319 {
320  if (trunkVolume == 0)
321  G4Exception("G4PhantomBuilder::BuildRightAdrenal()", "human_phantom0043", FatalException, "The trunk volume is missing !!!!!");
322 
323  body -> CreateOrgan("RightAdrenal", trunkVolume,colourName, solidVis, sensitivity);
324 }
325 
326 
328 {
329  if (trunkVolume == 0)
330  G4Exception("G4PhantomBuilder::BuildLiver()", "human_phantom0044", FatalException, "The trunk volume is missing !!!!!");
331 
332  body -> CreateOrgan("Liver", trunkVolume,colourName, solidVis, sensitivity);
333 }
335 {
336  if (trunkVolume == 0)
337  G4Exception("G4PhantomBuilder::BuildPancreas()", "human_phantom0045", FatalException, "The trunk volume is missing !!!!!");
338 
339  body -> CreateOrgan("Pancreas",trunkVolume,colourName, solidVis, sensitivity);
340 }
341 
343 {
344  if (trunkVolume == 0)
345  G4Exception("G4PhantomBuilder::BuildUrinaryBladder()", "human_phantom0046", FatalException, "The trunk volume is missing !!!!!");
346 
347  body -> CreateOrgan("UrinaryBladder",trunkVolume, colourName, solidVis, sensitivity);
348 }
349 
351 {
352  if (headVolume == 0)
353  G4Exception("G4PhantomBuilder::BuildThyroid()", "human_phantom0047", FatalException, "The trunk volume is missing !!!!!");
354 
355  body -> CreateOrgan("Thyroid",headVolume, colourName,solidVis, sensitivity);
356 }
357 
359 {
360  if (trunkVolume == 0)
361  G4Exception("G4PhantomBuilder::BuildThymus()", "human_phantom0048", FatalException, "The trunk volume is missing !!!!!");
362 
363  body -> CreateOrgan("Thymus",trunkVolume, colourName,solidVis, sensitivity);
364 }
365 
366 
368 {
369  return motherVolume;
370 }
371 
373 {
374  motherVolume = mother;
375 }
376 
377 
379 {
380  model = modelFlag;
381 
382  if(model=="MIRD" || model =="MIX") body = new G4MIRDBodyFactory();
383  if(model=="ORNLFemale")
384  {
385 
386 #ifdef G4LIB_USE_GDML
387  body = new G4ORNLFemaleBodyFactory();
388 #else
389  G4cout << model << " Working with GDML only! set G4LIB_USE_GDML 1" << G4endl;
390 #endif
391  }
392 
393  if(model=="ORNLMale")
394  {
395 #ifdef G4LIB_USE_GDML
396  body = new G4ORNLMaleBodyFactory();
397 #else
398  G4cout << model << " Working with GDML only! set G4LIB_USE_GDML 1" << G4endl;
399 #endif
400  }
401 }