Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-30 07:50:13

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