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