Geant4  10.00.p01
G4PhantomBuilder.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 // Authors: S. Guatelli and M. G. Pia, INFN Genova and F. Ambroglini INFN Perugia, Italy
27 //
28 // Based on code developed by the undergraduate student G. Guerrieri
29 // Note: this is a preliminary beta-version of the code; an improved
30 // version will be distributed in the next Geant4 public release, compliant
31 // with the design in a forthcoming publication, and subject to a
32 // design and code review.
33 //
34 #include "G4PhantomBuilder.hh"
35 #include "G4VBodyFactory.hh"
36 #include "G4MIRDBodyFactory.hh"
38 #include "G4ORNLMaleBodyFactory.hh"
39 #include "G4RunManager.hh"
40 #include "G4Element.hh"
41 #include "G4Material.hh"
42 #include "G4Box.hh"
43 #include "G4LogicalVolume.hh"
44 #include "G4PVPlacement.hh"
45 #include "G4Colour.hh"
46 #include "G4VisAttributes.hh"
47 
49 {
50  // sex can be "female" or "male"
51  body = 0;
52  motherVolume = 0;
53  headVolume = 0;
54  trunkVolume = 0;
55  leftLegVolume =0;
56  rightLegVolume =0;
58 }
59 
61 {
62 }
63 void G4PhantomBuilder::BuildTrunk(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
64 {
65  if (motherVolume == 0)
66  G4Exception("G4PhantomBuilder::BuildTrunk()", "human_phantom0014", FatalException, "The world volume is missing !!!!!");
67 
68  G4cout <<"MotherVolume: " << motherVolume -> GetName()<< G4endl;
69  G4cout << "sensitivity : "<< sensitivity << G4endl;
70  trunkVolume = body -> CreateOrgan("Trunk", motherVolume, colourName, solidVis, sensitivity);
71 }
72 
73 void G4PhantomBuilder::BuildLeftLeg(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
74 {
75  if (motherVolume == 0)
76  G4Exception("G4PhantomBuilder::BuildLeftLeg()", "human_phantom0015", FatalException, "The world volume is missing !!!!!");
77 
78  G4cout <<"MotherVolume: " << motherVolume -> GetName()<< G4endl;
79  G4cout << "sensitivity : "<< sensitivity << G4endl;
80  leftLegVolume = body -> CreateOrgan("LeftLeg", motherVolume, colourName, solidVis, sensitivity);
81 }
82 void G4PhantomBuilder::BuildRightLeg(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
83 {
84  if (motherVolume == 0)
85  G4Exception("G4PhantomBuilder::BuildRightLeg()", "human_phantom0016", FatalException, "The world volume is missing !!!!!");
86 
87  G4cout <<"MotherVolume: " << motherVolume -> GetName()<< G4endl;
88  G4cout << "sensitivity : "<< sensitivity << G4endl;
89  rightLegVolume = body -> CreateOrgan("RightLeg", motherVolume, colourName, solidVis, sensitivity);
90 }
91 
92 void G4PhantomBuilder::BuildLeftLegBone(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
93 {
94  if (leftLegVolume == 0)
95  G4Exception("G4PhantomBuilder::BuildLeftLegBone()", "human_phantom0017", FatalException, "The left leg volume is missing !!!!!");
96 
97  G4cout <<"MotherVolume: " << leftLegVolume -> GetName()<< G4endl;
98  G4cout << "sensitivity : "<< sensitivity << G4endl;
99  body -> CreateOrgan("LeftLegBone", leftLegVolume,colourName, solidVis, sensitivity);
100 }
101 
102 void G4PhantomBuilder::BuildRightLegBone(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
103 {
104  if (trunkVolume == 0)
105  G4Exception("G4PhantomBuilder::BuildRightLegBone()", "human_phantom0018", FatalException, "The right leg volume is missing !!!!!");
106 
107  G4cout <<"MotherVolume: " << rightLegVolume -> GetName()<< G4endl;
108  G4cout << "sensitivity : "<< sensitivity << G4endl;
109  body -> CreateOrgan("RightLegBone", rightLegVolume, colourName, solidVis, sensitivity);
110 }
111 
112 void G4PhantomBuilder::BuildLeftArmBone(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
113 {
114  if (trunkVolume == 0)
115  G4Exception("G4PhantomBuilder::BuildLeftArmBone()", "human_phantom0019", FatalException, "The world volume is missing !!!!!");
116 
117  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
118  G4cout << "sensitivity : "<< sensitivity << G4endl;
119  body -> CreateOrgan("LeftArmBone" ,trunkVolume,colourName,solidVis, sensitivity);
120 }
121 void G4PhantomBuilder::BuildRightArmBone(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
122 {
123  if (trunkVolume == 0)
124  G4Exception("G4PhantomBuilder::BuildRightArmBone()", "human_phantom0020", FatalException, "The trunk volume is missing !!!!!");
125 
126  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
127  G4cout << "sensitivity : "<< sensitivity << G4endl;
128  body -> CreateOrgan("RightArmBone",trunkVolume,colourName,solidVis, sensitivity);
129 }
130 
131 void G4PhantomBuilder::BuildLeftScapula(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
132 {
133  if (trunkVolume == 0)
134  G4Exception("G4PhantomBuilder::BuildLeftScapula()", "human_phantom0021", FatalException, "The trunk volume is missing !!!!!");
135 
136  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
137  G4cout << "sensitivity : "<< sensitivity << G4endl;
138  body -> CreateOrgan("LeftScapula",trunkVolume,colourName,solidVis, sensitivity);
139 }
140 
141 void G4PhantomBuilder::BuildRightScapula(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
142 {
143  if (trunkVolume == 0)
144  G4Exception("G4PhantomBuilder::BuildRightScapula()", "human_phantom0022", FatalException, "The trunk volume is missing !!!!!");
145 
146  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
147  G4cout << "sensitivity : "<< sensitivity << G4endl;
148  body -> CreateOrgan("RightScapula",trunkVolume,colourName,solidVis, sensitivity);
149 }
150 
151 void G4PhantomBuilder::BuildLeftClavicle(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
152 {
153  if (trunkVolume == 0)
154  G4Exception("G4PhantomBuilder::BuildLeftClavicle()", "human_phantom0023", FatalException, "The trunk volume is missing !!!!!");
155 
156  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
157  G4cout << "sensitivity : "<< sensitivity << G4endl;
158  body -> CreateOrgan("LeftClavicle",trunkVolume,colourName,solidVis, sensitivity);
159 }
160 
161 void G4PhantomBuilder::BuildRightClavicle(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
162 {
163  if (trunkVolume == 0)
164  G4Exception("G4PhantomBuilder::BuildRightClavicle()", "human_phantom0024", FatalException, "The trunk volume is missing !!!!!");
165 
166  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
167  G4cout << "sensitivity : "<< sensitivity << G4endl;
168  body -> CreateOrgan("RightClavicle",trunkVolume,colourName,solidVis, sensitivity);
169 }
170 
171 
172 void G4PhantomBuilder::BuildHead(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
173 {
174  if (motherVolume == 0)
175  G4Exception("G4PhantomBuilder::BuildHead()", "human_phantom0025", FatalException, "The mother volume is missing !!!!!");
176 
177  G4cout <<"MotherVolume: " << motherVolume -> GetName()<< G4endl;
178  G4cout << "sensitivity : "<< sensitivity << G4endl;
179  headVolume = body -> CreateOrgan("Head",motherVolume, colourName, solidVis, sensitivity);
180 }
181 
182 void G4PhantomBuilder::BuildSkull(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
183 {
184  if (headVolume == 0)
185  G4Exception("G4PhantomBuilder::BuildSkull()", "human_phantom0026", FatalException, "The head volume is missing !!!!!");
186 
187  G4cout <<"MotherVolume: " << headVolume -> GetName()<< G4endl;
188  G4cout << "sensitivity : "<< sensitivity << G4endl;
189  body -> CreateOrgan( "Skull",headVolume, colourName, solidVis, sensitivity);
190 }
191 
192 void G4PhantomBuilder::BuildUpperSpine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
193 {
194  if (headVolume == 0)
195  G4Exception("G4PhantomBuilder::BuildUpperSpine()", "human_phantom0027", FatalException, "The head volume is missing !!!!!");
196 
197  G4cout <<"MotherVolume: " << headVolume -> GetName()<< G4endl;
198  G4cout << "sensitivity : "<< sensitivity << G4endl;
199  body -> CreateOrgan("UpperSpine",headVolume,colourName, solidVis, sensitivity);
200 }
201 
202 void G4PhantomBuilder::BuildMiddleLowerSpine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
203 {
204  if (trunkVolume == 0)
205  G4Exception("G4PhantomBuilder::BuildMiddleLowerSpine()", "human_phantom0028", FatalException, "The trunk volume is missing !!!!!");
206 
207  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
208  G4cout << "sensitivity : "<< sensitivity << G4endl;
209  body -> CreateOrgan("MiddleLowerSpine",trunkVolume, colourName, solidVis, sensitivity);
210 }
211 
212 void G4PhantomBuilder::BuildPelvis(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
213 {
214  if (trunkVolume == 0)
215  G4Exception("G4PhantomBuilder::BuildPelvis()", "human_phantom0029", FatalException, "The trunk volume is missing !!!!!");
216 
217  body -> CreateOrgan( "Pelvis",trunkVolume,
218  colourName, solidVis, sensitivity);
219 }
220 
221 void G4PhantomBuilder::BuildBrain(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
222 {
223  if (headVolume == 0)
224  G4Exception("G4PhantomBuilder::BuildBrain()", "human_phantom0030", FatalException, "The head volume is missing !!!!!");
225 
226  body -> CreateOrgan("Brain",headVolume, colourName, solidVis, sensitivity);
227 }
228 
229 void G4PhantomBuilder::BuildHeart(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
230 {
231  if (trunkVolume == 0)
232  G4Exception("G4PhantomBuilder::BuildHeart()", "human_phantom0031", FatalException, "The trunk volume is missing !!!!!");
233  body -> CreateOrgan("Heart", trunkVolume,colourName, solidVis, sensitivity);
234 }
235 
236 void G4PhantomBuilder::BuildLeftLung(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
237 {
238  if (trunkVolume == 0)
239  G4Exception("G4PhantomBuilder::BuildLeftLung()", "human_phantom0032", FatalException, "The trunk volume is missing !!!!!");
240 
241  body -> CreateOrgan("LeftLung",trunkVolume,colourName,solidVis, sensitivity);
242 }
243 
244 void G4PhantomBuilder::BuildRightLung(const G4String& colourName, G4bool solidVis, G4bool sensitivity )
245 {
246  if (trunkVolume == 0)
247  G4Exception("G4PhantomBuilder::BuildRightLung()", "human_phantom0033", FatalException, "The trunk volume is missing !!!!!");
248 
249  body -> CreateOrgan("RightLung",trunkVolume,colourName, solidVis, sensitivity);
250 }
251 
252 void G4PhantomBuilder::BuildStomach(const G4String& colourName, G4bool solidVis, G4bool sensitivity )
253 {
254  if (trunkVolume == 0)
255  G4Exception("G4PhantomBuilder::BuildStomach()", "human_phantom0034", FatalException, "The trunk volume is missing !!!!!");
256 
257  body -> CreateOrgan("Stomach",trunkVolume,colourName, solidVis, sensitivity);
258 }
259 
260 void G4PhantomBuilder::BuildRibCage(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
261 {
262  if (trunkVolume == 0)
263  G4Exception("G4PhantomBuilder::BuildRibCage()", "human_phantom0035", FatalException, "The trunk volume is missing !!!!!");
264 
265  body -> CreateOrgan("RibCage",trunkVolume,colourName, solidVis, sensitivity);
266 }
267 
268 void G4PhantomBuilder::BuildSpleen(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
269 {
270  if (trunkVolume == 0)
271  G4Exception("G4PhantomBuilder::BuildSpleen()", "human_phantom0036", FatalException, "The trunk volume is missing !!!!!");
272 
273  body -> CreateOrgan("Spleen", trunkVolume,colourName, solidVis, sensitivity);
274 }
275 
276 void G4PhantomBuilder::BuildUpperLargeIntestine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
277 {
278  if (trunkVolume == 0)
279  G4Exception("G4PhantomBuilder::BuildUpperLargeIntestine()", "human_phantom0037", FatalException, "The trunk volume is missing !!!!!");
280 
281  body -> CreateOrgan("UpperLargeIntestine",trunkVolume, colourName, solidVis, sensitivity);
282 }
283 
284 void G4PhantomBuilder::BuildLowerLargeIntestine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
285 {
286  if (trunkVolume == 0)
287  G4Exception("G4PhantomBuilder::BuildLowerLargeIntestine()", "human_phantom0038", FatalException, "The trunk volume is missing !!!!!");
288 
289  body -> CreateOrgan("LowerLargeIntestine", trunkVolume, colourName,solidVis, sensitivity);
290 }
291 
292 void G4PhantomBuilder::BuildSmallIntestine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
293 {
294  if (trunkVolume == 0)
295  G4Exception("G4PhantomBuilder::BuildSamllIntestine()", "human_phantom0039", FatalException, "The trunk volume is missing !!!!!");
296 
297  body -> CreateOrgan("SmallIntestine",trunkVolume, colourName, solidVis, sensitivity);
298 }
299 
300 void G4PhantomBuilder::BuildLeftKidney(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
301 {
302  if (trunkVolume == 0)
303  G4Exception("G4PhantomBuilder::BuildLeftKidney()", "human_phantom0040", FatalException, "The trunk volume is missing !!!!!");
304 
305  body -> CreateOrgan("LeftKidney", trunkVolume,colourName, solidVis, sensitivity);
306 }
307 void G4PhantomBuilder::BuildRightKidney(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
308 {
309  if (trunkVolume == 0)
310  G4Exception("G4PhantomBuilder::BuildRightKidney()", "human_phantom0041", FatalException, "The trunk volume is missing !!!!!");
311 
312  body -> CreateOrgan("RightKidney",trunkVolume,colourName, solidVis, sensitivity);
313 }
314 
315 void G4PhantomBuilder::BuildLeftAdrenal(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
316 {
317  if (trunkVolume == 0)
318  G4Exception("G4PhantomBuilder::BuildLeftAdrenal()", "human_phantom0042", FatalException, "The trunk volume is missing !!!!!");
319 
320  body -> CreateOrgan("LeftAdrenal", trunkVolume,colourName, solidVis, sensitivity);
321 }
322 
323 void G4PhantomBuilder::BuildRightAdrenal(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
324 {
325  if (trunkVolume == 0)
326  G4Exception("G4PhantomBuilder::BuildRightAdrenal()", "human_phantom0043", FatalException, "The trunk volume is missing !!!!!");
327 
328  body -> CreateOrgan("RightAdrenal", trunkVolume,colourName, solidVis, sensitivity);
329 }
330 
331 
332 void G4PhantomBuilder::BuildLiver(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
333 {
334  if (trunkVolume == 0)
335  G4Exception("G4PhantomBuilder::BuildLiver()", "human_phantom0044", FatalException, "The trunk volume is missing !!!!!");
336 
337  body -> CreateOrgan("Liver", trunkVolume,colourName, solidVis, sensitivity);
338 }
339 void G4PhantomBuilder::BuildPancreas(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
340 {
341  if (trunkVolume == 0)
342  G4Exception("G4PhantomBuilder::BuildPancreas()", "human_phantom0045", FatalException, "The trunk volume is missing !!!!!");
343 
344  body -> CreateOrgan("Pancreas",trunkVolume,colourName, solidVis, sensitivity);
345 }
346 
347 void G4PhantomBuilder::BuildUrinaryBladder(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
348 {
349  if (trunkVolume == 0)
350  G4Exception("G4PhantomBuilder::BuildUrinaryBladder()", "human_phantom0046", FatalException, "The trunk volume is missing !!!!!");
351 
352  body -> CreateOrgan("UrinaryBladder",trunkVolume, colourName, solidVis, sensitivity);
353 }
354 
355 void G4PhantomBuilder::BuildThyroid(const G4String& colourName, G4bool solidVis, G4bool sensitivity )
356 {
357  if (headVolume == 0)
358  G4Exception("G4PhantomBuilder::BuildThyroid()", "human_phantom0047", FatalException, "The trunk volume is missing !!!!!");
359 
360  body -> CreateOrgan("Thyroid",headVolume, colourName,solidVis, sensitivity);
361 }
362 
363 void G4PhantomBuilder::BuildThymus(const G4String& colourName, G4bool solidVis, G4bool sensitivity )
364 {
365  if (trunkVolume == 0)
366  G4Exception("G4PhantomBuilder::BuildThymus()", "human_phantom0048", FatalException, "The trunk volume is missing !!!!!");
367 
368  body -> CreateOrgan("Thymus",trunkVolume, colourName,solidVis, sensitivity);
369 }
370 
371 
373 {
374  return motherVolume;
375 }
376 
378 {
379  motherVolume = mother;
380 }
381 
382 
384 {
385  model = modelFlag;
386 
387  if(model=="MIRD" || model =="MIX") body = new G4MIRDBodyFactory();
388  if(model=="ORNLFemale")
389  {
390 
391 #ifdef G4LIB_USE_GDML
392  body = new G4ORNLFemaleBodyFactory();
393 #else
394  G4cout << model << " Working with GDML only! set G4LIB_USE_GDML 1" << G4endl;
395 #endif
396  }
397 
398  if(model=="ORNLMale")
399 {
400 #ifdef G4LIB_USE_GDML
401 body = new G4ORNLMaleBodyFactory();
402 #else
403 G4cout << model << " Working with GDML only! set G4LIB_USE_GDML 1" << G4endl;
404 #endif
405 }
406 }
void BuildTrunk(const G4String &, G4bool, G4bool)
G4VPhysicalVolume * GetPhantom()
void BuildLeftLegBone(const G4String &, G4bool, G4bool)
void BuildRightKidney(const G4String &, G4bool, G4bool)
void BuildLeftLung(const G4String &, G4bool, G4bool)
void SetMotherVolume(G4VPhysicalVolume *)
void BuildRightLeg(const G4String &, G4bool, G4bool)
void BuildLowerLargeIntestine(const G4String &, G4bool, G4bool)
G4VPhysicalVolume * motherVolume
void BuildRightClavicle(const G4String &, G4bool, G4bool)
void BuildLeftLeg(const G4String &, G4bool, G4bool)
G4VPhysicalVolume * maleGenitaliaVolume
void BuildHead(const G4String &, G4bool, G4bool)
void BuildSkull(const G4String &, G4bool, G4bool)
void BuildLeftKidney(const G4String &, G4bool, G4bool)
void BuildRightArmBone(const G4String &, G4bool, G4bool)
G4VPhysicalVolume * leftLegVolume
void BuildLiver(const G4String &, G4bool, G4bool)
G4GLOB_DLL std::ostream G4cout
G4VPhysicalVolume * rightLegVolume
void BuildRightLegBone(const G4String &, G4bool, G4bool)
G4VPhysicalVolume * headVolume
bool G4bool
Definition: G4Types.hh:79
void BuildRightAdrenal(const G4String &, G4bool, G4bool)
void BuildUpperLargeIntestine(const G4String &, G4bool, G4bool)
void BuildRibCage(const G4String &, G4bool, G4bool)
void BuildPancreas(const G4String &, G4bool, G4bool)
void BuildBrain(const G4String &, G4bool, G4bool)
void BuildPelvis(const G4String &, G4bool, G4bool)
void BuildHeart(const G4String &, G4bool, G4bool)
void BuildStomach(const G4String &, G4bool, G4bool)
void BuildMiddleLowerSpine(const G4String &, G4bool, G4bool)
void BuildLeftArmBone(const G4String &, G4bool, G4bool)
void BuildThyroid(const G4String &, G4bool, G4bool)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4VBodyFactory * body
void BuildThymus(const G4String &, G4bool, G4bool)
void BuildUpperSpine(const G4String &, G4bool, G4bool)
void BuildSmallIntestine(const G4String &, G4bool, G4bool)
void BuildLeftClavicle(const G4String &, G4bool, G4bool)
void SetModel(G4String)
void BuildRightScapula(const G4String &, G4bool, G4bool)
void BuildRightLung(const G4String &, G4bool, G4bool)
void BuildLeftScapula(const G4String &, G4bool, G4bool)
#define G4endl
Definition: G4ios.hh:61
G4VPhysicalVolume * trunkVolume
void BuildSpleen(const G4String &, G4bool, G4bool)
void BuildLeftAdrenal(const G4String &, G4bool, G4bool)
void BuildUrinaryBladder(const G4String &, G4bool, G4bool)