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 "G4MIRDRightScapula.hh"
0032 
0033 #include "globals.hh"
0034 #include "G4SystemOfUnits.hh"
0035 #include "G4SDManager.hh"
0036 #include "G4Cons.hh"
0037 #include "G4VisAttributes.hh"
0038 #include "G4HumanPhantomMaterial.hh"
0039 #include "G4EllipticalTube.hh"
0040 #include "G4ThreeVector.hh"
0041 #include "G4VPhysicalVolume.hh"
0042 #include "G4RotationMatrix.hh"
0043 #include "G4LogicalVolume.hh"
0044 #include "G4PVPlacement.hh"
0045 #include "G4SubtractionSolid.hh"
0046 #include "G4HumanPhantomColour.hh"
0047 #include "G4Box.hh"
0048 
0049 G4VPhysicalVolume* G4MIRDRightScapula::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* skeleton = material -> GetMaterial("skeleton");
0056  
0057   G4double ax_in = 17.* cm;
0058   G4double by_in = 9.8* cm;
0059   G4double ax_out = 19.*cm;
0060   G4double by_out = 9.8*cm;
0061   G4double dz= 16.4* cm;
0062 
0063   auto* inner_scapula = new G4EllipticalTube("ScapulaIn", ax_in, by_in, (dz+ 1.*cm)/2);
0064   auto* outer_scapula = new G4EllipticalTube("ScapulaOut", ax_out, by_out, dz/2);
0065   
0066   auto* subtraction = new G4Box("subtraction",ax_out, ax_out, ax_out);
0067 
0068   G4double xx = -ax_out * 0.242 ; //(sin 14deg)
0069   G4double yy  = - ax_out * 0.97; // (cos 14 deg)
0070                            
0071   auto* rm = new G4RotationMatrix();
0072   rm -> rotateZ(14.* degree);
0073 
0074   auto* scapula_first =  new G4SubtractionSolid("Scapula_first",
0075                                   outer_scapula,
0076                                   subtraction,
0077                                   rm, 
0078                                   G4ThreeVector(xx, yy, 0. *cm));
0079                                   
0080   G4double xx2 = ax_out * 0.62470 ; //(cos 51.34deg)
0081   G4double yy2 = ax_out * 0.78087; // (sin 51.34 deg)
0082                            
0083   auto* rm2 = new G4RotationMatrix();
0084   rm2 -> rotateZ(38.6598* degree);
0085 
0086   auto* scapula_bone =  new G4SubtractionSolid("Scapula",
0087                                  scapula_first,
0088                                  subtraction,
0089                                  rm2, 
0090                                  G4ThreeVector(xx2, yy2, 0. *cm));
0091 
0092   auto* scapula =  new G4SubtractionSolid("Scapula",
0093                             scapula_bone,
0094                             inner_scapula);
0095 
0096   auto* logicRightScapula = new G4LogicalVolume(scapula,
0097                                skeleton,
0098                                "logical" + volumeName,
0099                                nullptr, nullptr, nullptr);
0100 
0101   G4VPhysicalVolume* physRightScapula = new G4PVPlacement(nullptr,
0102                               G4ThreeVector(0. * cm, 0. * cm, 24.1 *cm),
0103                               "physicalRightScapula",
0104                               logicRightScapula,
0105                               mother,
0106                               false,
0107                               0, true);
0108 
0109   // Visualization Attributes
0110   //G4VisAttributes* RightScapulaVisAtt = new G4VisAttributes(G4Colour(0.94,0.5,0.5));
0111   auto* colourPointer = new G4HumanPhantomColour();
0112   G4Colour colour = colourPointer -> GetColour(colourName);
0113   auto* RightScapulaVisAtt = new G4VisAttributes(colour);
0114   RightScapulaVisAtt->SetForceSolid(wireFrame);
0115   logicRightScapula->SetVisAttributes(RightScapulaVisAtt);
0116   G4cout << "RightScapula created !!!!!!" << G4endl;
0117 
0118   // Testing RightScapula Volume
0119   G4double RightScapulaVol = logicRightScapula->GetSolid()->GetCubicVolume();
0120   G4cout << "Volume of RightScapula = " << RightScapulaVol/cm3 << " cm^3" << G4endl;
0121   
0122   // Testing RightScapula Material
0123   G4String RightScapulaMat = logicRightScapula->GetMaterial()->GetName();
0124   G4cout << "Material of RightScapula = " << RightScapulaMat << G4endl;
0125   
0126   // Testing Density
0127   G4double RightScapulaDensity = logicRightScapula->GetMaterial()->GetDensity();
0128   G4cout << "Density of Material = " << RightScapulaDensity*cm3/g << " g/cm^3" << G4endl;
0129 
0130   // Testing Mass
0131   G4double RightScapulaMass = (RightScapulaVol)*RightScapulaDensity;
0132   G4cout << "Mass of RightScapula = " << RightScapulaMass/gram << " g" << G4endl;
0133 
0134   return physRightScapula;
0135 }