Geant4  10.01
G4HumanPhantomConstruction.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 , M. G. Pia, INFN Genova and F. Ambroglini INFN Perugia, Italy
27 //
28 //
29 
30 #include <map>
31 
32 #include "globals.hh"
33 
35 
36 #include "G4SystemOfUnits.hh"
37 #include "G4HumanPhantomSD.hh"
38 #include "G4SDManager.hh"
39 
40 //#include "G4VBodyFactory.hh"
41 //#include "G4MIRDBodyFactory.hh"
42 //#include "G4ORNLBodyFactory.hh"
43 
44 #include "G4PhantomBuilder.hh"
45 #include "G4FemaleBuilder.hh"
46 #include "G4MaleBuilder.hh"
47 #include "G4PhantomHeadBuilder.hh"
48 #include "G4CustomFemaleBuilder.hh"
49 #include "G4RunManager.hh"
51 #include "G4Box.hh"
52 #include "G4LogicalVolume.hh"
53 #include "G4VPhysicalVolume.hh"
54 #include "G4VisAttributes.hh"
55 #include "G4Colour.hh"
56 #include "G4PVPlacement.hh"
57 
59 {
62 }
63 
65 {
66  delete material;
67  delete messenger;
68 }
69 
71 {
72  material -> DefineMaterials();
73 
74 
75 
76  G4BasePhantomBuilder* builder = 0;
77 
78  if (model == "MIRDHead" || model == "ORNLHead")
79  {
80  G4cout << "HeadBuilder instantiated" << G4endl;
81  builder = new G4PhantomHeadBuilder;
82  if (model == "MIRDHead") builder->SetModel("MIRD");
83  else if (model == "ORNLHead") builder->SetModel("ORNLMale");
84  }
85  else
86  {
87  if (sex =="Female")
88  {
89  if (model == "MIX") builder = new G4CustomFemaleBuilder;
90  else {builder = new G4FemaleBuilder;}
91  builder->SetModel(model);
92  G4cout <<model << " "<< sex << G4endl;
93  }
94  else if (sex == "Male")
95  {
96  builder = new G4MaleBuilder;
97  builder->SetModel(model);
98  if (model == "MIX")
99  {
100  G4cout<< "Custom Male is not available!!! MIRD model is selected !"
101  << G4endl;
102  model = "MIRD";
103  builder->SetModel(model);}
104  }
105  }
106 
107  builder->SetMotherVolume(ConstructWorld());
108 
109  // the argument indicates the sensitivity of the volume
110 
111  builder->BuildHead("black", false, sensitivities["Head"]);
112  builder->BuildSkull("orange", false,sensitivities["Skull"]);
113  builder->BuildBrain("yellow", true,sensitivities["Brain"]);
114 
115  if (model != "MIRDHead" && model != "ORNLHead")
116  {
117  // builder->SetModel(model);
118  builder->BuildTrunk("yellow", false, sensitivities["Trunk"]);
119 
120  builder->BuildLeftLeg("yellow", false,sensitivities["LeftLeg"]);
121  builder->BuildRightLeg("yellow", false,sensitivities["RightLeg"]);
122 
123  builder->BuildLeftArmBone("grey", true,sensitivities["LeftArmBone"]);
124  builder->BuildRightArmBone("grey", true, sensitivities["RightArmBone"]);
125 
126  builder->BuildLeftLegBone("grey", true,sensitivities["LeftLegBone"]);
127  builder ->BuildRightLegBone("grey", true,sensitivities["RightLegBone"]);
128 
129  builder->BuildUpperSpine("yellow", true,sensitivities["UpperSpine"]);
130 
131  if (model == "MIRD" || model == "MIX")
132  {
133  builder->BuildLeftScapula("grey", true, sensitivities["LeftScapula"]);
134  builder->BuildRightScapula("grey", true, sensitivities["RightScapula"]);
135  builder->BuildLeftAdrenal("yellow", true, sensitivities["LeftAdrenal"]);
136  builder->BuildRightAdrenal("yellow", true, sensitivities["RightAdrenal"]);
137  builder->BuildThymus("orange", true,sensitivities["Thymus"]);
138  builder->BuildLeftClavicle("grey", true,sensitivities["LeftClavicle"]);
139  builder->BuildRightClavicle("grey", true,sensitivities["RightClavicle"]);
140  builder->BuildSmallIntestine("orange", true,sensitivities["SmallIntestine"]);
141  builder->BuildRibCage("grey", true,sensitivities["RibCage"]);
142  }
143 
144  builder->BuildMiddleLowerSpine("yellow", true,sensitivities["MiddleLowerSpine"]);
145 
146  builder->BuildPelvis("grey", true,sensitivities["Pelvis"]);
147 
148  builder->BuildStomach("orange", true,sensitivities["Stomach"]);
149  builder->BuildUpperLargeIntestine("lightBlue", true,sensitivities["UpperLargeIntestine"]);
150  builder->BuildLowerLargeIntestine("lightBlue", true,sensitivities["LowerLargeIntestine"]);
151 
152  builder->BuildSpleen("green", true,sensitivities["Spleen"]);
153  builder->BuildPancreas("purple", true,sensitivities["Pancreas"]);
154  //builder->BuildLiver("orange", true,sensitivities["Liver"]);
155 
156  builder->BuildLeftKidney("green", true,sensitivities["LeftKidney"]);
157  builder->BuildRightKidney("green", true,sensitivities["RightKidney"]);
158  builder->BuildUrinaryBladder("green", true,sensitivities["UrinaryBladder"]);
159 
160  //builder->BuildHeart("red", true,sensitivities["Hearth"]);// to do MIRD
161  // builder->BuildLeftLung("blue", true,sensitivities["LeftLung"]);
162  //builder->BuildRightLung("blue", true,sensitivities["RightLung"]);
163  // builder->BuildThyroid("orange", true,sensitivities["Thyroid"]);
164 
165  if(sex=="Female"){
166 
167  builder->BuildLeftOvary("purple", true,sensitivities["LeftOvary"]);
168  builder->BuildRightOvary("purple", true,sensitivities["RightOvary"]);
169  builder->BuildUterus("purple", true,sensitivities["Uterus"]);
170 
171  if (model == "ORNLFemale" || model == "MIRD")
172  {
173  builder->BuildLeftBreast("purple", true,sensitivities["LeftBreast"]);
174  builder->BuildRightBreast("purple", true,sensitivities["RightBreast"]);
175  }
176  else if (model == "MIX")
177  {
178  builder->BuildVoxelLeftBreast("purple",false, sensitivities["LeftBreast"]);
179  builder->BuildVoxelRightBreast("purple", false, sensitivities["RightBreast"]);
180  }
181  }
182 
183  if(sex=="Male"){
184 
185  if (model == "MIRD"){
186  builder -> BuildMaleGenitalia("yellow",false,sensitivities["MaleGenitalia"]);
187  builder -> BuildLeftTeste("purple",true,sensitivities["LeftTeste"]);
188  builder -> BuildRightTeste("purple",true,sensitivities["RightTeste"]);
189  }
190  else G4cout << "ORNL does not have model for male genitalia and testes yet" << G4endl;
191  }
192 
193  }
194  G4VPhysicalVolume* result=builder->GetPhantom();
195  delete builder;
196  return result;
197 }
198 
200 {
201  G4cout << "This method is not currently working !!!!" << G4endl;
202 }
203 
205 {
206  G4Material* air = material -> GetMaterial("Air");
207 
208  // World Volume
209  // G4double worldSize = 1.*m ;
210  G4double worldSize = 1.5 *m ;
211  G4Box* world = new G4Box("world", worldSize, worldSize, worldSize);
212 
213  G4LogicalVolume* logicWorld = new G4LogicalVolume(world,
214  air,
215  "logicalWorld", 0, 0,0);
216 
217  G4VPhysicalVolume* motherVolume = new G4PVPlacement(0,G4ThreeVector(),
218  "physicalWorld",
219  logicWorld,
220  0,
221  false,
222  0);
223 
224  // Visualization Attributes
225  G4VisAttributes* WorldVisAtt = new G4VisAttributes(G4Colour(0.94,0.5,0.5));
226 
227  WorldVisAtt->SetForceSolid(false);
229 
230  return motherVolume;
231 }
232 
234 {
235  sex=newSex;
236 
237  if (sex == "Male")
238  {
239  G4cout << ">> Male Phantom will be built." << G4endl;
240  }
241  if (sex == "Female")
242  {
243  G4cout << ">> Female Phantom will be built." << G4endl;
244  }
245  if ((sex != "Female") && (sex != "Male"))
246  G4cout << sex << " can not be defined!" << G4endl;
247 }
248 
250 {
251  model = newModel;
252 
253  if (model == "MIRD")
254  {
255  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
256  }
257  if (model == "ORNLFemale")
258  {
259  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
260  }
261 
262  if (model == "ORNLMale")
263  {
264  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
265  }
266 
267  if (model == "MIX")
268  {
269  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
270  }
271  if (model == "MIRDHead")
272  {
273  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
274  }
275 
276  if (model == "ORNLHead")
277  {
278  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
279  }
280 }
281 
283 {
284  G4HumanPhantomSD* SD = new G4HumanPhantomSD("SD", "HumanPhantomCollection");
285 
286 if (model != "ORNLMale" && model != "ORNLFemale" && model!= "ORNLHead")
287 {
288  SetSensitiveDetector("logicalHead",SD);
289  SetSensitiveDetector("logicalSkull",SD);
290  SetSensitiveDetector("logicalBrain",SD);
291  if (model != "MIRDHead")
292  {
293  SetSensitiveDetector("logicalTrunk",SD);
294  SetSensitiveDetector("logicalLeftLeg",SD);
295  SetSensitiveDetector("logicalRightLeg",SD);
296  SetSensitiveDetector("logicalLeftArmBone",SD);
297  SetSensitiveDetector("logicalRightArmBone",SD);
298  SetSensitiveDetector("logicalLeftLegBone",SD);
299  SetSensitiveDetector("logicalRightLegBone",SD);
300  SetSensitiveDetector("logicalUpperSpine",SD);
301  SetSensitiveDetector("logicalLeftScapula",SD);
302  SetSensitiveDetector("logicalRightScapula",SD);
303  SetSensitiveDetector("logicalLeftAdrenal",SD);
304  SetSensitiveDetector("logicalRightAdrenal",SD); SetSensitiveDetector("logicalThymus",SD); SetSensitiveDetector("logicalLeftClavicle",SD);
305  SetSensitiveDetector("logicalRightClavicle",SD);
306  SetSensitiveDetector("logicalSmallIntestine",SD);
307  SetSensitiveDetector("logicalRibCage",SD); SetSensitiveDetector("logicalMiddleLowerSpine",SD);
308  SetSensitiveDetector("logicalStomach",SD);
309  SetSensitiveDetector("logicalUpperLargeIntestine",SD);
310  SetSensitiveDetector("logicalLowerLargeIntestine",SD);
311  SetSensitiveDetector("logicalSpleen",SD);
312  SetSensitiveDetector("logicalPancreas",SD);
313  SetSensitiveDetector("logicalLeftKidney",SD);
314  SetSensitiveDetector("logicalRightKidney",SD);
315  SetSensitiveDetector("logicalUrinaryBladder",SD);
316 
317  if(sex=="Female"){
318 
319  SetSensitiveDetector("logicalLeftOvary",SD);
320  SetSensitiveDetector("logicalRightOvary",SD);
321  SetSensitiveDetector("logicalUterus",SD);
322  SetSensitiveDetector("logicalLeftBreast",SD);
323  SetSensitiveDetector("logicalRightBreast",SD);
324  }
325 
326  if(sex=="Male"){
327 
328 
329  SetSensitiveDetector("logicalMaleGenitalia",SD);
330  SetSensitiveDetector("logicalLeftTeste",SD);
331  SetSensitiveDetector("logicalRightTeste",SD);
332  }
333 
334  }
335  }else
336  {
337  SetSensitiveDetector("HeadVolume",SD);
338  SetSensitiveDetector("SkullVolume",SD);
339  SetSensitiveDetector("BrainVolume",SD);
340  G4cout << "Work in progress!!!! " << G4endl;
341  G4cout <<"ORNL model!!!! Head is sensitive only!!!" << G4endl;
342 }
343 
344 
345 }
virtual void SetMotherVolume(G4VPhysicalVolume *)
virtual void BuildVoxelRightBreast(const G4String &, G4bool, G4bool)
virtual void BuildLeftOvary(const G4String &, G4bool, G4bool)
virtual G4VPhysicalVolume * GetPhantom()
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
virtual void BuildBrain(const G4String &, G4bool, G4bool)
virtual void BuildMiddleLowerSpine(const G4String &, G4bool, G4bool)
virtual void BuildUrinaryBladder(const G4String &, G4bool, G4bool)
virtual void BuildLeftScapula(const G4String &, G4bool, G4bool)
virtual void BuildSpleen(const G4String &, G4bool, G4bool)
virtual void BuildPelvis(const G4String &, G4bool, G4bool)
void SetForceSolid(G4bool)
virtual void SetModel(G4String)
virtual void BuildSkull(const G4String &, G4bool, G4bool)
virtual void BuildRightOvary(const G4String &, G4bool, G4bool)
virtual void BuildPancreas(const G4String &, G4bool, G4bool)
virtual void BuildLeftAdrenal(const G4String &, G4bool, G4bool)
G4GLOB_DLL std::ostream G4cout
virtual void BuildRibCage(const G4String &, G4bool, G4bool)
virtual void BuildRightKidney(const G4String &, G4bool, G4bool)
virtual void BuildUpperLargeIntestine(const G4String &, G4bool, G4bool)
void SetBodyPartSensitivity(G4String, G4bool)
bool G4bool
Definition: G4Types.hh:79
virtual void BuildStomach(const G4String &, G4bool, G4bool)
virtual void BuildLeftKidney(const G4String &, G4bool, G4bool)
virtual void BuildLowerLargeIntestine(const G4String &, G4bool, G4bool)
virtual void BuildLeftBreast(const G4String &, G4bool, G4bool)
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
virtual void BuildLeftClavicle(const G4String &, G4bool, G4bool)
virtual void BuildUpperSpine(const G4String &, G4bool, G4bool)
G4HumanPhantomMessenger * messenger
virtual void BuildVoxelLeftBreast(const G4String &, G4bool, G4bool)
static const G4VisAttributes Invisible
virtual void BuildRightArmBone(const G4String &, G4bool, G4bool)
virtual void BuildThymus(const G4String &, G4bool, G4bool)
virtual void BuildRightLegBone(const G4String &, G4bool, G4bool)
#define G4endl
Definition: G4ios.hh:61
virtual void BuildRightAdrenal(const G4String &, G4bool, G4bool)
static const double m
Definition: G4SIunits.hh:110
virtual void BuildRightClavicle(const G4String &, G4bool, G4bool)
virtual void BuildTrunk(const G4String &, G4bool, G4bool)
double G4double
Definition: G4Types.hh:76
virtual void BuildLeftLegBone(const G4String &, G4bool, G4bool)
virtual void BuildRightBreast(const G4String &, G4bool, G4bool)
std::map< std::string, G4bool > sensitivities
virtual void BuildLeftLeg(const G4String &, G4bool, G4bool)
virtual void BuildRightScapula(const G4String &, G4bool, G4bool)
virtual void BuildUterus(const G4String &, G4bool, G4bool)
virtual void BuildLeftArmBone(const G4String &, G4bool, G4bool)
void SetVisAttributes(const G4VisAttributes *pVA)
virtual void BuildHead(const G4String &, G4bool, G4bool)
virtual void BuildRightLeg(const G4String &, G4bool, G4bool)
virtual void BuildSmallIntestine(const G4String &, G4bool, G4bool)