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