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