Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExP02DetectorConstruction.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 /// \file persistency/P02/src/ExP02DetectorConstruction.cc
27 /// \brief Implementation of the ExP02DetectorConstruction class
28 //
29 // $Id: ExP02DetectorConstruction.cc 71727 2013-06-21 07:55:45Z gcosmo $
30 //
31 //
33 
34 #include "G4Material.hh"
35 #include "G4Box.hh"
36 #include "G4Tubs.hh"
37 #include "G4LogicalVolume.hh"
38 #include "G4ThreeVector.hh"
39 #include "G4PVPlacement.hh"
40 #include "globals.hh"
41 #include "G4SystemOfUnits.hh"
42 
43 //ROOT
44 #include "TROOT.h"
45 #include "TFile.h"
46 #include "TSystem.h"
47 #include "Cintex/Cintex.h"
48 
49 #include "ExP02GeoTree.hh"
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52 
55  fExperimentalHall_log(0), fTracker_log(0),
56  fCalorimeterBlock_log(0), fCalorimeterLayer_log(0),
57  fExperimentalHall_phys(0), fCalorimeterLayer_phys(0),
58  fCalorimeterBlock_phys(0), fTracker_phys(0)
59 {;}
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62 
64 {
65 }
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
70 {
71 
72  //------------------------------------------------------ materials
73 
74  G4double a; // atomic mass
75  G4double z; // atomic number
77 
78  G4Material* Ar =
79  new G4Material("ArgonGas", z= 18., a= 39.95*g/mole, density= 1.782*mg/cm3);
80 
81  G4Material* Al =
82  new G4Material("Aluminum", z= 13., a= 26.98*g/mole, density= 2.7*g/cm3);
83 
84  G4Material* Pb =
85  new G4Material("Lead", z= 82., a= 207.19*g/mole, density= 11.35*g/cm3);
86 
87  //------------------------------------------------------ volumes
88 
89  //------------------------------ experimental hall (world volume)
90  //------------------------------ beam line along x axis
91 
92  G4double expHall_x = 3.0*m;
93  G4double expHall_y = 1.0*m;
94  G4double expHall_z = 1.0*m;
95  G4Box* experimentalHall_box
96  = new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);
97  fExperimentalHall_log = new G4LogicalVolume(experimentalHall_box,
98  Ar,"expHall_log",0,0,0);
99  fExperimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(),
100  fExperimentalHall_log,"expHall",0,false,0);
101 
102  //------------------------------ a tracker tube
103 
104  G4double innerRadiusOfTheTube = 0.*cm;
105  G4double outerRadiusOfTheTube = 60.*cm;
106  G4double hightOfTheTube = 50.*cm;
107  G4double startAngleOfTheTube = 0.*deg;
108  G4double spanningAngleOfTheTube = 360.*deg;
109  G4Tubs* tracker_tube = new G4Tubs("tracker_tube",innerRadiusOfTheTube,
110  outerRadiusOfTheTube,hightOfTheTube,
111  startAngleOfTheTube,spanningAngleOfTheTube);
112  fTracker_log = new G4LogicalVolume(tracker_tube,Al,"tracker_log",0,0,0);
113  G4double trackerPos_x = -1.0*m;
114  G4double trackerPos_y = 0.*m;
115  G4double trackerPos_z = 0.*m;
116  fTracker_phys = new G4PVPlacement(0,
117  G4ThreeVector(trackerPos_x,trackerPos_y,trackerPos_z),
118  fTracker_log,"tracker",fExperimentalHall_log,false,0);
119 
120  //------------------------------ a calorimeter block
121 
122  G4double block_x = 1.0*m;
123  G4double block_y = 50.0*cm;
124  G4double block_z = 50.0*cm;
125  G4Box* calorimeterBlock_box = new G4Box("calBlock_box",block_x,
126  block_y,block_z);
127  fCalorimeterBlock_log = new G4LogicalVolume(calorimeterBlock_box,
128  Pb,"caloBlock_log",0,0,0);
129  G4double blockPos_x = 1.0*m;
130  G4double blockPos_y = 0.0*m;
131  G4double blockPos_z = 0.0*m;
132  fCalorimeterBlock_phys = new G4PVPlacement(0,
133  G4ThreeVector(blockPos_x,blockPos_y,blockPos_z),
134  fCalorimeterBlock_log,"caloBlock",fExperimentalHall_log,false,0);
135 
136  //------------------------------ calorimeter layers
137 
138  G4double calo_x = 1.*cm;
139  G4double calo_y = 40.*cm;
140  G4double calo_z = 40.*cm;
141  G4Box* calorimeterLayer_box = new G4Box("caloLayer_box",
142  calo_x,calo_y,calo_z);
143  fCalorimeterLayer_log = new G4LogicalVolume(calorimeterLayer_box,
144  Al,"caloLayer_log",0,0,0);
145  for(G4int i=0;i<19;i++) // loop for 19 layers
146  {
147  G4double caloPos_x = (i-9)*10.*cm;
148  G4double caloPos_y = 0.0*m;
149  G4double caloPos_z = 0.0*m;
150  fCalorimeterLayer_phys = new G4PVPlacement(0,
151  G4ThreeVector(caloPos_x,caloPos_y,caloPos_z),
152  fCalorimeterLayer_log,"caloLayer",fCalorimeterBlock_log,false,i);
153  }
154 
155  //------------------------------------------------------------------
156 
157  // writing the geometry to a ROOT file
158 
159  // initialize ROOT
160  TSystem ts;
161 
162  gSystem->Load("libExP02ClassesDict");
163 
164  // ROOT::Cintex::Cintex::SetDebug(2);
165  ROOT::Cintex::Cintex::Enable();
166  // gDebug = 1;
167 
170 
171  ExP02GeoTree* geotree = new ExP02GeoTree(fExperimentalHall_phys, eltab, mattab);
172 
173  TFile fo("geo.root","RECREATE");
174 
175  fo.WriteObject(geotree, "my_geo");
176 
177  return fExperimentalHall_phys;
178 }
179 
virtual G4VPhysicalVolume * Construct()
CLHEP::Hep3Vector G4ThreeVector
G4double z
Definition: TRTMaterials.hh:39
Definition: G4Box.hh:63
Definition: G4Tubs.hh:84
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
std::vector< G4Material * > G4MaterialTable
Definition of the ExP02DetectorConstruction class.
int G4int
Definition: G4Types.hh:78
G4double density
Definition: TRTMaterials.hh:39
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
Definition of the ExP02GeoTree class.
std::vector< G4Element * > G4ElementTable
double G4double
Definition: G4Types.hh:76
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:395
G4Material * Al
Definition: TRTMaterials.hh:74