Geant4  9.6.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, 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 
152 
153 void G4PhantomBuilder::BuildHead(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
154 {
155  if (motherVolume == 0)
156  G4Exception("G4PhantomBuilder::BuildHead()", "human_phantom0023", FatalException, "The mother volume is missing !!!!!");
157 
158  G4cout <<"MotherVolume: " << motherVolume -> GetName()<< G4endl;
159  G4cout << "sensitivity : "<< sensitivity << G4endl;
160  headVolume = body -> CreateOrgan("Head",motherVolume, colourName, solidVis, sensitivity);
161 }
162 
163 void G4PhantomBuilder::BuildSkull(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
164 {
165  if (headVolume == 0)
166  G4Exception("G4PhantomBuilder::BuildSkull()", "human_phantom0024", FatalException, "The head volume is missing !!!!!");
167 
168  G4cout <<"MotherVolume: " << headVolume -> GetName()<< G4endl;
169  G4cout << "sensitivity : "<< sensitivity << G4endl;
170  body -> CreateOrgan( "Skull",headVolume, colourName, solidVis, sensitivity);
171 }
172 
173 void G4PhantomBuilder::BuildUpperSpine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
174 {
175  if (headVolume == 0)
176  G4Exception("G4PhantomBuilder::BuildUpperSpine()", "human_phantom0025", FatalException, "The head volume is missing !!!!!");
177 
178  G4cout <<"MotherVolume: " << headVolume -> GetName()<< G4endl;
179  G4cout << "sensitivity : "<< sensitivity << G4endl;
180  body -> CreateOrgan("UpperSpine",headVolume,colourName, solidVis, sensitivity);
181 }
182 
183 void G4PhantomBuilder::BuildMiddleLowerSpine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
184 {
185  if (trunkVolume == 0)
186  G4Exception("G4PhantomBuilder::BuildMiddleLowerSpine()", "human_phantom0026", FatalException, "The trunk volume is missing !!!!!");
187 
188  G4cout <<"MotherVolume: " << trunkVolume -> GetName()<< G4endl;
189  G4cout << "sensitivity : "<< sensitivity << G4endl;
190  body -> CreateOrgan("MiddleLowerSpine",trunkVolume, colourName, solidVis, sensitivity);
191 }
192 
193 void G4PhantomBuilder::BuildPelvis(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
194 {
195  if (trunkVolume == 0)
196  G4Exception("G4PhantomBuilder::BuildPelvis()", "human_phantom0027", FatalException, "The trunk volume is missing !!!!!");
197 
198  body -> CreateOrgan( "Pelvis",trunkVolume,
199  colourName, solidVis, sensitivity);
200 }
201 /*
202 
203 void G4PhantomBuilder::BuildClavicles(G4bool sensitivity)
204 {
205  if (trunkVolume == 0)
206  G4Exception("G4PhantomBuilder::BuildClavicles()", "human_phantom0028", FatalException, "The trunk volume is missing !!!!!");
207 
208  body -> CreateClavicles(trunkVolume, sensitivity);
209 }
210 */
211 
212 void G4PhantomBuilder::BuildBrain(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
213 {
214  if (headVolume == 0)
215  G4Exception("G4PhantomBuilder::BuildBrain()", "human_phantom0029", FatalException, "The head volume is missing !!!!!");
216 
217  body -> CreateOrgan("Brain",headVolume, colourName, solidVis, sensitivity);
218 }
219 
220 void G4PhantomBuilder::BuildHeart(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
221 {
222  if (trunkVolume == 0)
223  G4Exception("G4PhantomBuilder::BuildHeart()", "human_phantom0030", FatalException, "The trunk volume is missing !!!!!");
224  body -> CreateOrgan("Heart", trunkVolume,colourName, solidVis, sensitivity);
225 }
226 
227 void G4PhantomBuilder::BuildLeftLung(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
228 {
229  if (trunkVolume == 0)
230  G4Exception("G4PhantomBuilder::BuildLeftLung()", "human_phantom0031", FatalException, "The trunk volume is missing !!!!!");
231 
232  body -> CreateOrgan("LeftLung",trunkVolume,colourName,solidVis, sensitivity);
233 }
234 
235 void G4PhantomBuilder::BuildRightLung(const G4String& colourName, G4bool solidVis, G4bool sensitivity )
236 {
237  if (trunkVolume == 0)
238  G4Exception("G4PhantomBuilder::BuildRightLung()", "human_phantom0032", FatalException, "The trunk volume is missing !!!!!");
239 
240  body -> CreateOrgan("RightLung",trunkVolume,colourName, solidVis, sensitivity);
241 }
242 
243 void G4PhantomBuilder::BuildStomach(const G4String& colourName, G4bool solidVis, G4bool sensitivity )
244 {
245  if (trunkVolume == 0)
246  G4Exception("G4PhantomBuilder::BuildStomach()", "human_phantom0033", FatalException, "The trunk volume is missing !!!!!");
247 
248  body -> CreateOrgan("Stomach",trunkVolume,colourName, solidVis, sensitivity);
249 }
250 
251 void G4PhantomBuilder::BuildRibCage(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
252 {
253  if (trunkVolume == 0)
254  G4Exception("G4PhantomBuilder::BuildRibCage()", "human_phantom0034", FatalException, "The trunk volume is missing !!!!!");
255 
256  body -> CreateOrgan("RibCage",trunkVolume,colourName, solidVis, sensitivity);
257 }
258 
259 void G4PhantomBuilder::BuildSpleen(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
260 {
261  if (trunkVolume == 0)
262  G4Exception("G4PhantomBuilder::BuildSpleen()", "human_phantom0035", FatalException, "The trunk volume is missing !!!!!");
263 
264  body -> CreateOrgan("Spleen", trunkVolume,colourName, solidVis, sensitivity);
265 }
266 
267 void G4PhantomBuilder::BuildUpperLargeIntestine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
268 {
269  if (trunkVolume == 0)
270  G4Exception("G4PhantomBuilder::BuildUpperLargeIntestine()", "human_phantom0036", FatalException, "The trunk volume is missing !!!!!");
271 
272  body -> CreateOrgan("UpperLargeIntestine",trunkVolume, colourName, solidVis, sensitivity);
273 }
274 
275 void G4PhantomBuilder::BuildLowerLargeIntestine(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
276 {
277  if (trunkVolume == 0)
278  G4Exception("G4PhantomBuilder::BuildLowerLargeIntestine()", "human_phantom0037", FatalException, "The trunk volume is missing !!!!!");
279 
280  body -> CreateOrgan("LowerLargeIntestine", trunkVolume, colourName,solidVis, sensitivity);
281 }
282 /*
283 void G4PhantomBuilder::BuildEsophagus(G4bool sensitivity)
284 {
285  if (trunkVolume == 0)
286  G4Exception("G4PhantomBuilder::BuildEsophagus()", "human_phantom0038", FatalException, "The trunk volume is missing !!!!!");
287 
288  body -> CreateEsophagus(trunkVolume, sensitivity);
289 }
290 */
291 void G4PhantomBuilder::BuildLeftKidney(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
292 {
293  if (trunkVolume == 0)
294  G4Exception("G4PhantomBuilder::BuildLeftKidney()", "human_phantom0039", FatalException, "The trunk volume is missing !!!!!");
295 
296  body -> CreateOrgan("LeftKidney", trunkVolume,colourName, solidVis, sensitivity);
297 }
298 void G4PhantomBuilder::BuildRightKidney(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
299 {
300  if (trunkVolume == 0)
301  G4Exception("G4PhantomBuilder::BuildRightKidney()", "human_phantom0040", FatalException, "The trunk volume is missing !!!!!");
302 
303  body -> CreateOrgan("RightKidney",trunkVolume,colourName, solidVis, sensitivity);
304 }
305 
306 void G4PhantomBuilder::BuildLeftAdrenal(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
307 {
308  if (trunkVolume == 0)
309  G4Exception("G4PhantomBuilder::BuildLeftAdrenal()", "human_phantom0041", FatalException, "The trunk volume is missing !!!!!");
310 
311  body -> CreateOrgan("LeftAdrenal", trunkVolume,colourName, solidVis, sensitivity);
312 }
313 
314 void G4PhantomBuilder::BuildRightAdrenal(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
315 {
316  if (trunkVolume == 0)
317  G4Exception("G4PhantomBuilder::BuildRightAdrenal()", "human_phantom0042", FatalException, "The trunk volume is missing !!!!!");
318 
319  body -> CreateOrgan("RightAdrenal", trunkVolume,colourName, solidVis, sensitivity);
320 }
321 
322 
323 void G4PhantomBuilder::BuildLiver(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
324 {
325  if (trunkVolume == 0)
326  G4Exception("G4PhantomBuilder::BuildLiver()", "human_phantom0043", FatalException, "The trunk volume is missing !!!!!");
327 
328  body -> CreateOrgan("Liver", trunkVolume,colourName, solidVis, sensitivity);
329 }
330 void G4PhantomBuilder::BuildPancreas(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
331 {
332  if (trunkVolume == 0)
333  G4Exception("G4PhantomBuilder::BuildPancreas()", "human_phantom0044", FatalException, "The trunk volume is missing !!!!!");
334 
335  body -> CreateOrgan("Pancreas",trunkVolume,colourName, solidVis, sensitivity);
336 }
337 
338 void G4PhantomBuilder::BuildUrinaryBladder(const G4String& colourName, G4bool solidVis, G4bool sensitivity)
339 {
340  if (trunkVolume == 0)
341  G4Exception("G4PhantomBuilder::BuildUrinaryBladder()", "human_phantom0045", FatalException, "The trunk volume is missing !!!!!");
342 
343  body -> CreateOrgan("UrinaryBladder",trunkVolume, colourName, solidVis, sensitivity);
344 }
345 
346 void G4PhantomBuilder::BuildThyroid(const G4String& colourName, G4bool solidVis, G4bool sensitivity )
347 {
348  if (headVolume == 0)
349  G4Exception("G4PhantomBuilder::BuildThyroid()", "human_phantom0046", FatalException, "The trunk volume is missing !!!!!");
350 
351  body -> CreateOrgan("Thyroid",headVolume, colourName,solidVis, sensitivity);
352 }
353 
354 
356 {
357  return motherVolume;
358 }
359 
361 {
362  motherVolume = mother;
363 }
364 
365 
367 {
368  model = modelFlag;
369 
370  if(model=="MIRD" || model =="MIX") body = new G4MIRDBodyFactory();
371  if(model=="ORNLFemale")
372  {
373 
374 #ifdef G4LIB_USE_GDML
375  body = new G4ORNLFemaleBodyFactory();
376 #else
377  G4cout << model << " Working with GDML only! set G4LIB_USE_GDML 1" << G4endl;
378 #endif
379  }
380 
381  if(model=="ORNLMale")
382 {
383 #ifdef G4LIB_USE_GDML
384 body = new G4ORNLMaleBodyFactory();
385 #else
386 G4cout << model << " Working with GDML only! set G4LIB_USE_GDML 1" << G4endl;
387 #endif
388 }
389 }