Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:29:36

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 // Previous authors: G. Guerrieri, S. Guatelli and M. G. Pia, INFN Genova, Italy
0027 // Authors (since 2007): S. Guatelli, University of Wollongong, Australia
0028 // 
0029 //
0030 
0031 #include "G4MIRDLeftArmBone.hh"
0032 #include "globals.hh"
0033 #include "G4SystemOfUnits.hh"
0034 #include "G4SDManager.hh"
0035 #include "G4VisAttributes.hh"
0036 #include "G4HumanPhantomMaterial.hh"
0037 #include "G4EllipticalTube.hh"
0038 #include "G4RotationMatrix.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "G4VPhysicalVolume.hh"
0041 #include "G4PVPlacement.hh"
0042 #include "G4UnionSolid.hh"
0043 #include "G4EllipticalCone.hh"
0044 #include "G4HumanPhantomColour.hh"
0045 
0046 G4VPhysicalVolume* G4MIRDLeftArmBone::Construct(const G4String& volumeName,G4VPhysicalVolume* mother,   
0047                         const G4String& colourName, G4bool wireFrame, G4bool)
0048 {
0049   // Remind! the elliptical cone gives problems! Intersections of volumes, 
0050   // wrong calculation of the volume!
0051    
0052   auto* material = new G4HumanPhantomMaterial();
0053    
0054   G4cout << "Construct " << volumeName <<" with mother "<<mother->GetName()<<G4endl;
0055    
0056   auto* skeleton = material -> GetMaterial("skeleton");
0057   
0058   delete material;
0059 
0060   G4double dx = 1.4 * cm;//a
0061   G4double dy = 2.7 * cm;//b
0062   // G4double dz= 46. * cm;//z0
0063 
0064   auto* leftArm = new G4EllipticalTube("OneLeftArmBone",dx,dy,34.5 *cm);
0065 
0066   auto* logicLeftArmBone = new G4LogicalVolume(leftArm,
0067                               skeleton,
0068                               "logical" + volumeName,
0069                               nullptr, nullptr, nullptr);
0070 
0071   auto* rm = new G4RotationMatrix();
0072   rm->rotateX(180.*degree);
0073   G4VPhysicalVolume* physLeftArmBone = new G4PVPlacement(rm,
0074                              G4ThreeVector(18.4 * cm, 0.0, -0.5*cm),
0075                              //-x0
0076                              "physicalLeftArmBone",
0077                              logicLeftArmBone,
0078                              mother,
0079                              false,0,true);
0080                   
0081   // Visualization Attributes
0082 
0083   auto* colourPointer = new G4HumanPhantomColour();
0084   G4Colour colour = colourPointer -> GetColour(colourName);
0085   auto* LeftArmBoneVisAtt = new G4VisAttributes(colour);
0086   LeftArmBoneVisAtt->SetForceSolid(wireFrame);
0087   logicLeftArmBone->SetVisAttributes(LeftArmBoneVisAtt);
0088 
0089   G4cout << "LeftArmBone created !!!!!!" << G4endl;
0090  
0091   // Testing LeftArmBone Volume
0092   G4double LeftArmBoneVol = logicLeftArmBone->GetSolid()->GetCubicVolume();
0093   G4cout << "Volume of LeftArmBone = " << LeftArmBoneVol/cm3 << " cm^3" << G4endl;
0094   
0095   // Testing LeftArmBone Material
0096   G4String LeftArmBoneMat = logicLeftArmBone->GetMaterial()->GetName();
0097   G4cout << "Material of LeftArmBone = " << LeftArmBoneMat << G4endl;
0098   
0099   // Testing Density
0100   G4double LeftArmBoneDensity = logicLeftArmBone->GetMaterial()->GetDensity();
0101   G4cout << "Density of Material = " << LeftArmBoneDensity*cm3/g << " g/cm^3" << G4endl;
0102 
0103   // Testing Mass
0104   G4double LeftArmBoneMass = (LeftArmBoneVol)*LeftArmBoneDensity;
0105   G4cout << "Mass of LeftArmBone = " << LeftArmBoneMass/gram << " g" << G4endl;
0106   
0107   return physLeftArmBone;
0108 }