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