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