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 "G4MIRDThyroid.hh"
0033 
0034 #include "globals.hh"
0035 #include "G4SystemOfUnits.hh"
0036 #include "G4SDManager.hh"
0037 #include "G4VisAttributes.hh"
0038 #include "G4HumanPhantomMaterial.hh"
0039 #include "G4RotationMatrix.hh"
0040 #include "G4ThreeVector.hh"
0041 #include "G4VPhysicalVolume.hh"
0042 #include "G4PVPlacement.hh"
0043 #include "G4Tubs.hh"
0044 #include "G4Box.hh"
0045 #include "G4VSolid.hh"
0046 #include "G4SubtractionSolid.hh"
0047 #include "G4HumanPhantomColour.hh"
0048 
0049 G4VPhysicalVolume* G4MIRDThyroid::Construct(const G4String& volumeName,G4VPhysicalVolume* mother,
0050                         const G4String& colourName, G4bool wireFrame, G4bool)
0051 {
0052 
0053   G4cout << "Construct " << volumeName <<" with mother "<<mother->GetName()<<G4endl;
0054   
0055   auto* material = new G4HumanPhantomMaterial();
0056   auto* soft = material -> GetMaterial("soft_tissue");
0057   delete material;
0058   
0059   G4double z= 4.20*cm; //c thickness = c,  
0060   G4double rmin= 0. * cm;
0061   G4double rmax= 1.85 *cm; //Rmax
0062   G4double startphi = 0. * degree;
0063   G4double deltaphi= 180. * degree; // y< y0
0064   
0065   auto* LobOfThyroidOut = new G4Tubs("LobOfThyroidOut",
0066                        rmin, rmax,z/2., 
0067                        startphi, deltaphi);
0068 
0069   z= 4.50*cm; // c thickness + something
0070   rmax= 0.83 * cm; //r
0071   deltaphi= 360. * degree; 
0072   auto* LobOfThyroidIn = new G4Tubs("LobOfThyroidIn",
0073                       rmin, rmax,z/2., 
0074                       startphi, deltaphi);
0075 
0076   G4double xx = 3.72*cm;
0077   G4double yy= 3.72*cm;
0078   G4double zz= 20.00*cm;
0079   auto* SubtrThyroid = new G4Box("SubtrThyroid",
0080                   xx/2., yy/2., zz/2.);
0081 
0082   // subtraction of the two tubs
0083   auto* FirstThyroid = new G4SubtractionSolid("FirstThyroid",
0084                                 LobOfThyroidOut,
0085                                 LobOfThyroidIn);
0086 
0087   auto* relative_matrix = new G4RotationMatrix();
0088   relative_matrix -> rotateX(-50.* degree);
0089 
0090   auto* SecondThyroid = new G4SubtractionSolid("SecondThyroid",
0091                                  FirstThyroid,
0092                                  SubtrThyroid,
0093                                  relative_matrix,
0094                                  G4ThreeVector(0.0 *cm,0.0 *cm, 4.20*cm));
0095 
0096   auto* relative_matrix_2 = new G4RotationMatrix();
0097   relative_matrix_2 -> rotateX(50.* degree);
0098  
0099   auto* thyroid = new G4SubtractionSolid("SecondThyroid",
0100                                SecondThyroid,
0101                                SubtrThyroid,
0102                                relative_matrix_2,
0103                                G4ThreeVector(0.0 *cm,0.0 *cm, -5.40*cm));
0104 
0105   auto* logicThyroid = new G4LogicalVolume(thyroid, soft,
0106                               "ThyroidVolume",
0107                               nullptr, nullptr, nullptr);
0108 
0109   auto* rm = new G4RotationMatrix();
0110   rm->rotateZ(180.*degree);
0111   G4VPhysicalVolume* physThyroid = new G4PVPlacement(rm,
0112                              //                          G4ThreeVector(0.0*cm,-3.91*cm, -5.925*cm),//y0
0113                              G4ThreeVector(0.0*cm,-3.91*cm, -5.65*cm),//y0
0114                              "physicalThyroid",
0115                              logicThyroid,
0116                              mother,
0117                              false,
0118                              0,true);
0119  
0120  
0121   // Visualization Attributes
0122   auto* colourPointer = new G4HumanPhantomColour();
0123   G4Colour colour = colourPointer -> GetColour(colourName);
0124   auto* ThyroidVisAtt = new G4VisAttributes(colour);
0125   ThyroidVisAtt->SetForceSolid(wireFrame);
0126   logicThyroid->SetVisAttributes(ThyroidVisAtt);
0127 
0128   G4cout << "Thyroid created !!!!!!" << G4endl;
0129 
0130   // Testing Thyroid Volume
0131   G4double ThyroidVol = logicThyroid->GetSolid()->GetCubicVolume();
0132   G4cout << "Volume of Thyroid = " << ThyroidVol/cm3 << " cm^3" << G4endl;
0133   
0134   // Testing Thyroid Material
0135   G4String ThyroidMat = logicThyroid->GetMaterial()->GetName();
0136   G4cout << "Material of Thyroid = " << ThyroidMat << G4endl;
0137   
0138   // Testing Density
0139   G4double ThyroidDensity = logicThyroid->GetMaterial()->GetDensity();
0140   G4cout << "Density of Material = " << ThyroidDensity*cm3/g << " g/cm^3" << G4endl;
0141 
0142   // Testing Mass
0143   G4double ThyroidMass = (ThyroidVol)*ThyroidDensity;
0144   G4cout << "Mass of Thyroid = " << ThyroidMass/gram << " g" << G4endl;
0145 
0146   
0147   return physThyroid;
0148 }