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