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 // << 26 // Authors: S. Guatelli and M. G. Pia, INFN Genova, Italy 27 // Previous authors: G. Guerrieri, S. Guatelli << 28 // Authors (since 2007): S. Guatelli, Universi << 29 // << 30 // Contribution: F. Ambroglini INFN Perugia, I << 31 // 27 // 32 << 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 // 33 #include "G4MIRDTrunk.hh" 34 #include "G4MIRDTrunk.hh" 34 #include "globals.hh" 35 #include "globals.hh" 35 #include "G4SystemOfUnits.hh" << 36 #include "G4SDManager.hh" 36 #include "G4SDManager.hh" 37 #include "G4VisAttributes.hh" 37 #include "G4VisAttributes.hh" 38 #include "G4HumanPhantomMaterial.hh" 38 #include "G4HumanPhantomMaterial.hh" 39 #include "G4EllipticalTube.hh" 39 #include "G4EllipticalTube.hh" 40 #include "G4RotationMatrix.hh" 40 #include "G4RotationMatrix.hh" 41 #include "G4ThreeVector.hh" 41 #include "G4ThreeVector.hh" 42 #include "G4VPhysicalVolume.hh" 42 #include "G4VPhysicalVolume.hh" 43 #include "G4PVPlacement.hh" 43 #include "G4PVPlacement.hh" 44 #include "G4HumanPhantomColour.hh" << 45 44 >> 45 G4MIRDTrunk::G4MIRDTrunk() >> 46 { >> 47 } 46 48 47 G4VPhysicalVolume* G4MIRDTrunk::Construct(cons << 49 G4MIRDTrunk::~G4MIRDTrunk() 48 const G4String& colourName, G4bool << 49 { 50 { 50 auto* material = new G4HumanPhantomMaterial( << 51 >> 52 } >> 53 >> 54 G4VPhysicalVolume* G4MIRDTrunk::ConstructTrunk(G4VPhysicalVolume* mother, G4String sex, G4bool sensitivity) >> 55 { >> 56 >> 57 G4HumanPhantomMaterial* material = new G4HumanPhantomMaterial(); 51 58 52 G4cout<<"Construct "<<volumeName<<" with mot << 59 G4cout << "ConstructTrunck for "<< sex <<G4endl; 53 60 54 auto* soft = material -> GetMaterial("soft_t << 61 G4Material* soft = material -> GetMaterial("soft_tissue"); 55 62 56 delete material; 63 delete material; 57 64 58 // MIRD Male trunk << 65 G4double dx = 17.25 * cm; 59 << 66 G4double dy = 9.80 * cm; 60 G4double dx = 20. * cm; << 67 G4double dz = 31.55 * cm; 61 G4double dy = 10. * cm; << 68 62 G4double dz = 35. * cm; << 69 G4EllipticalTube* trunk = new G4EllipticalTube("Trunk",dx, dy, dz); >> 70 >> 71 G4LogicalVolume* logicTrunk = new G4LogicalVolume(trunk, soft, >> 72 "TrunkVolume", >> 73 0, 0, 0); >> 74 G4RotationMatrix* rm = new G4RotationMatrix(); >> 75 rm -> rotateX(90.* degree); 63 76 64 auto* trunk = new G4EllipticalTube("Trunk",d << 65 << 66 auto* logicTrunk = new G4LogicalVolume(trunk << 67 "logical" + volumeName, << 68 nullptr, nullptr, nullptr); << 69 // Define rotation and position here! 77 // Define rotation and position here! 70 auto* rm = new G4RotationMatrix(); << 71 rm->rotateX(180.*degree); << 72 rm->rotateY(180.*degree); << 73 G4VPhysicalVolume* physTrunk = new G4PVPlace 78 G4VPhysicalVolume* physTrunk = new G4PVPlacement(rm, 74 //G4ThreeVector(0.* cm, 0. *cm, << 79 G4ThreeVector(0.* cm,31.55*cm, 0.*cm), 75 G4ThreeVector(0.* cm, 0. *cm, 3 << 80 "physicalTrunk", 76 "physicalTrunk", << 81 logicTrunk, 77 logicTrunk, << 82 mother, 78 mother, << 83 false, 79 false, << 84 0); 80 0, true); << 85 >> 86 // Sensitive Body Part >> 87 if (sensitivity == true) >> 88 { >> 89 G4SDManager* SDman = G4SDManager::GetSDMpointer(); >> 90 logicTrunk->SetSensitiveDetector( SDman->FindSensitiveDetector("BodyPartSD") ); >> 91 } >> 92 81 // Visualization Attributes 93 // Visualization Attributes 82 auto* colourPointer = new G4HumanPhantomColo << 94 G4VisAttributes* TrunkVisAtt = new G4VisAttributes(G4Colour(0.94,0.5,0.5)); 83 G4Colour colour = colourPointer -> GetColour << 95 TrunkVisAtt->SetForceSolid(false); 84 auto* TrunkVisAtt = new G4VisAttributes(colo << 85 TrunkVisAtt->SetForceSolid(wireFrame); << 86 logicTrunk->SetVisAttributes(TrunkVisAtt); 96 logicTrunk->SetVisAttributes(TrunkVisAtt); 87 97 88 G4cout << "Trunk created !!!!!!" << G4endl; 98 G4cout << "Trunk created !!!!!!" << G4endl; 89 99 90 // Testing Trunk Volume 100 // Testing Trunk Volume 91 G4double TrunkVol = logicTrunk->GetSolid()-> 101 G4double TrunkVol = logicTrunk->GetSolid()->GetCubicVolume(); 92 G4cout << "Volume of Trunk = " << TrunkVol/c 102 G4cout << "Volume of Trunk = " << TrunkVol/cm3 << " cm^3" << G4endl; 93 103 94 // Testing Trunk Material 104 // Testing Trunk Material 95 G4String TrunkMat = logicTrunk->GetMaterial( 105 G4String TrunkMat = logicTrunk->GetMaterial()->GetName(); 96 G4cout << "Material of Trunk = " << TrunkMat 106 G4cout << "Material of Trunk = " << TrunkMat << G4endl; 97 107 98 // Testing Density 108 // Testing Density 99 G4double TrunkDensity = logicTrunk->GetMater 109 G4double TrunkDensity = logicTrunk->GetMaterial()->GetDensity(); 100 G4cout << "Density of Material = " << TrunkD 110 G4cout << "Density of Material = " << TrunkDensity*cm3/g << " g/cm^3" << G4endl; 101 111 102 // Testing Mass 112 // Testing Mass 103 G4double TrunkMass = (TrunkVol)*TrunkDensity 113 G4double TrunkMass = (TrunkVol)*TrunkDensity; 104 G4cout << "Mass of Trunk = " << TrunkMass/gr 114 G4cout << "Mass of Trunk = " << TrunkMass/gram << " g" << G4endl; >> 115 105 116 106 return physTrunk; 117 return physTrunk; 107 } 118 } 108 119