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 #include "G4MIRDRightLung.hh"
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 "G4SubtractionSolid.hh"
0047 #include "G4Box.hh"
0048 #include "G4HumanPhantomColour.hh"
0049 
0050 G4VPhysicalVolume* G4MIRDRightLung::Construct(const G4String& volumeName,G4VPhysicalVolume* mother, 
0051                           const G4String& colourName, G4bool wireFrame,G4bool)
0052 {
0053   G4cout << "Construct " << volumeName << " with mother volume " <<mother->GetName()<<G4endl;
0054  
0055   auto* material = new G4HumanPhantomMaterial();
0056   auto* lung_material = material -> GetMaterial("lung_material");
0057   delete material;
0058 
0059   G4double ax = 5. *cm; //a
0060   G4double by = 7.5 *cm; //b
0061   G4double cz = 24.*cm; //c
0062   G4double zcut1 = 0.0 *cm; 
0063   G4double zcut2=24. *cm;
0064  
0065   auto* oneLung = new G4Ellipsoid("OneLung",ax, by, cz, zcut1,zcut2);
0066  
0067   ax= 5.*cm; 
0068   by= 7.5*cm; 
0069   cz= 24.*cm;
0070 
0071 
0072   auto* subtrLung = new G4Ellipsoid("subtrLung",ax, by, cz);
0073 
0074   // y<0
0075 
0076   G4double dx = 5.5* cm;
0077   G4double dy = 8.5 * cm;
0078   G4double dz = 24. * cm;
0079 
0080   auto* box = new G4Box("Box", dx, dy, dz);
0081  
0082   auto* section = new G4SubtractionSolid("BoxSub", subtrLung, box, nullptr, G4ThreeVector(0.*cm, 8.5* cm, 0.*cm)); 
0083   //G4SubtractionSolid* section2 = new G4SubtractionSolid("BoxSub2", subtrLung, box, 0, G4ThreeVector(0.*cm, -8.5* cm, 0.*cm)); 
0084  
0085   auto* lung1 =  new G4SubtractionSolid("Lung1", oneLung,
0086                       section,
0087                           nullptr, G4ThreeVector(6.*cm,0*cm,0.0*cm));
0088  
0089   auto* logicRightLung = new G4LogicalVolume(lung1,lung_material,
0090                             "logical" + volumeName, nullptr, nullptr, nullptr); 
0091  
0092   auto* rm = new G4RotationMatrix();
0093   rm->rotateZ(-360.*degree);
0094   G4VPhysicalVolume* physRightLung = new G4PVPlacement(rm,G4ThreeVector(-8.50 *cm, 0.0*cm, 8.5*cm),
0095                                "physicalRightLung",                    
0096                                logicRightLung,
0097                                mother,
0098                                false,
0099                                0, true);
0100 
0101   // Visualization Attributes
0102   // G4VisAttributes* RightLungVisAtt = new G4VisAttributes(G4Colour(0.25,0.41,0.88));
0103   auto* colourPointer = new G4HumanPhantomColour();
0104   G4Colour colour = colourPointer -> GetColour(colourName);
0105   auto* RightLungVisAtt = new G4VisAttributes(colour);
0106   RightLungVisAtt->SetForceSolid(wireFrame);
0107   logicRightLung->SetVisAttributes(RightLungVisAtt); 
0108 
0109   G4cout << "RightLung created !!!!!!" << G4endl;
0110 
0111   // Testing RightLung Volume
0112   G4double RightLungVol = logicRightLung->GetSolid()->GetCubicVolume();
0113  
0114   G4cout << "Volume of RightLung = " << (RightLungVol)/cm3 << " cm^3" << G4endl;
0115   
0116   // Testing RightLung Material
0117   G4String RightLungMat = logicRightLung->GetMaterial()->GetName();
0118   G4cout << "Material of RightLung = " << RightLungMat << G4endl;
0119   
0120   // Testing Density
0121   G4double RightLungDensity = logicRightLung->GetMaterial()->GetDensity();
0122   G4cout << "Density of Material = " << RightLungDensity*cm3/g << " g/cm^3" << G4endl;
0123 
0124   // Testing Mass
0125   G4double RightLungMass = (RightLungVol)*RightLungDensity;
0126   G4cout << "Mass of RightLung = " << RightLungMass/gram << " g" << G4endl;
0127   
0128   return physRightLung;
0129 }