fe4da5cc |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // // |
3 | // Time Projection Chamber version 2 -- detailed TPC and slow simulation // |
4 | // // |
5 | //Begin_Html |
6 | /* |
7 | <img src="gif/AliTPCv2Class.gif"> |
8 | */ |
9 | //End_Html |
10 | // // |
11 | // // |
12 | /////////////////////////////////////////////////////////////////////////////// |
13 | |
14 | #include <TMath.h> |
15 | #include <TGeometry.h> |
16 | #include "AliTPCv2.h" |
17 | #include "AliRun.h" |
18 | #include <iostream.h> |
19 | #include <fstream.h> |
20 | |
21 | #include "AliMC.h" |
22 | #include "AliConst.h" |
23 | #include <stdlib.h> |
24 | |
25 | ClassImp(AliTPCv2) |
26 | |
27 | //_____________________________________________________________________________ |
28 | AliTPCv2::AliTPCv2(const char *name, const char *title) : |
29 | AliTPC(name, title) |
30 | { |
31 | // |
32 | // Standard constructor for Time Projection Chamber version 2 |
33 | // |
34 | fIdSens1=0; |
35 | fIdSens2=0; |
36 | SetBufferSize(128000); |
37 | } |
38 | |
39 | //_____________________________________________________________________________ |
40 | void AliTPCv2::CreateGeometry() |
41 | { |
42 | // |
43 | // Create the geometry of Time Projection Chamber version 2 |
44 | // |
45 | //Begin_Html |
46 | /* |
47 | <img src="gif/AliTPCv2.gif"> |
48 | */ |
49 | //End_Html |
50 | //Begin_Html |
51 | /* |
52 | <img src="gif/AliTPCv2Tree.gif"> |
53 | */ |
54 | //End_Html |
55 | |
56 | AliMC* pMC = AliMC::GetMC(); |
57 | |
58 | Int_t *idtmed = gAlice->Idtmed(); |
59 | |
60 | Float_t padl, tana; |
61 | Int_t isll; |
62 | Float_t rlsl, wlsl, rssl, rlsu, wssl, wlsu, rssu, wssu; |
63 | Int_t i; |
64 | Float_t alpha, x, y, z, sec_thick; |
65 | |
66 | Float_t r1, r2, x1, z0, z1, x2, theta1, theta2, theta3, dm[21]; |
67 | Int_t il, iu; |
68 | Float_t z_side, zz; |
69 | Int_t idrotm[100]; |
70 | |
71 | Float_t x0l, x0u; |
72 | Int_t idr; |
73 | Float_t thl, opl; |
74 | Int_t ils, iss; |
75 | Float_t thu, opu, dzz; |
76 | Int_t ifl1 = 0, ifl2 = 0; |
77 | Float_t phi1, phi2, phi3; |
78 | |
79 | // --------------------------------------------------- |
80 | // sector specification check |
81 | // --------------------------------------------------- |
82 | if (fSecAL >= 0) { |
83 | ifl1 = 0; |
84 | |
85 | for (i = 0; i < 6; ++i) { |
86 | if (fSecLows[i] > 0 && fSecLows[i] <25) { |
87 | ifl1 = 1; |
88 | printf("*** SECTOR %d selected\n",fSecLows[i]); |
89 | } |
90 | } |
91 | |
92 | } else { |
93 | printf("*** ALL LOWER SECTORS SELECTED ***\n"); |
94 | } |
95 | |
96 | if (fSecAU >= 0) { |
97 | ifl2 = 0; |
98 | |
99 | for (i = 0; i < 12; ++i) { |
100 | if (fSecUps[i] > 24 && fSecUps[i] < 73) { |
101 | ifl2 = 1; |
102 | printf("*** SECTOR %d selected\n",fSecUps[i]); |
103 | } |
104 | } |
105 | |
106 | } else { |
107 | printf("*** ALL UPPER SECTORS SELECTED ***\n"); |
108 | } |
109 | |
110 | if (ifl1 == 0 && ifl2 == 0) { |
111 | printf("*** ERROR: AT LEAST ONE SECTOR MUST BE SPECIFIED ***\n"); |
112 | printf("!!! PROGRAM STOPPED !!!\n"); |
113 | exit(1); |
114 | } |
115 | |
116 | if ((fSecAL < 0 || fSecAU < 0) && fSens >= 0) { |
117 | printf("** ERROR: STRIPS CANNOT BE SPECIFIED FOR ALL SECTORS **\n"); |
118 | printf("!!! PROGRAM STOPPED !!!\n"); |
119 | exit(1); |
120 | } |
121 | // ---------------------------------------------------- |
122 | // FIELD CAGE WITH ENDCAPS - CARBON FIBER |
123 | // THIS IS ALSO A TPC MOTHER VOLUME |
124 | // ---------------------------------------------------- |
125 | dm[0] = 76.; |
126 | dm[1] = 278.; |
127 | dm[2] = 275.; |
128 | |
129 | pMC->Gsvolu("TPC ", "TUBE", idtmed[407], dm, 3); |
130 | // ------------------------------------------------------- |
131 | // drift gas Ne/CO2 (90/10 volume) - nonsensitive |
132 | // field cage thickness = 0.52% X0 |
133 | // ---------------------------------------------------- |
134 | dm[0] = 76.+0.09776; |
135 | dm[1] = 257.; |
136 | dm[2] = 250.; |
137 | |
138 | pMC->Gsvolu("TGAS", "TUBE", idtmed[402], dm, 3); |
139 | // ------------------------------------------------------ |
140 | // "side" gas volume (the same as drift gas), |
141 | // here the readout chambers are positioned |
142 | // ------------------------------------------------------ |
143 | dm[2] = 0.5*(275.-250.); |
144 | z_side = dm[2]; |
145 | |
146 | pMC->Gsvolu("TPSG", "TUBE", idtmed[401], dm, 3); |
147 | // ------------------------------------------------------ |
148 | // HV midplane - 20 microns of mylar |
149 | // ----------------------------------------------------- |
150 | dm[2] = .001; |
151 | |
152 | pMC->Gsvolu("TPHV", "TUBE", idtmed[405], dm, 3); |
153 | |
154 | // ==================================================== |
155 | // lower and upper readout chambers |
156 | // ==================================================== |
157 | // sectros opening angles in degrees |
158 | // --------------------------------------------------- |
159 | opl = 30.; |
160 | opu = 15.; |
161 | thl = TMath::Tan(opl * .5 * kDegrad); |
162 | thu = TMath::Tan(opu * .5 * kDegrad); |
163 | // --------------------------------------------------- |
164 | // S and L-sectors radii |
165 | // --------------------------------------------------- |
166 | rssl = 88.; |
167 | rssu = 136.; |
168 | rlsl = 142.; |
169 | rlsu = 250.; |
170 | // -------------------------------------------------- |
171 | // Sectors widths |
172 | // -------------------------------------------------- |
173 | wssl = 46.5; |
174 | wssu = 72.2; |
175 | wlsl = 37.; |
176 | wlsu = 65.4; |
177 | // --------------------------------------------------- |
178 | // Sector thickness 25% of X0 (Al) |
179 | // --------------------------------------------------- |
180 | sec_thick = 2.225; |
181 | // --------------------------------------------------- |
182 | // S-sectors (lower sectors) |
183 | // --------------------------------------------------- |
184 | dm[0] = wssl * .5; |
185 | dm[1] = wssu * .5; |
186 | dm[2] = sec_thick * .5; |
187 | dm[3] = (rssu - rssl) * .5; |
188 | |
189 | x0l = rssl + dm[3]; |
190 | |
191 | pMC->Gsvolu("TRCS", "TRD1", idtmed[399], dm, 4); |
192 | // ----------------------------------------------------- |
193 | // S-sectors --> "gas sectors" - sensitive |
194 | // ----------------------------------------------------- |
195 | dm[2] = (250.-0.001)/2.; |
196 | pMC->Gsvolu("TSGA", "TRD1", idtmed[403], dm, 4); |
197 | // ------------------------------------------------------------- |
198 | // Only for the debugging purpose and resolution calculation |
199 | // Sensitive strips at the pad-row center |
200 | // ------------------------------------------------------------- |
201 | if (fSens >= 0) { |
202 | pMC->Gsvolu("TSST", "TRD1", idtmed[403], dm, 0); |
203 | dm[3] = .005; |
204 | padl = 2.05; |
205 | z0 = (rssu - rssl) * .5; |
206 | dzz = (rssu - rssl - padl * 22.) * .5; |
207 | z0 = -z0 + dzz; |
208 | |
209 | for (iss = 1; iss <= 23; ++iss) { |
210 | r1 = rssl + dzz + (iss - 1) * padl - dm[3]; |
211 | r2 = r1 + dm[3] * 2.; |
212 | dm[0] = r1 * thl - .01; |
213 | dm[1] = r2 * thl - .01; |
214 | zz = z0 + (iss - 1) * padl; |
215 | pMC->Gsposp("TSST", iss, "TSGA", 0, 0, zz, 0, "ONLY", dm, 4); |
216 | } |
217 | pMC->Gsord("TSGA", 3); |
218 | } |
219 | // --------------------------------------------------- |
220 | // L-sectors (upper sectors) |
221 | // --------------------------------------------------- |
222 | dm[0] = wlsl * .5; |
223 | dm[1] = wlsu * .5; |
224 | dm[2] = sec_thick * .5; |
225 | dm[3] = (rlsu - rlsl) * .5; |
226 | |
227 | x0u = rlsl + dm[3]; |
228 | |
229 | pMC->Gsvolu("TRCL", "TRD1", idtmed[399], dm, 4); |
230 | // ----------------------------------------------------- |
231 | // L-sectors - "gas sectors" - sensitive! |
232 | // ----------------------------------------------------- |
233 | dm[2] = (250.-0.001)/2.; |
234 | pMC->Gsvolu("TLGA", "TRD1", idtmed[403], dm, 4); |
235 | // ------------------------------------------------------------- |
236 | // Only for the debugging purpose and resolution calculation |
237 | // Sensitive strips at the pad-row center |
238 | // ------------------------------------------------------------- |
239 | if (fSens >= 0) { |
240 | pMC->Gsvolu("TLST", "TRD1", idtmed[403], dm, 0); |
241 | |
242 | dm[3] = .005; |
243 | padl = 2.05; |
244 | z0 = (rlsu - rlsl) * .5; |
245 | dzz = (rlsu - rlsl - padl * 51.) * .5; |
246 | z0 = -z0 + dzz; |
247 | |
248 | for (ils = 1; ils <= 52; ++ils) { |
249 | r1 = rlsl + dzz + (ils - 1) * padl - dm[3]; |
250 | r2 = r1 + dm[3] * 2.; |
251 | dm[0] = r1 * thu - 1.1; |
252 | dm[1] = r2 * thu - 1.1; |
253 | zz = z0 + (ils - 1) * padl; |
254 | pMC->Gsposp("TLST", ils, "TLGA", 0, 0, zz, 0, "ONLY", dm, 4); |
255 | } |
256 | pMC->Gsord("TLGA", 3); |
257 | } |
258 | // ****************************************************** |
259 | // ------------------------------------------------ |
260 | // positioning of lower sectors (1-12)*2 |
261 | // rotation matrices 1-12 |
262 | |
263 | // the isec_al flag allows to select all (<0) or |
264 | // only a few (up to 6) sectors |
265 | // ------------------------------------------------ |
266 | z = (250.+0.001)/2.; |
267 | z1 = -z_side + sec_thick * .5; |
268 | |
269 | for (il = 1; il <= 12; ++il) { |
270 | phi1 = (il - 1) * opl + 270.; |
271 | if (phi1 > 360.) { |
272 | phi1 += -360.; |
273 | } |
274 | theta1 = 90.; |
275 | phi2 = 90.; |
276 | theta2 = 180.; |
277 | phi3 = (il - 1) * opl; |
278 | theta3 = 90.; |
279 | |
280 | idr = il; |
281 | AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3); |
282 | |
283 | alpha = (il - 1) * opl * kDegrad; |
284 | x = x0l * TMath::Cos(alpha); |
285 | y = x0l * TMath::Sin(alpha); |
286 | |
287 | if (fSecAL < 0) { |
288 | // ----------------------------------------------------------- |
289 | // position ALL lower sectors |
290 | // ----------------------------------------------------------- |
291 | pMC->Gspos("TSGA", il, "TGAS", x, y, z, idrotm[idr], "ONLY"); |
292 | pMC->Gspos("TSGA",il+12 , "TGAS", x, y, -z, idrotm[idr], "ONLY"); |
293 | } else { |
294 | // ----------------------------------------------------------- |
295 | // position selected lower sectors |
296 | // ----------------------------------------------------------- |
297 | for (isll = 1; isll <= 6; ++isll) { |
298 | if (fSecLows[isll - 1] == il) { |
299 | pMC->Gspos("TSGA", il, "TGAS", x, y, z, idrotm[idr], "ONLY"); |
300 | } else if (fSecLows[isll - 1] == il + 12) { |
301 | pMC->Gspos("TSGA",il+12 , "TGAS", x, y, -z, idrotm[idr],"ONLY"); |
302 | } |
303 | } |
304 | } |
305 | |
306 | pMC->Gspos("TRCS", il, "TPSG", x, y, z1, idrotm[idr], "ONLY"); |
307 | |
308 | } |
309 | // ---------------------------------------------------- |
310 | // positioning of upper sectors (1-24)*2 |
311 | // rotation matrices 13-36 |
312 | // the isec_au flag allows to select all (<0) or |
313 | // only a few (up to 12) sectors |
314 | // ---------------------------------------------------- |
315 | for (iu = 1; iu <= 24; ++iu) { |
316 | phi1 = (iu - 1) * opu + 270.; |
317 | if (phi1 > 360.) { |
318 | phi1 += -360.; |
319 | } |
320 | theta1 = 90.; |
321 | phi2 = 90.; |
322 | theta2 = 180.; |
323 | phi3 = (iu - 1) * opu; |
324 | theta3 = 90.; |
325 | |
326 | idr = iu + 12; |
327 | AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3); |
328 | |
329 | alpha = (iu - 1) * opu * kDegrad; |
330 | x = x0u * TMath::Cos(alpha); |
331 | y = x0u * TMath::Sin(alpha); |
332 | |
333 | if (fSecAU < 0) { |
334 | // ------------------------------------------------------------- |
335 | // position ALL upper sectors |
336 | // ------------------------------------------------------------- |
337 | pMC->Gspos("TLGA", iu, "TGAS", x, y, z, idrotm[idr], "ONLY"); |
338 | pMC->Gspos("TLGA",iu+24 , "TGAS", x, y, -z, idrotm[idr], "ONLY"); |
339 | } else { |
340 | // ------------------------------------------------------------- |
341 | // position selected upper sectors |
342 | // ------------------------------------------------------------- |
343 | for (isll = 1; isll <= 12; ++isll) { |
344 | if (fSecUps[isll - 1] == iu + 24) { |
345 | pMC->Gspos("TLGA", iu, "TGAS", x, y, z, idrotm[idr], "ONLY"); |
346 | } else if (fSecUps[isll - 1] == iu + 48) { |
347 | pMC->Gspos("TLGA",iu+24 , "TGAS", x, y, -z, idrotm[idr],"ONLY"); |
348 | } |
349 | } |
350 | } |
351 | |
352 | pMC->Gspos("TRCL", iu, "TPSG", x, y, z1, idrotm[idr], "ONLY"); |
353 | } |
354 | // -------------------------------------------------------- |
355 | // Spoke wheel structures |
356 | // -------------------------------------------------------- |
357 | pMC->Gsvolu("TSWS", "TUBE", idtmed[399], dm, 0); |
358 | |
359 | z0 = -z_side + 2.; |
360 | |
361 | dm[0] = 82.; |
362 | dm[1] = 86.; |
363 | dm[2] = 1.; |
364 | |
365 | pMC->Gsposp("TSWS", 1, "TPSG", 0, 0, z0, 0, "ONLY", dm, 3); |
366 | |
367 | dm[0] = 253.; |
368 | dm[1] = 257.; |
369 | |
370 | pMC->Gsposp("TSWS", 2, "TPSG", 0, 0, z0, 0, "ONLY", dm, 3); |
371 | |
372 | dm[0] = 140.9; |
373 | dm[1] = 141.9; |
374 | |
375 | pMC->Gsposp("TSWS", 3, "TPSG", 0, 0, z0, 0, "ONLY", dm, 3); |
376 | |
377 | // ------------------------------------------------------- |
378 | // this volumes are to avoid overlaping |
379 | // ------------------------------------------------------- |
380 | z0 = 253.; |
381 | |
382 | dm[0] = 76.; |
383 | dm[1] = 76.+0.09776; |
384 | |
385 | pMC->Gsposp("TSWS", 4, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3); |
386 | pMC->Gsposp("TSWS", 5, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3); |
387 | |
388 | z0 += 21.; |
389 | |
390 | pMC->Gsposp("TSWS", 6, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3); |
391 | pMC->Gsposp("TSWS", 7, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3); |
392 | |
393 | dm[0] = 257.; |
394 | dm[1] = 257.+0.09776; |
395 | dm[2] = 11.5; |
396 | |
397 | z0 = 263.5; |
398 | |
399 | pMC->Gsposp("TSWS", 8, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3); |
400 | pMC->Gsposp("TSWS", 9, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3); |
401 | // ========================================================== |
402 | // wheels |
403 | // ========================================================== |
404 | // ---------------------------------------------------------- |
405 | // Large wheel -> positioned in the TPC |
406 | // ---------------------------------------------------------- |
407 | dm[0] = 257.+0.09776; |
408 | dm[1] = 278.; |
409 | dm[2] = 11.5; |
410 | pMC->Gsvolu("TPW1", "TUBE", idtmed[399], dm, 3); |
411 | |
412 | dm[0] = 259.; |
413 | dm[1] = 278.; |
414 | dm[2] = 9.5; |
415 | |
416 | pMC->Gsvolu("TPW2", "TUBE", idtmed[498], dm, 3); |
417 | |
418 | pMC->Gspos("TPW2", 1, "TPW1", 0, 0, 0, 0, "ONLY"); |
419 | |
420 | pMC->Gspos("TPW1", 1, "TPC ", 0, 0, z0, 0, "ONLY"); |
421 | pMC->Gspos("TPW1", 2, "TPC ", 0, 0, -z0, 0, "ONLY"); |
422 | // ----------------------------------------------------------- |
423 | // Small wheel -> positioned in the TPSG |
424 | // ----------------------------------------------------------- |
425 | dm[0] = 76.+0.09776; |
426 | dm[1] = 82.; |
427 | dm[2] = 11.5; |
428 | |
429 | pMC->Gsvolu("TPW3", "TUBE", idtmed[399], dm, 3); |
430 | |
431 | dm[0] = 76.+0.09776; |
432 | dm[1] = 80.; |
433 | dm[2] = 9.5; |
434 | |
435 | pMC->Gsvolu("TPW4", "TUBE", idtmed[401], dm, 3); |
436 | |
437 | pMC->Gspos("TPW4", 1, "TPW3", 0, 0, 0, 0, "ONLY"); |
438 | |
439 | z0 = 1.; |
440 | |
441 | pMC->Gspos("TPW3", 1, "TPSG", 0, 0, z0, 0, "ONLY"); |
442 | // --------------------------------------------------------- |
443 | // spokes, inner and outer, also the inner ring |
444 | // --------------------------------------------------------- |
445 | dm[0] = 0.5*(135.9-82.1); |
446 | dm[1] = 3.; |
447 | dm[2] = 2.; |
448 | |
449 | x1 = dm[0] + 82.; |
450 | |
451 | pMC->Gsvolu("TSPI", "BOX ", idtmed[399], dm, 3); |
452 | |
453 | dm[1] = 2.; |
454 | dm[2] = 1.; |
455 | |
456 | pMC->Gsvolu("TSP1", "BOX ", idtmed[498], dm, 3); |
457 | |
458 | pMC->Gspos("TSP1", 1, "TSPI", 0, 0, 0, 0, "ONLY"); |
459 | |
460 | dm[0] = 0.5*(256.9-142.1); |
461 | dm[1] = 3.; |
462 | dm[2] = 2.; |
463 | |
464 | x2 = dm[0] + 142.; |
465 | |
466 | pMC->Gsvolu("TSPO", "BOX ", idtmed[399], dm, 3); |
467 | |
468 | dm[1] = 2.; |
469 | dm[2] = 1.; |
470 | |
471 | pMC->Gsvolu("TSP2", "BOX ", idtmed[498], dm, 3); |
472 | |
473 | pMC->Gspos("TSP2", 1, "TSPO", 0, 0, 0, 0, "ONLY"); |
474 | // -------------------------------------------------------- |
475 | dm[0] = 136.; |
476 | dm[1] = 142.; |
477 | dm[2] = 2.; |
478 | |
479 | pMC->Gsvolu("TSWH", "TUBE", idtmed[399], dm, 3); |
480 | |
481 | dm[0] = 137.; |
482 | dm[1] = 141.; |
483 | dm[2] = 1.; |
484 | |
485 | pMC->Gsvolu("TSW1", "TUBE", idtmed[498], dm, 3); |
486 | |
487 | pMC->Gspos("TSW1", 1, "TSWH", 0, 0, 0, 0, "ONLY"); |
488 | |
489 | z0 = z_side - .16168 - 2.; |
490 | // -------------------------------------------------------- |
491 | pMC->Gspos("TSWH", 1, "TPSG", 0, 0, z0, 0, "ONLY"); |
492 | // ------------------------------------------------------- |
493 | // posiioning of the inner spokes |
494 | // ------------------------------------------------------- |
495 | for (il = 1; il <= 6; ++il) { |
496 | phi1 = opl * .5 + (il - 1) * 2. * opl; |
497 | theta1 = 90.; |
498 | phi2 = opl * .5 + 90. + (il - 1) * 2. * opl; |
499 | if (phi2 > 360.) { |
500 | phi2 += -360.; |
501 | } |
502 | theta2 = 90.; |
503 | phi3 = 0.; |
504 | theta3 = 0.; |
505 | |
506 | alpha = phi1 * kDegrad; |
507 | x = x1 * TMath::Cos(alpha); |
508 | y = x1 * TMath::Sin(alpha); |
509 | |
510 | idr = il + 36; |
511 | |
512 | AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3); |
513 | pMC->Gspos("TSPI", il, "TPSG", x, y, z0, idrotm[idr], "ONLY"); |
514 | |
515 | } |
516 | |
517 | for (iu = 1; iu <= 12; ++iu) { |
518 | phi1 = opu * .5 + (iu - 1) * 2. * opu; |
519 | theta1 = 90.; |
520 | phi2 = opu * .5 + 90. + (iu - 1) * 2. * opu; |
521 | if (phi2 > 360.) { |
522 | phi2 += -360.; |
523 | } |
524 | theta2 = 90.; |
525 | phi3 = 0.; |
526 | theta3 = 0.; |
527 | |
528 | alpha = phi1 * kDegrad; |
529 | x = x2 * TMath::Cos(alpha); |
530 | y = x2 * TMath::Sin(alpha); |
531 | |
532 | idr = iu + 42; |
533 | |
534 | AliMatrix(idrotm[idr], theta1, phi1, theta2, phi2, theta3, phi3); |
535 | pMC->Gspos("TSPO", iu, "TPSG", x, y, z0, idrotm[idr], "ONLY"); |
536 | } |
537 | // -------------------------------------------------------- |
538 | // endcap cover (C, 0.86% X0) |
539 | // -------------------------------------------------------- |
540 | dm[0] = 76.+0.09776; |
541 | dm[1] = 257.; |
542 | dm[2] = 0.16168*0.5; |
543 | |
544 | pMC->Gsvolu("TCOV", "TUBE", idtmed[407], dm, 3); |
545 | |
546 | z0 = z_side - dm[2]; |
547 | |
548 | pMC->Gspos("TCOV", 1, "TPSG", 0, 0, z0, 0, "ONLY"); |
549 | // -------------------------------------------------------- |
550 | // put the readout chambers into the TPC |
551 | // -------------------------------------------------------- |
552 | theta1 = 90.; |
553 | phi1 = 0.; |
554 | theta2 = 90.; |
555 | phi2 = 270.; |
556 | theta3 = 180.; |
557 | phi3 = 0.; |
558 | |
559 | AliMatrix(idrotm[55], theta1, phi1, theta2, phi2, theta3, phi3); |
560 | |
561 | z0 = z_side + 250.; |
562 | |
563 | pMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY"); |
564 | pMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[55], "ONLY"); |
565 | // --------------------------------------------------------- |
566 | // outer gas insulation (CO2) |
567 | // --------------------------------------------------------- |
568 | dm[0] = 257.+0.09776; |
569 | dm[1] = 278.-0.25004; |
570 | dm[2] = 275.-23.; |
571 | |
572 | pMC->Gsvolu("TPOI", "TUBE", idtmed[406], dm, 3); |
573 | |
574 | pMC->Gspos("TPHV", 1, "TGAS", 0, 0, 0, 0, "ONLY"); |
575 | pMC->Gspos("TGAS", 1, "TPC ", 0, 0, 0, 0, "ONLY"); |
576 | pMC->Gspos("TPOI", 1, "TPC ", 0, 0, 0, 0, "ONLY"); |
577 | |
578 | pMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY"); |
579 | // ====================================================== |
580 | // all volumes below are positioned in ALIC |
581 | // ====================================================== |
582 | // ------------------------------------------------------ |
583 | // the last parts of the smaller wheel (TSWS) |
584 | // ------------------------------------------------------ |
585 | dm[0] = 74.; |
586 | dm[1] = 76.; |
587 | dm[2] = 1.; |
588 | |
589 | z0 = 253.; |
590 | |
591 | pMC->Gsposp("TSWS", 10, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3); |
592 | pMC->Gsposp("TSWS", 11, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3); |
593 | |
594 | dm[0] = 70.; |
595 | |
596 | z0 += 21.; |
597 | |
598 | pMC->Gsposp("TSWS", 12, "TPC ", 0, 0, z0, 0, "ONLY", dm, 3); |
599 | pMC->Gsposp("TSWS", 13, "TPC ", 0, 0, -z0, 0, "ONLY", dm, 3); |
600 | // ---------------------------------------------------- |
601 | // Inner vessel (PCON) |
602 | // This volume is to be positioned directly in ALIC |
603 | // ---------------------------------------------------- |
604 | dm[0] = 0.; |
605 | dm[1] = 360.; |
606 | dm[2] = 4.; |
607 | |
608 | dm[3] = -250.; |
609 | dm[4] = 75.; |
610 | dm[5] = 76.; |
611 | |
612 | dm[6] = -64.5; |
613 | dm[7] = 50.; |
614 | dm[8] = 76.; |
615 | |
616 | dm[9] = 64.5; |
617 | dm[10] = 50.; |
618 | dm[11] = 76.; |
619 | |
620 | dm[12] = 250.; |
621 | dm[13] = 75.; |
622 | dm[14] = 76.; |
623 | |
624 | pMC->Gsvolu("TPIV", "PCON", idtmed[407], dm, 15); |
625 | // -------------------------------------------------------- |
626 | // fill the inner vessel with CO2, (HV kDegrader) |
627 | // cone parts have different thickness |
628 | // than the central barrel, according to the TP |
629 | // -------------------------------------------------------- |
630 | tana = 75./185.5; |
631 | |
632 | dm[0] = 0.; |
633 | dm[1] = 360.; |
634 | dm[2] = 6.; |
635 | |
636 | dm[3] = -(250.-0.2162); |
637 | dm[4] = (185.5-0.2126)*tana+0.2126; |
638 | dm[5] = 76-0.001; |
639 | |
640 | dm[6] = -64.5; |
641 | dm[7] = 50.+0.2162; |
642 | dm[8] = 76-0.001; |
643 | |
644 | dm[9] = -64.5; |
645 | dm[10] = 50+0.05076; |
646 | dm[11] = 76-0.001; |
647 | |
648 | dm[12] = 64.5; |
649 | dm[13] = 50+0.05076; |
650 | dm[14] = 76-0.001; |
651 | |
652 | dm[15] = 64.5; |
653 | dm[16] = 50.+0.2162; |
654 | dm[17] = 76-0.001; |
655 | |
656 | dm[18] = (250.-0.2162); |
657 | dm[19] = (185.5-0.2126)*tana+0.2126; |
658 | dm[20] = 76-0.001; |
659 | |
660 | pMC->Gsvolu("TPVD", "PCON", idtmed[406], dm, 21); |
661 | |
662 | pMC->Gspos("TPVD", 1, "TPIV", 0, 0, 0, 0, "ONLY"); |
663 | |
664 | pMC->Gspos("TPIV", 1, "ALIC", 0, 0, 0, 0, "ONLY"); |
665 | // --------------------------------------------------- |
666 | // volumes ordering |
667 | // --------------------------------------------------- |
668 | pMC->Gsord("TGAS", 6); |
669 | pMC->Gsord("TPSG", 6); |
670 | } |
671 | |
672 | //_____________________________________________________________________________ |
673 | void AliTPCv2::DrawDetector() |
674 | { |
675 | // |
676 | // Draw a shaded view of the Time Projection Chamber version 1 |
677 | // |
678 | |
679 | AliMC* pMC = AliMC::GetMC(); |
680 | |
681 | // Set everything unseen |
682 | pMC->Gsatt("*", "seen", -1); |
683 | // |
684 | // Set ALIC mother transparent |
685 | pMC->Gsatt("ALIC","SEEN",0); |
686 | // |
687 | // Set the volumes visible |
688 | pMC->Gsatt("TPC","SEEN",0); |
689 | pMC->Gsatt("TGAS","SEEN",0); |
690 | pMC->Gsatt("TPSG","SEEN",0); |
691 | pMC->Gsatt("TPHV","SEEN",1); |
692 | pMC->Gsatt("TRCS","SEEN",1); |
693 | pMC->Gsatt("TRCL","SEEN",1); |
694 | pMC->Gsatt("TSWS","SEEN",1); |
695 | pMC->Gsatt("TPW1","SEEN",1); |
696 | pMC->Gsatt("TPW3","SEEN",1); |
697 | pMC->Gsatt("TSPI","SEEN",1); |
698 | pMC->Gsatt("TSPO","SEEN",1); |
699 | pMC->Gsatt("TSWH","SEEN",1); |
700 | pMC->Gsatt("TPOI","SEEN",1); |
701 | pMC->Gsatt("TPIV","SEEN",1); |
702 | pMC->Gsatt("TPVD","SEEN",1); |
703 | // |
704 | pMC->Gdopt("hide", "on"); |
705 | pMC->Gdopt("shad", "on"); |
706 | pMC->Gsatt("*", "fill", 7); |
707 | pMC->SetClipBox("."); |
708 | pMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000); |
709 | pMC->DefaultRange(); |
710 | pMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025); |
711 | pMC->Gdhead(1111, "Time Projection Chamber"); |
712 | pMC->Gdman(18, 4, "MAN"); |
713 | pMC->Gdopt("hide","off"); |
714 | } |
715 | |
716 | //_____________________________________________________________________________ |
717 | void AliTPCv2::CreateMaterials() |
718 | { |
719 | // |
720 | // Define materials for version 2 of the Time Projection Chamber |
721 | // |
722 | |
723 | AliMC* pMC = AliMC::GetMC(); |
724 | |
725 | // |
726 | // Increase maximum number of steps |
727 | pMC->SetMaxNStep(30000); |
728 | // |
729 | AliTPC::CreateMaterials(); |
730 | } |
731 | |
732 | //_____________________________________________________________________________ |
733 | void AliTPCv2::Init() |
734 | { |
735 | // |
736 | // Initialises version 2 of the TPC after that it has been built |
737 | // |
738 | AliMC* pMC=AliMC::GetMC(); |
739 | Int_t *idtmed = gAlice->Idtmed(); |
740 | AliTPC::Init(); |
741 | fIdSens1=pMC->VolId("TLGA"); // L-sector |
742 | fIdSens2=pMC->VolId("TSGA"); // S-sector |
743 | fIdSens3=pMC->VolId("TSST"); // strip - S-sector (not always used) |
744 | fIdSens4=pMC->VolId("TLST"); // strip - S-sector (not always used) |
745 | |
746 | pMC->SetMaxNStep(30000); // max. number of steps increased |
747 | |
748 | pMC->Gstpar(idtmed[403],"LOSS",5); |
749 | |
750 | printf("*** TPC version 2 initialized ***\n"); |
751 | printf("Maximum number of steps = %d\n",pMC->GetMaxNStep()); |
752 | |
753 | // |
754 | |
755 | } |
756 | |
757 | //_____________________________________________________________________________ |
758 | void AliTPCv2::StepManager() |
759 | { |
760 | // |
761 | // Called for every step in the Time Projection Chamber |
762 | // |
763 | |
764 | // |
765 | // parameters used for the energy loss calculations |
766 | // |
767 | const Float_t prim = 14.35; // number of primary collisions per 1 cm |
768 | const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2 |
769 | const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation |
770 | |
771 | |
772 | const Float_t big = 1.e10; |
773 | |
774 | Int_t id,copy; |
775 | Float_t hits[4]; |
776 | Int_t vol[2]; |
777 | TClonesArray &lhits = *fHits; |
778 | AliMC* pMC=AliMC::GetMC(); |
779 | |
780 | vol[1]=0; |
781 | |
782 | // |
783 | |
784 | pMC->SetMaxStep(big); |
785 | |
786 | if(!pMC->TrackAlive()) return; // particle has disappeared |
787 | |
788 | Float_t charge = pMC->TrackCharge(); |
789 | |
790 | if(TMath::Abs(charge)<=0.) return; // take only charged particles |
791 | |
792 | |
793 | id=pMC->CurrentVol(0, copy); |
794 | |
795 | // Check the sensitive volume |
796 | |
797 | if(id == fIdSens1) |
798 | { |
799 | vol[0] = copy + 24; // L-sector number |
800 | } |
801 | else if(id == fIdSens2) |
802 | { |
803 | vol[0] = copy; // S-sector number |
804 | } |
805 | else if(id == fIdSens3 && pMC->TrackEntering()) |
806 | { |
807 | vol[1] = copy; // row number |
808 | id = pMC->CurrentVolOff(1,0,copy); |
809 | vol[0] = copy; // sector number (S-sector) |
810 | |
811 | pMC->TrackPosition(hits); |
812 | hits[3]=0.; // this hit has no energy loss |
813 | new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits); |
814 | } |
815 | else if(id == fIdSens4 && pMC->TrackEntering()) |
816 | { |
817 | vol[1] = copy; // row number |
818 | id = pMC->CurrentVolOff(1,0,copy); |
819 | vol[0] = copy+24; // sector number (L-sector) |
820 | |
821 | pMC->TrackPosition(hits); |
822 | hits[3]=0.; // this hit has no energy loss |
823 | new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits); |
824 | } |
825 | else return; |
826 | |
827 | // |
828 | // charged particle is in the sensitive volume |
829 | // |
830 | |
831 | if(pMC->TrackStep() > 0) { |
832 | |
833 | Int_t nel = (Int_t)(((pMC->Edep())-poti)/w_ion) + 1; |
834 | nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV |
835 | |
836 | pMC->TrackPosition(hits); |
837 | hits[3]=(Float_t)nel; |
838 | |
839 | // Add this hit |
840 | |
841 | new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits); |
842 | |
843 | } |
844 | |
845 | // Stemax calculation for the next step |
846 | |
847 | Float_t pp; |
848 | Float_t vect[4]; |
849 | pMC->TrackMomentum(vect); |
850 | Float_t ptot = vect[3]; |
851 | Float_t beta_gamma = ptot/(pMC->TrackMass()); |
852 | |
853 | if(pMC->TrackPid() <= 3 && ptot > 0.002) |
854 | { |
855 | pp = prim*1.58; // electrons above 20 MeV/c are on the plateau! |
856 | } |
857 | else |
858 | { |
859 | pp=prim*BetheBloch(beta_gamma); |
860 | if(TMath::Abs(charge) > 1.) pp *= (charge*charge); |
861 | } |
862 | |
863 | Float_t random[1]; |
864 | pMC->Rndm(random,1); // good, old GRNDM from Geant3 |
865 | |
866 | Double_t rnd = (Double_t)random[0]; |
867 | |
868 | pMC->SetMaxStep(-TMath::Log(rnd)/pp); |
869 | |
870 | } |
871 | |
872 | //_____________________________________________________________________________ |
873 | Float_t AliTPCv2::BetheBloch(Float_t bg) |
874 | { |
875 | // |
876 | // Bethe-Bloch energy loss formula |
877 | // |
878 | const Double_t p1=0.76176e-1; |
879 | const Double_t p2=10.632; |
880 | const Double_t p3=0.13279e-4; |
881 | const Double_t p4=1.8631; |
882 | const Double_t p5=1.9479; |
883 | |
884 | Double_t dbg = (Double_t) bg; |
885 | |
886 | Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg); |
887 | |
888 | Double_t aa = TMath::Power(beta,p4); |
889 | Double_t bb = TMath::Power(1./dbg,p5); |
890 | |
891 | bb=TMath::Log(p3+bb); |
892 | |
893 | return ((Float_t)((p2-aa-bb)*p1/aa)); |
894 | } |