Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:06

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 /// \file eventgenerator/exgps/src/GeometryConstruction.cc
0028 /// \brief Implementation of the GeometryConstruction class
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #include "GeometryConstruction.hh"
0034 
0035 #include "G4Box.hh"
0036 #include "G4Colour.hh"
0037 #include "G4Element.hh"
0038 #include "G4LogicalVolume.hh"
0039 #include "G4Material.hh"
0040 #include "G4PVPlacement.hh"
0041 #include "G4PhysicalConstants.hh"
0042 #include "G4Sphere.hh"
0043 #include "G4SystemOfUnits.hh"
0044 #include "G4ThreeVector.hh"
0045 #include "G4VisAttributes.hh"
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0048 
0049 GeometryConstruction::GeometryConstruction()
0050   : G4VUserDetectorConstruction(), fUniverse_phys(0), fAl_phys(0), fSphere_phys(0)
0051 {
0052   ;
0053 }
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0056 
0057 GeometryConstruction::~GeometryConstruction()
0058 {
0059   ;
0060 }
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0063 
0064 G4VPhysicalVolume* GeometryConstruction::Construct()
0065 {
0066   //
0067   //
0068   // Define materials.
0069   //
0070   G4double a, z, density, pressure, temperature;
0071   G4String name, symbol;
0072 
0073   density = universe_mean_density;  // from PhysicalConstants.h
0074   pressure = 3.e-18 * pascal;
0075   temperature = 2.73 * kelvin;
0076   G4Material* Vacuum =
0077     new G4Material("Vacuum", 1., 1.01 * g / mole, density, kStateGas, temperature, pressure);
0078   a = 26.98154 * g / mole;
0079   density = 2.70 * g / cm3;
0080   G4Material* Aluminium = new G4Material(name = "aluminium", z = 13., a, density);
0081 
0082   a = 28.0855 * g / mole;
0083   G4Element* elSi = new G4Element(name = "silicon", symbol = "Si", z = 14., a);
0084 
0085   a = 16.00 * g / mole;
0086   G4Element* elO = new G4Element(name = "Oxygen", symbol = "O", z = 8., a);
0087 
0088   density = 2.65 * g / cm3;
0089   G4Material* SiliconDioxide = new G4Material(name = "silicon oxide", density, 2);
0090   SiliconDioxide->AddElement(elSi, 1);
0091   SiliconDioxide->AddElement(elO, 2);
0092   //
0093   // Define size of world and volumes in it.
0094   //
0095   G4double world_r = 18 * cm;
0096 
0097   G4double box_x = 10 * cm;
0098   G4double box_y = 10 * cm;
0099   G4double box_z = 10 * cm;
0100 
0101   G4double sphere_r = 5 * cm;
0102 
0103   // Define bodies, logical volumes and physical volumes.
0104   // First define the experimental hall.
0105   //
0106   G4Sphere* universe_s = new G4Sphere("universe_s", 0, world_r, 0, twopi, 0, pi);
0107   G4LogicalVolume* universe_log = new G4LogicalVolume(universe_s, Vacuum, "universe_L", 0, 0, 0);
0108   //
0109   fUniverse_phys = new G4PVPlacement(0, G4ThreeVector(), "universe_P", universe_log, 0, false, 0);
0110 
0111   // define an aluminium box
0112   //
0113   G4Box* Al_box = new G4Box("Al_b", box_x, box_y, box_z);
0114   G4LogicalVolume* Al_log = new G4LogicalVolume(Al_box, Aluminium, "Box_log", 0, 0, 0);
0115   //
0116   fAl_phys =
0117     new G4PVPlacement(0, G4ThreeVector(0., 0., 0.), "Box_phys", Al_log, fUniverse_phys, false, 0);
0118 
0119   // Define an inner sphere.
0120   //
0121   G4Sphere* aSphere_sph = new G4Sphere("aSphere", 0, sphere_r, 0, twopi, 0, pi);
0122   G4LogicalVolume* aSphere_log =
0123     new G4LogicalVolume(aSphere_sph, SiliconDioxide, "Sphere_log", 0, 0, 0);
0124   //
0125   fSphere_phys =
0126     new G4PVPlacement(0, G4ThreeVector(0., 0., 0.), "Sphere_phys", aSphere_log, fAl_phys, false, 0);
0127 
0128   //--------- Visualization attributes -------------------------------
0129   universe_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0130   G4VisAttributes* aVisAtt = new G4VisAttributes(G4Colour(0, 1.0, 1.0));
0131   Al_log->SetVisAttributes(aVisAtt);
0132   G4VisAttributes* bVisAtt = new G4VisAttributes(G4Colour(1.0, 2.0, .0));
0133   aSphere_log->SetVisAttributes(bVisAtt);
0134 
0135   return fUniverse_phys;
0136 }
0137 
0138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....