]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFv0.cxx
updating of the TOF volume numbering (ALICE-INT-2003-038)
[u/mrichter/AliRoot.git] / TOF / AliTOFv0.cxx
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 /* $Id$ */
17
18 ///////////////////////////////////////////////////////////////////////////////
19 //                                                                           //
20 //  This class contains the functions for version 0 of the Time Of Flight    //
21 //  detector.                                                                //
22 //                                                                           //
23 //  VERSION WITH 5 MODULES AND TILTED STRIPS                                 //
24 //  NO HITS DEFINED BY DEFAULT FOR THIS VERSION                              //
25 //   FULL COVERAGE VERSION                                                   //
26 //                                                                           //
27 //   Authors:                                                                //
28 //                                                                           //
29 //   Alessio Seganti                                                         //
30 //   Domenico Vicinanza                                                      //
31 //                                                                           //
32 //   University of Salerno - Italy                                           //
33 //                                                                           //
34 //   Fabrizio Pierella                                                       //
35 //   University of Bologna - Italy                                           //
36 //                                                                           //
37 //                                                                           //
38 //Begin_Html                                                                 //
39 /*                                                                           //
40 <img src="picts/AliTOFv0Class.gif">                                          //
41 */                                                                           //
42 //End_Html                                                                   //
43 //                                                                           //
44 ///////////////////////////////////////////////////////////////////////////////
45
46 #include <Riostream.h>
47 #include <stdlib.h>
48
49 #include <TBRIK.h>
50 #include <TGeometry.h>
51 #include <TLorentzVector.h>
52 #include <TNode.h>
53 #include <TObject.h>
54 #include <TVirtualMC.h>
55
56 #include "AliConst.h"
57 #include "AliRun.h"
58 #include "AliTOFv0.h"
59 #include "AliTOFConstants.h" // AdC
60  
61 ClassImp(AliTOFv0)
62  
63 //_____________________________________________________________________________
64 AliTOFv0::AliTOFv0()
65 {
66   //
67   // Default constructor
68   //
69 }
70  
71 //_____________________________________________________________________________
72 AliTOFv0::AliTOFv0(const char *name, const char *title)
73         : AliTOF(name,title)
74 {
75   //
76   // Standard constructor
77   //
78   //
79   // Check that FRAME is there otherwise we have no place where to
80   // put TOF
81   AliModule* frame=gAlice->GetModule("FRAME");
82   if(!frame) {
83     Error("Ctor","TOF needs FRAME to be present\n");
84     exit(1);
85   } else
86     if(frame->IsVersion()!=1) {
87       Error("Ctor","FRAME version 1 needed with this version of TOF\n");
88       exit(1);
89     }
90  
91 }
92
93 //____________________________________________________________________________
94
95 void AliTOFv0::BuildGeometry()
96 {
97   //
98   // Build TOF ROOT geometry for the ALICE event display
99   //
100   TNode *node, *top;
101   const int kColorTOF  = 27;
102   
103   // Find top TNODE
104   top = gAlice->GetGeometry()->GetNode("alice");
105   
106   // Position the different copies
107   const Float_t krTof  =(fRmax+fRmin)/2;
108   const Float_t khTof  = fRmax-fRmin;
109   const Int_t   kNTof = fNTof;
110   const Float_t kPi   = TMath::Pi();
111   const Float_t kangle = 2*kPi/kNTof;
112   Float_t ang;
113   
114   // define offset for nodes
115   Float_t zOffsetC = fZtof - fZlenC*0.5;
116   Float_t zOffsetB = fZtof - fZlenC - fZlenB*0.5;
117   Float_t zOffsetA = 0.;
118   // Define TOF basic volume
119   
120   char nodeName0[7], nodeName1[7], nodeName2[7]; 
121   char nodeName3[7], nodeName4[7], rotMatNum[7];
122   
123   new TBRIK("S_TOF_C","TOF box","void",
124             fStripLn*0.5,khTof*0.5,fZlenC*0.5);
125   new TBRIK("S_TOF_B","TOF box","void",
126             fStripLn*0.5,khTof*0.5,fZlenB*0.5);
127   new TBRIK("S_TOF_A","TOF box","void",
128             fStripLn*0.5,khTof*0.5,fZlenA*0.5);
129   
130   for (Int_t nodeNum=1;nodeNum<19;nodeNum++){
131     
132     if (nodeNum<10) {
133       sprintf(rotMatNum,"rot50%i",nodeNum);
134       sprintf(nodeName0,"FTO00%i",nodeNum);
135       sprintf(nodeName1,"FTO10%i",nodeNum);
136       sprintf(nodeName2,"FTO20%i",nodeNum);
137       sprintf(nodeName3,"FTO30%i",nodeNum);
138       sprintf(nodeName4,"FTO40%i",nodeNum);
139     }
140     if (nodeNum>9) {
141       sprintf(rotMatNum,"rot5%i",nodeNum);
142       sprintf(nodeName0,"FTO0%i",nodeNum);
143       sprintf(nodeName1,"FTO1%i",nodeNum);
144       sprintf(nodeName2,"FTO2%i",nodeNum);
145       sprintf(nodeName3,"FTO3%i",nodeNum);
146       sprintf(nodeName4,"FTO4%i",nodeNum);
147     }
148     
149     new TRotMatrix(rotMatNum,rotMatNum,90,-20*nodeNum,90,90-20*nodeNum,0,0);
150     ang = (4.5-nodeNum) * kangle;
151     
152     top->cd();
153     node = new TNode(nodeName0,nodeName0,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetC,rotMatNum);
154     node->SetLineColor(kColorTOF);
155     fNodes->Add(node); 
156     
157     top->cd(); 
158     node = new TNode(nodeName1,nodeName1,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetC,rotMatNum);
159     node->SetLineColor(kColorTOF);
160     fNodes->Add(node); 
161     
162     top->cd();
163     node = new TNode(nodeName2,nodeName2,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetB,rotMatNum);
164     node->SetLineColor(kColorTOF);
165     fNodes->Add(node); 
166     
167     top->cd();
168     node = new TNode(nodeName3,nodeName3,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
169     node->SetLineColor(kColorTOF);
170     fNodes->Add(node); 
171     
172     top->cd();
173     node = new TNode(nodeName4,nodeName4,"S_TOF_A",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetA,rotMatNum);
174     node->SetLineColor(kColorTOF);
175     fNodes->Add(node); 
176   } // end loop on nodeNum
177 }
178
179
180  
181 //_____________________________________________________________________________
182 void AliTOFv0::CreateGeometry()
183 {
184   //
185   // Create geometry for Time Of Flight version 0
186   //
187   //Begin_Html
188   /*
189     <img src="picts/AliTOFv0.gif">
190   */
191   //End_Html
192   //
193   // Creates common geometry
194   //
195   AliTOF::CreateGeometry();
196 }
197  
198 //_____________________________________________________________________________
199 void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
200                      Float_t zlenB, Float_t zlenA, Float_t ztof0)
201 {
202   //
203   // Definition of the Time Of Fligh Resistive Plate Chambers
204   // xFLT, yFLT, zFLT - sizes of TOF modules (large)
205   
206   Float_t  ycoor, zcoor;
207   Float_t  par[3];
208   Int_t    *idtmed = fIdtmed->GetArray()-499;
209   Int_t    idrotm[100];
210   Int_t    nrot = 0;
211   Float_t  hTof = fRmax-fRmin;
212   
213   Float_t radius = fRmin+2.;//cm
214
215   par[0] =  xtof * 0.5;
216   par[1] =  ytof * 0.5;
217   par[2] = zlenC * 0.5;
218   gMC->Gsvolu("FTOC", "BOX ", idtmed[506], par, 3);
219   par[2] = zlenB * 0.5;
220   gMC->Gsvolu("FTOB", "BOX ", idtmed[506], par, 3);
221   par[2] = zlenA * 0.5;
222   gMC->Gsvolu("FTOA", "BOX ", idtmed[506], par, 3);
223
224
225 // Positioning of modules
226
227    Float_t zcor1 = ztof0 - zlenC*0.5;
228    Float_t zcor2 = ztof0 - zlenC - zlenB*0.5;
229    Float_t zcor3 = 0.;
230
231    AliMatrix(idrotm[0], 90.,  0., 0., 0., 90,-90.);
232    AliMatrix(idrotm[1], 90.,180., 0., 0., 90, 90.);
233    gMC->Gspos("FTOC", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
234    gMC->Gspos("FTOC", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
235    gMC->Gspos("FTOC", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
236    gMC->Gspos("FTOC", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
237    gMC->Gspos("FTOC", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
238    gMC->Gspos("FTOC", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
239
240    gMC->Gspos("FTOB", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
241    gMC->Gspos("FTOB", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
242    gMC->Gspos("FTOB", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
243    gMC->Gspos("FTOB", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
244    gMC->Gspos("FTOB", 1, "BTO3", 0,  zcor2, 0, idrotm[0], "ONLY");
245    gMC->Gspos("FTOB", 2, "BTO3", 0, -zcor2, 0, idrotm[1], "ONLY");
246
247    gMC->Gspos("FTOA", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
248    gMC->Gspos("FTOA", 0, "BTO2", 0, zcor3,  0, idrotm[0], "ONLY");
249    gMC->Gspos("FTOA", 0, "BTO3", 0, zcor3,  0, idrotm[0], "ONLY");
250
251   Float_t db = 0.5;//cm
252   Float_t xFLT, xFST, yFLT, zFLTA, zFLTB, zFLTC;
253
254   xFLT = fStripLn;
255   yFLT = ytof;
256   zFLTA = zlenA;
257   zFLTB = zlenB;
258   zFLTC = zlenC;
259
260   xFST = xFLT-fDeadBndX*2;//cm
261
262 // Sizes of MRPC pads
263
264   Float_t yPad = 0.505;//cm 
265   
266 // Large not sensitive volumes with Insensitive Freon
267   par[0] = xFLT*0.5;
268   par[1] = yFLT*0.5;
269   
270   cout <<"************************* TOF geometry **************************"<<endl;
271  
272   par[2] = (zFLTA *0.5);
273   gMC->Gsvolu("FLTA", "BOX ", idtmed[512], par, 3); // Insensitive Freon
274   gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY");
275
276   par[2] = (zFLTB * 0.5);
277   gMC->Gsvolu("FLTB", "BOX ", idtmed[512], par, 3); // Insensitive Freon
278   gMC->Gspos ("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY");
279
280   par[2] = (zFLTC * 0.5);
281   gMC->Gsvolu("FLTC", "BOX ", idtmed[512], par, 3); // Insensitive Freon
282   gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY");
283  
284 ////////// Layers of Aluminum before and after detector //////////
285 ////////// Aluminum Box for Modules (2.0 mm thickness)  /////////
286 ////////// lateral walls not simulated
287   par[0] = xFLT*0.5;
288   par[1] = 0.1;//cm
289   ycoor = -yFLT/2 + par[1];
290   par[2] = (zFLTA *0.5);
291   gMC->Gsvolu("FALA", "BOX ", idtmed[508], par, 3); // Alluminium
292   gMC->Gspos ("FALA", 1, "FLTA", 0., ycoor, 0., 0, "ONLY");
293   gMC->Gspos ("FALA", 2, "FLTA", 0.,-ycoor, 0., 0, "ONLY");
294   par[2] = (zFLTB *0.5);
295   gMC->Gsvolu("FALB", "BOX ", idtmed[508], par, 3); // Alluminium 
296   gMC->Gspos ("FALB", 1, "FLTB", 0., ycoor, 0., 0, "ONLY");
297   gMC->Gspos ("FALB", 2, "FLTB", 0.,-ycoor, 0., 0, "ONLY");
298   par[2] = (zFLTC *0.5);
299   gMC->Gsvolu("FALC", "BOX ", idtmed[508], par, 3); // Alluminium
300   gMC->Gspos ("FALC", 1, "FLTC", 0., ycoor, 0., 0, "ONLY");
301   gMC->Gspos ("FALC", 2, "FLTC", 0.,-ycoor, 0., 0, "ONLY");
302   
303 ///////////////// Detector itself //////////////////////
304   const Float_t  kdeadBound  =  fDeadBndZ; //cm non-sensitive between the pad edge 
305                                           //and the boundary of the strip
306   const Int_t    knx    = fNpadX;          // number of pads along x
307   const Int_t    knz    = fNpadZ;          // number of pads along z
308   const Float_t  kspace = fSpace;            //cm distance from the front plate of the box
309
310   Float_t zSenStrip  = fZpad*fNpadZ;//cm
311   Float_t stripWidth = zSenStrip + 2*kdeadBound;
312   par[0] = xFLT*0.5;
313   par[1] = yPad*0.5; 
314   par[2] = stripWidth*0.5;
315   
316 // new description for strip volume -double stack strip-
317 // -- all constants are expressed in cm
318 // heigth of different layers
319   const Float_t khhony = 1.      ;   // heigth of HONY  Layer
320   const Float_t khpcby = 0.15    ;   // heigth of PCB   Layer
321   const Float_t khmyly = 0.035   ;   // heigth of MYLAR Layer
322   const Float_t khgraphy = 0.02  ;   // heigth of GRAPHITE Layer
323   const Float_t khglasseiy = 0.17;   // 0.6 Ext. Glass + 1.1 i.e. (Int. Glass/2) (mm)
324   const Float_t khsensmy = 0.11  ;   // heigth of Sensitive Freon Mixture
325   const Float_t kwsensmz = 2*3.5 ;   // cm
326   const Float_t klsensmx = 48*2.5;   // cm
327   const Float_t kwpadz = 3.5;   // cm z dimension of the FPAD volume
328   const Float_t klpadx = 2.5;   // cm x dimension of the FPAD volume
329   
330   // heigth of the FSTR Volume (the strip volume)
331   const Float_t khstripy = 2*khhony+3*khpcby+4*(khmyly+khgraphy+khglasseiy)+2*khsensmy;
332   // width  of the FSTR Volume (the strip volume)
333   const Float_t kwstripz = 10.;
334   // length of the FSTR Volume (the strip volume)
335   const Float_t klstripx = 122.;
336   
337   Float_t parfp[3]={klstripx*0.5,khstripy*0.5,kwstripz*0.5};
338 // coordinates of the strip center in the strip reference frame; used for positioning
339 // internal strip volumes
340   Float_t posfp[3]={0.,0.,0.};   
341
342   
343   // FSTR volume definition and filling this volume with non sensitive Gas Mixture
344   gMC->Gsvolu("FSTR","BOX",idtmed[512],parfp,3);
345   //-- HONY Layer definition
346 //  parfp[0] = -1;
347   parfp[1] = khhony*0.5;
348 //  parfp[2] = -1;
349   gMC->Gsvolu("FHON","BOX",idtmed[503],parfp,3);
350   // positioning 2 HONY Layers on FSTR volume
351
352   posfp[1]=-khstripy*0.5+parfp[1];
353   gMC->Gspos("FHON",1,"FSTR",0., posfp[1],0.,0,"ONLY");
354   gMC->Gspos("FHON",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
355
356   //-- PCB Layer definition 
357   parfp[1] = khpcby*0.5;
358   gMC->Gsvolu("FPCB","BOX",idtmed[504],parfp,3);
359   // positioning 2 PCB Layers on FSTR volume
360   posfp[1]=-khstripy*0.5+khhony+parfp[1];
361   gMC->Gspos("FPCB",1,"FSTR",0., posfp[1],0.,0,"ONLY");
362   gMC->Gspos("FPCB",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
363   // positioning the central PCB layer
364   gMC->Gspos("FPCB",3,"FSTR",0.,0.,0.,0,"ONLY");
365
366
367
368   //-- MYLAR Layer definition
369   parfp[1] = khmyly*0.5;
370   gMC->Gsvolu("FMYL","BOX",idtmed[511],parfp,3);
371   // positioning 2 MYLAR Layers on FSTR volume
372   posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1]; 
373   gMC->Gspos("FMYL",1,"FSTR",0., posfp[1],0.,0,"ONLY");
374   gMC->Gspos("FMYL",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
375   // adding further 2 MYLAR Layers on FSTR volume
376   posfp[1] = khpcby*0.5+parfp[1];
377   gMC->Gspos("FMYL",3,"FSTR",0., posfp[1],0.,0,"ONLY");
378   gMC->Gspos("FMYL",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
379
380
381   //-- Graphite Layer definition
382   parfp[1] = khgraphy*0.5;
383   gMC->Gsvolu("FGRP","BOX",idtmed[502],parfp,3);
384   // positioning 2 Graphite Layers on FSTR volume
385   posfp[1] = -khstripy*0.5+khhony+khpcby+khmyly+parfp[1];
386   gMC->Gspos("FGRP",1,"FSTR",0., posfp[1],0.,0,"ONLY");
387   gMC->Gspos("FGRP",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
388   // adding further 2 Graphite Layers on FSTR volume
389   posfp[1] = khpcby*0.5+khmyly+parfp[1];
390   gMC->Gspos("FGRP",3,"FSTR",0., posfp[1],0.,0,"ONLY");
391   gMC->Gspos("FGRP",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
392  
393
394   //-- Glass (EXT. +Semi INT.) Layer definition
395   parfp[1] = khglasseiy*0.5;
396   gMC->Gsvolu("FGLA","BOX",idtmed[514],parfp,3);
397   // positioning 2 Glass Layers on FSTR volume
398   posfp[1] = -khstripy*0.5+khhony+khpcby+khmyly+khgraphy+parfp[1];
399   gMC->Gspos("FGLA",1,"FSTR",0., posfp[1],0.,0,"ONLY");
400   gMC->Gspos("FGLA",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
401   // adding further 2 Glass Layers on FSTR volume
402   posfp[1] = khpcby*0.5+khmyly+khgraphy+parfp[1];
403   gMC->Gspos("FGLA",3,"FSTR",0., posfp[1],0.,0,"ONLY");
404   gMC->Gspos("FGLA",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
405
406   
407   //-- Sensitive Mixture Layer definition
408   parfp[0] = klsensmx*0.5;
409   parfp[1] = khsensmy*0.5;
410   parfp[2] = kwsensmz*0.5;
411   gMC->Gsvolu("FSEN","BOX",idtmed[513],parfp,3);
412   gMC->Gsvolu("FNSE","BOX",idtmed[512],parfp,3);
413   // positioning 2 gas Layers on FSTR volume
414   // the upper is insensitive freon
415   // while the remaining is sensitive
416   posfp[1] = khpcby*0.5+khmyly+khgraphy+khglasseiy+parfp[1];
417   gMC->Gspos("FNSE",0,"FSTR", 0., posfp[1],0.,0,"ONLY");
418   gMC->Gspos("FSEN",0,"FSTR", 0.,-posfp[1],0.,0,"ONLY");
419
420   // dividing FSEN along z in knz=2 and along x in knx=48
421   gMC->Gsdvn("FSEZ","FSEN",knz,3);
422   gMC->Gsdvn("FSEX","FSEZ",knx,1);
423   
424   // FPAD volume definition
425   parfp[0] = klpadx*0.5;    
426   parfp[1] = khsensmy*0.5;
427   parfp[2] = kwpadz*0.5;
428   gMC->Gsvolu("FPAD","BOX",idtmed[513],parfp,3);
429   // positioning the FPAD volumes on previous divisions
430   gMC->Gspos("FPAD",0,"FSEX",0.,0.,0.,0,"ONLY");
431   
432 ////  Positioning the Strips  (FSTR) in the FLT volumes  /////
433
434   // Plate A (Central) 
435   
436   Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
437
438   Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
439   Float_t zpos = 0;
440   Float_t ang  = 0;
441   Int_t j=1; // AdC
442   nrot  = 0;
443   zcoor = 0;
444   ycoor = -14.5 + kspace ; //2 cm over front plate
445
446   AliMatrix (idrotm[0],  90.,  0.,90.,90.,0., 90.);   
447
448   Int_t centerLoc= (Int_t)(fNStripA/2.) + 1; // AdC
449
450   //gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
451   gMC->Gspos("FSTR",centerLoc,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY"); // AdC
452   if(fDebug>=1) {
453     printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
454     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
455   }
456   zcoor -= zSenStrip;
457   //j++; // AdC
458   Int_t upDown = -1; // upDown=-1 -> Upper strip
459                      // upDown=+1 -> Lower strip
460   do{
461      ang = atan(zcoor/radius);
462      ang *= kRaddeg;
463      AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
464      AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
465      ang /= kRaddeg;
466      ycoor = -14.5+ kspace; //2 cm over front plate
467      ycoor += (1-(upDown+1)/2)*gap;
468      //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
469      //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
470     gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
471     gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
472     if(fDebug>=1) {
473       printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
474       printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
475     }
476     //j += 2; // AdC
477     upDown*= -1; // Alternate strips 
478     zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
479       upDown*gap*TMath::Tan(ang)-
480       (zSenStrip/2)/TMath::Cos(ang);
481   } while (zcoor-(stripWidth/2)*TMath::Cos(ang)>-t+zFLTC+zFLTB+db*2);
482   
483   zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)+
484     upDown*gap*TMath::Tan(ang)+
485     (zSenStrip/2)/TMath::Cos(ang);
486   
487   gap = fGapB;
488   zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
489     upDown*gap*TMath::Tan(ang)-
490     (zSenStrip/2)/TMath::Cos(ang);
491   
492   ang = atan(zcoor/radius);
493   ang *= kRaddeg;
494   AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
495   AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
496   ang /= kRaddeg;
497           
498   ycoor = -14.5+ kspace; //2 cm over front plate
499   ycoor += (1-(upDown+1)/2)*gap;
500   //gMC->Gspos("FSTR",j  ,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
501   //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
502   gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot],  "ONLY"); // AdC
503   gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
504   if(fDebug>=1) {
505     printf("%s: %f,  St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
506     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
507   }
508   ycoor = -hTof/2.+ kspace;//2 cm over front plate
509
510   // Plate  B
511
512   nrot = 0;
513   Int_t i=1; // AdC
514   upDown = 1;
515   Float_t deadRegion = 1.0;//cm
516   
517   zpos = zcoor - (zSenStrip/2)/TMath::Cos(ang)-
518          upDown*gap*TMath::Tan(ang)-
519          (zSenStrip/2)/TMath::Cos(ang)-
520          deadRegion/TMath::Cos(ang);
521
522   ang = atan(zpos/radius);
523   ang *= kRaddeg;
524   AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
525   ang /= kRaddeg;
526   ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
527   ycoor += (1-(upDown+1)/2)*gap;
528   zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
529   gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
530   if(fDebug>=1) {   
531     printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); 
532     printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
533   }
534   i++;
535   upDown*=-1;
536
537   do {
538      zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)-
539             upDown*gap*TMath::Tan(ang)-
540             (zSenStrip/2)/TMath::Cos(ang);
541      ang = atan(zpos/radius);
542      ang *= kRaddeg;
543      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
544      ang /= kRaddeg;
545      Float_t deltaSpaceinB=-0.5; // [cm] to avoid overlaps with the end of freon frame
546      Float_t deltaGapinB=0.5;    // [cm] to avoid overlaps in between initial strips
547      ycoor = -hTof*0.5+ kspace+deltaSpaceinB ; //2 cm over front plate
548      ycoor += (1-(upDown+1)/2)*(gap+deltaGapinB);
549      zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
550      gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
551      if(fDebug>=1) {   
552        printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); 
553        printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
554      }
555      upDown*=-1;
556      i++;
557   } while (TMath::Abs(ang*kRaddeg)<22.5);
558   //till we reach a tilting angle of 22.5 degrees
559
560   ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
561   zpos = zpos - zSenStrip/TMath::Cos(ang);
562   // this avoid overlaps in between outer strips in plate B
563   Float_t deltaMovingUp=0.8;    // [cm]
564   Float_t deltaMovingDown=-0.5; // [cm]
565
566   do {
567      ang = atan(zpos/radius);
568      ang *= kRaddeg;
569      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
570      ang /= kRaddeg;
571      zcoor = zpos+(zFLTB/2+zFLTA/2+db);
572      gMC->Gspos("FSTR",i, "FLTB", 0., ycoor+deltaMovingDown+deltaMovingUp, zcoor,idrotm[nrot], "ONLY");
573      deltaMovingUp+=0.8; // update delta moving toward the end of the plate
574      zpos = zpos - zSenStrip/TMath::Cos(ang);
575      if(fDebug>=1) {
576        printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
577        printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
578      }
579      i++;
580   }  while (zpos-stripWidth*0.5/TMath::Cos(ang)>-t+zFLTC+db);
581   
582   // Plate  C
583   
584   zpos = zpos + zSenStrip/TMath::Cos(ang);
585
586   zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+
587          gap*TMath::Tan(ang)-
588          (zSenStrip/2)/TMath::Cos(ang);
589
590   nrot = 0;
591   i=0;
592   Float_t deltaGap=-2.5; // [cm] update distance from strip center and plate
593   ycoor= -hTof*0.5+kspace+gap+deltaGap;
594
595   do {
596      i++;
597      ang = atan(zpos/radius);
598      ang *= kRaddeg;
599      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
600      ang /= kRaddeg;
601      zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
602      gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
603      if(fDebug>=1) {
604        printf("%s: %f,  St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i);
605        printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
606      }
607      zpos = zpos - zSenStrip/TMath::Cos(ang);
608   }  while (zpos-stripWidth*TMath::Cos(ang)*0.5>-t);
609
610
611 ////////// Layers after strips /////////////////
612 // honeycomb (Polyethilene) Layer after (1.2cm)
613
614   Float_t overSpace = fOverSpc;//cm
615
616   par[0] = xFLT*0.5;
617   par[1] = 0.6;
618   par[2] = (zFLTA *0.5);
619   ycoor = -yFLT/2 + overSpace + par[1];
620   gMC->Gsvolu("FPEA", "BOX ", idtmed[503], par, 3); // Hony
621   gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
622   par[2] = (zFLTB *0.5);
623   gMC->Gsvolu("FPEB", "BOX ", idtmed[503], par, 3); // Hony
624   gMC->Gspos ("FPEB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
625   par[2] = (zFLTC *0.5);
626   gMC->Gsvolu("FPEC", "BOX ", idtmed[503], par, 3); // Hony
627   gMC->Gspos ("FPEC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
628
629 // Electronics (Cu) after
630   ycoor += par[1];
631   par[0] = xFLT*0.5;
632   par[1] = 1.43*0.05*0.5; // 5% of X0
633   par[2] = (zFLTA *0.5);
634   ycoor += par[1];
635   gMC->Gsvolu("FECA", "BOX ", idtmed[501], par, 3); // Cu
636   gMC->Gspos ("FECA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
637   par[2] = (zFLTB *0.5);
638   gMC->Gsvolu("FECB", "BOX ", idtmed[501], par, 3); // Cu
639   gMC->Gspos ("FECB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
640   par[2] = (zFLTC *0.5);
641   gMC->Gsvolu("FECC", "BOX ", idtmed[501], par, 3); // Cu
642   gMC->Gspos ("FECC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
643
644 // cooling WAter after
645   ycoor += par[1];
646   par[0] = xFLT*0.5;
647   par[1] = 36.1*0.02*0.5; // 2% of X0
648   par[2] = (zFLTA *0.5);
649   ycoor += par[1];
650   gMC->Gsvolu("FWAA", "BOX ", idtmed[515], par, 3); // Water
651   gMC->Gspos ("FWAA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
652   par[2] = (zFLTB *0.5);
653   gMC->Gsvolu("FWAB", "BOX ", idtmed[515], par, 3); // Water
654   gMC->Gspos ("FWAB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
655   par[2] = (zFLTC *0.5);
656   gMC->Gsvolu("FWAC", "BOX ", idtmed[515], par, 3); // Water
657   gMC->Gspos ("FWAC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
658
659 // frame of Air
660   ycoor += par[1];
661   par[0] = xFLT*0.5;
662   par[1] = (yFLT/2-ycoor-0.2)*0.5; // Aluminum layer considered (0.2 cm)
663   par[2] = (zFLTA *0.5);
664   ycoor += par[1];
665   gMC->Gsvolu("FAIA", "BOX ", idtmed[500], par, 3); // Air
666   gMC->Gspos ("FAIA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
667   par[2] = (zFLTB *0.5);
668   gMC->Gsvolu("FAIB", "BOX ", idtmed[500], par, 3); // Air
669   gMC->Gspos ("FAIB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
670   par[2] = (zFLTC *0.5);
671   gMC->Gsvolu("FAIC", "BOX ", idtmed[500], par, 3); // Air
672   gMC->Gspos ("FAIC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
673 /* fp
674 //Back Plate honycomb (2cm)
675   par[0] = -1;
676   par[1] = 2 *0.5;
677   par[2] = -1;
678   ycoor = yFLT/2 - par[1];
679   gMC->Gsvolu("FBPA", "BOX ", idtmed[503], par, 3); // Hony
680   gMC->Gspos ("FBPA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
681   gMC->Gsvolu("FBPB", "BOX ", idtmed[503], par, 3); // Hony
682   gMC->Gspos ("FBPB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
683   gMC->Gsvolu("FBPC", "BOX ", idtmed[503], par, 3); // Hony
684   gMC->Gspos ("FBPC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
685 fp */
686 }
687
688 //_____________________________________________________________________________
689 void AliTOFv0::DrawModule() const
690 {
691   //
692   // Draw a shaded view of the Time Of Flight version 0
693   //
694   // Set everything unseen
695   gMC->Gsatt("*", "seen", -1);
696   // 
697   // Set ALIC mother transparent
698   gMC->Gsatt("ALIC","SEEN",0);
699   //
700   // Set the volumes visible
701   gMC->Gsatt("ALIC","SEEN",0);
702
703   gMC->Gsatt("FTOA","SEEN",1);
704   gMC->Gsatt("FTOB","SEEN",1);
705   gMC->Gsatt("FTOC","SEEN",1);
706   gMC->Gsatt("FLTA","SEEN",1);
707   gMC->Gsatt("FLTB","SEEN",1);
708   gMC->Gsatt("FLTC","SEEN",1);
709   gMC->Gsatt("FPLA","SEEN",1);
710   gMC->Gsatt("FPLB","SEEN",1);
711   gMC->Gsatt("FPLC","SEEN",1);
712   gMC->Gsatt("FSTR","SEEN",1);
713   gMC->Gsatt("FPEA","SEEN",1);
714   gMC->Gsatt("FPEB","SEEN",1);
715   gMC->Gsatt("FPEC","SEEN",1);
716   
717   gMC->Gsatt("FLZ1","SEEN",0);
718   gMC->Gsatt("FLZ2","SEEN",0);
719   gMC->Gsatt("FLZ3","SEEN",0);
720   gMC->Gsatt("FLX1","SEEN",0);
721   gMC->Gsatt("FLX2","SEEN",0);
722   gMC->Gsatt("FLX3","SEEN",0);
723   gMC->Gsatt("FPAD","SEEN",0);
724
725   gMC->Gdopt("hide", "on");
726   gMC->Gdopt("shad", "on");
727   gMC->Gsatt("*", "fill", 7);
728   gMC->SetClipBox(".");
729   gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
730   gMC->DefaultRange();
731   gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
732   gMC->Gdhead(1111, "Time Of Flight");
733   gMC->Gdman(18, 4, "MAN");
734   gMC->Gdopt("hide","off");
735 }
736 //_____________________________________________________________________________
737 void AliTOFv0::DrawDetectorModules()
738 {
739 //
740 // Draw a shaded view of the TOF detector version 0
741 //
742  
743 //Set ALIC mother transparent
744  gMC->Gsatt("ALIC","SEEN",0);
745
746 //
747 //Set volumes visible
748 // 
749 //=====> Level 1
750   // Level 1 for TOF volumes
751   gMC->Gsatt("B077","seen",0);
752  
753  
754 //==========> Level 2
755   // Level 2
756   gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
757   gMC->Gsatt("B071","seen",0);
758   gMC->Gsatt("B074","seen",0);
759   gMC->Gsatt("B075","seen",0);
760   gMC->Gsatt("B080","seen",0); // B080 does not has sub-level                
761
762
763   // Level 2 of B071
764   gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
765   gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
766   gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
767   gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
768   gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
769   gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
770   gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
771   gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
772   gMC->Gsatt("BTO1","seen",0);
773
774  
775   // Level 2 of B074
776   gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
777   gMC->Gsatt("BTO2","seen",0);
778
779   // Level 2 of B075
780   gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
781   gMC->Gsatt("BTO3","seen",0);
782
783 // ==================> Level 3
784   // Level 3 of B071 / Level 2 of BTO1
785   gMC->Gsatt("FTOC","seen",-2);
786   gMC->Gsatt("FTOB","seen",-2);
787   gMC->Gsatt("FTOA","seen",-2);
788  
789   // Level 3 of B074 / Level 2 of BTO2
790   // -> cfr previous settings
791  
792   // Level 3 of B075 / Level 2 of BTO3
793   // -> cfr previous settings
794
795   gMC->Gdopt("hide","on");
796   gMC->Gdopt("shad","on");
797   gMC->Gsatt("*", "fill", 5);
798   gMC->SetClipBox(".");
799   gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
800   gMC->DefaultRange();
801   gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
802   gMC->Gdhead(1111,"TOF detector V1");
803   gMC->Gdman(18, 4, "MAN");
804   gMC->Gdopt("hide","off");
805 }                                 
806
807 //_____________________________________________________________________________
808 void AliTOFv0::DrawDetectorStrips()
809 {
810 //
811 // Draw a shaded view of the TOF strips for version 0
812 //
813  
814 //Set ALIC mother transparent
815  gMC->Gsatt("ALIC","SEEN",0);
816
817 //
818 //Set volumes visible 
819 //=====> Level 1
820   // Level 1 for TOF volumes
821   gMC->Gsatt("B077","seen",0);
822   
823 //==========> Level 2
824   // Level 2
825   gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
826   gMC->Gsatt("B071","seen",0);
827   gMC->Gsatt("B074","seen",0);
828   gMC->Gsatt("B075","seen",0);
829   gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
830
831   // Level 2 of B071
832   gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
833   gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
834   gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
835   gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
836   gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
837   gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
838   gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
839   gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
840   gMC->Gsatt("BTO1","seen",0);
841
842 // ==================> Level 3
843   // Level 3 of B071 / Level 2 of BTO1
844   gMC->Gsatt("FTOC","seen",0);
845   gMC->Gsatt("FTOB","seen",0);
846   gMC->Gsatt("FTOA","seen",0);
847  
848   // Level 3 of B074 / Level 2 of BTO2
849   // -> cfr previous settings
850  
851   // Level 3 of B075 / Level 2 of BTO3
852   // -> cfr previous settings
853
854
855 // ==========================> Level 4
856   // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOC
857   gMC->Gsatt("FLTC","seen",0);
858   // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOB
859   gMC->Gsatt("FLTB","seen",0);
860   // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOA
861   gMC->Gsatt("FLTA","seen",0);
862  
863   // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOC
864   // -> cfr previous settings
865   // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOB
866   // -> cfr previous settings
867  
868   // Level 4 of B075 / Level 3 of BTO3 / Level 2 of FTOC
869   // -> cfr previous settings
870
871 //======================================> Level 5
872   // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOC / Level 2 of FLTC
873   gMC->Gsatt("FALC","seen",0); // no children for FALC
874   gMC->Gsatt("FSTR","seen",-2);
875   gMC->Gsatt("FPEC","seen",0); // no children for FPEC
876   gMC->Gsatt("FECC","seen",0); // no children for FECC
877   gMC->Gsatt("FWAC","seen",0); // no children for FWAC
878   gMC->Gsatt("FAIC","seen",0); // no children for FAIC
879
880   // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOB / Level 2 of FLTB
881   gMC->Gsatt("FALB","seen",0); // no children for FALB
882 //-->  gMC->Gsatt("FSTR","seen",-2);
883
884
885   // -> cfr previous settings
886   gMC->Gsatt("FPEB","seen",0); // no children for FPEB
887   gMC->Gsatt("FECB","seen",0); // no children for FECB
888   gMC->Gsatt("FWAB","seen",0); // no children for FWAB
889   gMC->Gsatt("FAIB","seen",0); // no children for FAIB
890  
891   // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOA / Level 2 of FLTA
892   gMC->Gsatt("FALA","seen",0); // no children for FALB
893 //-->  gMC->Gsatt("FSTR","seen",-2);
894   // -> cfr previous settings
895   gMC->Gsatt("FPEA","seen",0); // no children for FPEA
896   gMC->Gsatt("FECA","seen",0); // no children for FECA
897   gMC->Gsatt("FWAA","seen",0); // no children for FWAA
898   gMC->Gsatt("FAIA","seen",0); // no children for FAIA
899
900   // Level 2 of B074
901   gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
902   gMC->Gsatt("BTO2","seen",0);
903
904   // Level 2 of B075
905   gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
906   gMC->Gsatt("BTO3","seen",0);
907
908 // for others Level 5, cfr. previous settings
909
910   gMC->Gdopt("hide","on");
911   gMC->Gdopt("shad","on");
912   gMC->Gsatt("*", "fill", 5);
913   gMC->SetClipBox(".");
914   gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
915   gMC->DefaultRange();
916   gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
917   gMC->Gdhead(1111,"TOF Strips V1");
918   gMC->Gdman(18, 4, "MAN");
919   gMC->Gdopt("hide","off");
920 }
921
922 //_____________________________________________________________________________
923 void AliTOFv0::CreateMaterials()
924 {
925   //
926   // Define materials for the Time Of Flight
927   //
928   AliTOF::CreateMaterials();
929 }
930  
931 //_____________________________________________________________________________
932 void AliTOFv0::Init()
933 {
934   //
935   // Initialise the detector after the geometry has been defined
936   //
937   printf("**************************************"
938          "  TOF  "
939          "**************************************\n");
940   printf("\n   Version 0 of TOF initialing, "
941               "symmetric TOF - Full Coverage version\n");
942
943   AliTOF::Init();
944
945   fIdFTOA = gMC->VolId("FTOA");
946   fIdFTOB = gMC->VolId("FTOB");
947   fIdFTOC = gMC->VolId("FTOC");
948   fIdFLTA = gMC->VolId("FLTA");
949   fIdFLTB = gMC->VolId("FLTB");
950   fIdFLTC = gMC->VolId("FLTC");
951
952   if(fDebug) {
953     printf("%s: **************************************"
954            "  TOF  "
955            "**************************************\n",ClassName());
956   }
957 }
958  
959 //_____________________________________________________________________________
960 void AliTOFv0::StepManager()
961 {
962   //
963   // Procedure called at each step in the Time Of Flight
964   //
965   TLorentzVector mom, pos;
966   Float_t xm[3],pm[3],xpad[3],ppad[3];
967   Float_t hits[13],phi,phid,z;
968   Int_t   vol[5];
969   Int_t   sector, plate, padx, padz, strip;
970   Int_t   copy, padzid, padxid, stripid, i;
971   Int_t   *idtmed = fIdtmed->GetArray()-499;
972   Float_t incidenceAngle;
973   
974   if(gMC->GetMedium()==idtmed[513] && 
975      gMC->IsTrackEntering() && gMC->TrackCharge()
976      && gMC->CurrentVolID(copy)==fIdSens) 
977   {    
978     // getting information about hit volumes
979     
980     padzid=gMC->CurrentVolOffID(2,copy);
981     padz=copy;  
982     
983     padxid=gMC->CurrentVolOffID(1,copy);
984     padx=copy;  
985     
986     stripid=gMC->CurrentVolOffID(4,copy);
987     strip=copy;  
988
989     gMC->TrackPosition(pos);
990     gMC->TrackMomentum(mom);
991
992 //    Double_t NormPos=1./pos.Rho();
993     Double_t normMom=1./mom.Rho();
994
995 //  getting the cohordinates in pad ref system
996     xm[0] = (Float_t)pos.X();
997     xm[1] = (Float_t)pos.Y();
998     xm[2] = (Float_t)pos.Z();
999
1000     pm[0] = (Float_t)mom.X()*normMom;
1001     pm[1] = (Float_t)mom.Y()*normMom;
1002     pm[2] = (Float_t)mom.Z()*normMom;
1003  
1004     gMC->Gmtod(xm,xpad,1);
1005     gMC->Gmtod(pm,ppad,2);
1006
1007     incidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
1008
1009     z = pos[2];
1010
1011     plate = 0;   
1012     if (TMath::Abs(z) <=  fZlenA*0.5)  plate = 2; //3; // AdC
1013     if (z < (fZlenA*0.5+fZlenB) && 
1014         z >  fZlenA*0.5)               plate = 1; //4; // AdC
1015     if (z >-(fZlenA*0.5+fZlenB) &&
1016         z < -fZlenA*0.5)               plate = 3; //2; // AdC
1017     if (z > (fZlenA*0.5+fZlenB))       plate = 0; //5; // AdC
1018     if (z <-(fZlenA*0.5+fZlenB))       plate = 4; //1; // AdC
1019
1020     if (plate==0) strip=AliTOFConstants::fgkNStripC-strip; // AdC
1021     else if (plate==1) strip=AliTOFConstants::fgkNStripB-strip; // AdC
1022     else strip--; // AdC
1023
1024     if (z<=0.) padx=AliTOFConstants::fgkNpadX-padx; // AdC
1025     else padx--; // AdC
1026
1027     if (plate==3 || plate==4) padz=AliTOFConstants::fgkNpadZ-padz; // AdC
1028     else padz--; // AdC
1029
1030     phi = pos.Phi();
1031     if (phi>=0.) phid = phi*kRaddeg; //+180.; // AdC
1032     else phid = phi*kRaddeg + 360.; // AdC
1033     sector = Int_t (phid/20.);
1034     //sector++;  // AdC
1035
1036     for(i=0;i<3;++i) {
1037       hits[i]   = pos[i];
1038       hits[i+3] = pm[i];
1039     }
1040
1041     hits[6] = mom.Rho();
1042     hits[7] = pos[3];
1043     hits[8] = xpad[0];
1044     hits[9] = xpad[1];
1045     hits[10]= xpad[2];
1046     hits[11]= incidenceAngle;
1047     hits[12]= gMC->Edep();
1048     
1049     vol[0]= sector;
1050     vol[1]= plate;
1051     vol[2]= strip;
1052     vol[3]= padx;
1053     vol[4]= padz;
1054
1055     AddHit(gAlice->GetCurrentTrackNumber(),vol, hits);
1056   }
1057 }
1058
1059
1060
1061
1062
1063