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 "G4MIRDRightBreast.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 "G4RotationMatrix.hh"
0042 #include "G4Material.hh"
0043 #include "G4LogicalVolume.hh"
0044 #include "G4HumanPhantomMaterial.hh"
0045 #include "G4VPhysicalVolume.hh"
0046 #include "G4PVPlacement.hh"
0047 #include "G4EllipticalTube.hh"
0048 #include "G4UnionSolid.hh"
0049 #include "G4SubtractionSolid.hh"
0050 #include "G4HumanPhantomColour.hh"
0051 
0052 G4VPhysicalVolume* G4MIRDRightBreast::Construct(const G4String& volumeName,G4VPhysicalVolume* mother,  
0053                         const G4String& colourName, G4bool wireFrame, G4bool)
0054 {
0055   G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl;
0056  
0057   auto* material = new G4HumanPhantomMaterial();
0058   auto* soft = material -> GetMaterial("soft_tissue");
0059   delete material;
0060 
0061   G4double ax= 4.95* cm;
0062   G4double by= 4.35* cm;
0063   G4double cz= 4.15*cm;
0064  
0065   auto* oneRightBreast = new G4Ellipsoid("OneRightBreast",
0066                         ax, by, cz);
0067 
0068   G4double dx= 20.* cm;
0069   G4double dy= 10.* cm;
0070   G4double dz= 35.* cm;
0071 
0072   auto* Trunk = new G4EllipticalTube("Trunk",dx, dy, dz );
0073                        
0074   auto* rm_relative = new G4RotationMatrix();
0075   rm_relative -> rotateX(90. * degree);
0076 
0077   auto* breast = new G4SubtractionSolid("RightBreast",
0078                               oneRightBreast,
0079                               Trunk,
0080                               rm_relative,
0081                                                       G4ThreeVector(10.*cm,
0082                                     0.0*cm,
0083                                     -8.66*cm));
0084 
0085  auto* logicRightBreast = new G4LogicalVolume(breast, soft,"logical" + volumeName, nullptr, nullptr, nullptr);
0086 
0087   // Define rotation and position here!
0088   auto* rm = new G4RotationMatrix();
0089   rm->rotateX(90.*degree);
0090   rm->rotateY(0.*degree);
0091   rm->rotateZ(-16.*degree);
0092   G4VPhysicalVolume* physRightBreast = new G4PVPlacement(rm,
0093                              G4ThreeVector(-10.*cm, 
0094                                        9.1 *cm,
0095                                        52.* cm),
0096                              "physicalRightBreast",
0097                              logicRightBreast,
0098                              mother,
0099                              false,
0100                              0, true);  
0101 
0102   // Visualization Attributes
0103   // G4VisAttributes* RightBreastVisAtt = new G4VisAttributes(G4Colour(1.0,0.41,0.71));
0104   auto* colourPointer = new G4HumanPhantomColour();
0105   G4Colour colour = colourPointer -> GetColour(colourName);
0106   auto* RightBreastVisAtt = new G4VisAttributes(colour);
0107   RightBreastVisAtt->SetForceSolid(wireFrame);
0108   logicRightBreast->SetVisAttributes(RightBreastVisAtt);
0109 
0110   G4cout << "RightBreast created !!!!!!" << G4endl;
0111   
0112   // Testing RightBreast Volume
0113   G4double RightBreastVol = logicRightBreast->GetSolid()->GetCubicVolume();
0114   G4cout << "Volume of RightBreast = " << RightBreastVol/cm3 << " cm^3" << G4endl;
0115   
0116   // Testing RightBreast Material
0117   G4String RightBreastMat = logicRightBreast->GetMaterial()->GetName();
0118   G4cout << "Material of RightBreast = " << RightBreastMat << G4endl;
0119   
0120   // Testing Density
0121   G4double RightBreastDensity = logicRightBreast->GetMaterial()->GetDensity();
0122   G4cout << "Density of Material = " << RightBreastDensity*cm3/g << " g/cm^3" << G4endl;
0123 
0124   // Testing Mass
0125   G4double RightBreastMass = (RightBreastVol)*RightBreastDensity;
0126   G4cout << "Mass of RightBreast = " << RightBreastMass/gram << " g" << G4endl;
0127 
0128 
0129   return physRightBreast;
0130 }