]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv1.cxx
Introduction of the Copyright and cvs Log
[u/mrichter/AliRoot.git] / ITS / AliITSv1.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 */
19
20 ///////////////////////////////////////////////////////////////////////////////
21 //                                                                           //
22 //  Inner Traking System version 1                                           //
23 //  This class contains the base procedures for the Inner Tracking System    //
24 //                                                                           //
25 // Authors: R. Barbera, A. Morsch.
26 // version 1.
27 // Created  1998.
28 //
29 //  NOTE: THIS IS THE COARSE pre.TDR geometry of the ITS. THIS WILL NOT WORK
30 // with the geometry or module classes or any analysis classes. You are 
31 // strongly encouraged to uses AliITSv5.
32 //                                                                           //
33 ///////////////////////////////////////////////////////////////////////////////
34  
35 #include <TMath.h>
36 #include <TRandom.h>
37 #include <TVector.h>
38 #include "AliITShit.h"
39 #include "AliITSv1.h"
40 #include "AliRun.h"
41
42 #include "AliMC.h"
43 #include "AliConst.h"
44
45 ClassImp(AliITSv1)
46  
47 //_____________________________________________________________________________
48 AliITSv1::AliITSv1() : AliITS() 
49 {
50   //
51   // Default constructor for the ITS
52   //
53 }
54  
55 //_____________________________________________________________________________
56 AliITSv1::AliITSv1(const char *name, const char *title)
57   : AliITS(name, title)
58
59   //
60   // Standard constructor for the ITS
61   //
62 }
63  
64 //_____________________________________________________________________________
65 void AliITSv1::CreateGeometry()
66 {
67   //
68   // Create geometry for version 1 of the ITS
69   //
70   //
71   // Create Geometry for ITS version 0
72   //
73   //
74   
75
76   
77   Float_t drcer[6] = { 0.,0.,.08,.08,0.,0. };           //CERAMICS THICKNESS
78   Float_t drepx[6] = { 0.,0.,0.,0.,.5357,.5357 };       //EPOXY THICKNESS
79   Float_t drpla[6] = { 0.,0.,0.,0.,.1786,.1786 };       //PLASTIC THICKNESS
80   Float_t dzb[6]   = { 0.,0.,15.,15.,4.,4. };           //LENGTH OF BOXES
81   Float_t dphi[6]  = { 72.,72.,72.,72.,50.6,45. };      //COVERED PHI-RANGE FOR LAYERS 1-6
82   Float_t rl[6]    = { 3.9,7.6,14.,24.,40.,45. };       //SILICON LAYERS INNER RADIUS
83   Float_t drl[6]   = { .755,.755,.809,.809,.7,.7 };     //THICKNESS OF LAYERS (in % radiation length)
84   Float_t dzl[6]   = { 12.67,16.91,20.85,29.15,45.11,50.975 };//HALF LENGTH OF LAYERS
85   Float_t drpcb[6] = { 0.,0.,.06,.06,0.,0. };           //PCB THICKNESS
86   Float_t drcu[6]  = { 0.,0.,.0504,.0504,.0357,.0357 }; //COPPER THICKNESS
87   Float_t drsi[6]  = { 0.,0.,.006,.006,.3571,.3571 };   //SILICON THICKNESS
88
89   Float_t drca = 0, dzfc;
90   Int_t i, nsec;
91   Float_t rend, drca_tpc, dzco, zend, dits[3], rlim, drsu, zmax;
92   Float_t zpos, dzco1, dzco2;
93   Float_t drcac[6], acone, dphii;
94   Float_t pcits[15], xltpc;
95   Float_t rzcone, rstep, r0, z0, acable, fp, dz, zi, ri;
96   Int_t idrotm[399];
97   Float_t dgh[15];
98   
99   Int_t *idtmed = fIdtmed->GetArray()-199;
100   
101   //     CONVERT INTO CM (RL(SI)=9.36 CM) 
102   for (i = 0; i < 6; ++i) {
103     drl[i] = drl[i] / 100. * 9.36;
104   }
105   
106   //     SUPPORT ENDPLANE THICKNESS 
107   drsu = 2.*0.06+1./20;  // 1./20. is 1 cm of honeycomb (1/20 carbon density);
108   
109   //     CONE BELOW TPC 
110   
111   drca_tpc = 1.2/4.;
112   
113   //     CABLE THICKNESS (CONICAL CABLES CONNECTING THE LAYERS) 
114
115   
116   //     ITS CONE ANGLE 
117   
118   acone  = 45.;
119   acone *= kDegrad;
120   
121   //     CONE RADIUS AT 1ST LAYER 
122   
123   rzcone = 30.;
124   
125   //     FIELD CAGE HALF LENGTH 
126   
127   dzfc  = 64.5;
128   rlim  = 48.;
129   zmax  = 80.;
130   xltpc = 275.;
131   
132   
133   //     PARAMETERS FOR SMALL (1/2) ITS 
134
135   for (i = 0; i < 6; ++i) {
136     dzl[i] /= 2.;
137     dzb[i] /= 2.;
138   }
139   drca     /= 2.;
140   acone    /= 2.;
141   drca_tpc /= 2.;
142   rzcone   /= 2.;
143   dzfc     /= 2.;
144   zmax     /= 2.;
145   xltpc    /= 2.;
146   acable    = 15.;
147   
148   
149   
150   //     EQUAL DISTRIBUTION INTO THE 6 LAYERS 
151   rstep = drca_tpc / 6.;
152   for (i = 0; i < 6; ++i) {
153     drcac[i] = (i+1) * rstep;
154   }
155
156   //     NUMBER OF PHI SECTORS 
157   
158   nsec = 5;
159   
160   //     PACK IN PHI AS MUCH AS POSSIBLE 
161   //     NOW PACK USING THICKNESS 
162   
163   for (i = 0; i < 6; ++i) {
164     
165 //     PACKING FACTOR 
166     fp = rl[5] / rl[i];
167     
168     //      PHI-PACKING NOT SUFFICIENT ? 
169     
170     if (dphi[i]/45 < fp) {
171       drcac[i] = drcac[i] * fp * 45/dphi[i];
172     }
173   }
174   
175   
176   // --- Define ghost volume containing the six layers and fill it with air 
177   
178   dgh[0] = 3.5;
179   dgh[1] = 50.;
180   dgh[2] = zmax;
181   gMC->Gsvolu("ITSV", "TUBE", idtmed[275], dgh, 3);
182   
183   // --- Place the ghost volume in its mother volume (ALIC) and make it 
184   //     invisible 
185   
186   gMC->Gspos("ITSV", 1, "ALIC", 0., 0., 0., 0, "ONLY");
187   gMC->Gsatt("ITSV", "SEEN", 0);
188   
189   //     ITS LAYERS (SILICON) 
190   
191   dits[0] = rl[0];
192   dits[1] = rl[0] + drl[0];
193   dits[2] = dzl[0];
194   gMC->Gsvolu("ITS1", "TUBE", idtmed[199], dits, 3);
195   gMC->Gspos("ITS1", 1, "ITSV", 0., 0., 0., 0, "ONLY");
196   
197   dits[0] = rl[1];
198   dits[1] = rl[1] + drl[1];
199   dits[2] = dzl[1];
200   gMC->Gsvolu("ITS2", "TUBE", idtmed[199], dits, 3);
201   gMC->Gspos("ITS2", 1, "ITSV", 0., 0., 0., 0, "ONLY");
202   
203   dits[0] = rl[2];
204   dits[1] = rl[2] + drl[2];
205   dits[2] = dzl[2];
206   gMC->Gsvolu("ITS3", "TUBE", idtmed[224], dits, 3);
207   gMC->Gspos("ITS3", 1, "ITSV", 0., 0., 0., 0, "ONLY");
208   
209   dits[0] = rl[3];
210   dits[1] = rl[3] + drl[3];
211   dits[2] = dzl[3];
212   gMC->Gsvolu("ITS4", "TUBE", idtmed[224], dits, 3);
213   gMC->Gspos("ITS4", 1, "ITSV", 0., 0., 0., 0, "ONLY");
214   
215   dits[0] = rl[4];
216   dits[1] = rl[4] + drl[4];
217   dits[2] = dzl[4];
218   gMC->Gsvolu("ITS5", "TUBE", idtmed[249], dits, 3);
219   gMC->Gspos("ITS5", 1, "ITSV", 0., 0., 0., 0, "ONLY");
220   
221   dits[0] = rl[5];
222   dits[1] = rl[5] + drl[5];
223   dits[2] = dzl[5];
224   gMC->Gsvolu("ITS6", "TUBE", idtmed[249], dits, 3);
225   gMC->Gspos("ITS6", 1, "ITSV", 0., 0., 0., 0, "ONLY");
226   
227   //    ELECTRONICS BOXES 
228   
229   //     PCB (layer #3 and #4) 
230   
231   gMC->Gsvolu("IPCB", "TUBE", idtmed[233], dits, 0);
232   for (i = 2; i < 4; ++i) {
233     dits[0] = rl[i];
234     dits[1] = dits[0] + drpcb[i];
235     dits[2] = dzb[i] / 2.;
236     zpos = dzl[i] + dits[2];
237     gMC->Gsposp("IPCB", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
238     gMC->Gsposp("IPCB", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
239   }
240   
241   //     COPPER (layer #3 and #4) 
242   
243   gMC->Gsvolu("ICO2", "TUBE", idtmed[234], dits, 0);
244   for (i = 2; i < 4; ++i) {
245     dits[0] = rl[i] + drpcb[i];
246     dits[1] = dits[0] + drcu[i];
247     dits[2] = dzb[i] / 2.;
248     zpos = dzl[i] + dits[2];
249     gMC->Gsposp("ICO2", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
250     gMC->Gsposp("ICO2", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
251   }
252   
253   //     CERAMICS (layer #3 and #4) 
254   
255   gMC->Gsvolu("ICER", "TUBE", idtmed[235], dits, 0);
256   for (i = 2; i < 4; ++i) {
257     dits[0] = rl[i] + drpcb[i] + drcu[i];
258     dits[1] = dits[0] + drcer[i];
259     dits[2] = dzb[i] / 2.;
260     zpos = dzl[i] + dits[2];
261     gMC->Gsposp("ICER", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
262     gMC->Gsposp("ICER", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
263   }
264   
265   //     SILICON (layer #3 and #4) 
266   
267   gMC->Gsvolu("ISI2", "TUBE", idtmed[226], dits, 0);
268   for (i = 2; i < 4; ++i) {
269     dits[0] = rl[i] + drpcb[i] + drcu[i] + drcer[i];
270     dits[1] = dits[0] + drsi[i];
271     dits[2] = dzb[i] / 2.;
272     zpos = dzl[i] + dits[2];
273     gMC->Gsposp("ISI2", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
274     gMC->Gsposp("ISI2", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
275   }
276   
277   //     PLASTIC (G10FR4) (layer #5 and #6) 
278   
279   gMC->Gsvolu("IPLA", "TUBE", idtmed[262], dits, 0);
280   for (i = 4; i < 6; ++i) {
281     dits[0] = rl[i];
282     dits[1] = dits[0] + drpla[i];
283     dits[2] = dzb[i] / 2.;
284     zpos = dzl[i] + dits[2];
285     gMC->Gsposp("IPLA", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
286     gMC->Gsposp("IPLA", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
287   }
288   
289   //     COPPER (layer #5 and #6) 
290   
291   gMC->Gsvolu("ICO3", "TUBE", idtmed[259], dits, 0);
292   for (i = 4; i < 6; ++i) {
293     dits[0] = rl[i] + drpla[i];
294     dits[1] = dits[0] + drcu[i];
295     dits[2] = dzb[i] / 2.;
296     zpos = dzl[i] + dits[2];
297     gMC->Gsposp("ICO3", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
298     gMC->Gsposp("ICO3", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
299   }
300   
301   //     EPOXY (layer #5 and #6) 
302   
303   gMC->Gsvolu("IEPX", "TUBE", idtmed[262], dits, 0);
304   for (i = 4; i < 6; ++i) {
305     dits[0] = rl[i] + drpla[i] + drcu[i];
306     dits[1] = dits[0] + drepx[i];
307     dits[2] = dzb[i] / 2.;
308     zpos = dzl[i] + dits[2];
309     gMC->Gsposp("IEPX", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
310     gMC->Gsposp("IEPX", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
311   }
312   
313   //     SILICON (layer #5 and #6) 
314   
315   gMC->Gsvolu("ISI3", "TUBE", idtmed[251], dits, 0);
316   for (i = 4; i < 6; ++i) {
317     dits[0] = rl[i] + drpla[i] + drcu[i] + drepx[i];
318     dits[1] = dits[0] + drsi[i];
319     dits[2] = dzb[i] / 2.;
320     zpos = dzl[i] + dits[2];
321     gMC->Gsposp("ISI3", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
322     gMC->Gsposp("ISI3", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
323   }
324   
325   //    SUPPORT 
326   
327   gMC->Gsvolu("ISUP", "TUBE", idtmed[274], dits, 0);
328   for (i = 0; i < 6; ++i) {
329     dits[0] = rl[i];
330     if (i < 5) dits[1] = rl[i];
331     else       dits[1] = rlim;
332     dits[2] = drsu / 2.;
333     zpos = dzl[i] + dzb[i] + dits[2];
334     gMC->Gsposp("ISUP", i+1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
335     gMC->Gsposp("ISUP", i+7, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
336   }
337   
338   // CABLES (HORIZONTAL) 
339   
340   gMC->Gsvolu("ICHO", "TUBE", idtmed[278], dits, 0);
341   for (i = 0; i < 6; ++i) {
342     dits[0] = rl[i];
343     dits[1] = dits[0] + drca;
344     dits[2] = (rzcone + TMath::Tan(acone) * (rl[i] - rl[0]) - (dzl[i]+ dzb[i] + drsu)) / 2.;
345     zpos = dzl[i - 1] + dzb[i] + drsu + dits[2];
346     gMC->Gsposp("ICHO", i+1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
347     gMC->Gsposp("ICHO", i+7, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
348   }
349   //    DEFINE A CONICAL GHOST VOLUME FOR THE PHI SEGMENTATION 
350   pcits[0] = 0.;
351   pcits[1] = 360.;
352   pcits[2] = 2.;
353   pcits[3] = rzcone;
354   pcits[4] = 3.5;
355   pcits[5] = rl[0];
356   pcits[6] = pcits[3] + TMath::Tan(acone) * (rlim - rl[0]);
357   pcits[7] = rlim - rl[0] + 3.5;
358   pcits[8] = rlim;
359   gMC->Gsvolu("ICMO", "PCON", idtmed[275], pcits, 9);
360   AliMatrix(idrotm[200], 90., 0., 90., 90., 180., 0.);
361   gMC->Gspos("ICMO", 1, "ITSV", 0., 0., 0., 0, "ONLY");
362   gMC->Gspos("ICMO", 2, "ITSV", 0., 0., 0., idrotm[200], "ONLY");
363   
364   //     DIVIDE INTO NSEC PHI-SECTIONS 
365   
366   gMC->Gsdvn("ICMD", "ICMO", nsec, 2);
367   gMC->Gsatt("ICMO", "SEEN", 0);
368   gMC->Gsatt("ICMD", "SEEN", 0);
369   
370   //     CONICAL CABLES 
371   
372   pcits[2] = 2.;
373   gMC->Gsvolu("ICCO", "PCON", idtmed[278], pcits, 0);
374   for (i = 1; i < 6; ++i) {
375     pcits[0] = -dphi[i] / 2.;
376     pcits[1] = dphi[i];
377     if (i < 5) {
378       dzco = TMath::Tan(acone) * (rl[i+1] - rl[i]);
379     } else {
380       dzco1 = zmax - (rzcone + TMath::Tan(acone) * (rl[5] - rl[0])) -2.;
381       dzco2 = (rlim - rl[5]) * TMath::Tan(acone);
382       if (rl[5] + dzco1 / TMath::Tan(acone) < rlim) {
383         dzco = dzco1;
384       } else {
385         dzco = dzco2;
386       }
387     }
388     pcits[3] = rzcone + TMath::Tan(acone) * (rl[i] - rl[0]);
389     pcits[4] = rl[i] - drcac[i] / TMath::Sin(acone);
390     pcits[5] = rl[i];
391     pcits[6] = pcits[3] + dzco;
392     pcits[7] = rl[i] + dzco / TMath::Tan(acone) - drcac[i] / TMath::Sin(acone);
393     pcits[8] = rl[i] + dzco / TMath::Tan(acone);
394     
395     gMC->Gsposp("ICCO", i, "ICMD", 0., 0., 0., 0, "ONLY", pcits, 9);
396     
397   }
398   zend = pcits[6];
399   rend = pcits[8];
400   
401   //  CONICAL CABLES BELOW TPC 
402   
403   //    DEFINE A CONICAL GHOST VOLUME FOR THE PHI SEGMENTATION 
404   pcits[0] = 0.;
405   pcits[1] = 360.;
406   pcits[2] = 2.;
407   pcits[3] = zend;
408   pcits[5] = rend;
409   pcits[4] = pcits[5] - drca_tpc;
410   pcits[6] = xltpc;
411   pcits[8] = pcits[4] + (pcits[6] - pcits[3]) * TMath::Tan(acable * kDegrad);
412   pcits[7] = pcits[8] - drca_tpc;
413   AliMatrix(idrotm[200], 90., 0., 90., 90., 180., 0.);
414   gMC->Gsvolu("ICCM", "PCON", idtmed[275], pcits, 9);
415   gMC->Gspos("ICCM", 1, "ALIC", 0., 0., 0., 0, "ONLY");
416   gMC->Gspos("ICCM", 2, "ALIC", 0., 0., 0., idrotm[200], "ONLY");
417   gMC->Gsdvn("ITMD", "ICCM", nsec, 2);
418   gMC->Gsatt("ITMD", "SEEN", 0);
419   gMC->Gsatt("ICCM", "SEEN", 0);
420   
421   //     NOW PLACE SEGMENTS WITH DECREASING PHI SEGMENTS INTO THE 
422   //     GHOST-VOLUME 
423   
424   pcits[2] = 2.;
425   gMC->Gsvolu("ITTT", "PCON", idtmed[278], pcits, 0);
426   r0 = rend;
427   z0 = zend;
428   dz = (xltpc - zend) / 9.;
429   for (i = 0; i < 9; ++i) {
430     zi = z0 + i*dz + dz / 2.;
431     ri = r0 + (zi - z0) * TMath::Tan(acable * kDegrad);
432     dphii = dphi[5] * r0 / ri;
433     pcits[0] = -dphii / 2.;
434     pcits[1] = dphii;
435     pcits[3] = zi - dz / 2.;
436     pcits[5] = r0 + (pcits[3] - z0) * TMath::Tan(acable * kDegrad);
437     pcits[4] = pcits[5] - drca_tpc;
438     pcits[6] = zi + dz / 2.;
439     pcits[8] = r0 + (pcits[6] - z0) * TMath::Tan(acable * kDegrad);
440     pcits[7] = pcits[8] - drca_tpc;
441     
442     gMC->Gsposp("ITTT", i+1, "ITMD", 0., 0., 0., 0, "ONLY", pcits, 9);
443   }
444   
445   // --- Outputs the geometry tree in the EUCLID/CAD format 
446   
447   if (fEuclidOut) {
448     gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
449   }
450 }
451
452 //_____________________________________________________________________________
453 void AliITSv1::CreateMaterials()
454 {
455   //
456   // Create the materials for ITS
457   //
458   AliITS::CreateMaterials();
459 }
460
461 //_____________________________________________________________________________
462 void AliITSv1::Init()
463 {
464   //
465   // Initialise the ITS after it has been built
466   //
467   AliITS::Init();
468   fMajorVersion = 1;
469   fMinorVersion = 0;
470 }  
471  
472 //_____________________________________________________________________________
473 void AliITSv1::DrawModule()
474
475   //
476   // Draw a shaded view of the FMD version 1
477   //
478
479   
480   // Set everything unseen
481   gMC->Gsatt("*", "seen", -1);
482   // 
483   // Set ALIC mother visible
484   gMC->Gsatt("ALIC","SEEN",0);
485   //
486   // Set the volumes visible
487   gMC->Gsatt("ITSV","SEEN",0);
488   gMC->Gsatt("ITS1","SEEN",1);
489   gMC->Gsatt("ITS2","SEEN",1);
490   gMC->Gsatt("ITS3","SEEN",1);
491   gMC->Gsatt("ITS4","SEEN",1);
492   gMC->Gsatt("ITS5","SEEN",1);
493   gMC->Gsatt("ITS6","SEEN",1);
494
495   gMC->Gsatt("IPCB","SEEN",1);
496   gMC->Gsatt("ICO2","SEEN",1);
497   gMC->Gsatt("ICER","SEEN",0);
498   gMC->Gsatt("ISI2","SEEN",0);
499   gMC->Gsatt("IPLA","SEEN",0);
500   gMC->Gsatt("ICO3","SEEN",0);
501   gMC->Gsatt("IEPX","SEEN",0);
502   gMC->Gsatt("ISI3","SEEN",1);
503   gMC->Gsatt("ISUP","SEEN",0);
504   gMC->Gsatt("ICHO","SEEN",0);
505   gMC->Gsatt("ICMO","SEEN",0);
506   gMC->Gsatt("ICMD","SEEN",0);
507   gMC->Gsatt("ICCO","SEEN",1);
508   gMC->Gsatt("ICCM","SEEN",0);
509   gMC->Gsatt("ITMD","SEEN",0);
510   gMC->Gsatt("ITTT","SEEN",1);
511
512   //
513   gMC->Gdopt("hide", "on");
514   gMC->Gdopt("shad", "on");
515   gMC->Gsatt("*", "fill", 7);
516   gMC->SetClipBox(".");
517   gMC->SetClipBox("*", 0, 300, -300, 300, -300, 300);
518   gMC->DefaultRange();
519   gMC->Gdraw("alic", 40, 30, 0, 11, 10, .07, .07);
520   gMC->Gdhead(1111, "Inner Tracking System Version 1");
521   gMC->Gdman(17, 6, "MAN");
522 }
523
524 //_____________________________________________________________________________
525 void AliITSv1::StepManager()
526
527   //
528   // Called at every step in the ITS
529   //
530   Int_t         copy, id;
531   Float_t       hits[8];
532   Int_t         vol[4];
533   TLorentzVector position, momentum;
534   TClonesArray &lhits = *fHits;
535   //
536   // Track status
537   vol[3] = 0;
538   if(gMC->IsTrackInside())      vol[3] +=  1;
539   if(gMC->IsTrackEntering())    vol[3] +=  2;
540   if(gMC->IsTrackExiting())     vol[3] +=  4;
541   if(gMC->IsTrackOut())         vol[3] +=  8;
542   if(gMC->IsTrackDisappeared()) vol[3] += 16;
543   if(gMC->IsTrackStop())        vol[3] += 32;
544   if(gMC->IsTrackAlive())       vol[3] += 64;
545   //
546   // Fill hit structure.
547   if(gMC->TrackCharge() && gMC->Edep()) {
548     //
549     // Only entering charged tracks
550     if((id=gMC->CurrentVolID(copy))==fIdSens[0]) {  
551       vol[0]=1;
552       id=gMC->CurrentVolOffID(1,copy);      
553       vol[1]=copy;
554       id=gMC->CurrentVolOffID(2,copy);
555       vol[2]=copy;                       
556     } else if(id==fIdSens[1]) {
557       vol[0]=2;
558       id=gMC->CurrentVolOffID(1,copy);       
559       vol[1]=copy;
560       id=gMC->CurrentVolOffID(2,copy);
561       vol[2]=copy;                    
562     } else if(id==fIdSens[2]) {
563       vol[0]=3;
564       vol[1]=copy;
565       id=gMC->CurrentVolOffID(1,copy);
566       vol[2]=copy;             
567     } else if(id==fIdSens[3]) {
568       vol[0]=4;
569       vol[1]=copy;
570       id=gMC->CurrentVolOffID(1,copy);
571       vol[2]=copy;                  
572     } else if(id==fIdSens[4]) {
573       vol[0]=5;
574       vol[1]=copy;
575       id=gMC->CurrentVolOffID(1,copy);
576       vol[2]=copy;               
577     } else if(id==fIdSens[5]) {
578       vol[0]=6;
579       vol[1]=copy;
580       id=gMC->CurrentVolOffID(1,copy);
581       vol[2]=copy;                      
582     } else return;
583     gMC->TrackPosition(position);
584     gMC->TrackMomentum(momentum);
585     hits[0]=position[0];
586     hits[1]=position[1];
587     hits[2]=position[2];          
588     hits[3]=momentum[0];
589     hits[4]=momentum[1];
590     hits[5]=momentum[2];
591     hits[6]=gMC->Edep();
592     hits[7]=gMC->TrackTime();
593     new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
594   }      
595 }