Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // Previous authors: G. Guerrieri, S. Guatelli << 26 // Authors: S. Guatelli and M. G. Pia, INFN Genova, Italy 27 // Authors (since 2007): S. Guatelli, Universi << 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. 28 // 33 // 29 34 30 #include <map> << 31 << 32 #include "globals.hh" 35 #include "globals.hh" >> 36 #include <map> 33 37 34 #include "G4HumanPhantomConstruction.hh" 38 #include "G4HumanPhantomConstruction.hh" 35 39 36 #include "G4SystemOfUnits.hh" << 37 #include "G4HumanPhantomSD.hh" 40 #include "G4HumanPhantomSD.hh" 38 #include "G4SDManager.hh" 41 #include "G4SDManager.hh" 39 42 40 //#include "G4VBodyFactory.hh" 43 //#include "G4VBodyFactory.hh" 41 //#include "G4MIRDBodyFactory.hh" 44 //#include "G4MIRDBodyFactory.hh" 42 //#include "G4ORNLBodyFactory.hh" 45 //#include "G4ORNLBodyFactory.hh" 43 46 44 #include "G4PhantomBuilder.hh" 47 #include "G4PhantomBuilder.hh" 45 #include "G4FemaleBuilder.hh" 48 #include "G4FemaleBuilder.hh" 46 #include "G4MaleBuilder.hh" 49 #include "G4MaleBuilder.hh" 47 #include "G4PhantomHeadBuilder.hh" << 50 48 #include "G4RunManager.hh" 51 #include "G4RunManager.hh" 49 #include "G4HumanPhantomMaterial.hh" 52 #include "G4HumanPhantomMaterial.hh" 50 #include "G4Box.hh" << 53 #include "G4HumanPhantomEnergyDeposit.hh" 51 #include "G4LogicalVolume.hh" << 52 #include "G4VPhysicalVolume.hh" << 53 #include "G4VisAttributes.hh" << 54 #include "G4Colour.hh" << 55 #include "G4PVPlacement.hh" << 56 54 57 G4HumanPhantomConstruction::G4HumanPhantomCons << 55 G4HumanPhantomConstruction::G4HumanPhantomConstruction(G4HumanPhantomEnergyDeposit* energyDep): >> 56 edepTot(energyDep) 58 { 57 { 59 fMessenger = new G4HumanPhantomMessenger(thi << 58 messenger = new G4HumanPhantomMessenger(this); 60 fMaterial = new G4HumanPhantomMaterial(); << 59 material = new G4HumanPhantomMaterial(); 61 } 60 } 62 61 63 G4HumanPhantomConstruction::~G4HumanPhantomCon 62 G4HumanPhantomConstruction::~G4HumanPhantomConstruction() 64 { 63 { 65 delete fMaterial; << 64 delete material; 66 delete fMessenger; << 65 delete messenger; 67 } 66 } 68 67 69 G4VPhysicalVolume* G4HumanPhantomConstruction: 68 G4VPhysicalVolume* G4HumanPhantomConstruction::Construct() 70 { 69 { 71 fMaterial -> DefineMaterials(); << 70 material -> DefineMaterials(); 72 71 73 G4BasePhantomBuilder* builder = nullptr; << 72 G4SDManager* SDman = G4SDManager::GetSDMpointer(); >> 73 G4String bodypartSD = "BodyPartSD"; >> 74 G4HumanPhantomSD* userPhantomSD = new G4HumanPhantomSD( bodypartSD, edepTot); >> 75 SDman->AddNewDetector( userPhantomSD ); >> 76 >> 77 G4PhantomBuilder* builder = 0; >> 78 >> 79 if(sex=="Female") builder = new G4FemaleBuilder; >> 80 else builder = new G4MaleBuilder ; >> 81 >> 82 builder->BuildWorld(); >> 83 >> 84 builder->SetModel(model); >> 85 >> 86 builder->SetSex(sex); 74 87 75 if (fModel == "MIRDHead" || fModel == "ORNLH << 76 { << 77 G4cout << "HeadBuilder instantiated" << << 78 builder = new G4PhantomHeadBuilder; << 79 if (fModel == "MIRDHead") builder->SetM << 80 else if (fModel == "ORNLHead") builder- << 81 } << 82 else << 83 { << 84 if (fSex =="Female") << 85 { << 86 builder = new G4FemaleBuilder; << 87 builder->SetModel(fModel); << 88 G4cout << fModel << " "<< fSex << G4endl; << 89 } << 90 else if (fSex == "Male") << 91 { << 92 builder = new G4MaleBuilder; << 93 builder->SetModel(fModel); << 94 } << 95 } << 96 << 97 builder->SetMotherVolume(ConstructWorld()); << 98 << 99 // the argument indicates the sensitivity of 88 // the argument indicates the sensitivity of the volume 100 << 89 builder->BuildHead(sensitivities["Head"]); 101 builder->BuildHead("black", false, fSensitiv << 90 102 builder->BuildSkull("orange", false, fSensit << 91 builder->BuildTrunk(sensitivities["Trunk"]); 103 builder->BuildBrain("yellow", true, fSensiti << 92 builder->BuildLegs(sensitivities["Legs"]); 104 << 93 builder->BuildBrain(sensitivities["Brain"]); 105 if (fModel != "MIRDHead" && fModel != "ORNLH << 94 106 { << 95 builder->BuildArmBone(sensitivities["ArmBone"]); 107 // builder->SetModel(model); << 96 builder->BuildLegBone(sensitivities["LegBone"]); 108 builder->BuildTrunk("yellow", false, fSe << 97 builder->BuildSkull(sensitivities["Skull"]); 109 << 98 builder->BuildUpperSpine(sensitivities["UpperSpine"]); 110 builder->BuildLeftLeg("yellow", false, f << 99 builder->BuildMiddleLowerSpine(sensitivities["MiddleLowerSpine"]); 111 builder->BuildRightLeg("yellow", false, << 100 112 << 101 builder->BuildPelvis(sensitivities["Pelvis"]); 113 builder->BuildLeftArmBone("grey", true, << 102 builder->BuildStomach(sensitivities["Stomach"]); 114 builder->BuildRightArmBone("grey", true, << 103 builder->BuildUpperLargeIntestine(sensitivities["UpperLargeIntestine"]); 115 << 104 builder->BuildLowerLargeIntestine(sensitivities["LowerLargeIntestine"]); 116 builder->BuildLeftLegBone("grey", true, << 105 117 builder ->BuildRightLegBone("grey", true << 106 builder->BuildSpleen(sensitivities["Spleen"]); >> 107 builder->BuildPancreas(sensitivities["Pancreas"]); >> 108 builder->BuildLiver(sensitivities["Liver"]); >> 109 >> 110 builder->BuildKidney(sensitivities["Kidney"]); >> 111 builder->BuildUrinaryBladder(sensitivities["UrinaryBladder"]); >> 112 >> 113 builder->BuildHeart(sensitivities["Hearth"]); >> 114 builder->BuildLung(sensitivities["Lung"]); >> 115 builder->BuildThyroid(sensitivities["Thyroid"]); >> 116 >> 117 if(sex=="Female"){ >> 118 builder->BuildOvary(true); >> 119 builder->BuildUterus(true); >> 120 builder->BuildBreast(true); >> 121 if(model == "MIRD") builder->BuildParameterisedBreast(true); >> 122 } 118 123 119 builder->BuildUpperSpine("yellow", true, << 124 if(sex=="Male"){ 120 << 125 builder->BuildMaleGenitalia(sensitivities["MaleGenitalia"]); 121 if (fModel == "MIRD") << 126 builder->BuildTestes(sensitivities["Testes"]); 122 { << 127 } 123 builder->BuildLeftScapula("grey", true, fS << 124 builder->BuildRightScapula("grey", true, f << 125 builder->BuildLeftAdrenal("yellow", true, << 126 builder->BuildRightAdrenal("yellow", true, << 127 builder->BuildThymus("orange", true, fSens << 128 builder->BuildLeftClavicle("grey", true, f << 129 builder->BuildRightClavicle("grey", true, << 130 builder->BuildSmallIntestine("orange", tru << 131 builder->BuildRibCage("grey", true, fSensi << 132 } << 133 << 134 builder->BuildMiddleLowerSpine("yellow", << 135 128 136 builder->BuildPelvis("grey", true, fSens << 129 return builder->GetPhantom(); 137 << 138 builder->BuildStomach("orange", true, fS << 139 builder->BuildUpperLargeIntestine("light << 140 builder->BuildLowerLargeIntestine("light << 141 builder->BuildSpleen("green", true, fSen << 142 builder->BuildPancreas("purple", true, f << 143 //builder->BuildLiver("orange", true,sen << 144 << 145 builder->BuildLeftKidney("green", true, << 146 builder->BuildRightKidney("green", true, << 147 builder->BuildUrinaryBladder("green", tr << 148 << 149 //builder->BuildHeart("red", true,fSensi << 150 // builder->BuildLeftLung("blue", true, f << 151 //builder->BuildRightLung("blue", true, << 152 // builder->BuildThyroid("orange", true, << 153 << 154 if(fSex=="Female"){ << 155 << 156 builder->BuildLeftOvary("purple", true, fSen << 157 builder->BuildRightOvary("purple", true, fSe << 158 builder->BuildUterus("purple", true, fSensit << 159 << 160 if (fModel == "ORNLFemale" || fModel == "MIR << 161 { << 162 builder->BuildLeftBreast("purple", true, << 163 builder->BuildRightBreast("purple", true << 164 } << 165 } << 166 << 167 if(fSex=="Male"){ << 168 << 169 if (fModel == "MIRD"){ << 170 builder -> BuildMaleGenitalia("yellow",fal << 171 builder -> BuildLeftTeste("purple",true, f << 172 builder -> BuildRightTeste("purple",true, << 173 } << 174 else G4cout << "ORNL does not have model fo << 175 } << 176 << 177 } << 178 G4VPhysicalVolume* result=builder->GetPhanto << 179 delete builder; 130 delete builder; 180 return result; << 181 } 131 } 182 132 183 void G4HumanPhantomConstruction::SetBodyPartS << 133 void G4HumanPhantomConstruction::SetBodyPartSensitivity(G4String bodyPartName, G4bool bodyPartSensitivity) 184 { 134 { 185 G4cout << "This method is not currently work << 135 sensitivities[bodyPartName] = bodyPartSensitivity; >> 136 if(bodyPartSensitivity==true) >> 137 G4cout << " >>> " << bodyPartName << " added as sensitive volume." << G4endl; 186 } 138 } 187 139 188 G4VPhysicalVolume* G4HumanPhantomConstruction: << 140 void G4HumanPhantomConstruction::CleanPhantom() 189 { 141 { 190 G4Material* air = fMaterial -> GetMaterial(" << 142 //delete mother; >> 143 } 191 144 192 // World Volume << 145 void G4HumanPhantomConstruction::UpdatePhantom() 193 // G4double worldSize = 1.*m ; << 146 { 194 G4double worldSize = 1.5 *m ; << 147 G4RunManager::GetRunManager()->DefineWorldVolume(Construct()); 195 G4Box* world = new G4Box("world", worldSize, << 196 << 197 auto* logicWorld = new G4LogicalVolume(world << 198 air, << 199 "logicalWorld", nullptr, nul << 200 << 201 G4VPhysicalVolume* motherVolume = new G4PVPl << 202 "physicalWorld", << 203 logicWorld, << 204 nullptr, << 205 false, << 206 0); << 207 << 208 // Visualization Attributes << 209 auto* WorldVisAtt = new G4VisAttributes(G4Co << 210 << 211 WorldVisAtt->SetForceSolid(false); << 212 logicWorld->SetVisAttributes(G4VisAttributes << 213 << 214 return motherVolume; << 215 } 148 } 216 149 217 void G4HumanPhantomConstruction::SetPhantomSex 150 void G4HumanPhantomConstruction::SetPhantomSex(G4String newSex) 218 { 151 { 219 fSex=newSex; << 152 sex=newSex; 220 153 221 if (fSex == "Male") << 154 if (sex == "Male") 222 { 155 { 223 G4cout << ">> Male Phantom will be built 156 G4cout << ">> Male Phantom will be built." << G4endl; 224 } 157 } 225 if (fSex == "Female") << 158 if (sex == "Female") 226 { 159 { 227 G4cout << ">> Female Phantom will be bui 160 G4cout << ">> Female Phantom will be built." << G4endl; 228 } 161 } 229 if ((fSex != "Female") && (fSex != "Male")) << 162 if ((sex != "Female") && (sex != "Male")) 230 G4cout << fSex << " can not be defined!" < << 163 G4cout << sex << " can not be defined!" << G4endl; 231 } 164 } 232 165 233 void G4HumanPhantomConstruction::SetPhantomMod 166 void G4HumanPhantomConstruction::SetPhantomModel(G4String newModel) 234 { 167 { 235 fModel = newModel; << 168 model = newModel; 236 << 237 if (fModel == "MIRD") << 238 { << 239 G4cout<<" >> Phantom " << fModel << " wi << 240 } << 241 if (fModel == "ORNLFemale") << 242 { << 243 G4cout<<" >> Phantom " << fModel << " wi << 244 } << 245 169 246 if (fModel == "ORNLMale") << 170 if (model == "MIRD") 247 { 171 { 248 G4cout<<" >> Phantom " << fModel << " wi << 172 G4cout<<" >> Phantom " << model << " will be built."<<G4endl; 249 } 173 } 250 << 174 if (model == "ORNL") 251 if (fModel == "MIRDHead") << 252 { 175 { 253 G4cout<<" >> Phantom " << fModel << " wi << 176 G4cout<<" >> Phantom " << model << " will be built."<<G4endl; 254 } 177 } 255 << 256 if (fModel == "ORNLHead") << 257 { << 258 G4cout<<" >> Phantom " << fModel << " wi << 259 } << 260 } << 261 << 262 void G4HumanPhantomConstruction::ConstructSDan << 263 { << 264 auto* SD = new G4HumanPhantomSD("SD", "Huma << 265 G4SDManager::GetSDMpointer()->AddNewDetecto << 266 << 267 if (fModel != "ORNLMale" && fModel != "ORNLFem << 268 { << 269 SetSensitiveDetector("logicalHead",SD); << 270 SetSensitiveDetector("logicalSkull",SD); << 271 SetSensitiveDetector("logicalBrain",SD); << 272 if (fModel != "MIRDHead") << 273 { << 274 SetSensitiveDetector("logicalTrunk",SD); << 275 SetSensitiveDetector("logicalLeftLeg",SD << 276 SetSensitiveDetector("logicalRightLeg",S << 277 SetSensitiveDetector("logicalLeftArmBone << 278 SetSensitiveDetector("logicalRightArmBon << 279 SetSensitiveDetector("logicalLeftLegBone << 280 SetSensitiveDetector("logicalRightLegBon << 281 SetSensitiveDetector("logicalUpperSpine" << 282 SetSensitiveDetector("logicalLeftScapula << 283 SetSensitiveDetector("logicalRightScapul << 284 SetSensitiveDetector("logicalLeftAdrenal << 285 SetSensitiveDetector("logicalRightAdrena << 286 SetSensitiveDetector("logicalThymus",SD) << 287 SetSensitiveDetector("logicalLeftClavicl << 288 SetSensitiveDetector("logicalRightClavic << 289 SetSensitiveDetector("logicalSmallIntest << 290 SetSensitiveDetector("logicalRibCage",SD << 291 SetSensitiveDetector("logicalMiddleLower << 292 SetSensitiveDetector("logicalStomach",SD << 293 SetSensitiveDetector("logicalUpperLargeI << 294 SetSensitiveDetector("logicalLowerLargeI << 295 SetSensitiveDetector("logicalSpleen",SD) << 296 SetSensitiveDetector("logicalPancreas",S << 297 SetSensitiveDetector("logicalLeftKidney" << 298 SetSensitiveDetector("logicalRightKidney << 299 SetSensitiveDetector("logicalUrinaryBlad << 300 << 301 if(fSex=="Female"){ << 302 SetSensitiveDetector("logicalLeftOvary",SD); << 303 SetSensitiveDetector("logicalRightOvar << 304 SetSensitiveDetector("logicalUterus",S << 305 SetSensitiveDetector("logicalLeftBreas << 306 SetSensitiveDetector("logicalRightBrea << 307 } << 308 else if(fSex=="Male"){ << 309 SetSensitiveDetector("logicalMaleGenitalia << 310 SetSensitiveDetector("logicalLeftTes << 311 SetSensitiveDetector("logicalRightTeste",S << 312 } << 313 } << 314 }else << 315 { << 316 SetSensitiveDetector("HeadVolume",SD); << 317 SetSensitiveDetector("SkullVolume",SD); << 318 SetSensitiveDetector("BrainVolume",SD); << 319 G4cout <<"ORNL model!!!! Head is sensitive o << 320 } << 321 } 178 } 322 179