This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / TRD / AliTRDv1.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Transition Radiation Detector version 1 -- detailed simulation //
4// //
5//Begin_Html
6/*
7<img src="gif/AliTRDv1Class.gif">
8*/
9//End_Html
10// //
11// //
12///////////////////////////////////////////////////////////////////////////////
13
14#include <TMath.h>
15#include <TRandom.h>
16#include <TVector.h>
17#include <TGeometry.h>
18#include <TNode.h>
19#include <TPGON.h>
20
21#include "GParticle.h"
22#include "AliTRDv1.h"
23#include "AliRun.h"
24#include "AliConst.h"
25#include "AliMC.h"
26
27ClassImp(AliTRDv1)
28
29//_____________________________________________________________________________
30AliTRDv1::AliTRDv1(const char *name, const char *title)
31 :AliTRD(name, title)
32{
33 //
34 // Standard constructor for the Transition Radiation Detector version 1
35 //
36 fIdSens1 = fIdSens2 = fIdSens3 = 0;
37}
38
39//_____________________________________________________________________________
40void AliTRDv1::CreateGeometry()
41{
42 //
43 // Create the geometry for the Transition Radiation Detector version 1
44 // --- The coarse geometry of the TRD, that can be used for background
45 // studies. This version leaves the space in front of the PHOS and
46 // HMPID empty.
47 // -- Author : Nick van Eijndhoven (CERN) 24/09/90
48 //
49 //Begin_Html
50 /*
51 <img src="gif/AliTRDv1.gif">
52 */
53 //End_Html
54 //Begin_Html
55 /*
56 <img src="gif/AliTRDv1Tree.gif">
57 */
58 //End_Html
59
60 Float_t xpos, ypos, zpos, f;
61 Int_t idmat[5];
62 Float_t widma, theoc, widmi, tanzr;
63 Float_t par_ic[4], par_oc[11], phisec, par_mo[10], par_fr[4], par_su[10];
64
65 Int_t *idtmed = gAlice->Idtmed();
66
67 // --- Name Conventions :
68 // TRD --> Mother TRD volume (Air)
69 // UTRL(S) --> Long (short) subdetector-type (Al)
70 // UTSL(S) --> Sectors of a subdetector (Al)
71 // UTFI(O/S) --> Inner part of the detector frame (Air)
72 // UTCI(O/S) --> Frames of the inner and outer chambers (C)
73 // UTII(O/S) --> Inner part of the chambers (Air)
74 // UTMI(O/S) --> Modules in the chambers (Air)
75 // UT1I(O/S) --> Radiator layer (CO2)
76 // UT2I(O/S) --> Polyethylene layer (PE)
77 // UT3I(O/S) --> Mylar layer (Mylar)
78 // UT4I(O/S) --> Xe/C02 layer (Xe/C02)
79 // UT5I(O/S) --> Cu layer (pads/sensitive) (Cu)
80 // UT6I(O/S) --> Kapton layer (Kapton)
81 // UT7I(O/S) --> NOMEX layer (C)
82 // UT8I(O/S) --> Readout layer (Al)
83
84 // --- Contains geometry information
85
86 // --- Number of sectors in the full detector
87 // --- Number of modules in each sector
88 // --- z-Coordinates of the TRD-frame
89 // --- r-Coordinates of the TRD-frame
90 // --- Thickness of the aluminium of the support frame
91 // --- Thickness of the interior of the support frame
92 // --- Thickness of the carbon chamber frame
93 // --- Thickness and z-position of the PE-layer in the radiator
94 // --- Thickness and z-position of the radiator
95 // --- Thickness and z-position of the mylar-layer
96 // --- Thickness and z-position of the Xe/C02-layer
97 // --- Thickness and z-position of the Cu-layer (Pads)
98 // --- Thickness and z-position of the kapton-layer
99 // --- Thickness and z-position of the NOMEX-layer
100 // Simple C-layer for the time being
101 // --- Thickness and z-position of the readout-layer
102 // --- Parameter for the arrays
103 // --- Number of subdetector-types
104 //--- Number of sectors in the first subdetector-type (full theta coverage)
105 //--- Number of sectors in the second subdetector-type (with hole for PHOS)
106 //************************************************************************
107
108 // Definition of Volumes
109
110 //************************************************************************
111
112 const Int_t nsec1 = 5; //Number of sectors in the first subdetector-type
113 const Int_t nsec2 = 5; //Number of sectors in the second subdetector-type
114
115 AliMC* pMC = AliMC::GetMC();
116
117 phisec = 360./nsect; //The phi-angle of the sectors
118 widmi = rmin*TMath::Sin(kPI/nsect);
119 widma = rmax*TMath::Sin(kPI/nsect);
120 // --- Definition of the Mother volume for the TRD (Al)
121 par_mo[0] = 0.;
122 par_mo[1] = 360.;
123 par_mo[2] = nsect;
124 par_mo[3] = 2.;
125 par_mo[4] = -zmax1;
126 par_mo[5] = rmin;
127 par_mo[6] = rmax;
128 par_mo[7] = zmax1;
129 par_mo[8] = rmin;
130 par_mo[9] = rmax;
131 pMC->Gsvolu("TRD ", "PGON", idtmed[1301], par_mo, 10);
132 // --- Definition of the 1st subdetector-type (full theta-coverage) (Al)
133 par_su[0] = 120.;
134 par_su[1] = nsec1*phisec;
135 par_su[2] = nsec1;
136 par_su[3] = 2.;
137 par_su[4] = -zmax1;
138 par_su[5] = rmin;
139 par_su[6] = rmax;
140 par_su[7] = 0.;
141 par_su[8] = rmin;
142 par_su[9] = rmax;
143 pMC->Gsvolu("UTRL", "PGON", idtmed[1300], par_su, 10);
144 pMC->Gsdvn("UTSL", "UTRL", nsec1, 2);
145 // --- Definition of the 2nd subdetector-type (hole for PHOS)
146 par_su[0] = 220.;
147 par_su[1] = nsec2*phisec;
148 par_su[2] = nsec2;
149 par_su[3] = 2.;
150 par_su[4] = -zmax1;
151 par_su[5] = rmin;
152 par_su[6] = rmax;
153 par_su[7] = -zmax1/2;
154 par_su[8] = rmin;
155 par_su[9] = rmax;
156 pMC->Gsvolu("UTRS", "PGON", idtmed[1300], par_su, 10);
157 pMC->Gsdvn("UTSS", "UTRS", nsec2, 2);
158 // --- Definition of the inner part of the detector frame (Air)
159 par_fr[0] = widmi;
160 par_fr[1] = widma;
161 par_fr[2] = zmax1/4 - alfram2/2;
162 par_fr[3] = (rmax-rmin)/2;
163 pMC->Gsvolu("UTFI", "TRD1", idtmed[1301], par_fr, 4);
164 pMC->Gsvolu("UTFO", "TRD1", idtmed[1301], par_fr, 4);
165 pMC->Gsvolu("UTFS", "TRD1", idtmed[1301], par_fr, 4);
166 // --- Calculate the shape-parameter for the outer chambers
167 tanzr = (zmax1-zmax2)/(rmax-rmin);
168 theoc = -kRaddeg*TMath::ATan(tanzr / 2.);
169 // --- The carbon frame of the outer chambers
170 par_oc[0] = (rmax-rmin)/2;
171 par_oc[1] = theoc;
172 par_oc[2] = 90.;
173 par_oc[3] = zmax2/2 - zmax1/4 -alfram2/2;
174 par_oc[4] = widmi - (inframe+alfram1)/2;
175 par_oc[5] = widmi - (inframe+alfram1)/2;
176 par_oc[6] = 0.;
177 par_oc[7] = zmax1/4 - alfram2/2;
178 par_oc[8] = widma - (inframe+alfram1)/2;
179 par_oc[9] = widma - (inframe+alfram1)/2;
180 par_oc[10] = 0.;
181 pMC->Gsvolu("UTCO", "TRAP", idtmed[1306], par_oc, 11);
182 // --- The inner part of the outer chambers (Air)
183 par_oc[3] -= ccframe;
184 par_oc[4] -= ccframe;
185 par_oc[5] -= ccframe;
186 par_oc[7] -= ccframe;
187 par_oc[8] -= ccframe;
188 par_oc[9] -= ccframe;
189 pMC->Gsvolu("UTIO", "TRAP", idtmed[1301], par_oc, 11);
190 // --- Definition of the six modules within each outer chamber
191 pMC->Gsdvn("UTMO", "UTIO", nmodul, 3);
192 // --- Definition of the layers of each outer chamber
193 par_oc[1] = theoc;
194 par_oc[2] = 90.;
195 par_oc[3] = -1.;
196 par_oc[4] = -1.;
197 par_oc[5] = -1.;
198 par_oc[6] = 0.;
199 par_oc[7] = -1.;
200 par_oc[8] = -1.;
201 par_oc[9] = -1.;
202 par_oc[10] = 0.;
203 // --- Radiator layer
204 par_oc[0] = rathick/2;
205 pMC->Gsvolu("UT1O", "TRAP", idtmed[1311], par_oc, 11);
206 // --- Polyethylene layer
207 par_oc[0] = pethick/2;
208 pMC->Gsvolu("UT2O", "TRAP", idtmed[1302], par_oc, 11);
209 // --- Mylar layer
210 par_oc[0] = mythick/2;
211 pMC->Gsvolu("UT3O", "TRAP", idtmed[1307], par_oc, 11);
212 // --- Xe/CO2 layer
213 par_oc[0] = xethick/2;
214 pMC->Gsvolu("UT4O", "TRAP", idtmed[1308], par_oc, 11);
215 // --- Cu layer
216 par_oc[0] = cuthick/2;
217 pMC->Gsvolu("UT5O", "TRAP", idtmed[1304], par_oc, 11);
218 // --- Kapton layer
219 par_oc[0] = kathick/2;
220 pMC->Gsvolu("UT6O", "TRAP", idtmed[1310], par_oc, 11);
221 // --- NOMEX layer
222 par_oc[0] = nothick/2;
223 pMC->Gsvolu("UT7O", "TRAP", idtmed[1309], par_oc, 11);
224 // --- Read out layer
225 par_oc[0] = rothick/2;
226 pMC->Gsvolu("UT8O", "TRAP", idtmed[1305], par_oc, 11);
227 // --- The carbon frame of the chambers in the short sectors
228 par_oc[0] = (rmax-rmin)/2;
229 par_oc[1] = theoc;
230 par_oc[2] = 90.;
231 par_oc[3] = zmax2/2 - zmax1/4 -alfram2/2;
232 par_oc[4] = widmi - (inframe+alfram1)/2;
233 par_oc[5] = widmi - (inframe+alfram1)/2;
234 par_oc[6] = 0.;
235 par_oc[7] = zmax1/4 - alfram2/2;
236 par_oc[8] = widma - (inframe+alfram1)/2;
237 par_oc[9] = widma - (inframe+alfram1)/2;
238 par_oc[10] = 0.;
239 pMC->Gsvolu("UTCS", "TRAP", idtmed[1306], par_oc, 11);
240 // --- The inner part of the chambers in the short sectors (Air)
241 par_oc[3] -= ccframe;
242 par_oc[4] -= ccframe;
243 par_oc[5] -= ccframe;
244 par_oc[7] -= ccframe;
245 par_oc[8] -= ccframe;
246 par_oc[9] -= ccframe;
247 pMC->Gsvolu("UTIS", "TRAP", idtmed[1301], par_oc, 11);
248 //--- Definition of the six modules within each chamber of the short sectors
249 pMC->Gsdvn("UTMS", "UTIS", 6, 3);
250 // --- Definition of the layers of each chamber in the short sectors
251 par_oc[1] = theoc;
252 par_oc[2] = 90.;
253 par_oc[3] = -1.;
254 par_oc[4] = -1.;
255 par_oc[5] = -1.;
256 par_oc[6] = 0.;
257 par_oc[7] = -1.;
258 par_oc[8] = -1.;
259 par_oc[9] = -1.;
260 par_oc[10] = 0.;
261 // --- Radiator layer
262 par_oc[0] = rathick/2;
263 pMC->Gsvolu("UT1S", "TRAP", idtmed[1311], par_oc, 11);
264 // --- Polyethylene layer
265 par_oc[0] = pethick/2;
266 pMC->Gsvolu("UT2S", "TRAP", idtmed[1302], par_oc, 11);
267 // --- Mylar layer
268 par_oc[0] = mythick/2;
269 pMC->Gsvolu("UT3S", "TRAP", idtmed[1307], par_oc, 11);
270 // --- Xe/CO2 layer
271 par_oc[0] = xethick/2;
272 pMC->Gsvolu("UT4S", "TRAP", idtmed[1308], par_oc, 11);
273 // --- Cu layer
274 par_oc[0] = cuthick/2;
275 pMC->Gsvolu("UT5S", "TRAP", idtmed[1304], par_oc, 11);
276 // --- Kapton layer
277 par_oc[0] = kathick/2;
278 pMC->Gsvolu("UT6S", "TRAP", idtmed[1310], par_oc, 11);
279 // --- NOMEX layer
280 par_oc[0] = nothick/2;
281 pMC->Gsvolu("UT7S", "TRAP", idtmed[1309], par_oc, 11);
282 // --- Read out layer
283 par_oc[0] = rothick/2;
284 pMC->Gsvolu("UT8S", "TRAP", idtmed[1305], par_oc, 11);
285 // --- The carbon frame of the inner chambers
286 par_ic[0] = widmi - (inframe+alfram1)/2;
287 par_ic[1] = widma - (inframe+alfram1)/2;
288 par_ic[2] = zmax1/4 - alfram2/2;
289 par_ic[3] = (rmax-rmin)/2;
290 pMC->Gsvolu("UTCI", "TRD1", idtmed[1306], par_ic, 4);
291 // --- The inner part of the inner chambers (Air)
292 par_ic[0] -= ccframe;
293 par_ic[1] -= ccframe;
294 par_ic[2] -= ccframe;
295 pMC->Gsvolu("UTII", "TRD1", idtmed[1301], par_ic, 4);
296 // --- Definition of the six modules within each outer chamber
297 pMC->Gsdvn("UTMI", "UTII", nmodul, 3);
298 // --- Definition of the layers of each inner chamber
299 par_ic[0] = -1.;
300 par_ic[1] = -1.;
301 par_ic[2] = -1.;
302 // --- Radiator layer
303 par_ic[3] = rathick/2;
304 pMC->Gsvolu("UT1I", "TRD1", idtmed[1311], par_ic, 4);
305 // --- Polyethylene layer
306 par_ic[3] = pethick/2;
307 pMC->Gsvolu("UT2I", "TRD1", idtmed[1302], par_ic, 4);
308 // --- Mylar layer
309 par_ic[3] = mythick/2;
310 pMC->Gsvolu("UT3I", "TRD1", idtmed[1307], par_ic, 4);
311 // --- Xe/CO2 layer
312 par_ic[3] = xethick/2;
313 pMC->Gsvolu("UT4I", "TRD1", idtmed[1308], par_ic, 4);
314 // --- Cu layer
315 par_ic[3] = cuthick/2;
316 pMC->Gsvolu("UT5I", "TRD1", idtmed[1304], par_ic, 4);
317 // --- Kapton layer
318 par_ic[3] = kathick/2;
319 pMC->Gsvolu("UT6I", "TRD1", idtmed[1310], par_ic, 4);
320 // --- NOMEX layer
321 par_ic[3] = nothick/2;
322 pMC->Gsvolu("UT7I", "TRD1", idtmed[1309], par_ic, 4);
323 // --- Read out layer
324 par_ic[3] = rothick/2;
325 pMC->Gsvolu("UT8I", "TRD1", idtmed[1305], par_ic, 4);
326 //************************************************************************
327
328 // Positioning of Volumes
329
330 //************************************************************************
331 // --- The rotation matrices
332 AliMatrix(idmat[0], 90., 180., 90., 90., 0., 0.);
333 AliMatrix(idmat[1], 90., 0., 90., 90., 180., 0.);
334 AliMatrix(idmat[2], 90., 180., 90., 90., 180., 0.);
335 AliMatrix(idmat[3], 90., 90., 180., 0., 90., 0.);
336 AliMatrix(idmat[4], 90., 90., 0., 0., 90., 0.);
337 // --- Position of the layers in a TRD module
338 f = TMath::Tan(theoc * kDegrad);
339 pMC->Gspos("UT8O", 1, "UTMO", 0., f*rozpos, rozpos, 0, "ONLY");
340 pMC->Gspos("UT7O", 1, "UTMO", 0., f*nozpos, nozpos, 0, "ONLY");
341 pMC->Gspos("UT6O", 1, "UTMO", 0., f*kazpos, kazpos, 0, "ONLY");
342 pMC->Gspos("UT5O", 1, "UTMO", 0., f*cuzpos, cuzpos, 0, "ONLY");
343 pMC->Gspos("UT4O", 1, "UTMO", 0., f*xezpos, xezpos, 0, "ONLY");
344 pMC->Gspos("UT3O", 1, "UTMO", 0., f*myzpos, myzpos, 0, "ONLY");
345 pMC->Gspos("UT1O", 1, "UTMO", 0., f*razpos, razpos, 0, "ONLY");
346 pMC->Gspos("UT2O", 1, "UT1O", 0., f*pezpos, pezpos, 0, "ONLY");
347
348 pMC->Gspos("UT8S", 1, "UTMS", 0., f*rozpos, rozpos, 0, "ONLY");
349 pMC->Gspos("UT7S", 1, "UTMS", 0., f*nozpos, nozpos, 0, "ONLY");
350 pMC->Gspos("UT6S", 1, "UTMS", 0., f*kazpos, kazpos, 0, "ONLY");
351 pMC->Gspos("UT5S", 1, "UTMS", 0., f*cuzpos, cuzpos, 0, "ONLY");
352 pMC->Gspos("UT4S", 1, "UTMS", 0., f*xezpos, xezpos, 0, "ONLY");
353 pMC->Gspos("UT3S", 1, "UTMS", 0., f*myzpos, myzpos, 0, "ONLY");
354 pMC->Gspos("UT1S", 1, "UTMS", 0., f*razpos, razpos, 0, "ONLY");
355 pMC->Gspos("UT2S", 1, "UT1S", 0., f*pezpos, pezpos, 0, "ONLY");
356
357 pMC->Gspos("UT8I", 1, "UTMI", 0., 0., rozpos, 0, "ONLY");
358 pMC->Gspos("UT7I", 1, "UTMI", 0., 0., nozpos, 0, "ONLY");
359 pMC->Gspos("UT6I", 1, "UTMI", 0., 0., kazpos, 0, "ONLY");
360 pMC->Gspos("UT5I", 1, "UTMI", 0., 0., cuzpos, 0, "ONLY");
361 pMC->Gspos("UT4I", 1, "UTMI", 0., 0., xezpos, 0, "ONLY");
362 pMC->Gspos("UT3I", 1, "UTMI", 0., 0., myzpos, 0, "ONLY");
363 pMC->Gspos("UT1I", 1, "UTMI", 0., 0., razpos, 0, "ONLY");
364 pMC->Gspos("UT2I", 1, "UT1I", 0., 0., pezpos, 0, "ONLY");
365 // --- Position of the inner part of the chambers
366 pMC->Gspos("UTII", 1, "UTCI", 0., 0., 0., 0, "ONLY");
367 pMC->Gspos("UTIO", 1, "UTCO", 0., 0., 0., 0, "ONLY");
368 pMC->Gspos("UTIS", 1, "UTCS", 0., 0., 0., 0, "ONLY");
369 // --- Position of the chambers in the support frame
370 xpos = 0.;
371 ypos = (zmax1-zmax2)/4;
372 zpos = 0.;
373 pMC->Gspos("UTCO", 1, "UTFO", xpos, ypos, zpos, 0, "ONLY");
374 xpos = 0.;
375 ypos = (zmax1-zmax2)/4;
376 zpos = 0.;
377 pMC->Gspos("UTCS", 1, "UTFS", xpos, ypos, zpos, 0, "ONLY");
378 xpos = 0.;
379 ypos = 0.;
380 zpos = 0.;
381 pMC->Gspos("UTCI", 1, "UTFI", xpos, ypos, zpos, 0, "ONLY");
382 // --- Position of the inner part of the frame in the sectors
383 xpos = (rmax+rmin)/2;
384 ypos = 0;
385 zpos = -zmax1*3/4;
386 pMC->Gspos("UTFO", 1, "UTSL", xpos, ypos, zpos, idmat[4], "ONLY");
387 xpos = (rmax+rmin)/2;
388 ypos = 0;
389 zpos = -zmax1*3/4;
390 pMC->Gspos("UTFS", 1, "UTSS", xpos, ypos, zpos, idmat[4], "ONLY");
391 xpos = (rmax+rmin)/2;
392 ypos = 0.;
393 zpos = -zmax1/4;
394 pMC->Gspos("UTFI", 1, "UTSL", xpos, ypos, zpos, idmat[4], "ONLY");
395 // --- Position of the subdetectors in the mother volume
396 pMC->Gspos("UTRL", 1, "TRD ", 0., 0., 0., 0, "ONLY");
397 pMC->Gspos("UTRL", 2, "TRD ", 0., 0., 0., idmat[0], "ONLY");
398 pMC->Gspos("UTRL", 3, "TRD ", 0., 0., 0., idmat[1], "ONLY");
399 pMC->Gspos("UTRL", 4, "TRD ", 0., 0., 0., idmat[2], "ONLY");
400 pMC->Gspos("UTRS", 1, "TRD ", 0., 0., 0., 0, "ONLY");
401 pMC->Gspos("UTRS", 2, "TRD ", 0., 0., 0., idmat[1], "ONLY");
402 // --- Position of TRD mother volume in ALICE experiment
403 pMC->Gspos("TRD ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
404}
405
406//_____________________________________________________________________________
407void AliTRDv1::DrawDetector()
408{
409 //
410 // Draw a shaded view of the Transition Radiation Detector version 1
411 //
412
413 AliMC* pMC = AliMC::GetMC();
414
415 // Set everything unseen
416 pMC->Gsatt("*", "seen", -1);
417 //
418 // Set ALIC mother transparent
419 pMC->Gsatt("ALIC","SEEN",0);
420 //
421 // Set the volumes visible
422 pMC->Gsatt("TRD","SEEN",0);
423 pMC->Gsatt("UTRL","SEEN",0);
424 pMC->Gsatt("UTSL","SEEN",0);
425 pMC->Gsatt("UTRS","SEEN",0);
426 pMC->Gsatt("UTSS","SEEN",0);
427 pMC->Gsatt("UTFI","SEEN",0);
428 pMC->Gsatt("UTFO","SEEN",0);
429 pMC->Gsatt("UTFS","SEEN",0);
430 pMC->Gsatt("UTCO","SEEN",0);
431 pMC->Gsatt("UTIO","SEEN",0);
432 pMC->Gsatt("UTMO","SEEN",0);
433 pMC->Gsatt("UT1O","SEEN",1);
434 pMC->Gsatt("UT4O","SEEN",1);
435 pMC->Gsatt("UTCS","SEEN",0);
436 pMC->Gsatt("UTIS","SEEN",0);
437 pMC->Gsatt("UTMS","SEEN",0);
438 pMC->Gsatt("UT1S","SEEN",1);
439 pMC->Gsatt("UT4S","SEEN",1);
440 pMC->Gsatt("UTCI","SEEN",0);
441 pMC->Gsatt("UTII","SEEN",0);
442 pMC->Gsatt("UTMI","SEEN",0);
443 pMC->Gsatt("UT1I","SEEN",1);
444 pMC->Gsatt("UT4I","SEEN",1);
445 //
446 pMC->Gdopt("hide", "on");
447 pMC->Gdopt("shad", "on");
448 pMC->Gsatt("*", "fill", 7);
449 pMC->SetClipBox(".");
450 pMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
451 pMC->DefaultRange();
452 pMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
453 pMC->Gdhead(1111, "Transition Radiation Detector Version 1");
454 pMC->Gdman(18, 4, "MAN");
455}
456
457//_____________________________________________________________________________
458void AliTRDv1::CreateMaterials()
459{
460 //
461 // Create materials for the Transition Radiation Detector version 1
462 //
463 printf("TRD: Fast simulation with coarse geometry\n");
464 AliTRD::CreateMaterials();
465}
466
467//_____________________________________________________________________________
468void AliTRDv1::Init()
469{
470 //
471 // Initialise the Transition Radiation Detector after the geometry is built
472 //
473 AliTRD::Init();
474 AliMC* pMC = AliMC::GetMC();
475 fIdSens1 = pMC->VolId("UT5I");
476 fIdSens2 = pMC->VolId("UT5O");
477 fIdSens3 = pMC->VolId("UT5S");
478}
479
480//_____________________________________________________________________________
481void AliTRDv1::StepManager()
482{
483 //
484 // Called at every step in the Transition Radiation Detector
485 //
486 Int_t vol[3];
487 Int_t icopy1, icopy5, icopy6, idSens, icSens;
488
489 Float_t hits[4];
490
491 TClonesArray &lhits = *fHits;
492
493 AliMC* pMC = AliMC::GetMC();
494
495 // Use only charged tracks and count them only once per volume
496 if(pMC->TrackCharge() && pMC->TrackEntering()) {
497
498 // Check on sensitive volume
499 idSens = pMC->CurrentVol(0,icSens);
500
501 // Long sectors
502 if ((idSens == fIdSens1) || (idSens == fIdSens2)) {
503
504 pMC->CurrentVolOff(1,0,icopy1);
505 pMC->CurrentVolOff(5,0,icopy5);
506 pMC->CurrentVolOff(6,0,icopy6);
507
508 // The sector number
509 if ((icopy6 == 1) || (icopy6 == 3))
510 vol[0] = icopy5;
511 else
512 vol[0] = 16 - icopy5;
513
514 // The chamber number
515 if (idSens == fIdSens2) {
516 if (icopy6 < 3)
517 vol[1] = 4;
518 else
519 vol[1] = 1;
520 }
521 else {
522 if (icopy6 < 3)
523 vol[1] = 3;
524 else
525 vol[1] = 2;
526 }
527
528 // The plane number
529 vol[2] = icopy1;
530
531 pMC->TrackPosition(hits);
532 hits[3] = 0;
533
534 new(lhits[fNhits++]) AliTRDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
535
536 }
537 // Short sectors
538 else if (idSens == fIdSens3) {
539
540 pMC->CurrentVolOff(1,0,icopy1);
541 pMC->CurrentVolOff(5,0,icopy5);
542 pMC->CurrentVolOff(6,0,icopy6);
543
544 // The sector number
545 vol[0] = icopy5 + 5;
546
547 // The chamber number
548 if (icopy6 == 1)
549 vol[1] = 4;
550 else
551 vol[1] = 1;
552
553 // The plane number
554 vol[2] = icopy1;
555
556 pMC->TrackPosition(hits);
557 hits[3] = 0;
558
559 new(lhits[fNhits++]) AliTRDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
560
561 }
562 }
563}