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 | // $Id: MyExDetectorConstruction.cc,v 1.1 2006/11/28 15:19:42 tnikitin Exp $ |
---|
28 | // GEANT4 tag $Name: HEAD $ |
---|
29 | // |
---|
30 | |
---|
31 | #include "ExN01DetectorConstruction.hh" |
---|
32 | |
---|
33 | #include "G4Material.hh" |
---|
34 | #include "G4Box.hh" |
---|
35 | #include "G4Tubs.hh" |
---|
36 | #include "G4LogicalVolume.hh" |
---|
37 | #include "G4ThreeVector.hh" |
---|
38 | #include "G4PVPlacement.hh" |
---|
39 | #include "G4UnitsTable.hh" |
---|
40 | #include "globals.hh" |
---|
41 | |
---|
42 | ExN01DetectorConstruction::ExN01DetectorConstruction() |
---|
43 | : experimentalHall_log(0), tracker_log(0), |
---|
44 | calorimeterBlock_log(0), calorimeterLayer_log(0), |
---|
45 | experimentalHall_phys(0), calorimeterLayer_phys(0), |
---|
46 | calorimeterBlock_phys(0), tracker_phys(0) |
---|
47 | {;} |
---|
48 | |
---|
49 | ExN01DetectorConstruction::~ExN01DetectorConstruction() |
---|
50 | { |
---|
51 | } |
---|
52 | |
---|
53 | G4VPhysicalVolume* ExN01DetectorConstruction::Construct() |
---|
54 | { |
---|
55 | |
---|
56 | //------------------------------------------------------ materials |
---|
57 | |
---|
58 | G4double a; // atomic mass |
---|
59 | G4double z; // atomic number |
---|
60 | G4double density; |
---|
61 | G4double pressure; |
---|
62 | G4double temperature; |
---|
63 | G4int ncomponents, natoms; |
---|
64 | G4double abundance, fractionmass; |
---|
65 | G4Material* Ar = |
---|
66 | new G4Material("ArgonGas", z= 18., a= 39.95*g/mole, density= 1.782*mg/cm3); |
---|
67 | |
---|
68 | G4Material* Al = |
---|
69 | new G4Material("Aluminum", z= 13., a= 26.98*g/mole, density= 2.7*g/cm3); |
---|
70 | |
---|
71 | G4Material* Pb = |
---|
72 | new G4Material("Lead", z= 82., a= 207.19*g/mole, density= 11.35*g/cm3); |
---|
73 | // |
---|
74 | // What about vacuum ? Vacuum is an ordinary gas with very low density |
---|
75 | // |
---|
76 | |
---|
77 | density = universe_mean_density; //from PhysicalConstants.h |
---|
78 | pressure = 1.e-19*pascal; |
---|
79 | temperature = 0.1*kelvin; |
---|
80 | G4Material* Galactic=new G4Material("Galactic", z=1., a=1.01*g/mole, density, |
---|
81 | kStateGas,temperature,pressure); |
---|
82 | |
---|
83 | // |
---|
84 | // define a material from elements. case 2: mixture by fractional mass |
---|
85 | // |
---|
86 | //This function illustrates the possible ways to define materials |
---|
87 | |
---|
88 | G4String symbol; |
---|
89 | |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | ////define Elements |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | G4Element* N = new G4Element("Nitrogen",symbol="N" , z= 7., a= 14.01*g/mole); |
---|
98 | G4Element* O = new G4Element("Oxygen" ,symbol="O" , z= 8., a= 16.00*g/mole); |
---|
99 | |
---|
100 | G4Material* Air = |
---|
101 | new G4Material("Air" , density= 1.290*mg/cm3, ncomponents=2); |
---|
102 | Air->AddElement(N, fractionmass=0.7); |
---|
103 | Air->AddElement(O, fractionmass=0.3); |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | //------------------------------------------------------ volumes |
---|
108 | |
---|
109 | //------------------------------ experimental hall (world volume) |
---|
110 | //------------------------------ beam line along x axis |
---|
111 | |
---|
112 | G4double expHall_x = 200.0*cm; |
---|
113 | G4double expHall_y = 200.0*cm; |
---|
114 | G4double expHall_z = 200.0*cm; |
---|
115 | G4Box* experimentalHall_box |
---|
116 | = new G4Box("expHall_box",expHall_x,expHall_y,expHall_z); |
---|
117 | experimentalHall_log = new G4LogicalVolume(experimentalHall_box, |
---|
118 | Galactic,"expHall_log",0,0,0); |
---|
119 | experimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(), |
---|
120 | experimentalHall_log,"expHall",0,false,0); |
---|
121 | |
---|
122 | //------------------------------ a tracker tube |
---|
123 | |
---|
124 | G4double innerRadiusOfTheTube = 0.*cm; |
---|
125 | G4double outerRadiusOfTheTube = 70.*cm; |
---|
126 | G4double hightOfTheTube = 70.*cm; |
---|
127 | G4double startAngleOfTheTube = 0.*deg; |
---|
128 | G4double spanningAngleOfTheTube = 360.*deg; |
---|
129 | G4Tubs* tracker_tube = new G4Tubs("tracker_tube",innerRadiusOfTheTube, |
---|
130 | outerRadiusOfTheTube,hightOfTheTube, |
---|
131 | startAngleOfTheTube,spanningAngleOfTheTube); |
---|
132 | tracker_log = new G4LogicalVolume(tracker_tube,Ar,"tracker_log",0,0,0); |
---|
133 | G4double trackerPos_x = -0.0*cm; |
---|
134 | G4double trackerPos_y = 0.*cm; |
---|
135 | G4double trackerPos_z = 0.*cm; |
---|
136 | tracker_phys = new G4PVPlacement(0, |
---|
137 | G4ThreeVector(trackerPos_x,trackerPos_y,trackerPos_z), |
---|
138 | tracker_log,"tracker",experimentalHall_log,false,0); |
---|
139 | |
---|
140 | |
---|
141 | //------------------------------ a calorimeter block |
---|
142 | |
---|
143 | // G4double block_x = 1.0*m; |
---|
144 | //G4double block_y = 50.0*cm; |
---|
145 | //G4double block_z = 50.0*cm; |
---|
146 | //G4Box* calorimeterBlock_box = new G4Box("calBlock_box",block_x, |
---|
147 | // block_y,block_z); |
---|
148 | //calorimeterBlock_log = new G4LogicalVolume(calorimeterBlock_box, |
---|
149 | // Pb,"caloBlock_log",0,0,0); |
---|
150 | //G4double blockPos_x = 1.0*m; |
---|
151 | //G4double blockPos_y = 0.0*m; |
---|
152 | //G4double blockPos_z = 0.0*m; |
---|
153 | //calorimeterBlock_phys = new G4PVPlacement(0, |
---|
154 | // G4ThreeVector(blockPos_x,blockPos_y,blockPos_z), |
---|
155 | // calorimeterBlock_log,"caloBlock",experimentalHall_log,false,0); |
---|
156 | |
---|
157 | //------------------------------ calorimeter layers |
---|
158 | |
---|
159 | //G4double calo_x = 1.*cm; |
---|
160 | //G4double calo_y = 40.*cm; |
---|
161 | //G4double calo_z = 40.*cm; |
---|
162 | //G4Box* calorimeterLayer_box = new G4Box("caloLayer_box", |
---|
163 | // calo_x,calo_y,calo_z); |
---|
164 | //calorimeterLayer_log = new G4LogicalVolume(calorimeterLayer_box, |
---|
165 | // Al,"caloLayer_log",0,0,0); |
---|
166 | //for(G4int i=0;i<19;i++) // loop for 19 layers |
---|
167 | //{ |
---|
168 | // G4double caloPos_x = (i-9)*10.*cm; |
---|
169 | // G4double caloPos_y = 0.0*m; |
---|
170 | // G4double caloPos_z = 0.0*m; |
---|
171 | // calorimeterLayer_phys = new G4PVPlacement(0, |
---|
172 | // G4ThreeVector(caloPos_x,caloPos_y,caloPos_z), |
---|
173 | // calorimeterLayer_log,"caloLayer",calorimeterBlock_log,false,i); |
---|
174 | //} |
---|
175 | |
---|
176 | //------------------------------------------------------------------ |
---|
177 | |
---|
178 | return experimentalHall_phys; |
---|
179 | } |
---|
180 | |
---|