Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:12

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // Previous authors: G. Guerrieri, S. Guatelli and M. G. Pia, INFN Genova, Italy
0028 // Authors (since 2007): S. Guatelli, University of Wollongong, Australia
0029 // 
0030 //
0031 //
0032 
0033 #include "G4MIRDRightLegBone.hh"
0034 
0035 #include "globals.hh"
0036 #include "G4SystemOfUnits.hh"
0037 #include "G4SDManager.hh"
0038 #include "G4VisAttributes.hh"
0039 #include "G4HumanPhantomMaterial.hh"
0040 #include "G4EllipticalTube.hh"
0041 #include "G4RotationMatrix.hh"
0042 #include "G4ThreeVector.hh"
0043 #include "G4VPhysicalVolume.hh"
0044 #include "G4PVPlacement.hh"
0045 #include "G4Cons.hh"
0046 #include "G4UnionSolid.hh"
0047 #include "G4HumanPhantomColour.hh"
0048 
0049 G4VPhysicalVolume* G4MIRDRightLegBone::Construct(const G4String& volumeName,G4VPhysicalVolume* mother,
0050                          const G4String& colourName, G4bool wireFrame,G4bool)
0051 {
0052  
0053   auto* material = new G4HumanPhantomMaterial();
0054   
0055   G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl;
0056    
0057   auto* skeleton = material -> GetMaterial("skeleton");
0058   
0059   delete material;
0060  
0061   G4double dz = 79.8 * cm;
0062   G4double rmin1 = 0.0 * cm;
0063   G4double rmin2 = 0.0 * cm;
0064   G4double rmax1 = 1. * cm;
0065   G4double rmax2 = 3.5 * cm;
0066   G4double startphi = 0. * degree;
0067   G4double deltaphi = 360. * degree;
0068 
0069   auto* leg_bone = new G4Cons("OneRightLegBone",  
0070                 rmin1, rmax1, 
0071                 rmin2, rmax2, dz/2., 
0072                 startphi, deltaphi);
0073 
0074   auto* logicRightLegBone = new G4LogicalVolume(leg_bone, skeleton,"logical" + volumeName,
0075                               nullptr, nullptr, nullptr);
0076 
0077   // Define rotation and position here!
0078   G4VPhysicalVolume* physRightLegBone = new G4PVPlacement(nullptr,
0079                               G4ThreeVector(0.0 * cm, 0.0, 0.1*cm),
0080                               "physicalRightLegBone",
0081                               logicRightLegBone,
0082                               mother,
0083                               false,
0084                               0, true);
0085 
0086   // Visualization Attributes
0087   auto* colourPointer = new G4HumanPhantomColour();
0088   G4Colour colour = colourPointer -> GetColour(colourName);
0089   auto* RightLegBoneVisAtt = new G4VisAttributes(colour);
0090 
0091   RightLegBoneVisAtt->SetForceSolid(wireFrame);
0092   logicRightLegBone->SetVisAttributes(RightLegBoneVisAtt);
0093 
0094   G4cout << "RightLegBone created !!!!!!" << G4endl;
0095 
0096   // Testing RightLegBone Volume
0097   G4double RightLegBoneVol = logicRightLegBone->GetSolid()->GetCubicVolume();
0098   G4cout << "Volume of RightLegBone = " << RightLegBoneVol/cm3 << " cm^3" << G4endl;
0099   
0100   // Testing RightLegBone Material
0101   G4String RightLegBoneMat = logicRightLegBone->GetMaterial()->GetName();
0102   G4cout << "Material of RightLegBone = " << RightLegBoneMat << G4endl;
0103   
0104   // Testing Density
0105   G4double RightLegBoneDensity = logicRightLegBone->GetMaterial()->GetDensity();
0106   G4cout << "Density of Material = " << RightLegBoneDensity*cm3/g << " g/cm^3" << G4endl;
0107 
0108   // Testing Mass
0109   G4double RightLegBoneMass = (RightLegBoneVol)*RightLegBoneDensity;
0110   G4cout << "Mass of RightLegBone = " << RightLegBoneMass/gram << " g" << G4endl;
0111  
0112   return physRightLegBone;
0113 }