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