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