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