New version for frame1099 with and without holes
[u/mrichter/AliRoot.git] / TOF / AliTOFv2.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 Revision 1.9  1999/09/29 09:24:33  fca
19 Introduction of the Copyright and cvs Log
20
21 */
22
23 ///////////////////////////////////////////////////////////////////////////////
24 //                                                                           //
25 //  Time Of Flight: design of C.Williams                FCA                  //
26 //  This class contains the functions for version 1 of the Time Of Flight    //
27 //  detector.                                                                //
28 //
29 //  VERSION WITH 5 MODULES AND TILTED STRIPS 
30 //  
31 //   WITH HOLES FOR PHOS AND HMPID 
32 //   INSIDE A FULL COVERAGE SPACE FRAME
33 //
34 //
35 //   Authors: 
36 //
37 //   Alessio Seganti
38 //   Domenico Vicinanza
39 //
40 //   University of Salerno - Italy
41 //
42 //
43 //
44 //Begin_Html
45 /*
46 <img src="picts/AliTOFv2Class.gif">
47 */
48 //End_Html
49 //                                                                           //
50 ///////////////////////////////////////////////////////////////////////////////
51
52 #include "AliTOFv2.h"
53 #include "AliRun.h"
54 #include "AliConst.h"
55  
56 ClassImp(AliTOFv2)
57  
58 //_____________________________________________________________________________
59 AliTOFv2::AliTOFv2()
60 {
61   //
62   // Default constructor
63   //
64 }
65  
66 //_____________________________________________________________________________
67 AliTOFv2::AliTOFv2(const char *name, const char *title)
68        : AliTOF(name,title)
69 {
70   //
71   // Standard constructor
72   //
73 }
74  
75 //_____________________________________________________________________________
76 void AliTOFv2::CreateGeometry()
77 {
78   //
79   // Create geometry for Time Of Flight version 0
80   //
81   //Begin_Html
82   /*
83     <img src="picts/AliTOFv2.gif">
84   */
85   //End_Html
86   //
87   // Creates common geometry
88   //
89   AliTOF::CreateGeometry();
90 }
91  
92 //_____________________________________________________________________________
93 void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
94                      Float_t zlen2, Float_t zlen3, Float_t ztof0)
95 {
96   //
97   // Definition of the Time Of Fligh Resistive Plate Chambers
98   // xFLT, yFLT, zFLT - sizes of TOF modules (large)
99   
100   Int_t idrotm[100];
101   Int_t nrot = 0;
102   Float_t  ycoor, zcoor;
103   Float_t par[10];
104   
105   Int_t *idtmed = fIdtmed->GetArray()-499;
106
107
108   par[0] =  xtof / 2.;
109   par[1] =  ytof / 2.;
110   par[2] = zlen1 / 2.;
111   gMC->Gsvolu("FTO1", "BOX ", idtmed[506], par, 3);
112   par[2] = zlen2 / 2.;
113   gMC->Gsvolu("FTO2", "BOX ", idtmed[506], par, 3);
114   par[2] = zlen3 / 2.;
115   gMC->Gsvolu("FTO3", "BOX ", idtmed[506], par, 3);
116
117
118 // Position of modules
119   Float_t zcor1 = ztof0 - zlen1/2;
120   Float_t zcor2 = ztof0 - zlen1 - zlen2/2.;
121   Float_t zcor3 = 0.;
122
123    AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
124    AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
125    gMC->Gspos("FTO1", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
126    gMC->Gspos("FTO1", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
127    gMC->Gspos("FTO1", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
128    gMC->Gspos("FTO1", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
129    gMC->Gspos("FTO1", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
130    gMC->Gspos("FTO1", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
131
132    gMC->Gspos("FTO2", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
133    gMC->Gspos("FTO2", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
134    gMC->Gspos("FTO2", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
135    gMC->Gspos("FTO2", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
136
137    gMC->Gspos("FTO3", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
138
139 // Subtraction the distance to TOF module boundaries 
140
141   Float_t db = 7.;
142   Float_t xFLT, yFLT, zFLT1, zFLT2, zFLT3; 
143
144   xFLT = xtof -(.5 +.5)*2;
145   yFLT = ytof;
146   zFLT1 = zlen1 - db;
147   zFLT2 = zlen2 - db;
148   zFLT3 = zlen3 - db;
149
150   
151 // Sizes of MRPC pads
152
153   Float_t yPad = 0.505; 
154   
155 // Large not sensitive volumes with CO2 
156   par[0] = xFLT/2;
157   par[1] = yFLT/2;
158
159   cout <<"************************* TOF geometry **************************"<<endl;
160
161   par[2] = (zFLT1 / 2.);
162   gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
163   gMC->Gspos("FLT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
164
165   par[2] = (zFLT2 / 2.);
166   gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
167   gMC->Gspos("FLT2", 0, "FTO2", 0., 0., 0., 0, "ONLY");
168
169   par[2] = (zFLT3 / 2.); 
170   gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
171   gMC->Gspos("FLT3", 0, "FTO3", 0., 0., 0., 0, "ONLY");
172
173 ////////// Layers before detector ////////////////////
174
175 // Alluminium layer in front 1.0 mm thick at the beginning
176   par[0] = -1;
177   par[1] = 0.1;
178   par[2] = -1;
179   ycoor = -yFLT/2 + par[1];
180   gMC->Gsvolu("FMY1", "BOX ", idtmed[508], par, 3); // Alluminium
181   gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
182   gMC->Gsvolu("FMY2", "BOX ", idtmed[508], par, 3); // Alluminium
183   gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
184   gMC->Gsvolu("FMY3", "BOX ", idtmed[508], par, 3); // Alluminium 
185   gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
186
187 // Honeycomb layer (1cm of special polyethilene)
188   ycoor = ycoor + par[1];
189   par[0] = -1;
190   par[1] = 0.5;
191   par[2] = -1;
192   ycoor = ycoor + par[1];
193   gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
194   gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
195   gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
196   gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
197   gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
198   gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
199
200 ///////////////// Detector itself //////////////////////
201
202   const Float_t StripWidth = 7.81;//cm
203   const Float_t DeadBound = 1.;//cm non-sensitive between the pad edge and the boundary of the strip
204   const Int_t nx = 40; // number of pads along x
205   const Int_t nz = 2;  // number of pads along z
206   const Float_t Gap=4.; //cm  distance between the strip axis
207   const Float_t Space = 5.5; //cm distance from the front plate of the box
208
209   Float_t zSenStrip;
210   zSenStrip = StripWidth-2*DeadBound;//cm
211
212   par[0] = -1;
213   par[1] = yPad/2; 
214   par[2] = StripWidth/2.;
215   
216   // Glass Layer of detector
217   gMC->Gsvolu("FSTR","BOX",idtmed[514],par,3);
218
219   // Freon for non-sesitive boundaries
220   par[0] = -1;
221   par[1] = 0.110/2;
222   par[2] = -1;
223   gMC->Gsvolu("FNSF","BOX",idtmed[512],par,3);
224   gMC->Gspos("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
225   // Mylar for non-sesitive boundaries
226   par[1] = 0.025;
227   gMC->Gsvolu("FMYI","BOX",idtmed[510],par,3); 
228   gMC->Gspos("FMYI",0,"FNSF",0.,0.,0.,0,"ONLY");
229
230   // Mylar for outer layers
231   par[1] = 0.035/2;
232   ycoor = -yPad/2.+par[1];
233   gMC->Gsvolu("FMYX","BOX",idtmed[510],par,3);
234   gMC->Gspos("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
235   gMC->Gspos("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
236   ycoor += par[1];
237  
238   // Graphyte layers
239   par[1] = 0.003/2;
240   ycoor += par[1];
241   gMC->Gsvolu("FGRL","BOX",idtmed[502],par,3);
242   gMC->Gspos("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
243   gMC->Gspos("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
244
245   // Freon sensitive layer
246   par[0] = -1;
247   par[1] = 0.110/2.;
248   par[2] = zSenStrip/2.;
249   gMC->Gsvolu("FCFC","BOX",idtmed[513],par,3);
250   gMC->Gspos("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
251   
252   // Pad definition x & z
253   gMC->Gsdvn("FLZ","FCFC", nz, 3); 
254   gMC->Gsdvn("FLX","FLZ" , nx, 1); 
255
256   // MRPC pixel itself 
257   par[0] = -1;
258   par[1] = -1; 
259   par[2] = -1;
260   gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);
261   gMC->Gspos("FPAD", 0, "FLX", 0., 0., 0., 0, "ONLY");
262
263
264 ////  Positioning the Strips  (FSTR) in the FLT volumes  /////
265
266  
267   // 3 (Central) Plate 
268   Float_t t = zFLT1+zFLT2+zFLT3/2.+7.*2.5;//Half Width of Barrel
269   Float_t zpos = 0;
270   Float_t ang;
271   Float_t Offset;  
272   Float_t last;
273   nrot = 0;
274   Int_t i=1,j=1;
275   zcoor=0;
276   Int_t UpDown=-1; // UpDown=-1 -> Upper strip, UpDown=+1 -> Lower strip
277  
278   do{
279      ang = atan(zcoor/t);
280      ang = ang*180/3.141592654;
281      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 0.);
282      AliMatrix (idrotm[nrot+1], 90., 180., 90.+ang,90.,ang, 0);
283      ycoor = -29./2.+ Space; //2 cm over front plate
284      ycoor += (1-(UpDown+1)/2)*Gap;
285      gMC->Gspos("FSTR",j,"FLT3",0.,ycoor,zcoor,idrotm[nrot],"ONLY");
286      gMC->Gspos("FSTR",j+1,"FLT3",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
287      ang  = ang*3.141592654/180;
288      
289      zcoor=zcoor-(zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
290      UpDown*= -1; // Alternate strips 
291      i++;
292      j+=2;
293   } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+zFLT2+7*2.5);
294   
295   ycoor = -29./2.+ Space; //2 cm over front plate
296
297   // Plate  2
298   zpos = -zFLT3/2-7;
299   ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
300   Offset = StripWidth*TMath::Cos(ang)/2;
301   zpos -= Offset;
302   nrot = 0;
303   i=1;
304   // UpDown has not to be reinitialized, so that the arrangement of the strips can continue coherently
305
306   do {
307      ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
308      ang = ang*180/3.141592654;
309      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 0.);
310      ycoor = -29./2.+ Space ; //2 cm over front plate
311      ycoor += (1-(UpDown+1)/2)*Gap;
312      zcoor = zpos+(zFLT3/2.+7+zFLT2/2); // Moves to the system of the centre of the modulus FLT2
313      gMC->Gspos("FSTR",i, "FLT2", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
314      ang  = ang*3.141592654/180;
315      zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
316      last = StripWidth*TMath::Cos(ang)/2;
317      UpDown*=-1;
318      i++; 
319   } while (zpos-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+7);
320
321   // Plate  1
322   zpos = -t+zFLT1+3.5;
323   ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
324   Offset = StripWidth*TMath::Cos(ang)/2.;
325   zpos -= Offset;
326   nrot = 0;
327   i=0;
328   ycoor= -29./2.+Space+Gap/2;
329
330  do {
331      ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
332      ang = ang*180/3.141592654;
333      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 0.);
334      i++;
335      zcoor = zpos+(zFLT1/2+zFLT2+zFLT3/2+7.*2.);
336      gMC->Gspos("FSTR",i, "FLT1", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
337      ang  = ang *3.141592654/180;
338      zpos = zpos - zSenStrip/TMath::Cos(ang);
339      last = StripWidth*TMath::Cos(ang)/2.;
340   }  while (zpos>-t+7.+last);
341
342 printf("#######################################################\n");
343 printf("     Distance from the bound of the FLT3: zFLT3- %f cm \n", zpos+(zSenStrip/2)/TMath::Cos(ang));
344      ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
345      zpos = zpos - zSenStrip/TMath::Cos(ang);
346 printf("NEXT Distance from the bound of the FLT3: zFLT3- %f cm \n", zpos+(zSenStrip/2)/TMath::Cos(ang));
347 printf("#######################################################\n");
348
349 ////////// Layers after detector /////////////////
350
351 // Honeycomb layer after (3cm)
352
353   Float_t OverSpace = Space + 7.3;
354 ///  StripWidth*TMath::Sin(ang) + 1.3;
355
356   par[0] = -1;
357   par[1] = 0.6;
358   par[2] = -1;
359   ycoor = -yFLT/2 + OverSpace + par[1];
360   gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
361   gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
362   gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
363   gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
364   gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
365   gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
366
367 // Electronics (Cu) after
368   ycoor += par[1];
369   par[0] = -1;
370   par[1] = 1.43*0.05 / 2.; // 5% of X0
371   par[2] = -1;
372   ycoor += par[1];
373   gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
374   gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
375   gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
376   gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
377   gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
378   gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
379
380 // Cooling water after
381   ycoor += par[1];
382   par[0] = -1;
383   par[1] = 36.1*0.02 / 2.; // 2% of X0
384   par[2] = -1;
385   ycoor += par[1];
386   gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
387   gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
388   gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
389   gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
390   gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
391   gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
392
393 //back plate honycomb (2cm)
394   par[0] = -1;
395   par[1] = 2 / 2.;
396   par[2] = -1;
397   ycoor = yFLT/2 - par[1];
398   gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
399   gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
400   gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
401   gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
402   gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
403   gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
404 }
405
406 //_____________________________________________________________________________
407 void AliTOFv2::DrawModule()
408 {
409   //
410   // Draw a shaded view of the Time Of Flight version 1
411   //
412   // Set everything unseen
413   gMC->Gsatt("*", "seen", -1);
414   // 
415   // Set ALIC mother transparent
416   gMC->Gsatt("ALIC","SEEN",0);
417   //
418   // Set the volumes visible
419   gMC->Gsatt("ALIC","SEEN",0);
420   gMC->Gsatt("FBAR","SEEN",1);
421   gMC->Gsatt("FTO1","SEEN",1);
422   gMC->Gsatt("FTO2","SEEN",1);
423   gMC->Gsatt("FTO3","SEEN",1);
424   gMC->Gsatt("FBT1","SEEN",1);
425   gMC->Gsatt("FBT2","SEEN",1);
426   gMC->Gsatt("FBT3","SEEN",1);
427   gMC->Gsatt("FDT1","SEEN",1);
428   gMC->Gsatt("FDT2","SEEN",1);
429   gMC->Gsatt("FDT3","SEEN",1);
430   gMC->Gsatt("FLT1","SEEN",1);
431   gMC->Gsatt("FLT2","SEEN",1);
432   gMC->Gsatt("FLT3","SEEN",1);
433   gMC->Gsatt("FPL1","SEEN",1);
434   gMC->Gsatt("FPL2","SEEN",1);
435   gMC->Gsatt("FPL3","SEEN",1);
436   gMC->Gsatt("FLD1","SEEN",1);
437   gMC->Gsatt("FLD2","SEEN",1);
438   gMC->Gsatt("FLD3","SEEN",1);
439   gMC->Gsatt("FLZ1","SEEN",1);
440   gMC->Gsatt("FLZ2","SEEN",1);
441   gMC->Gsatt("FLZ3","SEEN",1);
442   gMC->Gsatt("FLX1","SEEN",1);
443   gMC->Gsatt("FLX2","SEEN",1);
444   gMC->Gsatt("FLX3","SEEN",1);
445   gMC->Gsatt("FPA0","SEEN",1);
446   //
447   gMC->Gdopt("hide", "on");
448   gMC->Gdopt("shad", "on");
449   gMC->Gsatt("*", "fill", 7);
450   gMC->SetClipBox(".");
451   gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
452   gMC->DefaultRange();
453   gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
454   gMC->Gdhead(1111, "Time Of Flight");
455   gMC->Gdman(18, 4, "MAN");
456   gMC->Gdopt("hide","off");
457 }
458
459 //_____________________________________________________________________________
460 void AliTOFv2::CreateMaterials()
461 {
462   //
463   // Define materials for the Time Of Flight
464   //
465   AliTOF::CreateMaterials();
466 }
467  
468 //_____________________________________________________________________________
469 void AliTOFv2::Init()
470 {
471   //
472   // Initialise the detector after the geometry has been defined
473   //
474   AliTOF::Init();
475   fIdFTO2=gMC->VolId("FTO2");
476   fIdFTO3=gMC->VolId("FTO3");
477   fIdFLT1=gMC->VolId("FLT1");
478   fIdFLT2=gMC->VolId("FLT2");
479   fIdFLT3=gMC->VolId("FLT3");
480 }
481  
482 //_____________________________________________________________________________
483 void AliTOFv2::StepManager()
484 {
485   //
486   // Procedure called at each step in the Time Of Flight
487   //
488   TLorentzVector mom, pos;
489   Float_t hits[8];
490   Int_t vol[3];
491   Int_t copy, id, i;
492   Int_t *idtmed = fIdtmed->GetArray()-499;
493   if(gMC->GetMedium()==idtmed[514-1] && 
494      gMC->IsTrackEntering() && gMC->TrackCharge()
495      && gMC->CurrentVolID(copy)==fIdSens) {
496     TClonesArray &lhits = *fHits;
497     //
498     // Record only charged tracks at entrance
499     gMC->CurrentVolOffID(1,copy);
500     vol[2]=copy;
501     gMC->CurrentVolOffID(3,copy);
502     vol[1]=copy;
503     id=gMC->CurrentVolOffID(8,copy);
504     vol[0]=copy;
505     if(id==fIdFTO3) {
506       vol[0]+=22;
507       id=gMC->CurrentVolOffID(5,copy);
508       if(id==fIdFLT3) vol[1]+=6;
509     } else if (id==fIdFTO2) {
510       vol[0]+=20;
511       id=gMC->CurrentVolOffID(5,copy);
512       if(id==fIdFLT2) vol[1]+=8;
513     } else {
514       id=gMC->CurrentVolOffID(5,copy);
515       if(id==fIdFLT1) vol[1]+=14;
516     }
517     gMC->TrackPosition(pos);
518     gMC->TrackMomentum(mom);
519     //
520     Double_t ptot=mom.Rho();
521     Double_t norm=1/ptot;
522     for(i=0;i<3;++i) {
523       hits[i]=pos[i];
524       hits[i+3]=mom[i]*norm;
525     }
526     hits[6]=ptot;
527     hits[7]=pos[3];
528     new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
529   }
530 }
531