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: SCDetectorConstruction.cc,v 1.9 2007/07/18 14:38:48 tnikitin Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
29 | // |
---|
30 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
31 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
32 | |
---|
33 | #include "SCDetectorConstruction.hh" |
---|
34 | #include "SCDetectorMessenger.hh" |
---|
35 | #include "SCMagneticField.hh" |
---|
36 | #include "SCTrackerSD.hh" |
---|
37 | |
---|
38 | #include "G4Material.hh" |
---|
39 | |
---|
40 | #include "G4Box.hh" |
---|
41 | #include "G4Orb.hh" |
---|
42 | #include "G4Tubs.hh" |
---|
43 | #include "G4Sphere.hh" |
---|
44 | #include "G4Cons.hh" |
---|
45 | #include "G4Hype.hh" |
---|
46 | #include "G4Para.hh" |
---|
47 | #include "G4Paraboloid.hh" |
---|
48 | #include "G4Torus.hh" |
---|
49 | #include "G4Trd.hh" |
---|
50 | #include "G4Ellipsoid.hh" |
---|
51 | #include "G4EllipticalTube.hh" |
---|
52 | #include "G4EllipticalCone.hh" |
---|
53 | |
---|
54 | #include "G4Trap.hh" |
---|
55 | #include "G4Trd.hh" |
---|
56 | #include "G4Tet.hh" |
---|
57 | |
---|
58 | #include "G4Polycone.hh" |
---|
59 | |
---|
60 | #include "G4TwistedTubs.hh" |
---|
61 | #include "G4TwistedBox.hh" |
---|
62 | #include "G4TwistedTrd.hh" |
---|
63 | #include "G4TwistedTrap.hh" |
---|
64 | |
---|
65 | #include "G4BooleanSolid.hh" |
---|
66 | #include "G4DisplacedSolid.hh" |
---|
67 | #include "G4UnionSolid.hh" |
---|
68 | #include "G4IntersectionSolid.hh" |
---|
69 | #include "G4SubtractionSolid.hh" |
---|
70 | #include "G4ReflectedSolid.hh" |
---|
71 | |
---|
72 | #include "G4LogicalVolume.hh" |
---|
73 | #include "G4PVPlacement.hh" |
---|
74 | #include "G4PVParameterised.hh" |
---|
75 | #include "G4SDManager.hh" |
---|
76 | |
---|
77 | #include "G4UserLimits.hh" |
---|
78 | |
---|
79 | #include "G4VisAttributes.hh" |
---|
80 | #include "G4Colour.hh" |
---|
81 | |
---|
82 | #include "G4ios.hh" |
---|
83 | |
---|
84 | #include "G4UnitsTable.hh" |
---|
85 | |
---|
86 | #include "G4RunManager.hh" |
---|
87 | |
---|
88 | |
---|
89 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
90 | |
---|
91 | SCDetectorConstruction::SCDetectorConstruction() |
---|
92 | :solidWorld(0), logicWorld(0), physiWorld(0), |
---|
93 | logicTracker(0),physiTracker(0), |
---|
94 | fpMagField(0), fWorldLength(0.), fTrackerpDz(0.) |
---|
95 | { |
---|
96 | fpMagField = new SCMagneticField(); |
---|
97 | detectorMessenger = new SCDetectorMessenger(this); |
---|
98 | } |
---|
99 | |
---|
100 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
101 | |
---|
102 | SCDetectorConstruction::~SCDetectorConstruction() |
---|
103 | { |
---|
104 | delete fpMagField; |
---|
105 | delete detectorMessenger; |
---|
106 | } |
---|
107 | |
---|
108 | //////////////////////////////////////////////////////////////// |
---|
109 | |
---|
110 | void SCDetectorConstruction::SwitchDetector() |
---|
111 | { |
---|
112 | G4RunManager::GetRunManager()->DefineWorldVolume(physiWorld); |
---|
113 | } |
---|
114 | |
---|
115 | |
---|
116 | G4VPhysicalVolume* |
---|
117 | SCDetectorConstruction::SelectDetector( const G4String& val ) |
---|
118 | { |
---|
119 | |
---|
120 | |
---|
121 | G4double a, z; |
---|
122 | |
---|
123 | G4double density; |
---|
124 | G4int nel; |
---|
125 | |
---|
126 | //Air |
---|
127 | G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole); |
---|
128 | G4Element* O = new G4Element("Oxygen" , "O", z=8., a= 16.00*g/mole); |
---|
129 | |
---|
130 | G4Material* Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2); |
---|
131 | Air->AddElement(N, 70*perCent); |
---|
132 | Air->AddElement(O, 30*perCent); |
---|
133 | |
---|
134 | // Print all the materials defined. |
---|
135 | // |
---|
136 | // G4cout << G4endl << "The materials defined are : " << G4endl << G4endl; |
---|
137 | //G4cout << *(G4Material::GetMaterialTable()) << G4endl; |
---|
138 | |
---|
139 | G4Box* b1 = new G4Box ( "b1", 100*cm, 50*cm, 50*cm ); |
---|
140 | G4Box* b2 = new G4Box ( "b2", 50*cm, 100*cm, 50*cm ); |
---|
141 | |
---|
142 | fval = val ; |
---|
143 | |
---|
144 | if (val == "Sphere") |
---|
145 | { |
---|
146 | // only solid sphere is supportet for now |
---|
147 | fTrackerR1 = 0*cm ; |
---|
148 | fTrackerR2 = 12*cm ; |
---|
149 | fPhi = 0*deg ; |
---|
150 | fPhiSegment = 360*deg ; |
---|
151 | fTheta = 0*deg ; |
---|
152 | fThetaSegment = 180*deg ; |
---|
153 | aVolume = new G4Sphere ("aSphere", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
154 | } |
---|
155 | |
---|
156 | else if (val == "HalfSphere") |
---|
157 | { |
---|
158 | // only solid sphere is supportet for now |
---|
159 | fTrackerR1 = 0*cm ; |
---|
160 | fTrackerR2 = 12*cm ; |
---|
161 | fPhi = 0*deg ; |
---|
162 | fPhiSegment = 180*deg ; |
---|
163 | fTheta = 0*deg ; |
---|
164 | fThetaSegment = 180*deg ; |
---|
165 | aVolume = new G4Sphere ("aHalfSphere", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
166 | |
---|
167 | } |
---|
168 | else if (val == "HollowSphere") |
---|
169 | { |
---|
170 | // only solid sphere is supportet for now |
---|
171 | fTrackerR1 = 12*cm ; |
---|
172 | fTrackerR2 = 14*cm ; |
---|
173 | fPhi = 0*deg ; |
---|
174 | fPhiSegment = 360*deg ; |
---|
175 | fTheta = 0*deg ; |
---|
176 | fThetaSegment = 180*deg ; |
---|
177 | aVolume = new G4Sphere ("aHollowSphere", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
178 | |
---|
179 | } |
---|
180 | else if (val == "HalfHollowSphere") |
---|
181 | { |
---|
182 | // only solid sphere is supportet for now |
---|
183 | fTrackerR1 = 12*cm ; |
---|
184 | fTrackerR2 = 14*cm ; |
---|
185 | fPhi = 0*deg ; |
---|
186 | fPhiSegment = 180*deg ; |
---|
187 | fTheta = 0*deg ; |
---|
188 | fThetaSegment = 180*deg ; |
---|
189 | aVolume = new G4Sphere ("aHalfHollowSphere", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
190 | |
---|
191 | } |
---|
192 | else if (val == "Q1Shell") |
---|
193 | { |
---|
194 | // only solid sphere is supportet for now |
---|
195 | fTrackerR1 = 10*cm ; |
---|
196 | fTrackerR2 = 12*cm ; |
---|
197 | fPhi = 0*deg ; |
---|
198 | fPhiSegment = 90*deg ; |
---|
199 | fTheta = 0*deg ; |
---|
200 | fThetaSegment = 90*deg ; |
---|
201 | aVolume = new G4Sphere ("aQ1Shell", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
202 | |
---|
203 | } |
---|
204 | else if (val == "Q2Shell") |
---|
205 | { |
---|
206 | // only solid sphere is supportet for now |
---|
207 | fTrackerR1 = 10*cm ; |
---|
208 | fTrackerR2 = 12*cm ; |
---|
209 | fPhi = 90*deg ; |
---|
210 | fPhiSegment = 90*deg ; |
---|
211 | fTheta = 0*deg ; |
---|
212 | fThetaSegment = 90*deg ; |
---|
213 | aVolume = new G4Sphere ("aQ2Shell", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
214 | |
---|
215 | } |
---|
216 | else if (val == "Q3Shell") |
---|
217 | { |
---|
218 | // only solid sphere is supportet for now |
---|
219 | fTrackerR1 = 10*cm ; |
---|
220 | fTrackerR2 = 12*cm ; |
---|
221 | fPhi = 180*deg ; |
---|
222 | fPhiSegment = 90*deg ; |
---|
223 | fTheta = 0*deg ; |
---|
224 | fThetaSegment = 90*deg ; |
---|
225 | aVolume = new G4Sphere ("aQ3Shell", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
226 | |
---|
227 | } |
---|
228 | else if (val == "Q4Shell") |
---|
229 | { |
---|
230 | // only solid sphere is supportet for now |
---|
231 | fTrackerR1 = 10*cm ; |
---|
232 | fTrackerR2 = 12*cm ; |
---|
233 | fPhi = 270*deg ; |
---|
234 | fPhiSegment = 90*deg ; |
---|
235 | fTheta = 0*deg ; |
---|
236 | fThetaSegment = 90*deg ; |
---|
237 | aVolume = new G4Sphere ("aQ4Shell", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
238 | |
---|
239 | } |
---|
240 | else if (val == "Q5Shell") |
---|
241 | { |
---|
242 | // only solid sphere is supportet for now |
---|
243 | fTrackerR1 = 10*cm ; |
---|
244 | fTrackerR2 = 12*cm ; |
---|
245 | fPhi = 0*deg ; |
---|
246 | fPhiSegment = 90*deg ; |
---|
247 | fTheta = 90*deg ; |
---|
248 | fThetaSegment = 90*deg ; |
---|
249 | aVolume = new G4Sphere ("aQ5Shell", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
250 | |
---|
251 | } |
---|
252 | else if (val == "Q6Shell") |
---|
253 | { |
---|
254 | // only solid sphere is supportet for now |
---|
255 | fTrackerR1 = 10*cm ; |
---|
256 | fTrackerR2 = 12*cm ; |
---|
257 | fPhi = 90*deg ; |
---|
258 | fPhiSegment = 90*deg ; |
---|
259 | fTheta = 90*deg ; |
---|
260 | fThetaSegment = 90*deg ; |
---|
261 | aVolume = new G4Sphere ("aQ5Shell", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
262 | |
---|
263 | } |
---|
264 | else if (val == "Q7Shell") |
---|
265 | { |
---|
266 | // only solid sphere is supportet for now |
---|
267 | fTrackerR1 = 10*cm ; |
---|
268 | fTrackerR2 = 12*cm ; |
---|
269 | fPhi = 180*deg ; |
---|
270 | fPhiSegment = 90*deg ; |
---|
271 | fTheta = 90*deg ; |
---|
272 | fThetaSegment = 90*deg ; |
---|
273 | aVolume = new G4Sphere ("aQ7Shell", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
274 | |
---|
275 | } |
---|
276 | else if (val == "Q8Shell") |
---|
277 | { |
---|
278 | // only solid sphere is supportet for now |
---|
279 | fTrackerR1 = 10*cm ; |
---|
280 | fTrackerR2 = 12*cm ; |
---|
281 | fPhi = 270*deg ; |
---|
282 | fPhiSegment = 90*deg ; |
---|
283 | fTheta = 90*deg ; |
---|
284 | fThetaSegment = 90*deg ; |
---|
285 | aVolume = new G4Sphere ("aQ8Shell", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
286 | |
---|
287 | } |
---|
288 | |
---|
289 | |
---|
290 | else if (val == "Shell") |
---|
291 | { |
---|
292 | // only solid sphere is supportet for now |
---|
293 | fTrackerR1 = 10*cm ; |
---|
294 | fTrackerR2 = 12*cm ; |
---|
295 | fPhi = 30*deg ; |
---|
296 | fPhiSegment = 120*deg ; |
---|
297 | fTheta = 10*deg ; |
---|
298 | fThetaSegment = 100*deg ; |
---|
299 | aVolume = new G4Sphere ("aShell", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
300 | |
---|
301 | } |
---|
302 | else if (val == "Ring") |
---|
303 | { |
---|
304 | // only solid sphere is supportet for now |
---|
305 | fTrackerR1 = 10*cm ; |
---|
306 | fTrackerR2 = 12*cm ; |
---|
307 | fPhi = 30*deg ; |
---|
308 | fPhiSegment = 120*deg ; |
---|
309 | fTheta = 10*deg ; |
---|
310 | fThetaSegment = 40*deg ; |
---|
311 | aVolume = new G4Sphere ("aRing", fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment); |
---|
312 | |
---|
313 | } |
---|
314 | else if ( val == "Ellipsoid" ) { |
---|
315 | |
---|
316 | fSemiAxisX = 1*cm ; |
---|
317 | fSemiAxisY = 10*cm ; |
---|
318 | fSemiAxisZ = 100*cm ; |
---|
319 | |
---|
320 | aVolume = new G4Ellipsoid("aEllipsoid", |
---|
321 | fSemiAxisX, |
---|
322 | fSemiAxisY, |
---|
323 | fSemiAxisZ, |
---|
324 | -fSemiAxisZ,fSemiAxisZ); |
---|
325 | |
---|
326 | |
---|
327 | } |
---|
328 | else if (val == "Orb") |
---|
329 | { |
---|
330 | |
---|
331 | fTrackerR = 11*cm ; |
---|
332 | aVolume = new G4Orb ( "aOrb", fTrackerR ); |
---|
333 | |
---|
334 | } |
---|
335 | else if (val == "Box") |
---|
336 | { |
---|
337 | |
---|
338 | fTrackerpDx1 = 10*cm ; |
---|
339 | fTrackerpDy1 = 10*cm ; |
---|
340 | fTrackerpDz = 10*cm ; |
---|
341 | |
---|
342 | aVolume = new G4Box ( "aBox", fTrackerpDx1, fTrackerpDy1, fTrackerpDz ); |
---|
343 | } |
---|
344 | else if (val == "Cons") |
---|
345 | { |
---|
346 | |
---|
347 | fTrackerpDz = 80*cm ; |
---|
348 | fTrackerR1 = 11*cm ; |
---|
349 | fTrackerR2 = 16*cm ; |
---|
350 | |
---|
351 | aVolume = new G4Cons ( "aCons", 0.8*fTrackerR1 , fTrackerR1, 0.8*fTrackerR2, fTrackerR2, fTrackerpDz, 10*deg, 120.*deg ); |
---|
352 | |
---|
353 | } |
---|
354 | else if (val == "manyCons") |
---|
355 | { |
---|
356 | aVolume = new G4Cons ( "aCone", 2*cm, 6*cm, 8*cm, 14*cm, |
---|
357 | 10*cm, 10*deg, 300*deg ); |
---|
358 | // 10*cm, 10*deg, 300*deg ); |
---|
359 | // 0., pi); |
---|
360 | |
---|
361 | |
---|
362 | } |
---|
363 | else if (val == "Tubs") |
---|
364 | { |
---|
365 | |
---|
366 | // only solid Tube is supported. |
---|
367 | fTrackerpDz = 80*cm ; |
---|
368 | fTrackerR = 11*cm ; |
---|
369 | |
---|
370 | aVolume = new G4Tubs ( "aTube",0.8*fTrackerR,fTrackerR,fTrackerpDz,40.,100*deg) ; |
---|
371 | |
---|
372 | } |
---|
373 | else if (val == "Hype") |
---|
374 | { |
---|
375 | aVolume = new G4Hype ("aHype", 7*cm, 10*cm, 40*deg, 40*deg, 40*cm ); |
---|
376 | } |
---|
377 | else if (val == "Torus") |
---|
378 | { |
---|
379 | |
---|
380 | fPhi = 40*deg ; |
---|
381 | fPhiSegment = 100*deg ; |
---|
382 | |
---|
383 | fTrackerR1 = 5*cm ; |
---|
384 | fTrackerR2 = 6*cm ; |
---|
385 | fTrackerR = 20*cm ; |
---|
386 | |
---|
387 | aVolume = new G4Torus("aTorus", fTrackerR1, fTrackerR2 ,fTrackerR, fPhi, fPhiSegment) ; |
---|
388 | |
---|
389 | } |
---|
390 | else if (val == "Para") |
---|
391 | { |
---|
392 | aVolume = new G4Para ("aPara", 8*cm, 10*cm, 12*cm, 30*deg, 45*deg, 60*deg); |
---|
393 | } |
---|
394 | else if (val == "Paraboloid") |
---|
395 | { |
---|
396 | aVolume = new G4Paraboloid ("aParaboloid", 8*cm, 1*cm, 12*cm); |
---|
397 | } |
---|
398 | else if (val == "Trd") |
---|
399 | { |
---|
400 | aVolume = new G4Trd ("aTrd", 80*cm, 100*cm, 70*cm, 90*cm, 100*cm); |
---|
401 | } |
---|
402 | else if (val == "b1Ub2") |
---|
403 | { |
---|
404 | aVolume = new G4UnionSolid("b1Ub2",b1,b2); |
---|
405 | /* |
---|
406 | G4Box * box1 = new G4Box("Box1",1092.500000,240.103374,92.000000); |
---|
407 | G4Box * box2 = new G4Box("Box2",540.103374,792.500000,92.000000); |
---|
408 | |
---|
409 | G4double L1 = 1104; |
---|
410 | |
---|
411 | aVolume = |
---|
412 | new G4UnionSolid("ECShapeBoxes", |
---|
413 | box1, |
---|
414 | box2, |
---|
415 | 0, |
---|
416 | G4ThreeVector(-L1/2., |
---|
417 | L1/2., |
---|
418 | 0.)); |
---|
419 | */ |
---|
420 | } |
---|
421 | else if (val == "b1Ib2") |
---|
422 | { |
---|
423 | aVolume = new G4IntersectionSolid("b1Ib2",b1,b2); |
---|
424 | } |
---|
425 | else if (val == "b1Sb2") |
---|
426 | { |
---|
427 | aVolume = new G4SubtractionSolid("b1Sb2",b1,b2); |
---|
428 | } |
---|
429 | else if (val == "b1Ib1") |
---|
430 | { |
---|
431 | aVolume = new G4IntersectionSolid("b1Ib1",b1,b1); |
---|
432 | } |
---|
433 | else if (val == "b1Ub1") |
---|
434 | { |
---|
435 | aVolume = new G4UnionSolid("b1Ub1",b1,b1); |
---|
436 | } |
---|
437 | else if (val == "b1Sb1") |
---|
438 | { |
---|
439 | aVolume = new G4SubtractionSolid("b1Sb1",b1,b1); |
---|
440 | } |
---|
441 | else if ( val == "TwistedTubs" ) |
---|
442 | { |
---|
443 | |
---|
444 | fTwistAngle = 20*deg ; |
---|
445 | fTrackerpDz = 80*cm ; |
---|
446 | fTrackerR1 = 5*cm ; |
---|
447 | fTrackerR2 = 10*cm ; |
---|
448 | fPhi = 50*deg ; |
---|
449 | |
---|
450 | aVolume = new G4TwistedTubs("aTwistedTubs", fTwistAngle, fTrackerR1 , fTrackerR2, fTrackerpDz, fPhi ) ; |
---|
451 | } |
---|
452 | |
---|
453 | else if (val == "TwistedBox") |
---|
454 | { |
---|
455 | |
---|
456 | |
---|
457 | fTwistAngle = 20*deg ; |
---|
458 | fTrackerpDx1 = 11*cm ; |
---|
459 | fTrackerpDy1 = 8*cm ; |
---|
460 | fTrackerpDz = 80*cm ; |
---|
461 | |
---|
462 | aVolume = new G4TwistedBox("aTwistedBox",fTwistAngle,fTrackerpDx1,fTrackerpDy1,fTrackerpDz) ; |
---|
463 | } |
---|
464 | else if (val == "TwistedTrd") |
---|
465 | { |
---|
466 | |
---|
467 | fTrackerpDx1 = 5*cm ; |
---|
468 | fTrackerpDx2 = 10*cm ; |
---|
469 | fTrackerpDy1 = 8*cm ; |
---|
470 | fTrackerpDy2 = 15*cm ; |
---|
471 | fTrackerpDz = 80*cm ; |
---|
472 | fTwistAngle = 20*deg ; |
---|
473 | |
---|
474 | aVolume = new G4TwistedTrd("aTwistedTrd",fTrackerpDx1,fTrackerpDx2,fTrackerpDy1,fTrackerpDy2,fTrackerpDz,fTwistAngle); |
---|
475 | |
---|
476 | } |
---|
477 | else if ( val == "TwistedTrap") |
---|
478 | { |
---|
479 | fTwistAngle = 60*deg ; |
---|
480 | fTrackerpDz = 80*cm; |
---|
481 | fTheta = 10*deg ; |
---|
482 | fPhi = 40*deg ; |
---|
483 | fTrackerpDy1 = 16*cm ; |
---|
484 | fTrackerpDx1 = 24*cm ; |
---|
485 | fTrackerpDx2 = 14*cm ; |
---|
486 | fTrackerpDy2 = 8*cm ; |
---|
487 | fTrackerpDx3 = 16*cm ; |
---|
488 | fTrackerpDx4 = 11*cm ; |
---|
489 | fAlph = 50*deg ; |
---|
490 | |
---|
491 | aVolume = new G4TwistedTrap("aTwistedTrap", |
---|
492 | fTwistAngle, // twist angle |
---|
493 | fTrackerpDz, // half z length |
---|
494 | fTheta, // direction between end planes |
---|
495 | fPhi, // defined by polar and azimutal angles. |
---|
496 | fTrackerpDy1, // half y length at -pDz |
---|
497 | fTrackerpDx1, // half x length at -pDz,-pDy |
---|
498 | fTrackerpDx2, // half x length at -pDz,+pDy |
---|
499 | fTrackerpDy2, // half y length at +pDz |
---|
500 | fTrackerpDx3, // half x length at +pDz,-pDy |
---|
501 | fTrackerpDx4, // half x length at +pDz,+pDy |
---|
502 | fAlph // tilt angle at +pDz |
---|
503 | ) ; |
---|
504 | } |
---|
505 | else if ( val == "Tet" ) |
---|
506 | { |
---|
507 | |
---|
508 | G4ThreeVector pzero(0,0,0); |
---|
509 | G4ThreeVector pnt1(10.*cm,0.*cm,0.*cm),pnt2(5.0*cm,10.*cm,0.*cm), pnt3(5.*cm,5.*cm,10.*cm); |
---|
510 | G4bool goodTet; |
---|
511 | G4Tet t1( "aTet", pzero, pnt1, pnt2, pnt3, &goodTet); |
---|
512 | } |
---|
513 | else if ( val == "Trap") |
---|
514 | { |
---|
515 | fTrackerpDz = 80*cm; |
---|
516 | fTheta = 10*deg ; |
---|
517 | fPhi = 40*deg ; |
---|
518 | fTrackerpDy1 = 16*cm ; |
---|
519 | fTrackerpDx1 = 24*cm ; |
---|
520 | fTrackerpDx2 = 14*cm ; |
---|
521 | fTrackerpDy2 = 8*cm ; |
---|
522 | fTrackerpDx3 = 16*cm ; |
---|
523 | fTrackerpDx4 = 11*cm ; |
---|
524 | fAlph = 50*deg ; |
---|
525 | |
---|
526 | aVolume = new G4Trap("aTrap", |
---|
527 | fTrackerpDz, // half z length |
---|
528 | fTheta, // direction between end planes |
---|
529 | fPhi, // defined by polar and azimutal angles. |
---|
530 | fTrackerpDy1, // half y length at -pDz |
---|
531 | fTrackerpDx1, // half x length at -pDz,-pDy |
---|
532 | fTrackerpDx2, // half x length at -pDz,+pDy |
---|
533 | fAlph, // tilt angle at +pDz |
---|
534 | fTrackerpDy2, // half y length at +pDz |
---|
535 | fTrackerpDx3, // half x length at +pDz,-pDy |
---|
536 | fTrackerpDx4, // half x length at +pDz,+pDy |
---|
537 | fAlph // tilt angle at +pDz |
---|
538 | ) ; |
---|
539 | } |
---|
540 | else if ( val == "EllipticalCone" ) |
---|
541 | { |
---|
542 | aVolume = new G4EllipticalCone("aEllipticalCone", |
---|
543 | 0.5*mm, // xSemiAxis |
---|
544 | 1*mm, // ySemiAxis |
---|
545 | 40*mm, // zheight |
---|
546 | 25*mm) ; // zTopCut |
---|
547 | |
---|
548 | } |
---|
549 | else if ( val == "EllipticalTube" ) |
---|
550 | { |
---|
551 | aVolume = new G4EllipticalTube("aEllipticalTube" , |
---|
552 | 2*cm, // xSemiAxis |
---|
553 | 5*cm, // ySemiAxis |
---|
554 | 35*cm) ; // zheight |
---|
555 | |
---|
556 | } |
---|
557 | else |
---|
558 | { |
---|
559 | G4Exception("Sc01DetectorConstruction::SelectDetector() - Invalid shape!"); |
---|
560 | } |
---|
561 | |
---|
562 | fWorldLength= 10*m ; |
---|
563 | |
---|
564 | //--------- Definitions of Solids, Logical Volumes, Physical Volumes --------- |
---|
565 | |
---|
566 | //------------------------------ |
---|
567 | // World |
---|
568 | //------------------------------ |
---|
569 | |
---|
570 | G4double HalfWorldLength = 0.5*fWorldLength; |
---|
571 | solidWorld= new G4Box("world",HalfWorldLength,HalfWorldLength,HalfWorldLength); |
---|
572 | logicWorld= new G4LogicalVolume( solidWorld, Air, "World", 0, 0, 0); |
---|
573 | |
---|
574 | // Must place the World Physical volume unrotated at (0,0,0). |
---|
575 | // |
---|
576 | physiWorld = new G4PVPlacement(0, // no rotation |
---|
577 | G4ThreeVector(), // at (0,0,0) |
---|
578 | logicWorld, // its logical volume |
---|
579 | "World", // its name |
---|
580 | 0, // its mother volume |
---|
581 | false, // no boolean operations |
---|
582 | 0); // no field specific to volume |
---|
583 | |
---|
584 | |
---|
585 | |
---|
586 | G4LogicalVolume* aVolume_log = new G4LogicalVolume(aVolume, Air, "aVolume_L", 0,0,0); |
---|
587 | |
---|
588 | // G4VPhysicalVolume * aVolume_phys1 = |
---|
589 | new G4PVPlacement(0, |
---|
590 | G4ThreeVector(0*cm, 0*cm, 0*cm), |
---|
591 | aVolume_log, |
---|
592 | val, |
---|
593 | logicWorld, |
---|
594 | false, |
---|
595 | 0); |
---|
596 | |
---|
597 | |
---|
598 | |
---|
599 | //--------- Visualization attributes ------------------------------- |
---|
600 | |
---|
601 | |
---|
602 | // the world is transparent |
---|
603 | G4VisAttributes* WorldAtt = new G4VisAttributes(G4Colour(1.,1.,1.,0.)); |
---|
604 | WorldAtt->SetVisibility(true); |
---|
605 | logicWorld->SetVisAttributes(WorldAtt); |
---|
606 | |
---|
607 | G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(0.0,.0,1.0,0.6)); |
---|
608 | BoxVisAtt->SetVisibility(true); |
---|
609 | aVolume_log->SetVisAttributes(BoxVisAtt); |
---|
610 | |
---|
611 | //--------- example of User Limits ------------------------------- |
---|
612 | |
---|
613 | |
---|
614 | return physiWorld; |
---|
615 | |
---|
616 | } |
---|
617 | |
---|
618 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
619 | |
---|
620 | G4VPhysicalVolume* SCDetectorConstruction::Construct() |
---|
621 | { |
---|
622 | |
---|
623 | |
---|
624 | //-------------------Hall ---------------------------------- |
---|
625 | |
---|
626 | return SelectDetector ("Sphere"); // default is Sphere |
---|
627 | |
---|
628 | } |
---|
629 | |
---|
630 | |
---|
631 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
632 | |
---|
633 | void SCDetectorConstruction::SetMagField(G4double fieldValue) |
---|
634 | { |
---|
635 | fpMagField->SetFieldValue(fieldValue); |
---|
636 | } |
---|
637 | |
---|
638 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|