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 | #include "ExErrorDetectorConstruction.hh" |
---|
28 | #include "ExErrorDetectorMessenger.hh" |
---|
29 | #include "ExErrorMagneticField.hh" |
---|
30 | |
---|
31 | #include "G4Material.hh" |
---|
32 | #include "G4Box.hh" |
---|
33 | #include "G4LogicalVolume.hh" |
---|
34 | #include "G4PVPlacement.hh" |
---|
35 | #include "G4PVReplica.hh" |
---|
36 | |
---|
37 | #include "G4UserLimits.hh" |
---|
38 | #include "G4VisAttributes.hh" |
---|
39 | |
---|
40 | #include "G4Colour.hh" |
---|
41 | |
---|
42 | #include "G4ios.hh" |
---|
43 | |
---|
44 | //------------------------------------------------------------- |
---|
45 | ExErrorDetectorConstruction::ExErrorDetectorConstruction() |
---|
46 | : xBEAM(5.*cm), xCDET(20.*cm), xECAL(40.*cm), xSOLN(10.*cm), xHCAL(100.*cm), |
---|
47 | xMUON(50.*cm), ndivECAL(40./10.), ndivHCAL(100./10.), yzLength(50.*cm), |
---|
48 | xHalfWorldLength(xBEAM + xCDET + xECAL + xSOLN + xHCAL + xMUON) |
---|
49 | { |
---|
50 | |
---|
51 | // create UserLimits |
---|
52 | userLimits = new G4UserLimits(); |
---|
53 | |
---|
54 | fpMagField = new ExErrorMagneticField(G4ThreeVector(0.*kilogauss,0.*kilogauss,-1.*kilogauss)); |
---|
55 | detectorMessenger = new ExErrorDetectorMessenger(this); |
---|
56 | |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | //------------------------------------------------------------- |
---|
61 | ExErrorDetectorConstruction::~ExErrorDetectorConstruction() |
---|
62 | { |
---|
63 | delete fpMagField; |
---|
64 | delete detectorMessenger; |
---|
65 | } |
---|
66 | |
---|
67 | |
---|
68 | //------------------------------------------------------------- |
---|
69 | G4VPhysicalVolume* ExErrorDetectorConstruction::Construct() |
---|
70 | { |
---|
71 | //--------- Material definition --------- |
---|
72 | |
---|
73 | G4double a, iz, z, density; |
---|
74 | G4String name, symbol; |
---|
75 | G4int nel; |
---|
76 | |
---|
77 | //Vacuum |
---|
78 | /* a = 1.*g/mole; |
---|
79 | density = 1.E-9*g/cm3; |
---|
80 | G4Material* Vacuum = new G4Material(name="Vacuum", z=1., a, density); |
---|
81 | */ |
---|
82 | |
---|
83 | //Air |
---|
84 | a = 14.01*g/mole; |
---|
85 | G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a); |
---|
86 | a = 16.00*g/mole; |
---|
87 | G4Element* elO = new G4Element(name="Oxigen", symbol="O", iz=8., a); |
---|
88 | density = 1.205*mg/cm3; |
---|
89 | G4Material* Air = new G4Material(name="Air", density, nel=2); |
---|
90 | Air->AddElement(elN, .7); |
---|
91 | Air->AddElement(elO, .3); |
---|
92 | //Al |
---|
93 | a = 26.98*g/mole; |
---|
94 | density = 2.7*g/cm3; |
---|
95 | G4Material* Al = new G4Material(name="Al", z=13., a, density); |
---|
96 | //Fe |
---|
97 | a = 55.85*g/mole; |
---|
98 | density = 7.87*g/cm3; |
---|
99 | G4Material* Fe = new G4Material(name="Fe", z=26., a, density); |
---|
100 | //Cu |
---|
101 | a = 63.54*g/mole; |
---|
102 | density = 8.96*g/cm3; |
---|
103 | G4Material* Cu = new G4Material(name="Cu", z=29., a, density); |
---|
104 | |
---|
105 | |
---|
106 | // Print all the materials defined. |
---|
107 | // |
---|
108 | G4cout << G4endl << "The materials defined are : " << G4endl << G4endl; |
---|
109 | G4cout << *(G4Material::GetMaterialTable()) << G4endl; |
---|
110 | |
---|
111 | //--------- Sizes of the principal geometrical components (solids) --------- (half lengths) |
---|
112 | //double xBEAM = 5.*2.*cm; |
---|
113 | //double xCDET = 90.*cm; |
---|
114 | //double xECAL = 40.*cm; |
---|
115 | //double xSOLN = 10.*cm; |
---|
116 | //double xHCAL = 100.*cm; |
---|
117 | //double xMUON = 50.*cm; |
---|
118 | //double ndivECAL = 10; |
---|
119 | //double ndivHCAL = 10; |
---|
120 | //double yzLength = 100.*cm; |
---|
121 | |
---|
122 | // double xWorldLength= xBEAM + xCDET + xECAL + xSOLN + xHCAL + xMUON; |
---|
123 | |
---|
124 | |
---|
125 | //--------- Definitions of Solids, Logical Volumes, Physical Volumes --------- |
---|
126 | |
---|
127 | //------------------------------ |
---|
128 | // World |
---|
129 | //------------------------------ |
---|
130 | //- G4double HalfWorldLength = xWorldLength; |
---|
131 | G4cout << " HalfWorldLength " << xHalfWorldLength << G4endl; |
---|
132 | |
---|
133 | G4Box* solidWorld= new G4Box("world",xHalfWorldLength,yzLength,yzLength); |
---|
134 | G4LogicalVolume* logicWorld= new G4LogicalVolume( solidWorld, Air, "World", 0, 0, 0); |
---|
135 | // Must place the World Physical volume unrotated at (0,0,0). |
---|
136 | // |
---|
137 | G4VPhysicalVolume* physiWorld = new G4PVPlacement(0, // no rotation |
---|
138 | G4ThreeVector(), // at (0,0,0) |
---|
139 | "World", // its name |
---|
140 | logicWorld, // its logical volume |
---|
141 | 0, // its mother volume |
---|
142 | false, // no boolean operations |
---|
143 | 0); // no field specific to volum |
---|
144 | |
---|
145 | //------------------------------ |
---|
146 | // BEAM |
---|
147 | //------------------------------ |
---|
148 | G4Box* solidBEAM = new G4Box("BEAM",xBEAM,yzLength,yzLength); |
---|
149 | G4LogicalVolume* logicBEAM = new G4LogicalVolume(solidBEAM,Air,"BEAM",0,0,0); |
---|
150 | G4ThreeVector positionBEAM = G4ThreeVector(0.,0.,0.); |
---|
151 | //G4VPhysicalVolume* physiBEAM = |
---|
152 | new G4PVPlacement(0, // no rotation |
---|
153 | positionBEAM, // at (x,y,z) |
---|
154 | "BEAM", // its name |
---|
155 | logicBEAM, // its logical volume |
---|
156 | physiWorld, // its mother volume |
---|
157 | false, // no boolean operations |
---|
158 | 0); // no particular field |
---|
159 | |
---|
160 | //------------------------------ |
---|
161 | // CDET (Central DETector) |
---|
162 | //------------------------------ |
---|
163 | G4ThreeVector positionCdet = G4ThreeVector(xBEAM + xCDET/2.,0.,0.); |
---|
164 | G4Box* solidCDET = new G4Box("CDET",xCDET/2.,yzLength,yzLength); |
---|
165 | G4LogicalVolume* logicCDET = new G4LogicalVolume(solidCDET,Air,"Cdet",0,0,0); |
---|
166 | // G4VPhysicalVolume* physiCDET = |
---|
167 | new G4PVPlacement(0, // no rotation |
---|
168 | positionCdet, // at (x,y,z) |
---|
169 | "CDET", // its name |
---|
170 | logicCDET, // its logical volume |
---|
171 | physiWorld, // its mother volume |
---|
172 | false, // no boolean operations |
---|
173 | 0); // no particular field |
---|
174 | |
---|
175 | //------------------------------ |
---|
176 | // ECAL |
---|
177 | //------------------------------ |
---|
178 | G4ThreeVector positionECAL = G4ThreeVector(xBEAM + xCDET + xECAL/2., 0., 0.); |
---|
179 | G4Box* solidECAL = new G4Box("ECAL",xECAL/2.,yzLength,yzLength); |
---|
180 | G4LogicalVolume* logicECAL = new G4LogicalVolume(solidECAL,Cu,"ECAL",0,0,0); |
---|
181 | G4VPhysicalVolume* physiECAL = new G4PVPlacement(0, // no rotation |
---|
182 | positionECAL, // at (x,y,z) |
---|
183 | "ECAL", // its name |
---|
184 | logicECAL, // its logical volume |
---|
185 | physiWorld, // its mother volume |
---|
186 | false, // no boolean operations |
---|
187 | 0); // no particular field |
---|
188 | //--------- Divide it |
---|
189 | G4Box* solidECALdiv = new G4Box("ECAL",xECAL/2./ndivECAL,yzLength,yzLength); |
---|
190 | G4LogicalVolume* logicECALdiv = new G4LogicalVolume(solidECALdiv,Cu,"ECALdiv",0,0,0); |
---|
191 | new G4PVReplica("DVEC", logicECALdiv, physiECAL, |
---|
192 | kXAxis, G4int(ndivECAL), xECAL/ndivECAL); |
---|
193 | |
---|
194 | |
---|
195 | //------------------------------ |
---|
196 | // SOLN |
---|
197 | //------------------------------ |
---|
198 | G4ThreeVector positionSOLN = G4ThreeVector(xBEAM + xCDET + xECAL + xSOLN/2., 0., 0.); |
---|
199 | G4Box* solidSOLN = new G4Box("SOLN",xSOLN/2.,yzLength,yzLength); |
---|
200 | G4LogicalVolume* logicSOLN = new G4LogicalVolume(solidSOLN,Al,"SOLN",0,0,0); |
---|
201 | new G4PVPlacement(0, // no rotation |
---|
202 | positionSOLN, // at (x,y,z) |
---|
203 | "SOLN", // its name |
---|
204 | logicSOLN, // its logical volume |
---|
205 | physiWorld, // its mother volume |
---|
206 | false, // no boolean operations |
---|
207 | 0); // no particular field |
---|
208 | |
---|
209 | //------------------------------ |
---|
210 | // HCAL |
---|
211 | //------------------------------ |
---|
212 | G4ThreeVector positionHCAL = G4ThreeVector(xBEAM + xCDET + xECAL + xSOLN + xHCAL/2., 0., 0.); |
---|
213 | G4Box* solidHCAL = new G4Box("HCAL",xHCAL/2.,yzLength,yzLength); |
---|
214 | G4LogicalVolume* logicHCAL = new G4LogicalVolume(solidHCAL,Fe,"HCAL",0,0,0); |
---|
215 | G4VPhysicalVolume* physiHCAL = new G4PVPlacement(0, // no rotation |
---|
216 | positionHCAL, // at (x,y,z) |
---|
217 | "HCAL", // its name |
---|
218 | logicHCAL, // its logical volume |
---|
219 | physiWorld, // its mother volume |
---|
220 | false, // no boolean operations |
---|
221 | 0); // no particular field |
---|
222 | //--------- Divide it |
---|
223 | G4Box* solidHCALdiv = new G4Box("HCAL",xHCAL/2./ndivHCAL,yzLength,yzLength); |
---|
224 | G4LogicalVolume* logicHCALdiv = new G4LogicalVolume(solidHCALdiv,Fe,"HCALdiv",0,0,0); |
---|
225 | new G4PVReplica("DVEH", logicHCALdiv, physiHCAL, |
---|
226 | kXAxis, G4int(ndivHCAL), xHCAL/ndivHCAL); |
---|
227 | |
---|
228 | //------------------------------ |
---|
229 | // MUON |
---|
230 | //------------------------------ |
---|
231 | G4ThreeVector positionMUON = G4ThreeVector(xBEAM + xCDET + xECAL + xSOLN + xHCAL + xMUON/2., 0., 0.); |
---|
232 | G4Box* solidMUON = new G4Box("MUON",xMUON/2.,yzLength,yzLength); |
---|
233 | G4LogicalVolume* logicMUON = new G4LogicalVolume(solidMUON,Air,"MUON",0,0,0); |
---|
234 | new G4PVPlacement(0, // no rotation |
---|
235 | positionMUON, // at (x,y,z) |
---|
236 | "MUON", // its name |
---|
237 | logicMUON, // its logical volume |
---|
238 | physiWorld, // its mother volume |
---|
239 | false, // no boolean operations |
---|
240 | 0); // no particular field |
---|
241 | |
---|
242 | |
---|
243 | G4VisAttributes* worldVisAtt = new G4VisAttributes(0); |
---|
244 | logicWorld->SetVisAttributes( worldVisAtt); |
---|
245 | return physiWorld; |
---|
246 | } |
---|
247 | |
---|
248 | |
---|
249 | //------------------------------------------------------------- |
---|
250 | void ExErrorDetectorConstruction::SetMagField(G4double fieldValue) |
---|
251 | { |
---|
252 | fpMagField->SetFieldValue(fieldValue); |
---|
253 | } |
---|
254 | |
---|