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