Back to home page

EIC code displayed by LXR

 
 

    


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

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 #include "G4MIRDHeart.hh"
0031 #include "globals.hh"
0032 #include "G4SDManager.hh"
0033 #include "G4VisAttributes.hh"
0034 #include "G4Ellipsoid.hh"
0035 #include "G4ThreeVector.hh"
0036 #include "G4VPhysicalVolume.hh"
0037 #include "G4RotationMatrix.hh"
0038 #include "G4Material.hh"
0039 #include "G4LogicalVolume.hh"
0040 #include "G4HumanPhantomMaterial.hh"
0041 #include "G4VPhysicalVolume.hh"
0042 #include "G4PVPlacement.hh"
0043 #include "G4Sphere.hh"
0044 #include "G4UnionSolid.hh"
0045 #include "G4HumanPhantomColour.hh"
0046 #include "G4SystemOfUnits.hh"
0047 
0048 G4VPhysicalVolume* G4MIRDHeart::Construct(const G4String& volumeName,G4VPhysicalVolume* mother,
0049                       const G4String& colourName, G4bool wireFrame, G4bool)
0050 {
0051   
0052   G4cout << "Construct " << volumeName <<" with mother "<<mother->GetName()<<G4endl;
0053 
0054   auto* material = new G4HumanPhantomMaterial();
0055 
0056   auto* soft = material -> GetMaterial("soft_tissue");
0057   
0058   G4double ax= 4.00* cm;
0059   G4double by= 4.00 *cm;
0060   G4double cz= 7.00 *cm;
0061   G4double zcut1= -7.00 *cm;
0062   G4double zcut2= 0.0 *cm;
0063   
0064   auto* heart1 =  new G4Ellipsoid("Heart1",ax, by, cz, zcut1, zcut2);
0065   
0066   G4double rmin =0.*cm;
0067   G4double rmax = 3.99*cm;
0068   G4double startphi = 0. * degree;
0069   G4double deltaphi = 360. * degree;
0070   G4double starttheta = 0. * degree;
0071   G4double deltatheta = 90. * degree;
0072  
0073   auto* heart2 = new G4Sphere("Heart2", rmin,rmax,
0074                   startphi,   deltaphi,
0075                   starttheta, deltatheta);
0076  
0077   auto* heart = new G4UnionSolid("Heart", heart1, heart2);
0078  
0079   auto* logicHeart = new G4LogicalVolume(heart, soft,
0080                           "HeartVolume",
0081                            nullptr, nullptr, nullptr);
0082 
0083   // Define rotation and position here!
0084   auto* rm = new G4RotationMatrix();
0085   rm->rotateY(25.*degree);
0086   G4VPhysicalVolume* physHeart = new G4PVPlacement(rm,G4ThreeVector(0.0,-3.0*cm, 15.32 *cm),
0087                            "physicalHeart",
0088                            logicHeart,
0089                            mother,
0090                            false,
0091                            0,true);
0092 
0093   // Visualization Attributes
0094   auto* colourPointer = new G4HumanPhantomColour();
0095   G4Colour colour = colourPointer -> GetColour(colourName);
0096   auto* HeartVisAtt = new G4VisAttributes(colour);
0097   HeartVisAtt->SetForceSolid(wireFrame);
0098   logicHeart->SetVisAttributes(HeartVisAtt);
0099 
0100   G4cout << "Heart created !!!!!!" << G4endl;
0101 
0102   // Testing Heart Volume
0103   G4double HeartVol = logicHeart->GetSolid()->GetCubicVolume();
0104   G4cout << "Volume of Heart = " << HeartVol/cm3 << " cm^3" << G4endl;
0105   
0106   // Testing Heart Material
0107   G4String HeartMat = logicHeart->GetMaterial()->GetName();
0108   G4cout << "Material of Heart = " << HeartMat << G4endl;
0109   
0110   // Testing Density
0111   G4double HeartDensity = logicHeart->GetMaterial()->GetDensity();
0112   G4cout << "Density of Material = " << HeartDensity*cm3/g << " g/cm^3" << G4endl;
0113 
0114   // Testing Mass
0115   G4double HeartMass = (HeartVol)*HeartDensity;
0116   G4cout << "Mass of Heart = " << HeartMass/gram << " g" << G4endl;  
0117 
0118   return physHeart;
0119  
0120 }