Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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, colourName, solidVis, sensitivity);
218 }
219 
220 void G4PhantomBuilder::BuildBrain(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
221 {
222  if (headVolume == 0)
223  G4Exception("G4PhantomBuilder::BuildBrain()", "human_phantom0030", FatalException, "The head volume is missing !!!!!");
224 
225  body -> CreateOrgan("Brain",headVolume, colourName, solidVis, sensitivity);
226 }
227 
228 void G4PhantomBuilder::BuildHeart(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
229 {
230  if (trunkVolume == 0)
231  G4Exception("G4PhantomBuilder::BuildHeart()", "human_phantom0031", FatalException, "The trunk volume is missing !!!!!");
232  body -> CreateOrgan("Heart", trunkVolume,colourName, solidVis, sensitivity);
233 }
234 
235 void G4PhantomBuilder::BuildLeftLung(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
236 {
237  if (trunkVolume == 0)
238  G4Exception("G4PhantomBuilder::BuildLeftLung()", "human_phantom0032", FatalException, "The trunk volume is missing !!!!!");
239 
240  body -> CreateOrgan("LeftLung",trunkVolume,colourName,solidVis, sensitivity);
241 }
242 
243 void G4PhantomBuilder::BuildRightLung(const G4String& colourName, G4bool solidVis, G4bool sensitivity )
244 {
245  if (trunkVolume == 0)
246  G4Exception("G4PhantomBuilder::BuildRightLung()", "human_phantom0033", FatalException, "The trunk volume is missing !!!!!");
247 
248  body -> CreateOrgan("RightLung",trunkVolume,colourName, solidVis, sensitivity);
249 }
250 
251 void G4PhantomBuilder::BuildStomach(const G4String& colourName, G4bool solidVis, G4bool sensitivity )
252 {
253  if (trunkVolume == 0)
254  G4Exception("G4PhantomBuilder::BuildStomach()", "human_phantom0034", FatalException, "The trunk volume is missing !!!!!");
255 
256  body -> CreateOrgan("Stomach",trunkVolume,colourName, solidVis, sensitivity);
257 }
258 
259 void G4PhantomBuilder::BuildRibCage(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
260 {
261  if (trunkVolume == 0)
262  G4Exception("G4PhantomBuilder::BuildRibCage()", "human_phantom0035", FatalException, "The trunk volume is missing !!!!!");
263 
264  body -> CreateOrgan("RibCage",trunkVolume,colourName, solidVis, sensitivity);
265 }
266 
267 void G4PhantomBuilder::BuildSpleen(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
268 {
269  if (trunkVolume == 0)
270  G4Exception("G4PhantomBuilder::BuildSpleen()", "human_phantom0036", FatalException, "The trunk volume is missing !!!!!");
271 
272  body -> CreateOrgan("Spleen", trunkVolume,colourName, solidVis, sensitivity);
273 }
274 
275 void G4PhantomBuilder::BuildUpperLargeIntestine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
276 {
277  if (trunkVolume == 0)
278  G4Exception("G4PhantomBuilder::BuildUpperLargeIntestine()", "human_phantom0037", FatalException, "The trunk volume is missing !!!!!");
279 
280  body -> CreateOrgan("UpperLargeIntestine",trunkVolume, colourName, solidVis, sensitivity);
281 }
282 
283 void G4PhantomBuilder::BuildLowerLargeIntestine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
284 {
285  if (trunkVolume == 0)
286  G4Exception("G4PhantomBuilder::BuildLowerLargeIntestine()", "human_phantom0038", FatalException, "The trunk volume is missing !!!!!");
287 
288  body -> CreateOrgan("LowerLargeIntestine", trunkVolume, colourName,solidVis, sensitivity);
289 }
290 
291 void G4PhantomBuilder::BuildSmallIntestine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
292 {
293  if (trunkVolume == 0)
294  G4Exception("G4PhantomBuilder::BuildSamllIntestine()", "human_phantom0039", FatalException, "The trunk volume is missing !!!!!");
295 
296  body -> CreateOrgan("SmallIntestine",trunkVolume, colourName, solidVis, sensitivity);
297 }
298 
299 void G4PhantomBuilder::BuildLeftKidney(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
300 {
301  if (trunkVolume == 0)
302  G4Exception("G4PhantomBuilder::BuildLeftKidney()", "human_phantom0040", FatalException, "The trunk volume is missing !!!!!");
303 
304  body -> CreateOrgan("LeftKidney", trunkVolume,colourName, solidVis, sensitivity);
305 }
306 void G4PhantomBuilder::BuildRightKidney(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
307 {
308  if (trunkVolume == 0)
309  G4Exception("G4PhantomBuilder::BuildRightKidney()", "human_phantom0041", FatalException, "The trunk volume is missing !!!!!");
310 
311  body -> CreateOrgan("RightKidney",trunkVolume,colourName, solidVis, sensitivity);
312 }
313 
314 void G4PhantomBuilder::BuildLeftAdrenal(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
315 {
316  if (trunkVolume == 0)
317  G4Exception("G4PhantomBuilder::BuildLeftAdrenal()", "human_phantom0042", FatalException, "The trunk volume is missing !!!!!");
318 
319  body -> CreateOrgan("LeftAdrenal", trunkVolume,colourName, solidVis, sensitivity);
320 }
321 
322 void G4PhantomBuilder::BuildRightAdrenal(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
323 {
324  if (trunkVolume == 0)
325  G4Exception("G4PhantomBuilder::BuildRightAdrenal()", "human_phantom0043", FatalException, "The trunk volume is missing !!!!!");
326 
327  body -> CreateOrgan("RightAdrenal", trunkVolume,colourName, solidVis, sensitivity);
328 }
329 
330 
331 void G4PhantomBuilder::BuildLiver(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
332 {
333  if (trunkVolume == 0)
334  G4Exception("G4PhantomBuilder::BuildLiver()", "human_phantom0044", FatalException, "The trunk volume is missing !!!!!");
335 
336  body -> CreateOrgan("Liver", trunkVolume,colourName, solidVis, sensitivity);
337 }
338 void G4PhantomBuilder::BuildPancreas(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
339 {
340  if (trunkVolume == 0)
341  G4Exception("G4PhantomBuilder::BuildPancreas()", "human_phantom0045", FatalException, "The trunk volume is missing !!!!!");
342 
343  body -> CreateOrgan("Pancreas",trunkVolume,colourName, solidVis, sensitivity);
344 }
345 
346 void G4PhantomBuilder::BuildUrinaryBladder(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
347 {
348  if (trunkVolume == 0)
349  G4Exception("G4PhantomBuilder::BuildUrinaryBladder()", "human_phantom0046", FatalException, "The trunk volume is missing !!!!!");
350 
351  body -> CreateOrgan("UrinaryBladder",trunkVolume, colourName, solidVis, sensitivity);
352 }
353 
354 void G4PhantomBuilder::BuildThyroid(const G4String& colourName, G4bool solidVis, G4bool sensitivity )
355 {
356  if (headVolume == 0)
357  G4Exception("G4PhantomBuilder::BuildThyroid()", "human_phantom0047", FatalException, "The trunk volume is missing !!!!!");
358 
359  body -> CreateOrgan("Thyroid",headVolume, colourName,solidVis, sensitivity);
360 }
361 
362 void G4PhantomBuilder::BuildThymus(const G4String& colourName, G4bool solidVis, G4bool sensitivity )
363 {
364  if (trunkVolume == 0)
365  G4Exception("G4PhantomBuilder::BuildThymus()", "human_phantom0048", FatalException, "The trunk volume is missing !!!!!");
366 
367  body -> CreateOrgan("Thymus",trunkVolume, colourName,solidVis, sensitivity);
368 }
369 
370 
372 {
373  return motherVolume;
374 }
375 
377 {
378  motherVolume = mother;
379 }
380 
381 
383 {
384  model = modelFlag;
385 
386  if(model=="MIRD" || model =="MIX") body = new G4MIRDBodyFactory();
387  if(model=="ORNLFemale")
388  {
389 
390 #ifdef G4LIB_USE_GDML
391  body = new G4ORNLFemaleBodyFactory();
392 #else
393  G4cout << model << " Working with GDML only! set G4LIB_USE_GDML 1" << G4endl;
394 #endif
395  }
396 
397  if(model=="ORNLMale")
398  {
399 #ifdef G4LIB_USE_GDML
400  body = new G4ORNLMaleBodyFactory();
401 #else
402  G4cout << model << " Working with GDML only! set G4LIB_USE_GDML 1" << G4endl;
403 #endif
404  }
405 }
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)
const XML_Char XML_Content * model
Definition: expat.h:151
void BuildUrinaryBladder(const G4String &, G4bool, G4bool)