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 "G4MIRDMaleGenitalia.hh"
0031 
0032 #include "globals.hh"
0033 #include "G4SystemOfUnits.hh"
0034 #include "G4SDManager.hh"
0035 #include "G4VisAttributes.hh"
0036 #include "G4Ellipsoid.hh"
0037 #include "G4ThreeVector.hh"
0038 #include "G4VPhysicalVolume.hh"
0039 #include "G4RotationMatrix.hh"
0040 #include "G4Material.hh"
0041 #include "G4LogicalVolume.hh"
0042 #include "G4HumanPhantomMaterial.hh"
0043 #include "G4VPhysicalVolume.hh"
0044 #include "G4PVPlacement.hh"
0045 #include "G4UnionSolid.hh"
0046 #include "G4HumanPhantomColour.hh"
0047 #include "G4Trap.hh"
0048 #include "G4Cons.hh"
0049 #include "G4SubtractionSolid.hh"
0050 
0051 G4VPhysicalVolume* G4MIRDMaleGenitalia::Construct(const G4String& volumeName,G4VPhysicalVolume* mother, 
0052                           const G4String& colourName, G4bool wireFrame, G4bool)
0053 { 
0054   G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl;
0055 
0056   auto* material = new G4HumanPhantomMaterial();
0057   auto* soft = material -> GetMaterial("soft_tissue");
0058   delete material;
0059  
0060   G4double pDz=2.4*cm;
0061   G4double pTheta=0*degree;
0062   G4double pPhi=0*degree;
0063   G4double pDy1=4.76*cm;
0064   G4double pDx1=9.52*cm; 
0065   G4double pDx2=9.52*cm;
0066   G4double pAlp1=0*degree;
0067   G4double pDy2=5*cm;
0068   G4double pDx3=10*cm; 
0069   G4double pDx4=10*cm;
0070   G4double pAlp2=0*degree;
0071 
0072   auto* genitaliaTrap= new G4Trap("GenitaliaTrap", 
0073                     pDz,pTheta,pPhi,pDy1,
0074                     pDx1,pDx2,pAlp1,pDy2,
0075                     pDx3,pDx4,pAlp2);
0076  
0077   G4double rmin1 = 0.* cm;
0078   G4double rmin2 = 0.* cm;
0079   G4double dz= 5 * cm; 
0080   G4double rmax1= 9.51 * cm;
0081   G4double rmax2= 10.01 * cm;
0082   G4double startphi= 0.* degree;
0083   G4double deltaphi= 360. * degree;
0084 
0085   auto* genitaliaLegL = new G4Cons("GenitaliaLegL",  
0086                      rmin1, rmax1, 
0087                      rmin2, rmax2, dz/2., 
0088                      startphi, deltaphi);
0089 
0090   auto* genitaliaLegR = new G4Cons("GenitaliaLegR",  
0091                      rmin1, rmax1, 
0092                      rmin2, rmax2, dz/2., 
0093                      startphi, deltaphi);
0094  
0095   auto* genitaliaLegs = new G4UnionSolid("GenitaliaLegs",genitaliaLegL,genitaliaLegR,
0096                       nullptr,
0097                       G4ThreeVector(20.* cm, 0.*cm,0* cm) );
0098 
0099 
0100   auto* MaleGenitalia = new G4SubtractionSolid("MaleGenitalia",genitaliaTrap,genitaliaLegs,
0101                                  nullptr,//
0102                                  G4ThreeVector(-10.* cm, -5.*cm,0* cm) );
0103  
0104  
0105   auto* logicMaleGenitalia = new G4LogicalVolume(MaleGenitalia,
0106                                 soft,
0107                                 "logical" + volumeName,
0108                                 nullptr, nullptr, nullptr);
0109  
0110   // Define rotation and position here!
0111   G4VPhysicalVolume* physMaleGenitalia = new G4PVPlacement(nullptr,
0112                                G4ThreeVector(0*cm,5.*cm, -2.4*cm),
0113                                "physicalMaleGenitalia",
0114                                logicMaleGenitalia,
0115                                mother,
0116                                false,
0117                                0, true);
0118  
0119   // Visualization Attributes
0120   //G4VisAttributes* MaleGenitaliaVisAtt = new G4VisAttributes(G4Colour(0.85,0.44,0.84));
0121   auto* colourPointer = new G4HumanPhantomColour();
0122   G4Colour colour = colourPointer -> GetColour(colourName);
0123   delete colourPointer;
0124  
0125   auto* MaleGenitaliaVisAtt = new G4VisAttributes(colour);
0126   MaleGenitaliaVisAtt->SetForceSolid(wireFrame);
0127   logicMaleGenitalia->SetVisAttributes(MaleGenitaliaVisAtt);
0128  
0129   G4cout << "MaleGenitalia created !!!!!!" << G4endl;
0130  
0131   // Testing MaleGenitalia Volume
0132   G4double MaleGenitaliaVol = logicMaleGenitalia->GetSolid()->GetCubicVolume();
0133   G4cout << "Volume of MaleGenitalia = " << MaleGenitaliaVol/cm3 << " cm^3" << G4endl;
0134  
0135   // Testing MaleGenitalia Material
0136   G4String MaleGenitaliaMat = logicMaleGenitalia->GetMaterial()->GetName();
0137   G4cout << "Material of MaleGenitalia = " << MaleGenitaliaMat << G4endl;
0138  
0139   // Testing Density
0140   G4double MaleGenitaliaDensity = logicMaleGenitalia->GetMaterial()->GetDensity();
0141   G4cout << "Density of Material = " << MaleGenitaliaDensity*cm3/g << " g/cm^3" << G4endl;
0142  
0143   // Testing Mass
0144   G4double MaleGenitaliaMass = (MaleGenitaliaVol)*MaleGenitaliaDensity;
0145   G4cout << "Mass of MaleGenitalia = " << MaleGenitaliaMass/gram << " g" << G4endl;
0146  
0147   return physMaleGenitalia;
0148 }