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