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