Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 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 
35 #include <map>
36 
37 #include "globals.hh"
38 
40 
41 #include "G4SystemOfUnits.hh"
42 #include "G4HumanPhantomSD.hh"
43 #include "G4SDManager.hh"
44 
45 //#include "G4VBodyFactory.hh"
46 //#include "G4MIRDBodyFactory.hh"
47 //#include "G4ORNLBodyFactory.hh"
48 
49 #include "G4PhantomBuilder.hh"
50 #include "G4FemaleBuilder.hh"
51 #include "G4MaleBuilder.hh"
52 #include "G4PhantomHeadBuilder.hh"
53 #include "G4CustomFemaleBuilder.hh"
54 #include "G4RunManager.hh"
56 #include "G4Box.hh"
57 #include "G4LogicalVolume.hh"
58 #include "G4VPhysicalVolume.hh"
59 #include "G4VisAttributes.hh"
60 #include "G4Colour.hh"
61 #include "G4PVPlacement.hh"
62 
64 {
65  messenger = new G4HumanPhantomMessenger(this);
66  material = new G4HumanPhantomMaterial();
67 }
68 
70 {
71  delete material;
72  delete messenger;
73 }
74 
76 {
77  material -> DefineMaterials();
78 
80  G4String bodypartSD = "BodyPartSD";
81  G4HumanPhantomSD* userPhantomSD = new G4HumanPhantomSD(bodypartSD);
82  SDman->AddNewDetector(userPhantomSD);
83 
84  G4BasePhantomBuilder* builder = 0;
85 
86  if (model == "MIRDHead" || model == "ORNLHead")
87  {
88  G4cout << "HeadBuilder instantiated" << G4endl;
89  builder = new G4PhantomHeadBuilder;
90  if (model == "MIRDHead") builder->SetModel("MIRD");
91  else if (model == "ORNLHead") builder->SetModel("ORNLMale");
92  }
93  else
94  {
95  if (sex =="Female")
96  {
97  if (model == "MIX") builder = new G4CustomFemaleBuilder;
98  else {builder = new G4FemaleBuilder;}
99  builder->SetModel(model);
100  G4cout <<model << " "<< sex << G4endl;
101  }
102  else if (sex == "Male")
103  {
104  builder = new G4MaleBuilder;
105  builder->SetModel(model);
106  if (model == "MIX")
107  {
108  G4cout<< "Custom Male is not available!!! MIRD model is selected !"
109  << G4endl;
110  model = "MIRD";
111  builder->SetModel(model);}
112  }
113  }
114 
115  builder->SetMotherVolume(ConstructWorld());
116 
117  // the argument indicates the sensitivity of the volume
118 
119  builder->BuildHead("black", false, sensitivities["Head"]);
120  builder->BuildSkull("orange", false,sensitivities["Skull"]);
121  builder->BuildBrain("yellow", true,sensitivities["Brain"]);
122 
123  if (model != "MIRDHead" && model != "ORNLHead")
124  {
125  // builder->SetModel(model);
126  builder->BuildTrunk("yellow", false, sensitivities["Trunk"]);
127 
128  builder->BuildLeftLeg("yellow", false,sensitivities["LeftLeg"]);
129  builder->BuildRightLeg("yellow", false,sensitivities["RightLeg"]);
130 
131  builder->BuildLeftArmBone("grey", true,sensitivities["LeftArmBone"]);
132  builder->BuildRightArmBone("grey", true, sensitivities["RightArmBone"]);
133 
134  builder->BuildLeftLegBone("grey", true,sensitivities["LeftLegBone"]);
135  builder ->BuildRightLegBone("grey", true,sensitivities["RightLegBone"]);
136 
137  builder->BuildUpperSpine("yellow", true,sensitivities["UpperSpine"]);
138 
139  if (model == "MIRD" || model == "MIX")
140  {
141  builder->BuildLeftScapula("grey", true, sensitivities["LeftScapula"]);
142  builder->BuildRightScapula("grey", true, sensitivities["RightScapula"]);
143  builder->BuildLeftAdrenal("yellow", true, sensitivities["LeftAdrenal"]);
144  builder->BuildRightAdrenal("yellow", true, sensitivities["RightAdrenal"]);
145 
146  }
147 
148  builder->BuildMiddleLowerSpine("yellow", true,sensitivities["MiddleLowerSpine"]);
149 
150  builder->BuildPelvis("grey", true,sensitivities["Pelvis"]);
151 
152  builder->BuildStomach("orange", true,sensitivities["Stomach"]);
153  builder->BuildUpperLargeIntestine("lightBlue", true,sensitivities["UpperLargeIntestine"]);
154  builder->BuildLowerLargeIntestine("lightBlue", true,sensitivities["LowerLargeIntestine"]);
155  if (model == "MIRD" || model == "MIX") builder->BuildRibCage("grey", true,sensitivities["RibCage"]);
156 
157 
158  builder->BuildSpleen("green", true,sensitivities["Spleen"]);
159  builder->BuildPancreas("purple", true,sensitivities["Pancreas"]);
160  //builder->BuildLiver("orange", true,sensitivities["Liver"]); // da fare MIRD
161 
162  builder->BuildLeftKidney("green", true,sensitivities["LeftKidney"]);
163  builder->BuildRightKidney("green", true,sensitivities["RightKidney"]);
164  builder->BuildUrinaryBladder("green", true,sensitivities["UrinaryBladder"]);
165 
166  //builder->BuildHeart("red", true,sensitivities["Hearth"]);//dafare MIRD
167  // builder->BuildLeftLung("blue", true,sensitivities["LeftLung"]);
168  //builder->BuildRightLung("blue", true,sensitivities["RightLung"]);
169  //builder->BuildThyroid("orange", true,sensitivities["Thyroid"]);
170 
171  if(sex=="Female"){
172 
173  builder->BuildLeftOvary("purple", true,sensitivities["LeftOvary"]);
174  builder->BuildRightOvary("purple", true,sensitivities["RightOvary"]);
175  builder->BuildUterus("purple", true,sensitivities["Uterus"]);
176 
177  if (model == "ORNLFemale" || model == "MIRD")
178  {
179  builder->BuildLeftBreast("purple", true,sensitivities["LeftBreast"]);
180  builder->BuildRightBreast("purple", true,sensitivities["RightBreast"]);
181  }
182  else if (model == "MIX")
183  {
184  builder->BuildVoxelLeftBreast("purple",false, sensitivities["LeftBreast"]);
185  builder->BuildVoxelRightBreast("purple", false, sensitivities["RightBreast"]);
186  }
187  }
188 
189  if(sex=="Male"){
190  // builder->BuildMaleGenitalia(sensitivities["MaleGenitalia"]);
191  // builder->BuildTestes(sensitivities["Testes"]);
192  }
193 
194  }
195  G4VPhysicalVolume* result=builder->GetPhantom();
196  delete builder;
197  return result;
198 }
199 
201 {
202  sensitivities[bodyPartName] = bodyPartSensitivity;
203  if(bodyPartSensitivity==true)
204  G4cout << " >>> " << bodyPartName << " added as sensitive volume." << G4endl;
205 }
206 
207 G4VPhysicalVolume* G4HumanPhantomConstruction::ConstructWorld()
208 {
209  G4Material* air = material -> GetMaterial("Air");
210 
211  // World Volume
212  // G4double worldSize = 1.*m ;
213  G4double worldSize = 1. *m ;
214  G4Box* world = new G4Box("world", worldSize, worldSize, worldSize);
215 
216  G4LogicalVolume* logicWorld = new G4LogicalVolume(world,
217  air,
218  "logicalWorld", 0, 0,0);
219 
220  G4VPhysicalVolume* motherVolume = new G4PVPlacement(0,G4ThreeVector(),
221  "physicalWorld",
222  logicWorld,
223  0,
224  false,
225  0);
226 
227  // Visualization Attributes
228  G4VisAttributes* WorldVisAtt = new G4VisAttributes(G4Colour(0.94,0.5,0.5));
229 
230  WorldVisAtt->SetForceSolid(false);
232 
233  return motherVolume;
234 }
235 
237 {
238  sex=newSex;
239 
240  if (sex == "Male")
241  {
242  G4cout << ">> Male Phantom will be built." << G4endl;
243  }
244  if (sex == "Female")
245  {
246  G4cout << ">> Female Phantom will be built." << G4endl;
247  }
248  if ((sex != "Female") && (sex != "Male"))
249  G4cout << sex << " can not be defined!" << G4endl;
250 }
251 
253 {
254  model = newModel;
255 
256  if (model == "MIRD")
257  {
258  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
259  }
260  if (model == "ORNLFemale")
261  {
262  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
263  }
264 
265  if (model == "ORNLMale")
266  {
267  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
268  }
269 
270  if (model == "MIX")
271  {
272  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
273  }
274  if (model == "MIRDHead")
275  {
276  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
277  }
278 
279  if (model == "ORNLHead")
280  {
281  G4cout<<" >> Phantom " << model << " will be built."<<G4endl;
282  }
283 }