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