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