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