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 // Previous authors: G. Guerrieri, S. Guatelli and M. G. Pia, INFN Genova, Italy
0027 // Authors (since 2007): S. Guatelli, University of Wollongong, Australia
0028 // 
0029 //
0030 #include "G4MIRDUpperSpine.hh"
0031 
0032 #include "globals.hh"
0033 #include "G4SystemOfUnits.hh"
0034 #include "G4SDManager.hh"
0035 #include "G4VisAttributes.hh"
0036 #include "G4VisAttributes.hh"
0037 #include "G4HumanPhantomMaterial.hh"
0038 #include "G4EllipticalTube.hh"
0039 #include "G4RotationMatrix.hh"
0040 #include "G4ThreeVector.hh"
0041 #include "G4VPhysicalVolume.hh"
0042 #include "G4PVPlacement.hh"
0043 #include "G4Box.hh"
0044 #include "G4SubtractionSolid.hh"
0045 #include "G4HumanPhantomColour.hh"
0046 
0047 G4VPhysicalVolume* G4MIRDUpperSpine::Construct(const G4String& volumeName,
0048                            G4VPhysicalVolume* mother, 
0049                            const G4String& colourName
0050                            , G4bool wireFrame,G4bool)
0051 {
0052   auto* material = new G4HumanPhantomMaterial();
0053    
0054   G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl;
0055 
0056   auto* skeleton = material -> GetMaterial("skeleton");
0057  
0058   delete material;
0059 
0060   G4double dx = 2. *cm;
0061   G4double dy = 2.5 *cm;
0062   G4double dz = 4.25*cm;
0063 
0064   auto* upperSpine = new G4EllipticalTube("UpperSpine",dx, dy, dz);
0065 
0066   G4double xx = 20. * cm;
0067   G4double yy = 10. * cm;
0068   G4double zz = 5. * cm;
0069 
0070   auto* subtraction = new G4Box("box", xx/2., yy/2., zz/2.);
0071 
0072   auto* matrix = new G4RotationMatrix();
0073   matrix -> rotateX(-25.* deg); 
0074 
0075   auto* upper_spine = new G4SubtractionSolid("upperspine",upperSpine, subtraction,
0076                                matrix, G4ThreeVector(0., -2.5 * cm, 5.5* cm));
0077 
0078   auto* logicUpperSpine = new G4LogicalVolume(upper_spine, skeleton, 
0079                              "logical" + volumeName,
0080                              nullptr, nullptr, nullptr);  
0081   // Define rotation and position here!
0082   G4VPhysicalVolume* physUpperSpine = new G4PVPlacement(nullptr,
0083                             G4ThreeVector(0.0, 5.5 *cm, -3.5 *cm),
0084                             "physicalUpperSpine",
0085                             logicUpperSpine,
0086                             mother,
0087                             false,
0088                             0, true);
0089 
0090   // Visualization Attributes
0091   //G4VisAttributes* UpperSpineVisAtt = new G4VisAttributes(G4Colour(0.46,0.53,0.6));
0092   auto* colourPointer = new G4HumanPhantomColour();
0093   G4Colour colour = colourPointer -> GetColour(colourName);
0094   auto* UpperSpineVisAtt = new G4VisAttributes(colour);
0095  
0096   UpperSpineVisAtt->SetForceSolid(wireFrame);
0097   logicUpperSpine->SetVisAttributes(UpperSpineVisAtt);
0098 
0099   G4cout << "UpperSpine created !!!!!!" << G4endl;
0100  
0101   // Testing UpperSpine Volume
0102   G4double UpperSpineVol = logicUpperSpine->GetSolid()->GetCubicVolume();
0103   G4cout << "Volume of UpperSpine = " << UpperSpineVol/cm3 << " cm^3" << G4endl;
0104   
0105   // Testing UpperSpine Material
0106   G4String UpperSpineMat = logicUpperSpine->GetMaterial()->GetName();
0107   G4cout << "Material of UpperSpine = " << UpperSpineMat << G4endl;
0108   
0109   // Testing Density
0110   G4double UpperSpineDensity = logicUpperSpine->GetMaterial()->GetDensity();
0111   G4cout << "Density of Material = " << UpperSpineDensity*cm3/g << " g/cm^3" << G4endl;
0112 
0113   // Testing Mass
0114   G4double UpperSpineMass = (UpperSpineVol)*UpperSpineDensity;
0115   G4cout << "Mass of UpperSpine = " << UpperSpineMass/gram << " g" << G4endl;
0116 
0117   return physUpperSpine;
0118 }