ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeometryConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GeometryConstruction.cc
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 //
29 //
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
33 #include "GeometryConstruction.hh"
34 
35 #include "G4Material.hh"
36 #include "G4Element.hh"
37 #include "G4Box.hh"
38 #include "G4Sphere.hh"
39 #include "G4LogicalVolume.hh"
40 #include "G4ThreeVector.hh"
41 #include "G4PVPlacement.hh"
42 #include "G4VisAttributes.hh"
43 #include "G4Colour.hh"
44 #include "G4PhysicalConstants.hh"
45 #include "G4SystemOfUnits.hh"
46 
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 
52  fUniverse_phys(0),
53  fAl_phys(0),
54  fSphere_phys(0)
55 {;}
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
58 
60 {;}
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63 
65 {
66  //
67  //
68  // Define materials.
69  //
70  G4double a, z, density,pressure, temperature;
71  G4String name, symbol;
72 
73 
74  density = universe_mean_density; //from PhysicalConstants.h
75  pressure = 3.e-18*pascal;
76  temperature = 2.73*kelvin;
77  G4Material* Vacuum = new G4Material("Vacuum",
78  1., 1.01*g/mole, density,
79  kStateGas,temperature,pressure);
80  a = 26.98154*g/mole;
81  density = 2.70*g/cm3;
82  G4Material* Aluminium = new G4Material(name="aluminium", z=13., a, density);
83 
84  a = 28.0855*g/mole;
85  G4Element* elSi = new G4Element(name="silicon", symbol="Si", z=14., a);
86 
87  a = 16.00*g/mole;
88  G4Element* elO = new G4Element(name="Oxygen", symbol="O", z=8., a);
89 
90  density = 2.65*g/cm3;
91  G4Material* SiliconDioxide =
92  new G4Material(name="silicon oxide", density, 2);
93  SiliconDioxide->AddElement(elSi, 1);
94  SiliconDioxide->AddElement(elO, 2);
95  //
96  // Define size of world and volumes in it.
97  //
98  G4double world_r = 18*cm;
99 
100  G4double box_x = 10*cm;
101  G4double box_y = 10*cm;
102  G4double box_z = 10*cm;
103 
104  G4double sphere_r = 5*cm;
105 
106  // Define bodies, logical volumes and physical volumes.
107  // First define the experimental hall.
108  //
109  G4Sphere * universe_s
110  = new G4Sphere("universe_s", 0, world_r, 0, twopi, 0, pi);
111  G4LogicalVolume * universe_log
112  = new G4LogicalVolume(universe_s,Vacuum,"universe_L",0,0,0);
113  //
115  = new G4PVPlacement(0,G4ThreeVector(),"universe_P",
116  universe_log,0,false,0);
117 
118  //define an aluminium box
119  //
120  G4Box * Al_box
121  = new G4Box("Al_b", box_x, box_y, box_z);
122  G4LogicalVolume * Al_log
123  = new G4LogicalVolume(Al_box,Aluminium,"Box_log",0,0,0);
124  //
125  fAl_phys
126  = new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),"Box_phys",
127  Al_log,fUniverse_phys,false,0);
128 
129  // Define an inner sphere.
130  //
131  G4Sphere * aSphere_sph
132  = new G4Sphere("aSphere", 0, sphere_r, 0, twopi, 0, pi);
133  G4LogicalVolume * aSphere_log
134  = new G4LogicalVolume(aSphere_sph,SiliconDioxide,"Sphere_log",0,0,0);
135  //
137  = new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),"Sphere_phys",aSphere_log,
138  fAl_phys,false,0);
139 
140 //--------- Visualization attributes -------------------------------
142  G4VisAttributes* aVisAtt= new G4VisAttributes(G4Colour(0,1.0,1.0));
143  Al_log->SetVisAttributes(aVisAtt);
144  G4VisAttributes* bVisAtt= new G4VisAttributes(G4Colour(1.0,2.0,.0));
145  aSphere_log->SetVisAttributes(bVisAtt);
146 
147  return fUniverse_phys;
148 }
149 
150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....