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 "G4MIRDStomach.hh"
0033 
0034 #include "globals.hh"
0035 #include "G4SystemOfUnits.hh"
0036 #include "G4SDManager.hh"
0037 #include "G4VisAttributes.hh"
0038 #include "G4Ellipsoid.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "G4VPhysicalVolume.hh"
0041 #include "G4Material.hh"
0042 #include "G4LogicalVolume.hh"
0043 #include "G4HumanPhantomMaterial.hh"
0044 #include "G4VPhysicalVolume.hh"
0045 #include "G4PVPlacement.hh"
0046 #include "G4SubtractionSolid.hh"
0047 #include "G4HumanPhantomColour.hh"
0048 
0049 G4VPhysicalVolume* G4MIRDStomach::Construct(const G4String& volumeName,G4VPhysicalVolume* mother,
0050                         const G4String& colourName, G4bool wireFrame, G4bool)
0051 {
0052   G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl;
0053 
0054   auto* material = new G4HumanPhantomMaterial();
0055   auto* soft = material -> GetMaterial("soft_tissue");
0056   delete material;
0057 
0058   G4double ax = 4. * cm;
0059   G4double by= 3. * cm;
0060   G4double cz = 8. * cm;
0061   //G4double zcut1 = -8. * cm;
0062   //G4double zcut2 = 8* cm;
0063 
0064   auto* stomach_out = new G4Ellipsoid("stomach_out", 
0065                          ax, by, cz);
0066   // zcut1, zcut2);
0067   /*
0068     ax = 3.387 * cm;
0069     by = 2.387 * cm;
0070     cz = 7.387 * cm;
0071     zcut1 = - 7.387 *cm;
0072     zcut2 = 7.387 *cm;
0073 
0074     G4Ellipsoid* cavity = new G4Ellipsoid ("cavity", ax, by, cz, zcut1, zcut2);
0075 
0076     G4SubtractionSolid* stomach = new G4SubtractionSolid("stomach",stomach_out, cavity);
0077   */
0078   auto* logicStomach = new G4LogicalVolume(stomach_out, soft,
0079                               "logical" + volumeName, nullptr, nullptr, nullptr);
0080   
0081   // Define rotation and position here!
0082   auto* physStomach = new G4PVPlacement(nullptr,G4ThreeVector(8. *cm,-4. * cm, 0),
0083                              "physicalStomach",
0084                              logicStomach,
0085                              mother,
0086                              false,
0087                              0, true);
0088 
0089 
0090   // Visualization Attributes
0091   auto* colourPointer = new G4HumanPhantomColour();
0092   G4Colour colour = colourPointer -> GetColour(colourName);
0093   
0094   auto* StomachVisAtt = new G4VisAttributes(colour);
0095   StomachVisAtt->SetForceSolid(wireFrame);
0096   logicStomach->SetVisAttributes(StomachVisAtt);
0097   
0098   G4cout << "Stomach created !!!!!!" << G4endl;
0099   
0100   // Testing Stomach Volume
0101   G4double StomachVol = logicStomach->GetSolid()->GetCubicVolume();
0102   G4cout << "Volume of Stomach = " << StomachVol/cm3 << " cm^3" << G4endl;
0103   
0104   // Testing Stomach Material
0105   G4String StomachMat = logicStomach->GetMaterial()->GetName();
0106   G4cout << "Material of Stomach = " << StomachMat << G4endl;
0107   
0108   // Testing Density
0109   G4double StomachDensity = logicStomach->GetMaterial()->GetDensity();
0110   G4cout << "Density of Material = " << StomachDensity*cm3/g << " g/cm^3" << G4endl;
0111 
0112   // Testing Mass
0113   G4double StomachMass = (StomachVol)*StomachDensity;
0114   G4cout << "Mass of Stomach = " << StomachMass/gram << " g" << G4endl;
0115   
0116   return physStomach;
0117 }