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