Back to home page

EIC code displayed by LXR

 
 

    


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

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 "G4MIRDHead.hh"
0031 #include "globals.hh"
0032 #include "G4SystemOfUnits.hh"
0033 #include "G4HumanPhantomMaterial.hh"
0034 #include "G4SDManager.hh"
0035 #include "G4PVPlacement.hh"
0036 #include "G4VisAttributes.hh"
0037 #include "G4UnionSolid.hh"
0038 #include "G4Ellipsoid.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "G4VPhysicalVolume.hh"
0041 #include "G4RotationMatrix.hh"
0042 #include "G4Material.hh"
0043 #include "G4EllipticalTube.hh"
0044 #include "G4HumanPhantomColour.hh"
0045 
0046 G4VPhysicalVolume* G4MIRDHead::Construct(const G4String& volumeName,G4VPhysicalVolume* mother,
0047                      const G4String& colourName, G4bool wireFrame, G4bool)
0048 {
0049   G4cout << "Construct " << volumeName <<" with mother "<<mother->GetName()<<G4endl;
0050  
0051   auto* material = new G4HumanPhantomMaterial();
0052   
0053   G4Material* soft = material -> GetMaterial("soft_tissue");
0054   
0055   // MIRD male model
0056   // Ellipsoid
0057   G4double ax = 7.0 * cm;
0058   G4double by = 10.0 * cm;
0059   G4double cz = 8.50 * cm;
0060   G4double zcut1 = 0.0 * cm;
0061   G4double zcut2 = 8.5 * cm;
0062 
0063   auto* head1 = new G4Ellipsoid("Head1", ax, by, cz, zcut1, zcut2);
0064 
0065   G4double dx = 7.0 * cm;
0066   G4double dy = 10.0 * cm;
0067   G4double dz = 7.75 * cm;
0068  
0069 
0070   auto* head2 = new G4EllipticalTube("Head2", dx, dy, dz);
0071 
0072   auto* head = new G4UnionSolid("Head",head2,head1,
0073                     nullptr, // Rotation 
0074                     G4ThreeVector(0.* cm, 0.*cm, 7.7500 * cm) );
0075 
0076   auto* logicHead = new G4LogicalVolume(head, soft,"logical" + volumeName,
0077                           nullptr, nullptr, nullptr);
0078   // Define rotation and position here!
0079   auto* rm = new G4RotationMatrix();
0080   rm->rotateX(180.*degree); 
0081   rm->rotateY(180.*degree); 
0082   
0083   G4VPhysicalVolume* physHead = new G4PVPlacement(rm,
0084                           //G4ThreeVector(0.* cm,0.*cm, 70.75*cm), //FA
0085                           G4ThreeVector(0.* cm,0.*cm, 77.75*cm),
0086                           "physicalHead",
0087                           logicHead,
0088                           mother,
0089                           false,
0090                           0, true);
0091 
0092  
0093   // Visualization Attributes
0094 
0095   auto* colourPointer = new G4HumanPhantomColour();
0096   G4Colour colour = colourPointer -> GetColour(colourName);
0097   auto* HeadVisAtt = new G4VisAttributes(colour);
0098 
0099   HeadVisAtt->SetForceSolid(wireFrame);
0100   // HeadVisAtt->SetLineWidth(0.7* mm);
0101   //HeadVisAtt-> SetForceAuxEdgeVisible(true);
0102   logicHead->SetVisAttributes(HeadVisAtt);
0103 
0104   // Testing Head Volume
0105   G4double HeadVol = logicHead->GetSolid()->GetCubicVolume();
0106   G4cout << "Volume of Head = " << HeadVol/cm3 << " cm^3" << G4endl;
0107   
0108   // Testing Head Material
0109   G4String HeadMat = logicHead->GetMaterial()->GetName();
0110   G4cout << "Material of Head = " << HeadMat << G4endl;
0111   
0112   // Testing Density
0113   G4double HeadDensity = logicHead->GetMaterial()->GetDensity();
0114   G4cout << "Density of Material = " << HeadDensity*cm3/g << " g/cm^3" << G4endl;
0115 
0116   // Testing Mass
0117   G4double HeadMass = (HeadVol)*HeadDensity;
0118   G4cout << "Mass of Head = " << HeadMass/gram << " g" << G4endl;
0119   
0120   return physHead;
0121 }