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