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 // 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 30 #include "G4MIRDRightArmBone.hh" 35 #include "G4MIRDRightArmBone.hh" 31 #include "globals.hh" 36 #include "globals.hh" 32 #include "G4SystemOfUnits.hh" << 33 #include "G4SDManager.hh" 37 #include "G4SDManager.hh" 34 #include "G4VisAttributes.hh" 38 #include "G4VisAttributes.hh" >> 39 #include "G4HumanPhantomMaterial.hh" 35 #include "G4EllipticalTube.hh" 40 #include "G4EllipticalTube.hh" 36 #include "G4RotationMatrix.hh" 41 #include "G4RotationMatrix.hh" 37 #include "G4ThreeVector.hh" 42 #include "G4ThreeVector.hh" 38 #include "G4VPhysicalVolume.hh" 43 #include "G4VPhysicalVolume.hh" 39 #include "G4PVPlacement.hh" 44 #include "G4PVPlacement.hh" 40 #include "G4UnionSolid.hh" 45 #include "G4UnionSolid.hh" 41 #include "G4EllipticalCone.hh" 46 #include "G4EllipticalCone.hh" 42 #include "G4HumanPhantomColour.hh" 47 #include "G4HumanPhantomColour.hh" 43 #include "G4HumanPhantomMaterial.hh" << 48 G4MIRDRightArmBone::G4MIRDRightArmBone() >> 49 { >> 50 } >> 51 >> 52 G4MIRDRightArmBone::~G4MIRDRightArmBone() >> 53 { >> 54 } 44 55 45 G4VPhysicalVolume* G4MIRDRightArmBone::Constru 56 G4VPhysicalVolume* G4MIRDRightArmBone::Construct(const G4String& volumeName,G4VPhysicalVolume* mother, 46 const G4String& colourName,G4bool << 57 const G4String& colourName,G4bool wireFrame, G4bool sensitivity) 47 { << 58 { 48 auto* material = new G4HumanPhantomMaterial( << 59 // Remind! the elliptical cone gives problems! Intersections of volumes, >> 60 // wrong calculation of the volume! 49 61 50 G4cout<<"Construct "<<volumeName<<" with mot << 62 G4HumanPhantomMaterial* material = new G4HumanPhantomMaterial(); 51 63 52 auto* skeleton = material -> GetMaterial("sk << 64 G4cout << "Construct " << volumeName << G4endl; >> 65 >> 66 G4Material* skeleton = material -> GetMaterial("skeleton"); 53 67 54 delete material; 68 delete material; 55 69 56 G4double dx = 1.4 * cm;//a 70 G4double dx = 1.4 * cm;//a 57 G4double dy = 2.7 * cm;//b 71 G4double dy = 2.7 * cm;//b 58 // G4double dz= 46. * cm;//z0 72 // G4double dz= 46. * cm;//z0 59 73 60 auto* rightArm = new G4EllipticalTube("OneRi << 74 //G4EllipticalCone* arm = new G4EllipticalCone("OneRightArmBone",dx/2.,dy/2.,dz, 34.5 *cm); >> 75 G4EllipticalTube* rightArm = new G4EllipticalTube("OneRightArmBone",dx,dy,34.5 *cm); 61 76 62 auto* logicRightArmBone = new G4LogicalVolum << 77 G4LogicalVolume* logicRightArmBone = new G4LogicalVolume(rightArm, 63 skeleton, << 78 skeleton, 64 "logical" + volumeName, << 79 "logical" + volumeName, 65 nullptr, nullptr, nullptr); << 80 0, 0,0); 66 << 81 67 auto* rm = new G4RotationMatrix(); << 82 G4RotationMatrix* matrix = new G4RotationMatrix(); 68 rm->rotateX(180.*degree); << 83 matrix -> rotateX(180. * degree); 69 G4VPhysicalVolume* physRightArmBone = new G4 << 84 70 G4ThreeVector(-18.4 * cm, 0.0, << 85 G4VPhysicalVolume* physRightArmBone = new G4PVPlacement(matrix, 71 //-x0 << 86 G4ThreeVector(-18.4 * cm, 0.0, -0.5*cm), 72 "physicalRightArmBone", << 87 //-x0 73 logicRightArmBone, << 88 "physicalRightArmBone", 74 mother, << 89 logicRightArmBone, 75 false,0,true); << 90 mother, 76 << 91 false,0,true); >> 92 >> 93 >> 94 // Sensitive Body Part >> 95 if (sensitivity==true) >> 96 { >> 97 G4SDManager* SDman = G4SDManager::GetSDMpointer(); >> 98 logicRightArmBone->SetSensitiveDetector( SDman->FindSensitiveDetector("BodyPartSD") ); >> 99 } >> 100 >> 101 77 // Visualization Attributes 102 // Visualization Attributes 78 //G4VisAttributes* RightArmBoneVisAtt = new 103 //G4VisAttributes* RightArmBoneVisAtt = new G4VisAttributes(G4Colour(0.46,0.53,0.6)); 79 auto* colourPointer = new G4HumanPhantomColo << 104 G4HumanPhantomColour* colourPointer = new G4HumanPhantomColour(); 80 G4Colour colour = colourPointer -> GetColour 105 G4Colour colour = colourPointer -> GetColour(colourName); 81 auto* RightArmBoneVisAtt = new G4VisAttribut << 106 G4VisAttributes* RightArmBoneVisAtt = new G4VisAttributes(colour); 82 107 83 RightArmBoneVisAtt->SetForceSolid(wireFrame) 108 RightArmBoneVisAtt->SetForceSolid(wireFrame); 84 logicRightArmBone->SetVisAttributes(RightArm 109 logicRightArmBone->SetVisAttributes(RightArmBoneVisAtt); 85 110 86 G4cout << "RightArmBone created !!!!!!" << G 111 G4cout << "RightArmBone created !!!!!!" << G4endl; 87 112 88 // Testing RightArmBone Volume 113 // Testing RightArmBone Volume 89 G4double RightArmBoneVol = logicRightArmBone 114 G4double RightArmBoneVol = logicRightArmBone->GetSolid()->GetCubicVolume(); 90 G4cout << "Volume of RightArmBone = " << Rig 115 G4cout << "Volume of RightArmBone = " << RightArmBoneVol/cm3 << " cm^3" << G4endl; 91 116 92 // Testing RightArmBone Material 117 // Testing RightArmBone Material 93 G4String RightArmBoneMat = logicRightArmBone 118 G4String RightArmBoneMat = logicRightArmBone->GetMaterial()->GetName(); 94 G4cout << "Material of RightArmBone = " << R 119 G4cout << "Material of RightArmBone = " << RightArmBoneMat << G4endl; 95 120 96 // Testing Density 121 // Testing Density 97 G4double RightArmBoneDensity = logicRightArm 122 G4double RightArmBoneDensity = logicRightArmBone->GetMaterial()->GetDensity(); 98 G4cout << "Density of Material = " << RightA 123 G4cout << "Density of Material = " << RightArmBoneDensity*cm3/g << " g/cm^3" << G4endl; 99 124 100 // Testing Mass 125 // Testing Mass 101 G4double RightArmBoneMass = (RightArmBoneVol 126 G4double RightArmBoneMass = (RightArmBoneVol)*RightArmBoneDensity; 102 G4cout << "Mass of RightArmBone = " << Right 127 G4cout << "Mass of RightArmBone = " << RightArmBoneMass/gram << " g" << G4endl; 103 128 104 return physRightArmBone; 129 return physRightArmBone; 105 } 130 } 106 131