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] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 //
 27 /// \file eventgenerator/exgps/src/GeometryConstruction.cc
 28 /// \brief Implementation of the GeometryConstruction class
 29 //
 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32 
 33 #include "GeometryConstruction.hh"
 34 
 35 #include "G4Box.hh"
 36 #include "G4Colour.hh"
 37 #include "G4Element.hh"
 38 #include "G4LogicalVolume.hh"
 39 #include "G4Material.hh"
 40 #include "G4PVPlacement.hh"
 41 #include "G4PhysicalConstants.hh"
 42 #include "G4Sphere.hh"
 43 #include "G4SystemOfUnits.hh"
 44 #include "G4ThreeVector.hh"
 45 #include "G4VisAttributes.hh"
 46 
 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 48 
 49 GeometryConstruction::GeometryConstruction()
 50   : G4VUserDetectorConstruction(), fUniverse_phys(0), fAl_phys(0), fSphere_phys(0)
 51 {
 52   ;
 53 }
 54 
 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 56 
 57 GeometryConstruction::~GeometryConstruction()
 58 {
 59   ;
 60 }
 61 
 62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 63 
 64 G4VPhysicalVolume* GeometryConstruction::Construct()
 65 {
 66   //
 67   //
 68   // Define materials.
 69   //
 70   G4double a, z, density, pressure, temperature;
 71   G4String name, symbol;
 72 
 73   density = universe_mean_density;  // from PhysicalConstants.h
 74   pressure = 3.e-18 * pascal;
 75   temperature = 2.73 * kelvin;
 76   G4Material* Vacuum =
 77     new G4Material("Vacuum", 1., 1.01 * g / mole, density, kStateGas, temperature, pressure);
 78   a = 26.98154 * g / mole;
 79   density = 2.70 * g / cm3;
 80   G4Material* Aluminium = new G4Material(name = "aluminium", z = 13., a, density);
 81 
 82   a = 28.0855 * g / mole;
 83   G4Element* elSi = new G4Element(name = "silicon", symbol = "Si", z = 14., a);
 84 
 85   a = 16.00 * g / mole;
 86   G4Element* elO = new G4Element(name = "Oxygen", symbol = "O", z = 8., a);
 87 
 88   density = 2.65 * g / cm3;
 89   G4Material* SiliconDioxide = new G4Material(name = "silicon oxide", density, 2);
 90   SiliconDioxide->AddElement(elSi, 1);
 91   SiliconDioxide->AddElement(elO, 2);
 92   //
 93   // Define size of world and volumes in it.
 94   //
 95   G4double world_r = 18 * cm;
 96 
 97   G4double box_x = 10 * cm;
 98   G4double box_y = 10 * cm;
 99   G4double box_z = 10 * cm;
100 
101   G4double sphere_r = 5 * cm;
102 
103   // Define bodies, logical volumes and physical volumes.
104   // First define the experimental hall.
105   //
106   G4Sphere* universe_s = new G4Sphere("universe_s", 0, world_r, 0, twopi, 0, pi);
107   G4LogicalVolume* universe_log = new G4LogicalVolume(universe_s, Vacuum, "universe_L", 0, 0, 0);
108   //
109   fUniverse_phys = new G4PVPlacement(0, G4ThreeVector(), "universe_P", universe_log, 0, false, 0);
110 
111   // define an aluminium box
112   //
113   G4Box* Al_box = new G4Box("Al_b", box_x, box_y, box_z);
114   G4LogicalVolume* Al_log = new G4LogicalVolume(Al_box, Aluminium, "Box_log", 0, 0, 0);
115   //
116   fAl_phys =
117     new G4PVPlacement(0, G4ThreeVector(0., 0., 0.), "Box_phys", Al_log, fUniverse_phys, false, 0);
118 
119   // Define an inner sphere.
120   //
121   G4Sphere* aSphere_sph = new G4Sphere("aSphere", 0, sphere_r, 0, twopi, 0, pi);
122   G4LogicalVolume* aSphere_log =
123     new G4LogicalVolume(aSphere_sph, SiliconDioxide, "Sphere_log", 0, 0, 0);
124   //
125   fSphere_phys =
126     new G4PVPlacement(0, G4ThreeVector(0., 0., 0.), "Sphere_phys", aSphere_log, fAl_phys, false, 0);
127 
128   //--------- Visualization attributes -------------------------------
129   universe_log->SetVisAttributes(G4VisAttributes::GetInvisible());
130   G4VisAttributes* aVisAtt = new G4VisAttributes(G4Colour(0, 1.0, 1.0));
131   Al_log->SetVisAttributes(aVisAtt);
132   G4VisAttributes* bVisAtt = new G4VisAttributes(G4Colour(1.0, 2.0, .0));
133   aSphere_log->SetVisAttributes(bVisAtt);
134 
135   return fUniverse_phys;
136 }
137 
138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
139