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 #include "G4MIRDSkull.hh"
0033 
0034 #include "globals.hh"
0035 #include "G4SystemOfUnits.hh"
0036 #include "G4SDManager.hh"
0037 #include "G4VisAttributes.hh"
0038 #include "G4HumanPhantomMaterial.hh"
0039 #include "G4EllipticalTube.hh"
0040 #include "G4RotationMatrix.hh"
0041 #include "G4ThreeVector.hh"
0042 #include "G4VPhysicalVolume.hh"
0043 #include "G4PVPlacement.hh"
0044 #include "G4Ellipsoid.hh"
0045 #include "G4SubtractionSolid.hh"
0046 #include "G4Box.hh"
0047 #include "G4UnionSolid.hh"
0048 #include "G4VSolid.hh"
0049 #include "G4HumanPhantomColour.hh"
0050 
0051 G4VPhysicalVolume* G4MIRDSkull::Construct(const G4String& volumeName,G4VPhysicalVolume* mother,
0052                       const G4String& colourName,
0053                       G4bool wireFrame,G4bool)
0054 {
0055   
0056   auto* material = new G4HumanPhantomMaterial();
0057    
0058   G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl;
0059 
0060    
0061   auto* skeleton = material -> GetMaterial("skeleton");
0062  
0063   delete material;
0064 
0065   // Outer cranium
0066   G4double ax = 6.8 * cm;//a out skull
0067   G4double by = 9.8 * cm; // bout
0068   G4double cz = 8.3 * cm; //cout
0069  
0070   auto* craniumOut =  new G4Ellipsoid("CraniumOut", ax, by, cz);
0071 
0072   ax = 6. * cm; //a in
0073   by = 9. * cm; //b in 
0074   cz= 6.5 * cm; // cin
0075  
0076   auto* craniumIn =  new G4Ellipsoid("CraniumIn", ax, by, cz);
0077  
0078 
0079   auto* cranium =  new G4SubtractionSolid("Cranium",
0080                             craniumOut,
0081                             craniumIn, nullptr,
0082                             G4ThreeVector(0.0, 0.0,1. * cm));
0083 
0084  auto* logicSkull = new G4LogicalVolume(cranium, skeleton, 
0085                             "logical" + volumeName,
0086                             nullptr, nullptr, nullptr);
0087   
0088   // Define rotation and position here!
0089   G4VPhysicalVolume* physSkull = new G4PVPlacement(nullptr,
0090                            G4ThreeVector(0., 0.,7.75 * cm),
0091                            "physicalSkull",
0092                            logicSkull,
0093                            mother,
0094                            false,
0095                            0, true);
0096 
0097   // Visualization Attributes
0098   //G4VisAttributes* SkullVisAtt = new G4VisAttributes(G4Colour(0.46,0.53,0.6));
0099   auto* colourPointer = new G4HumanPhantomColour();
0100   G4Colour colour = colourPointer -> GetColour(colourName);
0101   auto* SkullVisAtt = new G4VisAttributes(colour);
0102   SkullVisAtt->SetForceSolid(wireFrame); 
0103   SkullVisAtt->SetLineWidth(4.* mm);
0104   logicSkull->SetVisAttributes(SkullVisAtt);
0105 
0106   G4cout << "Skull created !!!!!!" << G4endl;
0107 
0108 
0109   // Testing Skull Volume
0110   G4double SkullVol = logicSkull->GetSolid()->GetCubicVolume();
0111   G4cout << "Volume of Skull = " << SkullVol/cm3 << " cm^3" << G4endl;
0112   
0113   // Testing Skull Material
0114   G4String SkullMat = logicSkull->GetMaterial()->GetName();
0115   G4cout << "Material of Skull = " << SkullMat << G4endl;
0116   
0117   // Testing Density
0118   G4double SkullDensity = logicSkull->GetMaterial()->GetDensity();
0119   G4cout << "Density of Material = " << SkullDensity*cm3/g << " g/cm^3" << G4endl;
0120 
0121   // Testing Mass
0122   G4double SkullMass = (SkullVol)*SkullDensity;
0123   G4cout << "Mass of Skull = " << SkullMass/gram << " g" << G4endl;
0124 
0125   
0126   return physSkull;
0127 }