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