Geant4  10.01.p02
GeometryConstruction.cc
Go to the documentation of this file.
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 // $Id: GeometryConstruction.cc 67272 2013-02-13 12:05:47Z ihrivnac $
27 //
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "GeometryConstruction.hh"
35 
36 #include "G4Material.hh"
37 #include "G4Element.hh"
38 #include "G4Box.hh"
39 #include "G4Sphere.hh"
40 #include "G4LogicalVolume.hh"
41 #include "G4ThreeVector.hh"
42 #include "G4PVPlacement.hh"
43 #include "G4VisAttributes.hh"
44 #include "G4Colour.hh"
45 #include "G4PhysicalConstants.hh"
46 #include "G4SystemOfUnits.hh"
47 
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50 
53  fUniverse_phys(0),
54  fAl_phys(0),
55  fSphere_phys(0)
56 {;}
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
59 
61 {;}
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64 
66 {
67  //
68  //
69  // Define materials.
70  //
71  G4double a, z, density,pressure, temperature;
73 
74 
75  density = universe_mean_density; //from PhysicalConstants.h
76  pressure = 3.e-18*pascal;
77  temperature = 2.73*kelvin;
78  G4Material* Vacuum = new G4Material("Vacuum",
79  1., 1.01*g/mole, density,
80  kStateGas,temperature,pressure);
81  a = 26.98154*g/mole;
82  density = 2.70*g/cm3;
83  G4Material* Aluminium = new G4Material(name="aluminium", z=13., a, density);
84 
85  a = 28.0855*g/mole;
86  G4Element* elSi = new G4Element(name="silicon", symbol="Si", z=14., a);
87 
88  a = 16.00*g/mole;
89  G4Element* elO = new G4Element(name="Oxygen", symbol="O", z=8., a);
90 
91  density = 2.65*g/cm3;
92  G4Material* SiliconDioxide =
93  new G4Material(name="silicon oxide", density, 2);
94  SiliconDioxide->AddElement(elSi, 1);
95  SiliconDioxide->AddElement(elO, 2);
96  //
97  // Define size of world and volumes in it.
98  //
99  G4double world_r = 18*cm;
100 
101  G4double box_x = 10*cm;
102  G4double box_y = 10*cm;
103  G4double box_z = 10*cm;
104 
105  G4double sphere_r = 5*cm;
106 
107  // Define bodies, logical volumes and physical volumes.
108  // First define the experimental hall.
109  //
110  G4Sphere * universe_s
111  = new G4Sphere("universe_s", 0, world_r, 0, twopi, 0, pi);
112  G4LogicalVolume * universe_log
113  = new G4LogicalVolume(universe_s,Vacuum,"universe_L",0,0,0);
114  //
116  = new G4PVPlacement(0,G4ThreeVector(),"universe_P",
117  universe_log,0,false,0);
118 
119  //define an aluminium box
120  //
121  G4Box * Al_box
122  = new G4Box("Al_b", box_x, box_y, box_z);
123  G4LogicalVolume * Al_log
124  = new G4LogicalVolume(Al_box,Aluminium,"Box_log",0,0,0);
125  //
126  fAl_phys
127  = new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),"Box_phys",
128  Al_log,fUniverse_phys,false,0);
129 
130  // Define an inner sphere.
131  //
132  G4Sphere * aSphere_sph
133  = new G4Sphere("aSphere", 0, sphere_r, 0, twopi, 0, pi);
134  G4LogicalVolume * aSphere_log
135  = new G4LogicalVolume(aSphere_sph,SiliconDioxide,"Sphere_log",0,0,0);
136  //
138  = new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),"Sphere_phys",aSphere_log,
139  fAl_phys,false,0);
140 
141 //--------- Visualization attributes -------------------------------
143  G4VisAttributes* aVisAtt= new G4VisAttributes(G4Colour(0,1.0,1.0));
144  Al_log->SetVisAttributes(aVisAtt);
145  G4VisAttributes* bVisAtt= new G4VisAttributes(G4Colour(1.0,2.0,.0));
146  aSphere_log->SetVisAttributes(bVisAtt);
147 
148  return fUniverse_phys;
149 }
150 
151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
static const double cm
Definition: G4SIunits.hh:106
G4VPhysicalVolume * fSphere_phys
G4String symbol
Definition: TRTMaterials.hh:40
CLHEP::Hep3Vector G4ThreeVector
G4double z
Definition: TRTMaterials.hh:39
G4VPhysicalVolume * fAl_phys
Definition: G4Box.hh:64
G4String name
Definition: TRTMaterials.hh:40
const G4double pi
G4double a
Definition: TRTMaterials.hh:39
G4VPhysicalVolume * fUniverse_phys
G4double density
Definition: TRTMaterials.hh:39
G4Element * elO
Definition: TRTMaterials.hh:46
Definition of the GeometryConstruction class.
static const double cm3
Definition: G4SIunits.hh:108
virtual G4VPhysicalVolume * Construct()
static const double kelvin
Definition: G4SIunits.hh:260
#define pascal
Definition: G4SIunits.hh:213
static const double g
Definition: G4SIunits.hh:162
static const G4VisAttributes Invisible
static const double mole
Definition: G4SIunits.hh:265
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:364
double G4double
Definition: G4Types.hh:76
void SetVisAttributes(const G4VisAttributes *pVA)