Use gMC and not pMC everywhere
[u/mrichter/AliRoot.git] / STRUCT / AliPIPEv3.cxx
CommitLineData
77289c85 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Beam pipe class //
4// //
5//Begin_Html
6/*
1439f98e 7<img src="picts/AliPIPEClass.gif">
77289c85 8*/
9//End_Html
10// //
11///////////////////////////////////////////////////////////////////////////////
12
13#include "AliPIPEv3.h"
14#include "AliRun.h"
15#include "AliMC.h"
16
17ClassImp(AliPIPEv3)
18
19//_____________________________________________________________________________
20AliPIPEv3::AliPIPEv3()
21{
22 //
23 // Default constructor for beam pipe
24 //
25}
26
27//_____________________________________________________________________________
28AliPIPEv3::AliPIPEv3(const char *name, const char *title)
29 : AliPIPE(name,title)
30{
31 //
32 // Standard constructor for beam pipe
33 //
34}
35
36//_____________________________________________________________________________
37void AliPIPEv3::CreateGeometry()
38{
39 //
40 // Create Beam Pipe geometry
41 //
42 //Begin_Html
43 /*
1439f98e 44 <img src="picts/AliPIPE.gif">
77289c85 45 */
46 //End_Html
47 //Begin_Html
48 /*
1439f98e 49 <img src="picts/AliPIPETree.gif">
77289c85 50 */
51 //End_Html
52
77289c85 53 Float_t tpar[3], dzmo, zpos;
54 Float_t bepar[3], alpar[3],sspar[3],flange[3],vacpar[3];
55 Float_t bellow[3];
56// Float_t undul[3];
57// const Double_t z_flange = 150;
58//for undulated structure
59 char cn18[][5]={"CN01","CN02","CN03","CN04","CN05","CN06","CN07","CN08"};
60 char cn48[][5]={"CN21","CN22","CN23","CN24","CN25","CN26","CN27","CN28"};
61// char undul[][5]={'BELO','UNDL'};
62 Float_t zundul;
63 Float_t rundul;
64 Float_t pitch;
65 Float_t thick;
66
67
ad51aeb0 68 Int_t *idtmed = fIdtmed->GetArray()-1999;
77289c85 69// the mother of all beam pipes
70
71 tpar[0] = 0.;
72 tpar[1] = 10.;
73 tpar[2] = 1400. / 2;
74 dzmo = tpar[2];
cfce8870 75 gMC->Gsvolu("QQMO", "TUBE", idtmed[2015], tpar, 3);
77289c85 76
77// All beam pipe details as per the provisonal drawings given by Lars
78// Leistam on 31.5.99
79
80// Beryllium beam pipe, length 56.6 cm, centered at vertex
81
82 bepar[0]=0.0;
83 bepar[1]=3.0;
84 bepar[2]=28.3;
85 zpos=0.0;
86 vacpar[0]=0.0;
87 vacpar[1]=2.9;
88 vacpar[2]=bepar[2];
89 //
cfce8870 90 gMC->Gsvolu("QQBE", "TUBE", idtmed[2004], bepar, 3);
91 gMC->Gsvolu("VAC1", "TUBE", idtmed[2015], vacpar, 3);
92 gMC->Gspos("VAC1", 1, "QQBE", 0., 0., 0., 0, "ONLY");
93 gMC->Gspos("QQBE", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 94
95 // now beam pipes only in negative z-part for use in PMD.
96
97 // SS Flange 4 cm thick, 5.8 cm ID, 6.3 cm OD
98 flange[0]=0.0;
99 flange[1]=3.15;
100 flange[2]=2.0;
101 zpos = zpos -bepar[2] - flange[2];
102 vacpar[0]=0.0;
103 vacpar[1]=2.9;
104 vacpar[2]=flange[2];
105 //
cfce8870 106 gMC->Gsvolu("QFL1", "TUBE", idtmed[2018], flange, 3);
107 gMC->Gsvolu("VAC2", "TUBE", idtmed[2015], vacpar, 3);
108 gMC->Gspos("VAC2", 1, "QFL1", 0., 0., 0., 0, "ONLY");
109 gMC->Gspos("QFL1", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 110
111 // Aluminium alloy beam pipe, 1mm thick, 230 cm long
112 alpar[0]=0.0;
113 alpar[1]=3.0;
114 alpar[2]=115.;
115 zpos = zpos - flange[2] - alpar[2];
116
117 vacpar[0]=0.0;
118 vacpar[1]=2.9;
119 vacpar[2]=alpar[2];
cfce8870 120 gMC->Gsvolu("QQAL", "TUBE", idtmed[2003], alpar, 3);
121 gMC->Gsvolu("VAC3", "TUBE", idtmed[2015], vacpar, 3);
122 gMC->Gspos("VAC3", 1, "QQAL", 0., 0., 0., 0, "ONLY");
123 gMC->Gspos("QQAL", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 124
125
126 // SS tube 2.0 cm long, 0.8 mm thick, 5.96 cm OD
127
128 sspar[0]=0.0;
129 sspar[1]=2.98;
130 sspar[2]=1.0;
131 zpos = zpos - alpar[2] - sspar[2];
132
133 vacpar[0]=0.0;
134 vacpar[1]=2.9;
135 vacpar[2]=sspar[2];
cfce8870 136 gMC->Gsvolu("QSS1", "TUBE", idtmed[2018], sspar, 3);
137 gMC->Gsvolu("VAC4", "TUBE", idtmed[2015], vacpar, 3);
138 gMC->Gspos("VAC4", 1, "QSS1", 0., 0., 0., 0, "ONLY");
139 gMC->Gspos("QSS1", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 140
141
142 // SS Flange 3 cm thick 7.4 cm OD, 5.8 cm ID
143
144 flange[0]=0.0;
145 flange[1]=3.7;
146 flange[2]=1.5;
147 zpos = zpos - sspar[2] - flange[2];
148
149 vacpar[0]=0.0;
150 vacpar[1]=2.9;
151 vacpar[2]=flange[2];
cfce8870 152 gMC->Gsvolu("QFL2", "TUBE", idtmed[2018], flange, 3);
153 gMC->Gsvolu("VAC5", "TUBE", idtmed[2015], vacpar, 3);
154 gMC->Gspos("VAC5", 1, "QFL2", 0., 0., 0., 0, "ONLY");
155 gMC->Gspos("QFL2", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 156
157
158 // SS tube 4.0 cm long, 0.8 mm thick, 5.96 cm OD
159
160 sspar[0]=0.0;
161 sspar[1]=2.98;
162 sspar[2]=2.0;
163 zpos = zpos - flange[2] - sspar[2];
164
165 vacpar[0]=0.0;
166 vacpar[1]=2.9;
167 vacpar[2]=sspar[2];
cfce8870 168 gMC->Gsvolu("QSS2", "TUBE", idtmed[2018], sspar, 3);
169 gMC->Gsvolu("VAC6", "TUBE", idtmed[2015], vacpar, 3);
170 gMC->Gspos("VAC6", 1, "QSS2", 0., 0., 0., 0, "ONLY");
171 gMC->Gspos("QSS2", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 172
173
174 // *************
175 // SS Bellow 8.4 cm long, 6.5 cm ID, 7.5 cm OD
176 // 0.8 mm thick material, 0.3 cm pitch.
177 // zundul=4.2, rundul=6.5, thick=0.08
178 // **************
179 pitch=0.3;
180 thick=0.08;
181 zundul=4.2;
182 rundul=6.5;
183 Undulation("BELO",pitch,thick,zundul,rundul,cn18);
184//
185 bellow[2]=zundul;
186 zpos = zpos - sspar[2] - bellow[2];
cfce8870 187 gMC->Gspos("BELO", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 188
189 // SS tube 20.0 cm long, 0.8 mm thick, 5.96 cm OD
190
191 sspar[0]=0.0;
192 sspar[1]=2.98;
193 sspar[2]=10.0;
194 zpos = zpos - bellow[2] - sspar[2];
195
196 vacpar[0]=0.0;
197 vacpar[1]=2.9;
198 vacpar[2]=sspar[2];
cfce8870 199 gMC->Gsvolu("QSS3", "TUBE", idtmed[2018], sspar, 3);
200 gMC->Gsvolu("VAC7", "TUBE", idtmed[2015], vacpar, 3);
201 gMC->Gspos("VAC7", 1, "QSS3", 0., 0., 0., 0, "ONLY");
202 gMC->Gspos("QSS3", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 203
204 // *************
205 // SS Bellow 8.4 cm long, 6.5 cm ID, 7.5 cm OD
206 // 0.8 mm thick material, 0.3 cm pitch.
207 // **************
208//
209 zpos = zpos - sspar[2] - bellow[2];
cfce8870 210 gMC->Gspos("BELO", 2, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 211
212 // SS tube 4.7 cm long, 0.8 mm thick,
213
214 sspar[0]=0.0;
215 sspar[1]=2.98;
216 sspar[2]=4.7/2.;
217 zpos = zpos - bellow[2] - sspar[2];
218
219 vacpar[0]=0.0;
220 vacpar[1]=2.9;
221 vacpar[2]=sspar[2];
cfce8870 222 gMC->Gsvolu("QSS4", "TUBE", idtmed[2018], sspar, 3);
223 gMC->Gsvolu("VAC8", "TUBE", idtmed[2015], vacpar, 3);
224 gMC->Gspos("VAC8", 1, "QSS4", 0., 0., 0., 0, "ONLY");
225 gMC->Gspos("QSS4", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 226
227 // SS Flange 2.2 cm thick, ID=5.8 cm, OD=9.8 cm
228
229 flange[0]=0.0;
230 flange[1]=4.9;
231 flange[2]=1.1;
232 zpos = zpos - sspar[2] - flange[2];
233
234 vacpar[0]=0.0;
235 vacpar[1]=2.9;
236 vacpar[2]=flange[2];
cfce8870 237 gMC->Gsvolu("QFL3", "TUBE", idtmed[2018], flange, 3);
238 gMC->Gsvolu("VAC9", "TUBE", idtmed[2015], vacpar, 3);
239 gMC->Gspos("VAC9", 1, "QFL3", 0., 0., 0., 0, "ONLY");
240 gMC->Gspos("QFL3", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 241
242//Total of 3150 mm from vertex on the negative side upto this point.
243
244// SS tube 20.0 cm long, 0.15 cm thick, 5.8 cm ID, to support vac. pump
245
246 sspar[0]=0.0;
247 sspar[1]=3.05;
248 sspar[2]=10.0;
249 zpos = zpos - flange[2] - sspar[2];
250
251 vacpar[0]=0.0;
252 vacpar[1]=2.9;
253 vacpar[2]=sspar[2];
cfce8870 254 gMC->Gsvolu("QSS5", "TUBE", idtmed[2018], sspar, 3);
255 gMC->Gsvolu("VA10", "TUBE", idtmed[2015], vacpar, 3);
256 gMC->Gspos("VA10", 1, "QSS5", 0., 0., 0., 0, "ONLY");
257 gMC->Gspos("QSS5", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 258
259//
260 // last item, undulated SS beam pipe, pitch=0.25, length= 342.0 cm
261 // material thickness 0.015 cm, ID=6.0 cm,
262 // zundul=171.0, thick=0.015, rundul=3.0
263 pitch=0.25;
264 thick=0.015;
265 zundul=171;
266 rundul=3.0;
267 Undulation("UNDL",pitch,thick,zundul,rundul,cn48);
268 //
269 zpos = zpos - sspar[2] - zundul;
cfce8870 270 gMC->Gspos("UNDL", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 271//
cfce8870 272 gMC->Gspos("QQMO", 1, "ALIC", 0., 0., 0.1, 0, "ONLY");
77289c85 273
274// total of 6770 mm length upto this point, end of undulated beam
275// pipe section.
276
277// SS flange 22*2 mm thick
278
279
280 flange[0]=0.0;
281 flange[1]=6.3;
282 flange[2]=2.2;
283 zpos = zpos - zundul - flange[2];
284
285 vacpar[0]=0.0;
286 vacpar[1]=2.9;
287 vacpar[2]=flange[2];
cfce8870 288 gMC->Gsvolu("QFL4", "TUBE", idtmed[2018], flange, 3);
289 gMC->Gsvolu("VC11", "TUBE", idtmed[2015], vacpar, 3);
290 gMC->Gspos("VC11", 1, "QFL4", 0., 0., 0., 0, "ONLY");
291 gMC->Gspos("QFL4", 1, "QQMO", 0., 0., zpos, 0, "ONLY");
77289c85 292
293}
294
295//_____________________________________________________________________________
296void AliPIPEv3::DrawModule()
297{
298 //
299 // Draw a shaded view of the Beam Pipe
300 //
301
77289c85 302 // Set everything unseen
cfce8870 303 gMC->Gsatt("*", "seen", -1);
77289c85 304 //
305 // Set ALIC mother transparent
cfce8870 306 gMC->Gsatt("ALIC","SEEN",0);
77289c85 307 //
308 // Set the volumes visible
cfce8870 309 gMC->Gsatt("QQMO","seen",1);
310 gMC->Gsatt("QQBE","seen",1);
311 gMC->Gsatt("QFL1","seen",1);
312 gMC->Gsatt("QQAL","seen",1);
313 gMC->Gsatt("QSS1","seen",1);
314 gMC->Gsatt("QFL2","seen",1);
315 gMC->Gsatt("QSS2","seen",1);
316 gMC->Gsatt("QSS3","seen",1);
317 gMC->Gsatt("QSS4","seen",1);
318 gMC->Gsatt("QFL3","seen",1);
319 gMC->Gsatt("QSS5","seen",1);
320 gMC->Gsatt("BELO","seen",1);
321 gMC->Gsatt("UNDL","seen",1);
77289c85 322 //
cfce8870 323 gMC->Gdopt("hide", "on");
324 gMC->Gdopt("shad", "on");
325 gMC->Gsatt("*", "fill", 7);
326 gMC->SetClipBox(".");
327 gMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
328 gMC->DefaultRange();
329 gMC->Gdraw("alic", 40, 30, 0, 3, 5, .04, .04);
330 gMC->Gdhead(1111, "Beam Pipe");
331 gMC->Gdman(16, 6, "MAN");
332 gMC->Gdopt("hide","off");
77289c85 333}
334
335//_____________________________________________________________________________
336void AliPIPEv3::CreateMaterials()
337{
338 //
339 // Create materials for beam pipe
340 //
341
342 Int_t ISXFLD = gAlice->Field()->Integ();
343 Float_t SXMGMX = gAlice->Field()->Max();
344
345 Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
346 Float_t zsteel[4] = { 26.,24.,28.,14. };
347 Float_t wsteel[4] = { .715,.18,.1,.005 };
348
349 Float_t epsil, stmin, tmaxfd, deemax, stemax;
350
351 // STEEL
352
353
354 // --- Define the various materials for GEANT ---
355 AliMaterial(5, "BERILLIUM$", 9.01, 4., 1.848, 35.3, 36.7);
356 AliMaterial(4, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 18.5);
357 AliMaterial(16, "VACUUM$ ", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
358 AliMaterial(15, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500);
359 AliMixture(19, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
360
361 // ****************
362 // Defines tracking media parameters.
363 // Les valeurs sont commentees pour laisser le defaut
364 // a GEANT (version 3-21, page CONS200), f.m.
365 epsil = .001; // Tracking precision,
366 stemax = -1.; // Maximum displacement for multiple scat
367 tmaxfd = -20.; // Maximum angle due to field deflection
368 deemax = -.3; // Maximum fractional energy loss, DLS
369 stmin = -.8;
370
371 // Air
372
ad51aeb0 373 AliMedium(15, "AIR_L3_US", 15, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
77289c85 374
375 // Beryllium
376
ad51aeb0 377 AliMedium(5, "BE_L3_US", 5, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
77289c85 378
379
380 // Aluminium
381
ad51aeb0 382 AliMedium(4, "AL_L3_US", 4, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
77289c85 383
384 // Vacuum
385
ad51aeb0 386 AliMedium(16, "VA_L3_US", 16, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
77289c85 387
388 // Steel
389
ad51aeb0 390 AliMedium(19, "ST_L3_US", 19, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
77289c85 391}
392//
393void AliPIPEv3::Undulation(char *undul, Float_t pitch, Float_t thick,
394 Float_t zundul, Float_t rundul, char (*cone)[5])
395{
396 //
397 // RUNDUL : Internal radius of the undulated chamber
398 // THICK : material thickness
399 // PITCH : one-QUARTER wave of undulation (cm)
400 // ZUNDUL : half length (cm)
401 //
402 // The undulated structure is desgned as a superposition of eight CONES
403 // of suitable sizes, where the inner/outer radius of the cone increases,
404 // then decreases, each half of the wave is assumed to be a semicircle,
405 // which allows to calculate the thickness and the radii of the cone, by
406 // dividing the semicircle into 4 parts of equal arc length.
407 // Thus apear the constants 0.293 and 0.707.
408 //
409
410 const Float_t const1 = .293;
411 const Float_t const2 = .707;
412
77289c85 413 // Local variables
414 Int_t j, nwave;
415 Float_t dcone1[5], dcone2[5], dcone3[5], dcone4[5], dcone5[5],
416 dcone6[5], dcone7[5], dcone8[5];
417 Float_t xc, yc, zc, dundul[3];
ad51aeb0 418 Int_t *idtmed = fIdtmed->GetArray()-1999;
77289c85 419
420 // Function Body
421
422 dcone1[0] = const1 * pitch / 2;
423 dcone1[1] = rundul;
424 dcone1[2] = dcone1[1] + thick;
425 dcone1[3] = dcone1[1] + const2 * pitch;
426 dcone1[4] = dcone1[3] + thick;
427
428 dcone2[0] = const2 * pitch / 2;
429 dcone2[1] = dcone1[3];
430 dcone2[2] = dcone1[4];
431 dcone2[3] = dcone2[1] + const1 * pitch;
432 dcone2[4] = dcone2[3] + thick;
433
434 dcone3[0] = dcone2[0];
435 dcone3[1] = dcone2[3];
436 dcone3[2] = dcone2[4];
437 dcone3[3] = dcone2[1];
438 dcone3[4] = dcone2[2];
439
440 dcone4[0] = dcone1[0];
441 dcone4[1] = dcone1[3];
442 dcone4[2] = dcone1[4];
443 dcone4[3] = dcone1[1];
444 dcone4[4] = dcone1[2];
445
446 dcone5[0] = dcone1[0];
447 dcone5[1] = dcone1[1] - thick;
448 dcone5[2] = dcone1[1];
449 dcone5[3] = dcone5[1] - const2 * pitch;
450 dcone5[4] = dcone5[3] + thick;
451
452 dcone6[0] = dcone2[0];
453 dcone6[1] = dcone5[3];
454 dcone6[2] = dcone5[4];
455 dcone6[3] = dcone6[1] - const1 * pitch;
456 dcone6[4] = dcone6[3] + thick;
457 dcone7[0] = dcone6[0];
458 dcone7[1] = dcone6[3];
459 dcone7[2] = dcone6[4];
460 dcone7[3] = dcone5[3];
461 dcone7[4] = dcone5[4];
462
463 dcone8[0] = dcone5[0];
464 dcone8[1] = dcone7[3];
465 dcone8[2] = dcone7[4];
466 dcone8[3] = dcone5[1];
467 dcone8[4] = dcone5[2];
468
cfce8870 469 gMC->Gsvolu(cone[0], "CONE", idtmed[2015], dcone1, 5);
470 gMC->Gsvolu(cone[1], "CONE", idtmed[2015], dcone2, 5);
471 gMC->Gsvolu(cone[2], "CONE", idtmed[2015], dcone3, 5);
472 gMC->Gsvolu(cone[3], "CONE", idtmed[2015], dcone4, 5);
473 gMC->Gsvolu(cone[4], "CONE", idtmed[2015], dcone5, 5);
474 gMC->Gsvolu(cone[5], "CONE", idtmed[2015], dcone6, 5);
475 gMC->Gsvolu(cone[6], "CONE", idtmed[2015], dcone7, 5);
476 gMC->Gsvolu(cone[7], "CONE", idtmed[2015], dcone8, 5);
477 gMC->Gsatt(cone[0], "SEEN", 0);
478 gMC->Gsatt(cone[1], "SEEN", 0);
479 gMC->Gsatt(cone[2], "SEEN", 0);
480 gMC->Gsatt(cone[3], "SEEN", 0);
481 gMC->Gsatt(cone[4], "SEEN", 0);
482 gMC->Gsatt(cone[5], "SEEN", 0);
483 gMC->Gsatt(cone[6], "SEEN", 0);
484 gMC->Gsatt(cone[7], "SEEN", 0);
77289c85 485
486 // DEFINE AN IMAGINARY TUBE VOLUME FOR UNDULATED CHAMBER, FILL WITH VACUUM
487
488 nwave = Int_t (zundul / (pitch * 2) + .1);
489 dundul[2] = pitch * 2 * nwave;
490 dundul[1] = rundul + pitch + thick * 2;
491 //
492 dundul[0] = 1e-4;
cfce8870 493 gMC->Gsvolu(undul, "TUBE", idtmed[2015], dundul, 3);
77289c85 494
495 xc = 0;
496 yc = 0;
497 zc = -dundul[2] + dcone1[0];
498 for (j = 1; j <= nwave; ++j) {
cfce8870 499 gMC->Gspos(cone[0], j, undul, xc, yc, zc, 0, "ONLY");
77289c85 500 zc = zc + dcone1[0] + dcone2[0];
cfce8870 501 gMC->Gspos(cone[1], j, undul, xc, yc, zc, 0, "ONLY");
77289c85 502 zc = zc + dcone2[0] + dcone3[0];
cfce8870 503 gMC->Gspos(cone[2], j, undul, xc, yc, zc, 0, "ONLY");
77289c85 504 zc = zc + dcone3[0] + dcone4[0];
cfce8870 505 gMC->Gspos(cone[3], j, undul, xc, yc, zc, 0, "ONLY");
77289c85 506 zc = zc + dcone4[0] + dcone5[0];
cfce8870 507 gMC->Gspos(cone[4], j, undul, xc, yc, zc, 0, "ONLY");
77289c85 508 zc = zc + dcone5[0] + dcone6[0];
cfce8870 509 gMC->Gspos(cone[5], j, undul, xc, yc, zc, 0, "ONLY");
77289c85 510 zc = zc + dcone6[0] + dcone7[0];
cfce8870 511 gMC->Gspos(cone[6], j, undul, xc, yc, zc, 0, "ONLY");
77289c85 512 zc = zc + dcone7[0] + dcone8[0];
cfce8870 513 gMC->Gspos(cone[7], j, undul, xc, yc, zc, 0, "ONLY");
77289c85 514 zc = zc + dcone8[0] + dcone1[0];
515 }
516}