bc0b88bb67fd9b0ed2c02e6270f860126100dc73
[u/mrichter/AliRoot.git] / TOF / AliTOFv6T0.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 $Log$
18 Revision 1.9  2007/10/07 19:36:29  decaro
19 TOF materials and volumes description: update
20
21 Revision 1.8  2007/10/04 13:15:37  arcelli
22 updates to comply with AliTOFGeometryV5 becoming AliTOFGeometry
23
24 Revision 1.7  2007/10/03 18:07:26  arcelli
25 right handling of l2t matrices and alignable entries in case of TOF holes (Annalisa)
26
27 Revision 1.6  2007/10/03 10:41:16  arcelli
28 adding tracking-to-local matrices for new AliTOFcluster
29
30 Revision 1.5  2007/07/27 08:14:48  morsch
31 Write all track references into the same branch.
32
33 Revision 1.4  2007/05/29 16:51:05  decaro
34 Update of the front-end electronics and cooling system description
35
36 Revision 1.3.2  2007/05/29  decaro
37 FEA+cooling zone description: update
38      FEA+cooling orientation (side A/ side C) -> correction
39 Revision 1.3.1  2007/05/24  decaro
40 Change the FEA+cooling zone description:
41      - FCA1/FCA2, air boxes, contain:
42                  FFEA volume, G10 box,
43                  FAL1/FAL2/FAL3 volumes, aluminium boxes;
44      - FRO1/FRO2/FRO3/FRO4/FBAR, aluminum boxes;
45      - changed FTUB positions;
46
47 Revision 1.3  2007/05/04 14:05:42  decaro
48 Ineffective comment cleanup
49
50 Revision 1.2  2007/05/04 12:59:22  arcelli
51 Change the TOF SM paths for misalignment (one layer up)
52
53 Revision 1.1  2007/05/02 17:32:58  decaro
54 TOF geometry description as installed (G. Cara Romeo, A. De Caro)
55
56 Revision 0.1 2007 March G. Cara Romeo and A. De Caro
57         Implemented a more realistic TOF geometry description,
58         in terms of:
59            - material badget,
60            - services and front end electronics description,
61            - TOF crate readout modules
62              (added volume FTOS in ALIC_1/BBMO_1/BBCE_%i -for i=1,...,18-,
63               and in ALIC_1/BFMO_%i -for i=19,...,36- volumes)
64         As the 5th version in terms of geometrical positioning of volumes.
65
66 */
67
68 ///////////////////////////////////////////////////////////////////////////////
69 //                                                                           //
70 //  This class contains the functions for version 6 of the Time Of Flight    //
71 //  detector.                                                                //
72 //                                                                           //
73 //  VERSION WITH 6 MODULES AND TILTED STRIPS                                 //
74 //                                                                           //
75 //  FULL COVERAGE VERSION + OPTION for PHOS holes                            //
76 //                                                                           //
77 //                                                                           //
78 //Begin_Html                                                                 //
79 /*                                                                           //
80 <img src="picts/AliTOFv6T0Class.gif">                                        //
81 */                                                                           //
82 //End_Html                                                                   //
83 //                                                                           //
84 ///////////////////////////////////////////////////////////////////////////////
85
86 #include "TBRIK.h"
87 #include "TGeometry.h"
88 #include "TLorentzVector.h"
89 #include "TNode.h"
90 #include "TVirtualMC.h"
91 #include "TGeoManager.h"
92 #include <TGeoMatrix.h>
93 #include <TGeoPhysicalNode.h>
94 #include <TGeoVolume.h>
95
96 #include "AliConst.h"
97 #include "AliLog.h"
98 #include "AliMagF.h"
99 #include "AliMC.h"
100 #include "AliRun.h"
101 #include "AliTrackReference.h"
102
103 #include "AliTOFGeometry.h"
104 #include "AliTOFv6T0.h"
105
106 extern TDirectory *gDirectory;
107 extern TVirtualMC *gMC;
108 extern TGeoManager *gGeoManager;
109
110 extern AliRun *gAlice;
111
112 ClassImp(AliTOFv6T0)
113
114 const Float_t AliTOFv6T0::fgkModuleWallThickness   =   0.33; // cm
115 const Float_t AliTOFv6T0::fgkInterCentrModBorder1  =  49.5 ; // cm
116 const Float_t AliTOFv6T0::fgkInterCentrModBorder2  =  57.5 ; // cm
117 const Float_t AliTOFv6T0::fgkExterInterModBorder1  = 196.0 ; // cm
118 const Float_t AliTOFv6T0::fgkExterInterModBorder2  = 203.5 ; // cm
119 const Float_t AliTOFv6T0::fgkLengthInCeModBorder   =   4.7 ; // cm
120 const Float_t AliTOFv6T0::fgkLengthExInModBorder   =   7.0 ; // cm
121 const Float_t AliTOFv6T0::fgkModuleCoverThickness  =   2.0 ; // cm
122 const Float_t AliTOFv6T0::fgkFEAwidth1    = 19.0; // cm
123 const Float_t AliTOFv6T0::fgkFEAwidth2    = 38.5; // cm
124 const Float_t AliTOFv6T0::fgkSawThickness =  1.0; // cm
125 const Float_t AliTOFv6T0::fgkCBLw  = 13.5; // cm
126 const Float_t AliTOFv6T0::fgkCBLh1 =  2.0; // cm
127 const Float_t AliTOFv6T0::fgkCBLh2 = 12.3; // cm
128
129 //_____________________________________________________________________________
130   AliTOFv6T0::AliTOFv6T0():
131   fIdFTOA(-1),
132   fIdFTOB(-1),
133   fIdFTOC(-1),
134   fIdFLTA(-1),
135   fIdFLTB(-1),
136   fIdFLTC(-1),
137   fTOFHoles(kFALSE)
138 {
139   //
140   // Default constructor
141   //
142 }
143  
144 //_____________________________________________________________________________
145 AliTOFv6T0::AliTOFv6T0(const char *name, const char *title):
146   AliTOF(name,title,"tzero"),
147   fIdFTOA(-1),
148   fIdFTOB(-1),
149   fIdFTOC(-1),
150   fIdFLTA(-1),
151   fIdFLTB(-1),
152   fIdFLTC(-1),
153   fTOFHoles(kFALSE)
154 {
155   //
156   // Standard constructor
157   //
158   //
159   // Check that FRAME is there otherwise we have no place where to
160   // put TOF
161
162
163   AliModule* frame = (AliModule*)gAlice->GetModule("FRAME");
164   if(!frame) {
165     AliFatal("TOF needs FRAME to be present");
166   } else{
167     
168     if (fTOFGeometry) delete fTOFGeometry;
169     fTOFGeometry = new AliTOFGeometry();
170
171     if(frame->IsVersion()==1) {
172       AliDebug(1,Form("Frame version %d", frame->IsVersion())); 
173       AliDebug(1,"Full Coverage for TOF");
174       fTOFHoles=false;}    
175     else {
176       AliDebug(1,Form("Frame version %d", frame->IsVersion())); 
177       AliDebug(1,"TOF with Holes for PHOS");
178       fTOFHoles=true;}      
179   }
180   fTOFGeometry->SetHoles(fTOFHoles);
181
182   //AliTOF::fTOFGeometry = fTOFGeometry;
183
184   // Save the geometry
185   TDirectory* saveDir = gDirectory;
186   gAlice->GetRunLoader()->CdGAFile();
187   fTOFGeometry->Write("TOFgeometry");
188   saveDir->cd();
189
190
191
192 //_____________________________________________________________________________
193 void AliTOFv6T0::AddAlignableVolumes() const
194 {
195   //
196   // Create entries for alignable volumes associating the symbolic volume
197   // name with the corresponding volume path. Needs to be syncronized with
198   // eventual changes in the geometry.
199   //
200
201   TString volPath;
202   TString symName;
203
204   TString vpL0  = "ALIC_1/B077_1/BSEGMO";
205   TString vpL1 = "_1/BTOF";
206   TString vpL2 = "_1";
207   TString vpL3 = "/FTOA_0";
208   TString vpL4 = "/FLTA_0/FSTR_";
209
210   TString snSM  = "TOF/sm";
211   TString snSTRIP = "/strip";
212
213   Int_t nSectors=fTOFGeometry->NSectors();
214   Int_t nStrips =fTOFGeometry->NStripA()+
215                  2*fTOFGeometry->NStripB()+
216                  2*fTOFGeometry->NStripC();
217
218   //
219   // The TOF MRPC Strips
220   // The symbolic names are: TOF/sm00/strip01
221   //                           ...
222   //                         TOF/sm17/strip91
223  
224   Int_t imod=0;
225
226   for (Int_t isect = 0; isect < nSectors; isect++) {
227     for (Int_t istr = 1; istr <= nStrips; istr++) {
228
229       if (fTOFSectors[isect]==-1) continue;
230
231       if (fTOFHoles && (isect==11 || isect==12)) {
232         if (istr<39) {
233           vpL3 = "/FTOB_0";
234           vpL4 = "/FLTB_0/FSTR_";
235         }
236         else if (istr>53) {
237           vpL3 = "/FTOC_0";
238           vpL4 = "/FLTC_0/FSTR_";
239         }
240         else continue;
241       }
242       else {
243         vpL3 = "/FTOA_0";
244         vpL4 = "/FLTA_0/FSTR_";
245       }
246
247       volPath  = vpL0;
248       volPath += isect;
249       volPath += vpL1;
250       volPath += isect;
251       volPath += vpL2;
252       volPath += vpL3;
253       volPath += vpL4;
254       volPath += istr;
255
256       
257       symName  = snSM;
258       symName += Form("%02d",isect);
259       symName += snSTRIP;
260       symName += Form("%02d",istr);
261             
262       AliDebug(2,"--------------------------------------------"); 
263       AliDebug(2,Form("Alignable object %d", imod)); 
264       AliDebug(2,Form("volPath=%s\n",volPath.Data()));
265       AliDebug(2,Form("symName=%s\n",symName.Data()));
266       AliDebug(2,"--------------------------------------------"); 
267               
268       gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data());
269
270       //T2L matrices for alignment
271       TGeoPNEntry *e = gGeoManager->GetAlignableEntry(symName.Data());
272       if (e) {
273         const char *path = e->GetTitle();
274         if (!gGeoManager->cd(path)) {
275           AliFatal(Form("Volume path %s not valid!",path));
276         }
277         TGeoHMatrix *globMatrix = gGeoManager->GetCurrentMatrix();
278         Double_t phi = 20.0 * (isect % 18) + 10.0;
279         TGeoHMatrix *t2l  = new TGeoHMatrix();
280         t2l->RotateZ(phi);
281         t2l->MultiplyLeft(&(globMatrix->Inverse()));
282         e->SetMatrix(t2l);
283       }
284       else {
285         AliError(Form("Alignable entry %s is not valid!",symName.Data()));
286       }
287
288       imod++;
289     }
290   }
291
292
293   //
294   // The TOF supermodules
295   // The symbolic names are: TOF/sm00
296   //                           ...
297   //                         TOF/sm17
298   //
299   for (Int_t isect = 0; isect < nSectors; isect++) {
300
301     volPath  = vpL0;
302     volPath += isect;
303     volPath += vpL1;
304     volPath += isect;
305     volPath += vpL2;
306
307     symName  = snSM;
308     symName += Form("%02d",isect);
309
310       AliDebug(2,"--------------------------------------------"); 
311       AliDebug(2,Form("Alignable object %d", isect+imod)); 
312       AliDebug(2,Form("volPath=%s\n",volPath.Data()));
313       AliDebug(2,Form("symName=%s\n",symName.Data()));
314       AliDebug(2,"--------------------------------------------"); 
315               
316     gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data());
317
318   }
319   
320 }
321 //____________________________________________________________________________
322 void AliTOFv6T0::BuildGeometry()
323 {
324   //
325   // Build TOF ROOT geometry for the ALICE event display
326   //
327   TNode *node, *top;
328   const int kColorTOF  = 27;
329   
330   TGeometry *globalGeometry = (TGeometry*)gAlice->GetGeometry();
331
332   // Find top TNODE
333   top = globalGeometry->GetNode("alice");
334   
335   // Position the different copies
336   const Float_t krTof  =(fTOFGeometry->Rmax()+fTOFGeometry->Rmin())/2.;
337   const Float_t khTof  = fTOFGeometry->Rmax()-fTOFGeometry->Rmin();
338   const Int_t   kNTof  = fTOFGeometry->NSectors();
339   const Float_t kangle = k2PI/kNTof;
340
341   //const Float_t fgkInterCentrModBorder1 = 49.5;
342   //const Float_t fgkInterCentrModBorder2 = 57.5;
343
344   Float_t ang;
345   
346   // define offset for nodes
347   Float_t zOffsetB = (fTOFGeometry->ZlenA()*0.5 + (fgkInterCentrModBorder1+fgkInterCentrModBorder2)*0.5)*0.5;
348   Float_t zOffsetA = 0.;
349   // Define TOF basic volume
350   
351   char nodeName0[16], nodeName1[16], nodeName2[16];
352   char nodeName3[16], nodeName4[16], rotMatNum[16];
353
354   if (fTOFHoles) {
355     new TBRIK("S_TOF_B","TOF box","void",
356               fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenB()*0.5);
357     new TBRIK("S_TOF_C","TOF box","void",
358               fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenB()*0.5);
359   }
360   new TBRIK("S_TOF_A","TOF box","void",
361             fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenA()*0.5);
362   
363   for (Int_t nodeNum=1;nodeNum<kNTof+1;nodeNum++){
364     
365     if (nodeNum<10) {
366       sprintf(rotMatNum,"rot50%i",nodeNum);
367       sprintf(nodeName0,"FTO00%i",nodeNum);
368       sprintf(nodeName1,"FTO10%i",nodeNum);
369       sprintf(nodeName2,"FTO20%i",nodeNum);
370       sprintf(nodeName3,"FTO30%i",nodeNum);
371       sprintf(nodeName4,"FTO40%i",nodeNum);
372     }
373     if (nodeNum>9) {
374       sprintf(rotMatNum,"rot5%i",nodeNum);
375       sprintf(nodeName0,"FTO0%i",nodeNum);
376       sprintf(nodeName1,"FTO1%i",nodeNum);
377       sprintf(nodeName2,"FTO2%i",nodeNum);
378       sprintf(nodeName3,"FTO3%i",nodeNum);
379       sprintf(nodeName4,"FTO4%i",nodeNum);
380     }
381     
382     new TRotMatrix(rotMatNum,rotMatNum,90,-20*nodeNum,90,90-20*nodeNum,0,0);
383     ang = (4.5-nodeNum) * kangle;
384
385     if (fTOFHoles) {   
386       top->cd();
387       node = new TNode(nodeName2,nodeName2,"S_TOF_B", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang), zOffsetB,rotMatNum);
388       node->SetLineColor(kColorTOF);
389       fNodes->Add(node);
390       
391       top->cd();
392       node = new TNode(nodeName3,nodeName3,"S_TOF_C", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
393       node->SetLineColor(kColorTOF);
394       fNodes->Add(node);
395     }
396
397     top->cd();
398     node = new TNode(nodeName4,nodeName4,"S_TOF_A", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang), zOffsetA,rotMatNum);
399     node->SetLineColor(kColorTOF);
400     fNodes->Add(node);
401   } // end loop on nodeNum
402
403 }
404
405 //_____________________________________________________________________________
406 void AliTOFv6T0::CreateGeometry()
407 {
408   //
409   // Create geometry for Time Of Flight version 0
410   //
411   //Begin_Html
412   /*
413     <img src="picts/AliTOFv6T0.gif">
414   */
415   //End_Html
416   //
417   // Creates common geometry
418   //
419   AliTOF::CreateGeometry();
420 }
421  
422
423 //_____________________________________________________________________________
424 void AliTOFv6T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenA)
425 {
426   //
427   // Definition of the Time Of Fligh Resistive Plate Chambers
428   //
429
430   // module wall thickness (cm)
431   //const Float_t fgkModuleWallThickness = 0.33;
432
433   AliDebug(1, "************************* TOF geometry **************************");
434   AliDebug(1,Form(" xtof   %d",  xtof));
435   AliDebug(1,Form(" ytof   %d",  ytof));
436   AliDebug(1,Form(" zlenA   %d", zlenA));
437   AliDebug(2,Form(" zlenA*0.5 = %d", zlenA*0.5));
438
439   Float_t xFLT, yFLT, zFLTA;
440   xFLT  = xtof     - 2.*fgkModuleWallThickness;
441   yFLT  = ytof*0.5 -    fgkModuleWallThickness;
442   zFLTA = zlenA    - 2.*fgkModuleWallThickness;
443
444   CreateModules(xtof, ytof, zlenA, xFLT, yFLT, zFLTA);
445   MakeStripsInModules(ytof, zlenA);
446
447   CreateModuleCovers(xtof, zlenA);
448
449   CreateBackZone(xtof, ytof, zlenA);
450   MakeFrontEndElectronics();
451   MakeFEACooling(xtof, ytof, zlenA);
452   MakeNinoMask(xtof, ytof, zlenA);
453   MakeSuperModuleCooling(xtof, ytof, zlenA);
454   MakeSuperModuleServices(xtof, ytof, zlenA);
455
456   MakeModulesInBTOFvolumes(ytof, zlenA);
457   MakeCoversInBTOFvolumes();
458   MakeBackInBTOFvolumes(ytof);
459
460   MakeReadoutCrates(ytof);
461
462 }
463
464 //_____________________________________________________________________________
465 void AliTOFv6T0::CreateModules(Float_t xtof,  Float_t ytof, Float_t zlenA,
466                                Float_t xFLT,  Float_t yFLT, Float_t zFLTA) const
467 {
468   //
469   // Create supermodule volume
470   // and wall volumes to separate 5 modules
471   //
472
473   const Float_t kPi = TMath::Pi();
474
475   //const Float_t fgkInterCentrModBorder1 = 49.5;
476   //const Float_t fgkInterCentrModBorder2 = 57.5;
477   //const Float_t fgkExterInterModBorder1 = 196.0;
478   //const Float_t fgkExterInterModBorder2 = 203.5;
479
480   //const Float_t fgkLengthExInModBorder  = 4.7;
481   //const Float_t fgkLengthInCeModBorder  = 7.0;
482
483   // module wall thickness (cm)
484   //const Float_t fgkModuleWallThickness = 0.33;
485
486   // Definition of the of fibre glass modules (FTOA, FTOB and FTOC)
487
488   Int_t *idtmed = fIdtmed->GetArray()-499;
489
490   Int_t idrotm[8];
491
492   Float_t  par[3];
493   par[0] = xtof * 0.5;
494   par[1] = ytof * 0.25;
495   par[2] = zlenA * 0.5;
496   gMC->Gsvolu("FTOA", "BOX ", idtmed[503], par, 3);  // Fibre glass
497
498   if (fTOFHoles) {
499     par[0] =  xtof * 0.5;
500     par[1] =  ytof * 0.25;
501     par[2] = (zlenA*0.5 - fgkInterCentrModBorder1)*0.5;
502     gMC->Gsvolu("FTOB", "BOX ", idtmed[503], par, 3);  // Fibre glass
503     gMC->Gsvolu("FTOC", "BOX ", idtmed[503], par, 3);  // Fibre glass
504   }
505
506
507   // Definition and positioning
508   // of the not sensitive volumes with Insensitive Freon (FLTA, FLTB and FLTC)
509
510   par[0] = xFLT*0.5;
511   par[1] = yFLT*0.5;
512   par[2] = zFLTA*0.5;
513   gMC->Gsvolu("FLTA", "BOX ", idtmed[506], par, 3); // Freon mix
514
515   Float_t xcoor, ycoor, zcoor;
516   xcoor = 0.;
517   ycoor = fgkModuleWallThickness*0.5;
518   zcoor = 0.;
519   gMC->Gspos ("FLTA", 0, "FTOA", xcoor, ycoor, zcoor, 0, "ONLY");
520
521   if (fTOFHoles) {
522     par[2] = (zlenA*0.5 - 2.*fgkModuleWallThickness - fgkInterCentrModBorder1)*0.5;
523     gMC->Gsvolu("FLTB", "BOX ", idtmed[506], par, 3); // Freon mix
524     gMC->Gsvolu("FLTC", "BOX ", idtmed[506], par, 3); // Freon mix
525
526     //xcoor = 0.;
527     //ycoor = fgkModuleWallThickness*0.5;
528     zcoor = fgkModuleWallThickness;
529     gMC->Gspos ("FLTB", 0, "FTOB", xcoor, ycoor, zcoor, 0, "ONLY");
530     gMC->Gspos ("FLTC", 0, "FTOC", xcoor, ycoor,-zcoor, 0, "ONLY");
531   }
532
533   // Definition and positioning
534   // of the fibre glass walls between central and intermediate modules (FWZ1 and FWZ2)
535
536   Float_t alpha, tgal, beta, tgbe, trpa[11];
537   tgal  = (yFLT - 2.*fgkLengthInCeModBorder)/(fgkInterCentrModBorder2 - fgkInterCentrModBorder1);
538   alpha = TMath::ATan(tgal);
539   beta  = (kPi*0.5 - alpha)*0.5;
540   tgbe  = TMath::Tan(beta);
541   trpa[0]  = xFLT*0.5;
542   trpa[1]  = 0.;
543   trpa[2]  = 0.;
544   trpa[3]  = 2.*fgkModuleWallThickness;
545   trpa[4]  = (fgkLengthInCeModBorder - 2.*fgkModuleWallThickness*tgbe)*0.5;
546   trpa[5]  = (fgkLengthInCeModBorder + 2.*fgkModuleWallThickness*tgbe)*0.5;
547   trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
548   trpa[7]  = 2.*fgkModuleWallThickness;
549   trpa[8]  = (fgkLengthInCeModBorder - 2.*fgkModuleWallThickness*tgbe)*0.5;
550   trpa[9]  = (fgkLengthInCeModBorder + 2.*fgkModuleWallThickness*tgbe)*0.5;
551   trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
552   gMC->Gsvolu("FWZ1","TRAP", idtmed[503], trpa, 11); // Fibre glass
553
554   AliMatrix (idrotm[0],90., 90.,180.,0.,90.,180.);
555   AliMatrix (idrotm[1],90., 90.,  0.,0.,90.,  0.);
556
557   //xcoor = 0.;
558   ycoor = -(yFLT - fgkLengthInCeModBorder)*0.5;
559   zcoor = fgkInterCentrModBorder1;
560   gMC->Gspos("FWZ1", 1,"FLTA", xcoor, ycoor, zcoor,idrotm[0],"ONLY");
561   gMC->Gspos("FWZ1", 2,"FLTA", xcoor, ycoor,-zcoor,idrotm[1],"ONLY");
562
563   Float_t y0B, ycoorB, zcoorB;
564
565   if (fTOFHoles) {
566     y0B = fgkLengthInCeModBorder - fgkModuleWallThickness*tgbe;
567     trpa[0]  = xFLT*0.5;
568     trpa[1]  = 0.;
569     trpa[2]  = 0.;
570     trpa[3]  = fgkModuleWallThickness;
571     trpa[4]  = (y0B - fgkModuleWallThickness*tgbe)*0.5;
572     trpa[5]  = (y0B + fgkModuleWallThickness*tgbe)*0.5;
573     trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
574     trpa[7]  = fgkModuleWallThickness;
575     trpa[8]  = (y0B - fgkModuleWallThickness*tgbe)*0.5;
576     trpa[9]  = (y0B + fgkModuleWallThickness*tgbe)*0.5;
577     trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
578     //xcoor = 0.;
579     ycoorB = ycoor - fgkModuleWallThickness*0.5*tgbe;
580     zcoorB = (zlenA*0.5 - 2.*fgkModuleWallThickness - fgkInterCentrModBorder1)*0.5 - 2.*fgkModuleWallThickness;
581     gMC->Gsvolu("FWZA","TRAP", idtmed[503], trpa, 11); // Fibre glass
582     gMC->Gspos("FWZA", 1,"FLTB", xcoor, ycoorB, zcoorB,idrotm[1],"ONLY");
583     gMC->Gspos("FWZA", 2,"FLTC", xcoor, ycoorB,-zcoorB,idrotm[0],"ONLY");
584   }
585
586   AliMatrix (idrotm[2],90.,270.,  0.,0.,90.,180.);
587   AliMatrix (idrotm[3],90.,270.,180.,0.,90.,  0.);
588
589   //xcoor = 0.;
590   ycoor = (yFLT - fgkLengthInCeModBorder)*0.5;
591   zcoor = fgkInterCentrModBorder2;
592   gMC->Gspos("FWZ1", 3,"FLTA", xcoor, ycoor, zcoor,idrotm[2],"ONLY");
593   gMC->Gspos("FWZ1", 4,"FLTA", xcoor, ycoor,-zcoor,idrotm[3],"ONLY");
594
595   if (fTOFHoles) {
596     y0B = fgkLengthInCeModBorder + fgkModuleWallThickness*tgbe;
597     trpa[0]  = xFLT*0.5;
598     trpa[1]  = 0.;
599     trpa[2]  = 0.;
600     trpa[3]  = fgkModuleWallThickness;
601     trpa[4]  = (y0B - fgkModuleWallThickness*tgbe)*0.5;
602     trpa[5]  = (y0B + fgkModuleWallThickness*tgbe)*0.5;
603     trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
604     trpa[7]  = fgkModuleWallThickness;
605     trpa[8]  = (y0B - fgkModuleWallThickness*tgbe)*0.5;
606     trpa[9]  = (y0B + fgkModuleWallThickness*tgbe)*0.5;
607     trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
608     gMC->Gsvolu("FWZB","TRAP", idtmed[503], trpa, 11); // Fibre glass
609     //xcoor = 0.;
610     ycoorB = ycoor - fgkModuleWallThickness*0.5*tgbe;
611     zcoorB = (zlenA*0.5 - 2.*fgkModuleWallThickness - fgkInterCentrModBorder1)*0.5 -
612       (fgkInterCentrModBorder2 - fgkInterCentrModBorder1) - 2.*fgkModuleWallThickness;
613     gMC->Gspos("FWZB", 1,"FLTB", xcoor, ycoorB, zcoorB,idrotm[3],"ONLY");
614     gMC->Gspos("FWZB", 2,"FLTC", xcoor, ycoorB,-zcoorB,idrotm[2],"ONLY");
615   }
616
617   trpa[0] = 0.5*(fgkInterCentrModBorder2 - fgkInterCentrModBorder1)/TMath::Cos(alpha);
618   trpa[1] = 2.*fgkModuleWallThickness;
619   trpa[2] = xFLT*0.5;
620   trpa[3] = -beta*kRaddeg;
621   trpa[4] = 0.;
622   trpa[5] = 0.;
623   gMC->Gsvolu("FWZ2","PARA", idtmed[503], trpa, 6); // Fibre glass
624
625   AliMatrix (idrotm[4],     alpha*kRaddeg,90.,90.+alpha*kRaddeg,90.,90.,180.);
626   AliMatrix (idrotm[5],180.-alpha*kRaddeg,90.,90.-alpha*kRaddeg,90.,90.,  0.);
627
628   //xcoor = 0.;
629   ycoor = 0.;
630   zcoor = (fgkInterCentrModBorder2 + fgkInterCentrModBorder1)*0.5;
631   gMC->Gspos("FWZ2", 1,"FLTA", xcoor, ycoor, zcoor,idrotm[4],"ONLY");
632   gMC->Gspos("FWZ2", 2,"FLTA", xcoor, ycoor,-zcoor,idrotm[5],"ONLY");
633
634   if (fTOFHoles) {
635     trpa[0] = 0.5*(fgkInterCentrModBorder2 - fgkInterCentrModBorder1)/TMath::Cos(alpha);
636     trpa[1] = fgkModuleWallThickness;
637     trpa[2] = xFLT*0.5;
638     trpa[3] = -beta*kRaddeg;
639     trpa[4] = 0.;
640     trpa[5] = 0.;
641     gMC->Gsvolu("FWZC","PARA", idtmed[503], trpa, 6); // Fibre glass
642     //xcoor = 0.;
643     ycoorB = ycoor - fgkModuleWallThickness*tgbe;
644     zcoorB = (zlenA*0.5 - 2.*fgkModuleWallThickness - fgkInterCentrModBorder1)*0.5 -
645       (fgkInterCentrModBorder2 - fgkInterCentrModBorder1)*0.5 - 2.*fgkModuleWallThickness;
646     gMC->Gspos("FWZC", 1,"FLTB", xcoor, ycoorB, zcoorB, idrotm[5],"ONLY");
647     gMC->Gspos("FWZC", 2,"FLTC", xcoor, ycoorB,-zcoorB, idrotm[4],"ONLY");
648   }
649
650
651   // Definition and positioning
652   // of the fibre glass walls between intermediate and lateral modules (FWZ3 and FWZ4)
653
654   tgal  = (yFLT - 2.*fgkLengthExInModBorder)/(fgkExterInterModBorder2 - fgkExterInterModBorder1);
655   alpha = TMath::ATan(tgal);
656   beta  = (kPi*0.5 - alpha)*0.5;
657   tgbe  = TMath::Tan(beta);
658   trpa[0]  = xFLT*0.5;
659   trpa[1]  = 0.;
660   trpa[2]  = 0.;
661   trpa[3]  = 2.*fgkModuleWallThickness;
662   trpa[4]  = (fgkLengthExInModBorder - 2.*fgkModuleWallThickness*tgbe)*0.5;
663   trpa[5]  = (fgkLengthExInModBorder + 2.*fgkModuleWallThickness*tgbe)*0.5;
664   trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
665   trpa[7]  = 2.*fgkModuleWallThickness;
666   trpa[8]  = (fgkLengthExInModBorder - 2.*fgkModuleWallThickness*tgbe)*0.5;
667   trpa[9]  = (fgkLengthExInModBorder + 2.*fgkModuleWallThickness*tgbe)*0.5;
668   trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
669   gMC->Gsvolu("FWZ3","TRAP", idtmed[503], trpa, 11); // Fibre glass
670
671   //xcoor = 0.;
672   ycoor = (yFLT - fgkLengthExInModBorder)*0.5;
673   zcoor = fgkExterInterModBorder1;
674   gMC->Gspos("FWZ3", 1,"FLTA", xcoor, ycoor, zcoor,idrotm[3],"ONLY");
675   gMC->Gspos("FWZ3", 2,"FLTA", xcoor, ycoor,-zcoor,idrotm[2],"ONLY");
676
677   if (fTOFHoles) {
678     //xcoor = 0.;
679     //ycoor = (yFLT - fgkLengthExInModBorder)*0.5;
680     zcoor = -fgkExterInterModBorder1 + (zlenA*0.5 + fgkInterCentrModBorder1 - 2.*fgkModuleWallThickness)*0.5;
681     gMC->Gspos("FWZ3", 5,"FLTB", xcoor, ycoor, zcoor,idrotm[2],"ONLY");
682     gMC->Gspos("FWZ3", 6,"FLTC", xcoor, ycoor,-zcoor,idrotm[3],"ONLY");
683   }
684
685   //xcoor = 0.;
686   ycoor = -(yFLT - fgkLengthExInModBorder)*0.5;
687   zcoor = fgkExterInterModBorder2;
688   gMC->Gspos("FWZ3", 3,"FLTA", xcoor, ycoor, zcoor,idrotm[1],"ONLY");
689   gMC->Gspos("FWZ3", 4,"FLTA", xcoor, ycoor,-zcoor,idrotm[0],"ONLY");
690
691   if (fTOFHoles) {
692     //xcoor = 0.;
693     //ycoor = -(yFLT - fgkLengthExInModBorder)*0.5;
694     zcoor = -fgkExterInterModBorder2 + (zlenA*0.5 + fgkInterCentrModBorder1 - 2.*fgkModuleWallThickness)*0.5;
695     gMC->Gspos("FWZ3", 7,"FLTB", xcoor, ycoor, zcoor,idrotm[0],"ONLY");
696     gMC->Gspos("FWZ3", 8,"FLTC", xcoor, ycoor,-zcoor,idrotm[1],"ONLY");
697   }
698
699   trpa[0] = 0.5*(fgkExterInterModBorder2 - fgkExterInterModBorder1)/TMath::Cos(alpha);
700   trpa[1] = 2.*fgkModuleWallThickness;
701   trpa[2] = xFLT*0.5;
702   trpa[3] = -beta*kRaddeg;
703   trpa[4] = 0.;
704   trpa[5] = 0.;
705   gMC->Gsvolu("FWZ4","PARA", idtmed[503], trpa, 6); // Fibre glass
706
707   AliMatrix (idrotm[6],alpha*kRaddeg,90.,90.+alpha*kRaddeg,90.,90.,180.);
708   AliMatrix (idrotm[7],180.-alpha*kRaddeg,90.,90.-alpha*kRaddeg,90.,90.,0.);
709
710   //xcoor = 0.;
711   ycoor = 0.;
712   zcoor = (fgkExterInterModBorder2 + fgkExterInterModBorder1)*0.5;
713   gMC->Gspos("FWZ4", 1,"FLTA", xcoor, ycoor, zcoor,idrotm[7],"ONLY");
714   gMC->Gspos("FWZ4", 2,"FLTA", xcoor, ycoor,-zcoor,idrotm[6],"ONLY");
715
716   if (fTOFHoles) {
717     //xcoor = 0.;
718     //ycoor = 0.;
719     zcoor = -(fgkExterInterModBorder2 + fgkExterInterModBorder1)*0.5 +
720       (zlenA*0.5 + fgkInterCentrModBorder1 - 2.*fgkModuleWallThickness)*0.5;
721     gMC->Gspos("FWZ4", 3,"FLTB", xcoor, ycoor, zcoor,idrotm[6],"ONLY");
722     gMC->Gspos("FWZ4", 4,"FLTC", xcoor, ycoor,-zcoor,idrotm[7],"ONLY");
723   }
724
725 }
726
727 //_____________________________________________________________________________
728 void AliTOFv6T0::CreateModuleCovers(Float_t xtof, Float_t zlenA) const
729 {
730   //
731   // Create covers for module:
732   //   per each module zone, defined according to
733   //   fgkInterCentrModBorder2, fgkExterInterModBorder1 and zlenA+2 values,
734   //   there is a CORNICE of thickness 2cm in Al
735   //   and the contained zones in honeycomb of Al.
736   //   There is also an interface layer (1.6mm thichness)
737   //   and plastic and Cu corresponding to the flat cables.
738   //
739
740   // module cover between strips and cards (cm)
741   //const Float_t fgkModuleCoverThickness = 2.;
742
743   //const Float_t fgkInterCentrModBorder2 = 57.5;
744   //const Float_t fgkExterInterModBorder1 = 196.0;
745
746   Int_t  *idtmed = fIdtmed->GetArray()-499;
747
748   Float_t par[3];
749   par[0] = xtof*0.5 + 2.;
750   par[1] = fgkModuleCoverThickness*0.5;
751   par[2] = zlenA*0.5 + 2.;
752   gMC->Gsvolu("FPEA", "BOX ", idtmed[500], par, 3); // Air
753   if (fTOFHoles) gMC->Gsvolu("FPEB", "BOX ", idtmed[500], par, 3); // Air
754
755   const Float_t kAlCoverThickness = 1.5;
756   const Float_t kInterfaceCardThickness = 0.16;
757   const Float_t kAlSkinThickness = 0.1;
758
759   //par[0] = xtof*0.5 + 2.;
760   par[1] = kAlCoverThickness*0.5;
761   //par[2] = zlenA*0.5 + 2.;
762   gMC->Gsvolu("FALT", "BOX ", idtmed[504], par, 3); // Al
763   if (fTOFHoles) gMC->Gsvolu("FALB", "BOX ", idtmed[504], par, 3); // Al
764   Float_t  xcoor, ycoor, zcoor;
765   xcoor = 0.;
766   ycoor = 0.;
767   zcoor = 0.;
768   gMC->Gspos("FALT", 0, "FPEA", xcoor, ycoor, zcoor, 0, "ONLY");
769   if (fTOFHoles) gMC->Gspos("FALB", 0, "FPEB", xcoor, ycoor, zcoor, 0, "ONLY");
770
771   par[0] = xtof*0.5;
772   //par[1] = kAlCoverThickness*0.5;
773   par[2] = fgkInterCentrModBorder2 - 2.;
774   gMC->Gsvolu("FPE1", "BOX ", idtmed[505], par, 3); // Al honeycomb
775   //xcoor = 0.;
776   //ycoor = 0.;
777   //zcoor = 0.;
778   gMC->Gspos("FPE1", 0, "FALT", xcoor, ycoor, zcoor, 0, "ONLY");
779
780   if (fTOFHoles) {
781     //par[0] = xtof*0.5;
782     par[1] = kAlCoverThickness*0.5 - kAlSkinThickness;
783     //par[2] = fgkInterCentrModBorder2 - 2.;
784     gMC->Gsvolu("FPE4", "BOX ", idtmed[515], par, 3); // Al honeycomb for holes
785     //xcoor = 0.;
786     //ycoor = 0.;
787     //zcoor = 0.;
788     gMC->Gspos("FPE4", 0, "FALB", xcoor, ycoor, zcoor, 0, "ONLY");
789   }
790
791   //par[0] = xtof*0.5;
792   //par[1] = kAlCoverThickness*0.5;
793   par[2] = (fgkExterInterModBorder1 - fgkInterCentrModBorder2)*0.5 - 2.;
794   gMC->Gsvolu("FPE2", "BOX ", idtmed[505], par, 3); // Al honeycomb
795   //xcoor = 0.;
796   //ycoor = 0.;
797   zcoor = (fgkExterInterModBorder1 + fgkInterCentrModBorder2)*0.5;
798   gMC->Gspos("FPE2", 1, "FALT", xcoor, ycoor, zcoor, 0, "ONLY");
799   gMC->Gspos("FPE2", 2, "FALT", xcoor, ycoor,-zcoor, 0, "ONLY");
800
801   if (fTOFHoles) {
802     //xcoor = 0.;
803     //ycoor = 0.;
804     //zcoor = (fgkExterInterModBorder1 + fgkInterCentrModBorder2)*0.5;
805     gMC->Gspos("FPE2", 1, "FALB", xcoor, ycoor, zcoor, 0, "ONLY");
806     gMC->Gspos("FPE2", 2, "FALB", xcoor, ycoor,-zcoor, 0, "ONLY");
807   }
808
809   //par[0] = xtof*0.5;
810   //par[1] = kAlCoverThickness*0.5;
811   par[2] = (zlenA*0.5 + 2. - fgkExterInterModBorder1)*0.5 - 2.;
812   gMC->Gsvolu("FPE3", "BOX ", idtmed[505], par, 3); // Al honeycomb
813   //xcoor = 0.;
814   //ycoor = 0.;
815   zcoor = (zlenA*0.5 + 2. + fgkExterInterModBorder1)*0.5;
816   gMC->Gspos("FPE3", 1, "FALT", xcoor, ycoor, zcoor, 0, "ONLY");
817   gMC->Gspos("FPE3", 2, "FALT", xcoor, ycoor,-zcoor, 0, "ONLY");
818
819   if (fTOFHoles) {
820     //xcoor = 0.;
821     //ycoor = 0.;
822     zcoor = (zlenA*0.5 + 2. + fgkExterInterModBorder1)*0.5;
823     gMC->Gspos("FPE3", 1, "FALB", xcoor, ycoor, zcoor, 0, "ONLY");
824     gMC->Gspos("FPE3", 2, "FALB", xcoor, ycoor,-zcoor, 0, "ONLY");
825   }
826
827   // volumes for Interface cards
828   par[0] = xtof*0.5;
829   par[1] = kInterfaceCardThickness*0.5;
830   par[2] = fgkInterCentrModBorder2 - 2.;
831   gMC->Gsvolu("FIF1", "BOX ", idtmed[502], par, 3); // G10
832   //xcoor = 0.;
833   ycoor = kAlCoverThickness*0.5 + kInterfaceCardThickness*0.5;
834   zcoor = 0.;
835   gMC->Gspos("FIF1", 0, "FPEA", xcoor, ycoor, zcoor, 0, "ONLY");
836
837   //par[0] = xtof*0.5;
838   //par[1] = kInterfaceCardThickness*0.5;
839   par[2] = (fgkExterInterModBorder1 - fgkInterCentrModBorder2)*0.5 - 2.;
840   gMC->Gsvolu("FIF2", "BOX ", idtmed[502], par, 3); // G10
841   //xcoor = 0.;
842   //ycoor = kAlCoverThickness*0.5 + kInterfaceCardThickness*0.5;
843   zcoor = (fgkExterInterModBorder1 + fgkInterCentrModBorder2)*0.5;
844   gMC->Gspos("FIF2", 1, "FPEA", xcoor, ycoor, zcoor, 0, "ONLY");
845   gMC->Gspos("FIF2", 2, "FPEA", xcoor, ycoor,-zcoor, 0, "ONLY");
846   if (fTOFHoles) {
847     gMC->Gspos("FIF2", 1, "FPEB", xcoor, ycoor, zcoor, 0, "ONLY");
848     gMC->Gspos("FIF2", 2, "FPEB", xcoor, ycoor,-zcoor, 0, "ONLY");
849   }
850
851   //par[0] = xtof*0.5;
852   //par[1] = kInterfaceCardThickness*0.5;
853   par[2] = (zlenA*0.5 + 2. - fgkExterInterModBorder1)*0.5 - 2.;
854   gMC->Gsvolu("FIF3", "BOX ", idtmed[502], par, 3); // G10
855   //xcoor = 0.;
856   //ycoor = kAlCoverThickness*0.5 + kInterfaceCardThickness*0.5;
857   zcoor = (zlenA*0.5 + 2. + fgkExterInterModBorder1)*0.5;
858   gMC->Gspos("FIF3", 1, "FPEA", xcoor, ycoor, zcoor, 0, "ONLY");
859   gMC->Gspos("FIF3", 2, "FPEA", xcoor, ycoor,-zcoor, 0, "ONLY");
860   if (fTOFHoles) {
861     gMC->Gspos("FIF3", 1, "FPEB", xcoor, ycoor, zcoor, 0, "ONLY");
862     gMC->Gspos("FIF3", 2, "FPEB", xcoor, ycoor,-zcoor, 0, "ONLY");
863   }
864
865   // volumes for flat cables
866   // plastic
867   const Float_t kPlasticFlatCableThickness = 0.24;
868   par[0] = xtof*0.5;
869   par[1] = kPlasticFlatCableThickness*0.5;
870   par[2] = fgkInterCentrModBorder2 - 2.;
871   gMC->Gsvolu("FFC1", "BOX ", idtmed[513], par, 3); // Plastic (CH2)
872   //xcoor = 0.;
873   ycoor = -kAlCoverThickness*0.5 - kPlasticFlatCableThickness*0.5;
874   zcoor = 0.;
875   gMC->Gspos("FFC1", 0, "FPEA", xcoor, ycoor, zcoor, 0, "ONLY");
876
877   //par[0] = xtof*0.5;
878   //par[1] = kPlasticFlatCableThickness*0.5;
879   par[2] = (fgkExterInterModBorder1 - fgkInterCentrModBorder2)*0.5 - 2.;
880   gMC->Gsvolu("FFC2", "BOX ", idtmed[513], par, 3); // Plastic (CH2)
881   //xcoor = 0.;
882   //ycoor = -kAlCoverThickness*0.5 - kPlasticFlatCableThickness*0.5;
883   zcoor = (fgkExterInterModBorder1 + fgkInterCentrModBorder2)*0.5;
884   gMC->Gspos("FFC2", 1, "FPEA", xcoor, ycoor, zcoor, 0, "ONLY");
885   gMC->Gspos("FFC2", 2, "FPEA", xcoor, ycoor,-zcoor, 0, "ONLY");
886   if (fTOFHoles) {
887     gMC->Gspos("FFC2", 1, "FPEB", xcoor, ycoor, zcoor, 0, "ONLY");
888     gMC->Gspos("FFC2", 2, "FPEB", xcoor, ycoor,-zcoor, 0, "ONLY");
889   }
890
891   //par[0] = xtof*0.5;
892   //par[1] = kPlasticFlatCableThickness*0.5;
893   par[2] = (zlenA*0.5 + 2. - fgkExterInterModBorder1)*0.5 - 2.;
894   gMC->Gsvolu("FFC3", "BOX ", idtmed[513], par, 3); // Plastic (CH2)
895   //xcoor = 0.;
896   //ycoor = -kAlCoverThickness*0.5 - kPlasticFlatCableThickness*0.5;
897   zcoor = (zlenA*0.5 + 2. + fgkExterInterModBorder1)*0.5;
898   gMC->Gspos("FFC3", 1, "FPEA", xcoor, ycoor, zcoor, 0, "ONLY");
899   gMC->Gspos("FFC3", 2, "FPEA", xcoor, ycoor,-zcoor, 0, "ONLY");
900   if (fTOFHoles) {
901     gMC->Gspos("FFC3", 1, "FPEB", xcoor, ycoor, zcoor, 0, "ONLY");
902     gMC->Gspos("FFC3", 2, "FPEB", xcoor, ycoor,-zcoor, 0, "ONLY");
903   }
904
905   // Cu
906   const Float_t kCopperFlatCableThickness = 0.01;
907   par[0] = xtof*0.5;
908   par[1] = kCopperFlatCableThickness*0.5;
909   par[2] = fgkInterCentrModBorder2 - 2.;
910   gMC->Gsvolu("FCC1", "BOX ", idtmed[512], par, 3); // Cu
911   //xcoor = 0.;
912   ycoor = -kAlCoverThickness*0.5 - kPlasticFlatCableThickness - kCopperFlatCableThickness*0.5;
913   zcoor = 0.;
914   gMC->Gspos("FCC1", 0, "FPEA", xcoor, ycoor, zcoor, 0, "ONLY");
915
916   //par[0] = xtof*0.5;
917   //par[1] = kCopperFlatCableThickness*0.5;
918   par[2] = (fgkExterInterModBorder1 - fgkInterCentrModBorder2)*0.5 - 2.;
919   gMC->Gsvolu("FCC2", "BOX ", idtmed[512], par, 3); // Cu
920   //xcoor = 0.;
921   //ycoor = -kAlCoverThickness*0.5 - kPlasticFlatCableThickness - kCopperFlatCableThickness*0.5;
922   zcoor = (fgkExterInterModBorder1 + fgkInterCentrModBorder2)*0.5;
923   gMC->Gspos("FCC2", 1, "FPEA", xcoor, ycoor, zcoor, 0, "ONLY");
924   gMC->Gspos("FCC2", 2, "FPEA", xcoor, ycoor,-zcoor, 0, "ONLY");
925   if (fTOFHoles) {
926     gMC->Gspos("FCC2", 1, "FPEB", xcoor, ycoor, zcoor, 0, "ONLY");
927     gMC->Gspos("FCC2", 2, "FPEB", xcoor, ycoor,-zcoor, 0, "ONLY");
928   }
929
930   //par[0] = xtof*0.5;
931   //par[1] = kCopperFlatCableThickness*0.5;
932   par[2] = (zlenA*0.5 + 2. - fgkExterInterModBorder1)*0.5 - 2.;
933   gMC->Gsvolu("FCC3", "BOX ", idtmed[512], par, 3); // Cu
934   //xcoor = 0.;
935   //ycoor = -kAlCoverThickness*0.5 - kPlasticFlatCableThickness - kCopperFlatCableThickness*0.5;
936   zcoor = (zlenA*0.5 + 2. + fgkExterInterModBorder1)*0.5;
937   gMC->Gspos("FCC3", 1, "FPEA", xcoor, ycoor, zcoor, 0, "ONLY");
938   gMC->Gspos("FCC3", 2, "FPEA", xcoor, ycoor,-zcoor, 0, "ONLY");
939   if (fTOFHoles) {
940     gMC->Gspos("FCC3", 1, "FPEB", xcoor, ycoor, zcoor, 0, "ONLY");
941     gMC->Gspos("FCC3", 2, "FPEB", xcoor, ycoor,-zcoor, 0, "ONLY");
942   }
943
944 }
945
946 //_____________________________________________________________________________
947 void AliTOFv6T0::MakeModulesInBTOFvolumes(Float_t ytof, Float_t zlenA) const
948 {
949   //
950   // Fill BTOF_%i (for i=0,...17) volumes
951   // with volumes FTOA (MRPC strip container),
952   // In case of TOF holes, two sectors (i.e. 11th and 12th)
953   // are filled with volumes: FTOB and FTOC (MRPC containers),
954   //
955
956   //const Float_t fgkInterCentrModBorder1 = 49.5;
957
958   Int_t idrotm[1];
959
960   //AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,-90.);
961   AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,270.);
962
963   Float_t xcoor, ycoor, zcoor;
964   xcoor = 0.;
965
966   // Positioning of fibre glass modules (FTOA, FTOB and FTOC)
967
968   for(Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++){
969     if(fTOFSectors[isec]==-1)continue;
970     char name[16];
971     sprintf(name, "BTOF%d",isec);
972     if (fTOFHoles && (isec==11||isec==12)) {
973     //if (fTOFHoles && (isec==16||isec==17)) { \\Old 6h convention
974       //xcoor = 0.;
975       ycoor = (zlenA*0.5 + fgkInterCentrModBorder1)*0.5;
976       zcoor = -ytof * 0.25;
977       gMC->Gspos("FTOB", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
978       gMC->Gspos("FTOC", 0, name, xcoor,-ycoor, zcoor, idrotm[0], "ONLY");
979     }
980     else {
981       //xcoor = 0.;
982       ycoor = 0.;
983       zcoor = -ytof * 0.25;
984       gMC->Gspos("FTOA", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
985     }
986   }
987
988 }
989
990 //_____________________________________________________________________________
991 void AliTOFv6T0::MakeCoversInBTOFvolumes() const
992 {
993   //
994   // Fill BTOF_%i (for i=0,...17) volumes
995   // with volumes FPEA (to separate strips from FEA cards)
996   // In case of TOF holes, two sectors (i.e. 11th and 12th)
997   // are filled with FPEB volumes
998   // (to separate MRPC strips from FEA cards)
999   //
1000
1001   // module cover between strips and cards (cm)
1002   //const Float_t fgkModuleCoverThickness = 2.;
1003
1004   Int_t idrotm[1];
1005
1006   //AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,-90.);
1007   AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,270.);
1008
1009   Float_t xcoor, ycoor, zcoor;
1010   xcoor = 0.;
1011   ycoor = 0.;
1012   zcoor = fgkModuleCoverThickness*0.5;
1013
1014   char name[16];
1015
1016   // Positioning of module covers (FPEA, FPEB)
1017
1018   for(Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++) {
1019     if(fTOFSectors[isec]==-1)continue;
1020     sprintf(name, "BTOF%d",isec);
1021     //if (fTOFHoles && (isec==16||isec==17)) \\Old 6h convention
1022     if (fTOFHoles && (isec==11||isec==12))
1023       gMC->Gspos("FPEB", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
1024     else
1025       gMC->Gspos("FPEA", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
1026   }
1027
1028 }
1029
1030 //_____________________________________________________________________________
1031 void AliTOFv6T0::MakeBackInBTOFvolumes(Float_t ytof) const
1032 {
1033   //
1034   // Fill BTOF_%i (for i=0,...17) volumes
1035   // with volumes FAIA (FEA cards and services container)
1036   // In case of TOF holes, two sectors (i.e. 11th and 12th)
1037   // are filled with volumes FAIB (FEA cards and services container).
1038   //
1039
1040   // module cover between strips and cards (cm)
1041   //const Float_t fgkModuleCoverThickness = 2.;
1042
1043   Int_t idrotm[1];
1044
1045   //AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,-90.);
1046   AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,270.);
1047
1048   Float_t xcoor, ycoor, zcoor;
1049   xcoor = 0.;
1050   ycoor = 0.;
1051   zcoor = fgkModuleCoverThickness + (ytof*0.5 - fgkModuleCoverThickness)*0.5;
1052
1053   char name[16];
1054
1055   // Positioning of FEA cards and services containers (FAIA and FAIB)
1056
1057   for(Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++) {
1058     if(fTOFSectors[isec]==-1)continue;
1059     sprintf(name, "BTOF%d",isec);
1060     //if (fTOFHoles && (isec==16||isec==17)) \\Old 6h convention
1061     if (fTOFHoles && (isec==11||isec==12))
1062       gMC->Gspos("FAIB", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
1063     else
1064       gMC->Gspos("FAIA", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
1065   }
1066
1067 }
1068
1069 //_____________________________________________________________________________
1070 void AliTOFv6T0::MakeStripsInModules(Float_t ytof, Float_t zlenA) const
1071 {
1072   //
1073   // Define MRPC strip volume, called FSTR
1074   // Insert FSTR volume in FLTA/B/C volumes
1075   //
1076
1077   // module wall thickness (cm)
1078   //const Float_t fgkModuleWallThickness = 0.33;
1079
1080   //const Float_t fgkInterCentrModBorder1 = 49.5;
1081
1082   Float_t yFLT  = ytof*0.5 - fgkModuleWallThickness;
1083
1084   Int_t *idtmed = fIdtmed->GetArray()-499;
1085
1086   ///////////////// Detector itself //////////////////////
1087
1088   const Int_t    knx   = fTOFGeometry->NpadX();  // number of pads along x
1089   const Int_t    knz   = fTOFGeometry->NpadZ();  // number of pads along z
1090   const Float_t  kPadX = fTOFGeometry->XPad();   // pad length along x
1091   const Float_t  kPadZ = fTOFGeometry->ZPad();   // pad length along z
1092
1093   // new description for strip volume -double stack strip-
1094   // -- all constants are expressed in cm
1095   // height of different layers
1096   const Float_t khhony   = 1.0;       // height of HONY Layer
1097   const Float_t khpcby   = 0.08;      // height of PCB Layer
1098   const Float_t khrgly   = 0.055;     // height of RED GLASS Layer
1099
1100   const Float_t khfiliy  = 0.125;     // height of FISHLINE Layer
1101   const Float_t khglassy = 0.160*0.5; // semi-height of GLASS Layer
1102   const Float_t khglfy   = khfiliy+2.*khglassy; // height of GLASS Layer
1103
1104   const Float_t khcpcby  = 0.16;      // height of PCB  Central Layer
1105   const Float_t kwhonz   = 8.1;       // z dimension of HONEY Layer
1106   const Float_t kwpcbz1  = 10.64;     // z dimension of PCB Lower Layer
1107   const Float_t kwpcbz2  = 11.6;      // z dimension of PCB Upper Layer
1108   const Float_t kwcpcbz  = 12.4;      // z dimension of PCB Central Layer
1109
1110   const Float_t kwrglz   = 8.;        // z dimension of RED GLASS Layer
1111   const Float_t kwglfz   = 7.;        // z dimension of GLASS Layer
1112   const Float_t klsensmx = knx*kPadX; // length of Sensitive Layer
1113   const Float_t khsensmy = 0.0105;    // height of Sensitive Layer
1114   const Float_t kwsensmz = knz*kPadZ; // width of Sensitive Layer
1115
1116   // height of the FSTR Volume (the strip volume)
1117   const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;
1118
1119   // width  of the FSTR Volume (the strip volume)
1120   const Float_t kwstripz = kwcpcbz;
1121   // length of the FSTR Volume (the strip volume)
1122   const Float_t klstripx = fTOFGeometry->StripLength();
1123
1124
1125   // FSTR volume definition-filling this volume with non sensitive Gas Mixture
1126   Float_t parfp[3]={klstripx*0.5, khstripy*0.5, kwstripz*0.5};
1127   gMC->Gsvolu("FSTR","BOX",idtmed[506],parfp,3); // Freon mix
1128
1129   Float_t posfp[3]={0.,0.,0.};
1130
1131   // NOMEX (HONEYCOMB) Layer definition
1132   //parfp[0] = klstripx*0.5;
1133   parfp[1] = khhony*0.5;
1134   parfp[2] = kwhonz*0.5;
1135   gMC->Gsvolu("FHON","BOX",idtmed[501],parfp,3); // Nomex (Honeycomb)
1136   // positioning 2 NOMEX Layers on FSTR volume
1137   //posfp[0] = 0.;
1138   posfp[1] =-khstripy*0.5 + parfp[1];
1139   //posfp[2] = 0.;
1140   gMC->Gspos("FHON",1,"FSTR",0., posfp[1],0.,0,"ONLY");
1141   gMC->Gspos("FHON",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
1142   
1143   // Lower PCB Layer definition
1144   //parfp[0] = klstripx*0.5;
1145   parfp[1] = khpcby*0.5;
1146   parfp[2] = kwpcbz1*0.5;
1147   gMC->Gsvolu("FPC1","BOX",idtmed[502],parfp,3); // G10
1148
1149   // Upper PCB Layer definition
1150   //parfp[0] = klstripx*0.5;
1151   //parfp[1] = khpcby*0.5;
1152   parfp[2] = kwpcbz2*0.5;
1153   gMC->Gsvolu("FPC2","BOX",idtmed[502],parfp,3); // G10
1154
1155   // positioning 2 external PCB Layers in FSTR volume
1156   //posfp[0] = 0.;
1157   posfp[1] =-khstripy*0.5+khhony+parfp[1];
1158   //posfp[2] = 0.;
1159   gMC->Gspos("FPC1",1,"FSTR",0.,-posfp[1],0.,0,"ONLY");
1160   gMC->Gspos("FPC2",1,"FSTR",0., posfp[1],0.,0,"ONLY");
1161
1162   // Central PCB layer definition
1163   //parfp[0] = klstripx*0.5;
1164   parfp[1] = khcpcby*0.5;
1165   parfp[2] = kwcpcbz*0.5;
1166   gMC->Gsvolu("FPCB","BOX",idtmed[502],parfp,3); // G10
1167   // positioning the central PCB layer
1168   gMC->Gspos("FPCB",1,"FSTR",0.,0.,0.,0,"ONLY");
1169
1170   // Sensitive volume definition
1171   Float_t parfs[3] = {klsensmx*0.5, khsensmy*0.5, kwsensmz*0.5};
1172   gMC->Gsvolu("FSEN","BOX",idtmed[507],parfs,3); // Cu sensitive
1173   // dividing FSEN along z in knz=2 and along x in knx=48
1174   gMC->Gsdvn("FSEZ","FSEN",knz,3);
1175   gMC->Gsdvn("FPAD","FSEZ",knx,1);
1176   // positioning sensitive layer inside FPCB
1177   gMC->Gspos("FSEN",1,"FPCB",0.,0.,0.,0,"ONLY");
1178
1179   // RED GLASS Layer definition
1180   //parfp[0] = klstripx*0.5;
1181   parfp[1] = khrgly*0.5;
1182   parfp[2] = kwrglz*0.5;
1183   gMC->Gsvolu("FRGL","BOX",idtmed[508],parfp,3); // red glass
1184   // positioning 4 RED GLASS Layers in FSTR volume
1185   //posfp[0] = 0.;
1186   posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1];
1187   //posfp[2] = 0.;
1188   gMC->Gspos("FRGL",1,"FSTR",0., posfp[1],0.,0,"ONLY");
1189   gMC->Gspos("FRGL",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
1190   //posfp[0] = 0.;
1191   posfp[1] = (khcpcby+khrgly)*0.5;
1192   //posfp[2] = 0.;
1193   gMC->Gspos("FRGL",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
1194   gMC->Gspos("FRGL",3,"FSTR",0., posfp[1],0.,0,"ONLY");
1195
1196   // GLASS Layer definition
1197   //parfp[0] = klstripx*0.5;
1198   parfp[1] = khglassy;
1199   parfp[2] = kwglfz*0.5;
1200   gMC->Gsvolu("FGLF","BOX",idtmed[508],parfp,3); // glass
1201   // positioning 2 GLASS Layers in FSTR volume
1202   //posfp[0] = 0.;
1203   posfp[1] = (khcpcby + khglfy)*0.5 + khrgly;
1204   //posfp[2] = 0.;
1205   gMC->Gspos("FGLF",1,"FSTR",0.,-posfp[1],0.,0,"ONLY");
1206   gMC->Gspos("FGLF",2,"FSTR",0., posfp[1],0.,0,"ONLY");
1207
1208   // Positioning the Strips (FSTR volumes) in the FLT volumes
1209   Int_t maxStripNumbers [5] ={fTOFGeometry->NStripC(),
1210                               fTOFGeometry->NStripB(),
1211                               fTOFGeometry->NStripA(),
1212                               fTOFGeometry->NStripB(),
1213                               fTOFGeometry->NStripC()};
1214
1215   Int_t idrotm[91];
1216
1217   Int_t totalStrip = 0;
1218   Float_t xpos, zpos, ypos, ang;
1219   for(Int_t iplate = 0; iplate < fTOFGeometry->NPlates(); iplate++){
1220     if (iplate>0) totalStrip += maxStripNumbers[iplate-1];
1221     for(Int_t istrip = 0; istrip < maxStripNumbers[iplate]; istrip++){
1222
1223       ang = fTOFGeometry->GetAngles(iplate,istrip);
1224       AliDebug(1, Form(" iplate = %1i, istrip = %2i ---> ang = %f", iplate, istrip, ang));
1225  
1226       if (ang>0.)       AliMatrix (idrotm[istrip+totalStrip],90.,0.,90.+ang,90., ang, 90.);
1227       else if (ang==0.) AliMatrix (idrotm[istrip+totalStrip],90.,0.,90.,90., 0., 0.);
1228       else if (ang<0.)  AliMatrix (idrotm[istrip+totalStrip],90.,0.,90.+ang,90.,-ang,270.);
1229
1230       xpos = 0.;
1231       ypos = fTOFGeometry->GetHeights(iplate,istrip) + yFLT*0.5;
1232       zpos = fTOFGeometry->GetDistances(iplate,istrip);
1233       gMC->Gspos("FSTR",istrip+totalStrip+1,"FLTA", xpos, ypos,-zpos,idrotm[istrip+totalStrip],  "ONLY");
1234
1235       if (fTOFHoles) {
1236         if (istrip+totalStrip+1>53)
1237           gMC->Gspos("FSTR",istrip+totalStrip+1,"FLTC", xpos, ypos,-zpos-(zlenA*0.5 - 2.*fgkModuleWallThickness + fgkInterCentrModBorder1)*0.5,idrotm[istrip+totalStrip],"ONLY");
1238         if (istrip+totalStrip+1<39)
1239           gMC->Gspos("FSTR",istrip+totalStrip+1,"FLTB", xpos, ypos,-zpos+(zlenA*0.5 - 2.*fgkModuleWallThickness + fgkInterCentrModBorder1)*0.5,idrotm[istrip+totalStrip],"ONLY");
1240       }
1241     }
1242   }
1243
1244 }
1245
1246 //_____________________________________________________________________________
1247 void AliTOFv6T0::CreateBackZone(Float_t xtof, Float_t ytof, Float_t zlenA) const
1248 {
1249   //
1250   // Define:
1251   //        - containers for FEA cards, cooling system
1252   //          signal cables and supermodule support structure
1253   //          (volumes called FAIA/B),
1254   //        - containers for FEA cards and some cooling
1255   //          elements for a FEA (volumes called FCA1/2).
1256   //
1257
1258   // module cover between strips and cards (cm)
1259   //const Float_t fgkModuleCoverThickness = 2.;
1260
1261   //const Float_t fgkFEAwidth1 = 19.;
1262   //const Float_t fgkFEAwidth2 = 38.5;
1263
1264   Int_t *idtmed = fIdtmed->GetArray()-499;
1265
1266   Int_t idrotm[1];
1267
1268   // Definition of the air card containers (FAIA and FAIB)
1269
1270   Float_t  par[3];
1271   par[0] = xtof*0.5;
1272   par[1] = (ytof*0.5 - fgkModuleCoverThickness)*0.5;
1273   par[2] = zlenA*0.5;
1274   gMC->Gsvolu("FAIA", "BOX ", idtmed[500], par, 3); // Air
1275   if (fTOFHoles) gMC->Gsvolu("FAIB", "BOX ", idtmed[500], par, 3); // Air
1276
1277   // FEA card mother-volume definition
1278   Float_t carpar[3] = {fgkFEAwidth1*0.5, 5.6, 0.45};
1279   gMC->Gsvolu("FCA1", "BOX ", idtmed[500], carpar, 3); // Air
1280   carpar[0] = fgkFEAwidth2*0.5;
1281   //carpar[1] =  5.6;
1282   //carpar[2] =  0.45;
1283   gMC->Gsvolu("FCA2", "BOX ", idtmed[500], carpar, 3); // Air
1284
1285   // rotation matrix
1286   AliMatrix(idrotm[0],  90.,180., 90., 90.,180., 0.);
1287
1288   // FEA card mother-volume positioning
1289   Float_t rowstep = 6.66;
1290   Float_t rowgap[5] = {13.5, 22.9, 16.94, 23.8, 20.4};
1291   Int_t rowb[5] = {6, 7, 6, 19, 7};
1292   Float_t carpos[3] = {25. - xtof*0.5,
1293                        (11.5 - (ytof*0.5 - fgkModuleCoverThickness))*0.5,
1294                        0.};
1295   Int_t row = 1;
1296   Int_t nrow = 0;
1297   for (Int_t sg= -1; sg< 2; sg+= 2) {
1298     carpos[2] = sg*zlenA*0.5;
1299     for (Int_t nb=0; nb<5; ++nb) {
1300       carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
1301       nrow = row + rowb[nb];
1302       for ( ; row < nrow ; ++row) {
1303
1304         carpos[2] -= sg*rowstep;
1305
1306         if (nb==4) {
1307           gMC->Gspos("FCA1",2*row,  "FAIA", carpos[0],carpos[1],carpos[2], 0,"ONLY");
1308           gMC->Gspos("FCA1",2*row-1,"FAIA",-carpos[0],carpos[1],carpos[2], 0,"ONLY");
1309           gMC->Gspos("FCA2",  row,  "FAIA",        0.,carpos[1],carpos[2], 0,"ONLY");
1310
1311         }
1312         else {
1313           switch (sg) {
1314           case 1:
1315             gMC->Gspos("FCA1",2*row,  "FAIA", carpos[0],carpos[1],carpos[2], 0,"ONLY");
1316             gMC->Gspos("FCA1",2*row-1,"FAIA",-carpos[0],carpos[1],carpos[2], 0,"ONLY");
1317             gMC->Gspos("FCA2",  row,  "FAIA",        0.,carpos[1],carpos[2], 0,"ONLY");
1318             break;
1319           case -1:
1320             gMC->Gspos("FCA1",2*row,  "FAIA", carpos[0],carpos[1],carpos[2], idrotm[0],"ONLY");
1321             gMC->Gspos("FCA1",2*row-1,"FAIA",-carpos[0],carpos[1],carpos[2], idrotm[0],"ONLY");
1322             gMC->Gspos("FCA2",  row,  "FAIA",        0.,carpos[1],carpos[2], idrotm[0],"ONLY");
1323             break;
1324           }
1325
1326         }
1327       }
1328     }
1329   }
1330
1331   gMC->Gspos("FCA1", 182, "FAIA", carpos[0],carpos[1],0., 0,"ONLY");
1332   gMC->Gspos("FCA1", 181, "FAIA",-carpos[0],carpos[1],0., 0,"ONLY");
1333   gMC->Gspos("FCA2",  91, "FAIA",  0., carpos[1], 0., 0, "ONLY");
1334
1335   if (fTOFHoles) {
1336     row = 1;
1337     for (Int_t sg= -1; sg< 2; sg+= 2) {
1338       carpos[2] = sg*zlenA*0.5;
1339       for (Int_t nb=0; nb<4; ++nb) {
1340         carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
1341         nrow = row + rowb[nb];
1342         for ( ; row < nrow ; ++row) {
1343           carpos[2] -= sg*rowstep;
1344
1345           switch (sg) {
1346           case 1:
1347             gMC->Gspos("FCA1",2*row,  "FAIB", carpos[0],carpos[1],carpos[2], 0,"ONLY");
1348             gMC->Gspos("FCA1",2*row-1,"FAIB",-carpos[0],carpos[1],carpos[2], 0,"ONLY");
1349             gMC->Gspos("FCA2",  row,  "FAIB",        0.,carpos[1],carpos[2], 0,"ONLY");
1350             break;
1351           case -1:
1352             gMC->Gspos("FCA1",2*row,  "FAIB", carpos[0],carpos[1],carpos[2], idrotm[0],"ONLY");
1353             gMC->Gspos("FCA1",2*row-1,"FAIB",-carpos[0],carpos[1],carpos[2], idrotm[0],"ONLY");
1354             gMC->Gspos("FCA2",  row,  "FAIB",        0.,carpos[1],carpos[2], idrotm[0],"ONLY");
1355             break;
1356           }
1357         }
1358       }
1359     }
1360   }
1361
1362 }
1363
1364 //_____________________________________________________________________________
1365 void AliTOFv6T0::MakeFrontEndElectronics() const
1366 {
1367   //
1368   // Fill FCA1/2 volumes with FEA cards (FFEA volumes).
1369   //
1370
1371   Int_t *idtmed = fIdtmed->GetArray()-499;
1372
1373   //const Float_t fgkFEAwidth1 = 19.;
1374
1375   // FEA card volume definition
1376   Float_t feaParam1[3] = {fgkFEAwidth1*0.5, 5.6, 0.1};
1377   gMC->Gsvolu("FFEA", "BOX ", idtmed[502], feaParam1, 3); // G10
1378
1379   // FEA card volume positioning
1380   Float_t carpar[3] = {fgkFEAwidth1*0.5, 5.6, 0.45};
1381   gMC->Gspos("FFEA", 1, "FCA1", 0., 0., -carpar[2]+feaParam1[2], 0, "ONLY");
1382   gMC->Gspos("FFEA", 2, "FCA2", -(feaParam1[0]+0.25), 0., -carpar[2]+feaParam1[2], 0, "ONLY");
1383   gMC->Gspos("FFEA", 3, "FCA2",  (feaParam1[0]+0.25), 0., -carpar[2]+feaParam1[2], 0, "ONLY");
1384
1385 }
1386
1387 //_____________________________________________________________________________
1388 void AliTOFv6T0::MakeFEACooling(Float_t xtof, Float_t ytof, Float_t zlenA) const
1389 {
1390   //
1391   // Make cooling system attached to each FEA card
1392   // (FAL1, FRO1 and FBAR/1/2 volumes)
1393   // in FAIA/B and FCA1/2 volume containers.
1394   //
1395
1396   // honeycomb layer between strips and cards (cm)
1397   //const Float_t fgkModuleCoverThickness = 2.;
1398
1399   Int_t *idtmed = fIdtmed->GetArray()-499;
1400
1401   //const Float_t fgkFEAwidth1 = 19.;
1402
1403   Float_t feaParam1[3] = {fgkFEAwidth1*0.5, 5.6, 0.1};
1404
1405   // first FEA cooling element definition
1406   Float_t al1[3] = {fgkFEAwidth1*0.5, 0.4, 0.2};
1407   gMC->Gsvolu("FAL1", "BOX ", idtmed[504], al1, 3); // Al
1408   // first FEA cooling element positioning
1409   Float_t carpar[3] = {fgkFEAwidth1*0.5, 5.6, 0.45};
1410   gMC->Gspos("FAL1", 1, "FCA1", 0., carpar[1]-al1[1], -carpar[2]+2.*feaParam1[2]+al1[2], 0, "ONLY");
1411   gMC->Gspos("FAL1", 2, "FCA2", -(feaParam1[0]+0.25), carpar[1]-al1[1], -carpar[2]+2.*feaParam1[2]+al1[2], 0, "ONLY");
1412   gMC->Gspos("FAL1", 3, "FCA2",  (feaParam1[0]+0.25), carpar[1]-al1[1], -carpar[2]+2.*feaParam1[2]+al1[2], 0, "ONLY");
1413
1414   // second FEA cooling element difinition
1415   //Float_t feaRoof1[3] = {9.5, 0.2, 1.45};
1416   Float_t feaRoof1[3] = {al1[0], al1[2], 1.45};
1417   gMC->Gsvolu("FRO1", "BOX ", idtmed[504], feaRoof1, 3); // Al
1418
1419   // third FEA cooling element difinition
1420   Float_t bar[3] = {8.575, 0.6, 0.25};
1421   gMC->Gsvolu("FBAR", "BOX ", idtmed[504], bar, 3); // Al
1422
1423   // fourth FEA cooling element difinition
1424   //Float_t bar1[3] = {8.575, 0.6, 0.1};
1425   Float_t bar1[3] = {bar[0], bar[1], 0.1};
1426   gMC->Gsvolu("FBA1", "BOX ", idtmed[504], bar1, 3); // Al
1427
1428   // fifth FEA cooling element difinition
1429   //Float_t bar2[3] = {8.575, 0.1, 0.4};
1430   Float_t bar2[3] = {bar[0], 0.1, bar[1]-2.*bar[2]};
1431   gMC->Gsvolu("FBA2", "BOX ", idtmed[504], bar2, 3); // Al
1432
1433   //const Float_t fgkCBLw   = 13.5; // width of lateral cables and tubes block
1434
1435   Float_t tubepar[3] = {0., 0.4, xtof*0.5 - fgkCBLw};
1436
1437   // FEA cooling components positioning
1438   Float_t rowstep = 6.66;
1439   Float_t rowgap[5] = {13.5, 22.9, 16.94, 23.8, 20.4};
1440   Int_t rowb[5] = {6, 7, 6, 19, 7};
1441   Float_t carpos[3] = {25. - xtof*0.5,
1442                        (11.5 - (ytof*0.5 - fgkModuleCoverThickness))*0.5,
1443                        0.};
1444   Int_t row = 1;
1445   Int_t nrow = 0;
1446   for (Int_t sg= -1; sg< 2; sg+= 2) {
1447     carpos[2] = sg*zlenA*0.5;
1448     for (Int_t nb=0; nb<5; ++nb) {
1449       carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
1450       nrow = row + rowb[nb];
1451       for ( ; row < nrow ; ++row) {
1452
1453         carpos[2] -= sg*rowstep;
1454
1455         if (nb==4) {
1456
1457           gMC->Gspos("FBAR",4*row,  "FAIA", carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1458           gMC->Gspos("FBAR",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1459           gMC->Gspos("FBAR",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1460           gMC->Gspos("FBAR",4*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1461
1462           gMC->Gspos("FBA1",4*row,  "FAIA", carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1463           gMC->Gspos("FBA1",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1464           gMC->Gspos("FBA1",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1465           gMC->Gspos("FBA1",4*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1466
1467           gMC->Gspos("FBA2",8*row,  "FAIA", carpos[0],carpos[1]+carpar[1]-bar2[1], carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1468           gMC->Gspos("FBA2",8*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar2[1], carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1469           gMC->Gspos("FBA2",8*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar2[1], carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1470           gMC->Gspos("FBA2",8*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]-bar2[1], carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1471
1472           gMC->Gspos("FBA2",8*row-4,"FAIA", carpos[0],carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1473           gMC->Gspos("FBA2",8*row-5,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1474           gMC->Gspos("FBA2",8*row-6,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1475           gMC->Gspos("FBA2",8*row-7,"FAIA",-carpos[0],carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1476
1477
1478           gMC->Gspos("FRO1",4*row,  "FAIA", carpos[0],carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1479           gMC->Gspos("FRO1",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1480           gMC->Gspos("FRO1",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1481           gMC->Gspos("FRO1",4*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1482
1483         }
1484         else {
1485
1486           gMC->Gspos("FBAR",4*row,  "FAIA", carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1487           gMC->Gspos("FBAR",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1488           gMC->Gspos("FBAR",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1489           gMC->Gspos("FBAR",4*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1490
1491           gMC->Gspos("FBA1",4*row,  "FAIA", carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1492           gMC->Gspos("FBA1",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1493           gMC->Gspos("FBA1",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1494           gMC->Gspos("FBA1",4*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1495
1496           gMC->Gspos("FBA2",8*row,  "FAIA", carpos[0],carpos[1]+carpar[1]-bar2[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1497           gMC->Gspos("FBA2",8*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar2[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1498           gMC->Gspos("FBA2",8*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar2[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1499           gMC->Gspos("FBA2",8*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]-bar2[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1500
1501           gMC->Gspos("FBA2",8*row-4,"FAIA", carpos[0],carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1502           gMC->Gspos("FBA2",8*row-5,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1503           gMC->Gspos("FBA2",8*row-6,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1504           gMC->Gspos("FBA2",8*row-7,"FAIA",-carpos[0],carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1505
1506           gMC->Gspos("FRO1",4*row,  "FAIA", carpos[0],carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1507           gMC->Gspos("FRO1",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1508           gMC->Gspos("FRO1",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1509           gMC->Gspos("FRO1",4*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1510
1511         }
1512       }
1513     }
1514   }
1515
1516   gMC->Gspos("FBAR",364, "FAIA", carpos[0],carpos[1]+carpar[1]-bar[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1517   gMC->Gspos("FBAR",363, "FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1518   gMC->Gspos("FBAR",362, "FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1519   gMC->Gspos("FBAR",361, "FAIA",-carpos[0],carpos[1]+carpar[1]-bar[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1520
1521   gMC->Gspos("FBA1",364, "FAIA", carpos[0],carpos[1]+carpar[1]-bar[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1522   gMC->Gspos("FBA1",363, "FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1523   gMC->Gspos("FBA1",362, "FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1524   gMC->Gspos("FBA1",361, "FAIA",-carpos[0],carpos[1]+carpar[1]-bar[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1525
1526   gMC->Gspos("FBA2",728, "FAIA", carpos[0],carpos[1]+carpar[1]-bar2[1], -(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1527   gMC->Gspos("FBA2",727, "FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar2[1], -(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1528   gMC->Gspos("FBA2",726, "FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar2[1], -(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1529   gMC->Gspos("FBA2",725, "FAIA",-carpos[0],carpos[1]+carpar[1]-bar2[1], -(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1530
1531   gMC->Gspos("FBA2",724,"FAIA", carpos[0],carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], -(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1532   gMC->Gspos("FBA2",723,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], -(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1533   gMC->Gspos("FBA2",722,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], -(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1534   gMC->Gspos("FBA2",721,"FAIA",-carpos[0],carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], -(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1535
1536   gMC->Gspos("FRO1",364, "FAIA", carpos[0],carpos[1]+carpar[1]+feaRoof1[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1537   gMC->Gspos("FRO1",363, "FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof1[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1538   gMC->Gspos("FRO1",362, "FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof1[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1539   gMC->Gspos("FRO1",361, "FAIA",-carpos[0],carpos[1]+carpar[1]+feaRoof1[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1540
1541
1542   if (fTOFHoles) {
1543     row = 1;
1544     for (Int_t sg= -1; sg< 2; sg+= 2) {
1545       carpos[2] = sg*zlenA*0.5;
1546       for (Int_t nb=0; nb<4; ++nb) {
1547         carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
1548         nrow = row + rowb[nb];
1549         for ( ; row < nrow ; ++row) {
1550           carpos[2] -= sg*rowstep;
1551
1552           gMC->Gspos("FBAR",4*row,  "FAIB", carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1553           gMC->Gspos("FBAR",4*row-1,"FAIB", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1554           gMC->Gspos("FBAR",4*row-2,"FAIB",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1555           gMC->Gspos("FBAR",4*row-3,"FAIB",-carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-bar[2]), 0,"ONLY");
1556
1557           gMC->Gspos("FBA1",4*row,  "FAIB", carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1558           gMC->Gspos("FBA1",4*row-1,"FAIB", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1559           gMC->Gspos("FBA1",4*row-2,"FAIB",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1560           gMC->Gspos("FBA1",4*row-3,"FAIB",-carpos[0],carpos[1]+carpar[1]-bar[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-2.*tubepar[1]-bar1[2]), 0,"ONLY");
1561
1562           gMC->Gspos("FBA2",8*row,  "FAIB", carpos[0],carpos[1]+carpar[1]-bar2[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1563           gMC->Gspos("FBA2",8*row-1,"FAIB", (feaParam1[0]+0.25),carpos[1]+carpar[1]-bar2[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1564           gMC->Gspos("FBA2",8*row-2,"FAIB",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-bar2[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1565           gMC->Gspos("FBA2",8*row-3,"FAIB",-carpos[0],carpos[1]+carpar[1]-bar2[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1566
1567           gMC->Gspos("FBA2",8*row-4,"FAIB", carpos[0],carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1568           gMC->Gspos("FBA2",8*row-5,"FAIB", (feaParam1[0]+0.25),carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1569           gMC->Gspos("FBA2",8*row-6,"FAIB",-(feaParam1[0]+0.25),carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1570           gMC->Gspos("FBA2",8*row-7,"FAIB",-carpos[0],carpos[1]+carpar[1]-3.*bar2[1]-2.*tubepar[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), 0, "ONLY");
1571
1572           gMC->Gspos("FRO1",4*row,  "FAIB", carpos[0],carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1573           gMC->Gspos("FRO1",4*row-1,"FAIB", (feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1574           gMC->Gspos("FRO1",4*row-2,"FAIB",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1575           gMC->Gspos("FRO1",4*row-3,"FAIB",-carpos[0],carpos[1]+carpar[1]+feaRoof1[1],carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+feaRoof1[2]), 0,"ONLY");
1576
1577         }
1578       }
1579     }
1580   }
1581
1582 }
1583
1584 //_____________________________________________________________________________
1585 void AliTOFv6T0::MakeNinoMask(Float_t xtof, Float_t ytof, Float_t zlenA) const
1586 {
1587   //
1588   // Make cooling Nino mask
1589   // for each FEA card (FAL2/3 and FRO2/3/4 volumes)
1590   // in FAIA/B and FCA1/2 volume containers.
1591   //
1592
1593   // honeycomb layer between strips and cards (cm)
1594   //const Float_t fgkModuleCoverThickness = 2.;
1595
1596   Int_t *idtmed = fIdtmed->GetArray()-499;
1597
1598   //const Float_t fgkFEAwidth1 = 19.;
1599
1600   // first Nino ASIC mask volume definition
1601   Float_t al2[3] = {7.25, 0.75, 0.25};
1602   gMC->Gsvolu("FAL2", "BOX ", idtmed[504], al2, 3); // Al
1603
1604   // second Nino ASIC mask volume definition
1605   Float_t al3[3] = {3., 3.75, 0.1};
1606   gMC->Gsvolu("FAL3", "BOX ", idtmed[504], al3, 3); // Al
1607
1608   // first Nino ASIC mask volume positioning
1609   Float_t feaParam1[3] = {fgkFEAwidth1*0.5, 5.6, 0.1};
1610   Float_t carpar[3] = {fgkFEAwidth1*0.5, 5.6, 0.45};
1611   gMC->Gspos("FAL2", 1, "FCA1", 0., carpar[1]-2.*al3[1]+0.25,  carpar[2]-2.*al3[2]-al2[2], 0, "ONLY");
1612   gMC->Gspos("FAL2", 2, "FCA2", -(feaParam1[0]+0.25), carpar[1]-2.*al3[1]+0.25,  carpar[2]-2.*al3[2]-al2[2], 0, "ONLY");
1613   gMC->Gspos("FAL2", 3, "FCA2",  (feaParam1[0]+0.25), carpar[1]-2.*al3[1]+0.25,  carpar[2]-2.*al3[2]-al2[2], 0, "ONLY");
1614
1615   // second Nino ASIC mask volume positioning
1616   gMC->Gspos("FAL3", 1, "FCA1", 0., carpar[1]-al3[1],  carpar[2]-al3[2], 0, "ONLY");
1617   gMC->Gspos("FAL3", 2, "FCA2", -(feaParam1[0]+0.25), carpar[1]-al3[1],  carpar[2]-al3[2], 0, "ONLY");
1618   gMC->Gspos("FAL3", 3, "FCA2",  (feaParam1[0]+0.25), carpar[1]-al3[1],  carpar[2]-al3[2], 0, "ONLY");
1619
1620   //Float_t feaRoof1[3] = {9.5, 0.2, 1.45};
1621   Float_t feaRoof1[3] = {fgkFEAwidth1*0.5, 0.2, 1.45};
1622
1623   // third Nino ASIC mask volume definition
1624   //Float_t feaRoof2[3] = {3.35, 0.05, 1.05};
1625   Float_t feaRoof2[3] = {al3[0], 0.05, 1.05};
1626   gMC->Gsvolu("FRO2", "BOX ", idtmed[504], feaRoof2, 3); // Al
1627
1628   // fourth Nino ASIC mask volume definition
1629   //Float_t feaRoof3[3] = {3.35, feaRoof1[1]+feaRoof2[1], 0.1};
1630   Float_t feaRoof3[3] = {al3[0], feaRoof1[1]+feaRoof2[1], 0.1};
1631   gMC->Gsvolu("FRO3", "BOX ", idtmed[504], feaRoof3, 3); // Al
1632
1633   // fifth Nino ASIC mask volume definition
1634   Float_t feaRoof4[3] = {al3[0], 0.05, carpar[2]-feaParam1[2]-feaRoof1[1]-al3[2]};
1635   gMC->Gsvolu("FRO4", "BOX ", idtmed[504], feaRoof4, 3); // Al
1636
1637   // other Nino ASIC mask volumes positioning
1638   Float_t rowstep = 6.66;
1639   Float_t rowgap[5] = {13.5, 22.9, 16.94, 23.8, 20.4};
1640   Int_t rowb[5] = {6, 7, 6, 19, 7};
1641   Float_t carpos[3] = {25. - xtof*0.5,
1642                        (11.5 - (ytof*0.5 - fgkModuleCoverThickness))*0.5,
1643                        0.};
1644   Int_t row = 1;
1645   Int_t nrow = 0;
1646   for (Int_t sg= -1; sg< 2; sg+= 2) {
1647     carpos[2] = sg*zlenA*0.5;
1648     for (Int_t nb=0; nb<5; ++nb) {
1649       carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
1650       nrow = row + rowb[nb];
1651       for ( ; row < nrow ; ++row) {
1652
1653         carpos[2] -= sg*rowstep;
1654
1655         if (nb==4) {
1656
1657           gMC->Gspos("FRO2",4*row,  "FAIA", carpos[0],carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1658           gMC->Gspos("FRO2",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1659           gMC->Gspos("FRO2",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1660           gMC->Gspos("FRO2",4*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1661
1662           gMC->Gspos("FRO3",4*row,  "FAIA", carpos[0],carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+(carpar[2]-feaRoof3[2]), 0,"ONLY");
1663           gMC->Gspos("FRO3",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+(carpar[2]-feaRoof3[2]), 0,"ONLY");
1664           gMC->Gspos("FRO3",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+(carpar[2]-feaRoof3[2]), 0,"ONLY");
1665           gMC->Gspos("FRO3",4*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+(carpar[2]-feaRoof3[2]), 0,"ONLY");
1666
1667           gMC->Gspos("FRO4",4*row,  "FAIA", carpos[0],          carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1668           gMC->Gspos("FRO4",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1669           gMC->Gspos("FRO4",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1670           gMC->Gspos("FRO4",4*row-3,"FAIA",-carpos[0],          carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1671
1672         }
1673         else {
1674
1675           gMC->Gspos("FRO2",4*row,  "FAIA", carpos[0],carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+sg*(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1676           gMC->Gspos("FRO2",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+sg*(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1677           gMC->Gspos("FRO2",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+sg*(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1678           gMC->Gspos("FRO2",4*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+sg*(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1679
1680           gMC->Gspos("FRO3",4*row,  "FAIA", carpos[0],carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+sg*(carpar[2]-feaRoof3[2]), 0,"ONLY");
1681           gMC->Gspos("FRO3",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+sg*(carpar[2]-feaRoof3[2]), 0,"ONLY");
1682           gMC->Gspos("FRO3",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+sg*(carpar[2]-feaRoof3[2]), 0,"ONLY");
1683           gMC->Gspos("FRO3",4*row-3,"FAIA",-carpos[0],carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+sg*(carpar[2]-feaRoof3[2]), 0,"ONLY");
1684
1685           gMC->Gspos("FRO4",4*row,  "FAIA", carpos[0],          carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+sg*(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1686           gMC->Gspos("FRO4",4*row-1,"FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+sg*(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1687           gMC->Gspos("FRO4",4*row-2,"FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+sg*(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1688           gMC->Gspos("FRO4",4*row-3,"FAIA",-carpos[0],          carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+sg*(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1689
1690         }
1691       }
1692     }
1693   }
1694
1695   gMC->Gspos("FRO2",364, "FAIA", carpos[0],carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1696   gMC->Gspos("FRO2",363, "FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1697   gMC->Gspos("FRO2",362, "FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1698   gMC->Gspos("FRO2",361, "FAIA",-carpos[0],carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1699
1700   gMC->Gspos("FRO3",364, "FAIA", carpos[0],carpos[1]+carpar[1]+feaRoof3[1],(carpar[2]-feaRoof3[2]), 0,"ONLY");
1701   gMC->Gspos("FRO3",363, "FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof3[1],(carpar[2]-feaRoof3[2]), 0,"ONLY");
1702   gMC->Gspos("FRO3",362, "FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof3[1],(carpar[2]-feaRoof3[2]), 0,"ONLY");
1703   gMC->Gspos("FRO3",361, "FAIA",-carpos[0],carpos[1]+carpar[1]+feaRoof3[1],(carpar[2]-feaRoof3[2]), 0,"ONLY");
1704
1705   gMC->Gspos("FRO4",364, "FAIA", carpos[0],          carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1706   gMC->Gspos("FRO4",363, "FAIA", (feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1707   gMC->Gspos("FRO4",362, "FAIA",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1708   gMC->Gspos("FRO4",361, "FAIA",-carpos[0],          carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1709
1710
1711   if (fTOFHoles) {
1712     row = 1;
1713     for (Int_t sg= -1; sg< 2; sg+= 2) {
1714       carpos[2] = sg*zlenA*0.5;
1715       for (Int_t nb=0; nb<4; ++nb) {
1716         carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
1717         nrow = row + rowb[nb];
1718         for ( ; row < nrow ; ++row) {
1719           carpos[2] -= sg*rowstep;
1720
1721           gMC->Gspos("FRO2",4*row,  "FAIB", carpos[0],carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+sg*(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1722           gMC->Gspos("FRO2",4*row-1,"FAIB", (feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+sg*(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1723           gMC->Gspos("FRO2",4*row-2,"FAIB",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+sg*(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1724           gMC->Gspos("FRO2",4*row-3,"FAIB",-carpos[0],carpos[1]+carpar[1]+2.*feaRoof1[1]+feaRoof2[1],carpos[2]+sg*(carpar[2]-2.*feaRoof3[2]-feaRoof2[2]), 0,"ONLY");
1725
1726           gMC->Gspos("FRO3",4*row,  "FAIB", carpos[0],carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+sg*(carpar[2]-feaRoof3[2]), 0,"ONLY");
1727           gMC->Gspos("FRO3",4*row-1,"FAIB", (feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+sg*(carpar[2]-feaRoof3[2]), 0,"ONLY");
1728           gMC->Gspos("FRO3",4*row-2,"FAIB",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+sg*(carpar[2]-feaRoof3[2]), 0,"ONLY");
1729           gMC->Gspos("FRO3",4*row-3,"FAIB",-carpos[0],carpos[1]+carpar[1]+feaRoof3[1],carpos[2]+sg*(carpar[2]-feaRoof3[2]), 0,"ONLY");
1730
1731           gMC->Gspos("FRO4",4*row,  "FAIB", carpos[0],          carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+sg*(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1732           gMC->Gspos("FRO4",4*row-1,"FAIB", (feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+sg*(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1733           gMC->Gspos("FRO4",4*row-2,"FAIB",-(feaParam1[0]+0.25),carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+sg*(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1734           gMC->Gspos("FRO4",4*row-3,"FAIB",-carpos[0],          carpos[1]+carpar[1]+2.*feaRoof1[1]-feaRoof4[1],carpos[2]+sg*(carpar[2]-2.*al3[2]-feaRoof4[2]), 0,"ONLY");
1735
1736         }
1737       }
1738     }
1739   }
1740
1741 }
1742
1743 //_____________________________________________________________________________
1744 void AliTOFv6T0::MakeSuperModuleCooling(Float_t xtof, Float_t ytof, Float_t zlenA) const
1745 {
1746   //
1747   // Make cooling tubes (FTUB volume)
1748   // and cooling bars (FTLN and FLTN volumes)
1749   // in FAIA/B volume containers.
1750   //
1751
1752   //const Float_t fgkInterCentrModBorder2 = 57.5;
1753
1754   // honeycomb layer between strips and cards (cm)
1755   //const Float_t fgkModuleCoverThickness = 2.;
1756
1757   Int_t *idtmed = fIdtmed->GetArray()-499;
1758
1759   Int_t idrotm[1];
1760
1761   //const Float_t fgkFEAwidth1 = 19.;
1762
1763   //const Float_t fgkCBLw   = 13.5; // width of lateral cables and tubes block
1764   //const Float_t fgkSawThickness = 1.;
1765
1766   // cooling tube volume definition
1767   Float_t tubepar[3] = {0., 0.4, xtof*0.5 - fgkCBLw - fgkSawThickness};
1768   gMC->Gsvolu("FTUB", "TUBE", idtmed[512], tubepar, 3); // Cu
1769
1770   // water cooling tube volume definition
1771   Float_t tubeparW[3] = {0., 0.3, tubepar[2]};
1772   gMC->Gsvolu("FITU", "TUBE", idtmed[509], tubeparW, 3); // H2O
1773
1774   // Positioning of the water tube into the steel one
1775   gMC->Gspos("FITU",1,"FTUB",0.,0.,0.,0,"ONLY");
1776
1777   // definition of transverse components of SM cooling system
1778   Float_t lonpar[3] = {tubepar[2], 6.15, 0.7};
1779   gMC->Gsvolu("FTLN", "BOX ", idtmed[504], lonpar, 3); // Al
1780   lonpar[0] = 2.;
1781   lonpar[1] = 1.;
1782   lonpar[2] = zlenA*0.5;
1783   // definition of longitudinal components of SM cooling system
1784   gMC->Gsvolu("FLON", "BOX ", idtmed[504], lonpar, 3); // Al
1785   if (fTOFHoles) {
1786     lonpar[2] = (zlenA*0.5 - fgkInterCentrModBorder2)*0.5;
1787     gMC->Gsvolu("FLOB", "BOX ", idtmed[504], lonpar, 3); // Al
1788   }
1789
1790   // rotation matrix
1791   AliMatrix(idrotm[0], 180., 90., 90., 90., 90., 0.);
1792
1793   // Positioning of cooling tubes and transverse components of SM
1794   // cooling system
1795   Float_t carpar[3] = {fgkFEAwidth1*0.5, 5.6, 0.45};
1796   Float_t feaParam1[3] = {fgkFEAwidth1*0.5, 5.6, 0.1};
1797   Float_t al1[3] = {fgkFEAwidth1*0.5, 0.4, 0.2};
1798   Float_t feaRoof1[3] = {al1[0], al1[2], 1.45};
1799   Float_t bar[3] = {8.575, 0.6, 0.25};
1800   Float_t rowstep = 6.66;
1801   Float_t ytub= 3.65;
1802   Float_t rowgap[5] = {13.5, 22.9, 16.94, 23.8, 20.4};
1803   Int_t rowb[5] = {6, 7, 6, 19, 7};
1804   Float_t carpos[3] = {25. - xtof*0.5,
1805                        (11.5 - (ytof*0.5 - fgkModuleCoverThickness))*0.5,
1806                        0.};
1807   Int_t row = 1;
1808   Int_t nrow = 0;
1809   for (Int_t sg= -1; sg< 2; sg+= 2) {
1810     carpos[2] = sg*zlenA*0.5;
1811     for (Int_t nb=0; nb<5; ++nb) {
1812       carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
1813       nrow = row + rowb[nb];
1814       for ( ; row < nrow ; ++row) {
1815
1816         carpos[2] -= sg*rowstep;
1817
1818         if (nb==4)
1819           gMC->Gspos("FTUB", row, "FAIA", 0., carpos[1]+carpar[1]-bar[1], carpos[2]-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), idrotm[0], "ONLY");
1820         else
1821           gMC->Gspos("FTUB", row, "FAIA", 0., carpos[1]+carpar[1]-bar[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), idrotm[0], "ONLY");
1822       }
1823     }
1824     gMC->Gspos("FTLN", 5+4*sg, "FAIA", 0., -0.1, 369.9*sg, 0, "ONLY");
1825     gMC->Gspos("FTLN", 5+3*sg, "FAIA", 0., -0.1, 366.9*sg, 0, "ONLY");
1826     gMC->Gspos("FTLN", 5+2*sg, "FAIA", 0., -0.1, 198.8*sg, 0, "ONLY");
1827     gMC->Gspos("FTLN",   5+sg, "FAIA", 0., -0.1, 56.82*sg, 0, "ONLY");
1828   }
1829
1830   gMC->Gspos("FTUB", 91, "FAIA", 0., carpos[1]+carpar[1]-bar[1],-(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), idrotm[0], "ONLY");
1831
1832   gMC->Gspos("FLON",  2, "FAIA",-24., ytub+1.4, 0., 0, "MANY");
1833   gMC->Gspos("FLON",  1, "FAIA", 24., ytub+1.4, 0., 0, "MANY");
1834
1835
1836   if (fTOFHoles) {
1837     row = 1;
1838     for (Int_t sg= -1; sg< 2; sg+= 2) {
1839       carpos[2] = sg*zlenA*0.5;
1840       for (Int_t nb=0; nb<4; ++nb) {
1841         carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
1842         nrow = row + rowb[nb];
1843         for ( ; row < nrow ; ++row) {
1844           carpos[2] -= sg*rowstep;
1845           gMC->Gspos("FTUB", row, "FAIB", 0., carpos[1]+carpar[1]-bar[1], carpos[2]-sg*(carpar[2]-2.*feaParam1[2]-2.*al1[2]+2.*feaRoof1[2]-2.*bar[2]-tubepar[1]), idrotm[0], "ONLY");
1846         }
1847       }
1848
1849       gMC->Gspos("FTLN", 5+4*sg, "FAIB", 0., -0.1, 369.9*sg, 0, "ONLY");
1850       gMC->Gspos("FTLN", 5+3*sg, "FAIB", 0., -0.1, 366.9*sg, 0, "ONLY");
1851       gMC->Gspos("FTLN", 5+2*sg, "FAIB", 0., -0.1, 198.8*sg, 0, "ONLY");
1852       gMC->Gspos("FTLN",   5+sg, "FAIB", 0., -0.1, 56.82*sg, 0, "ONLY");
1853     }
1854
1855     gMC->Gspos("FLOB", 4, "FAIB",-24., ytub+1.4,  (zlenA*0.5 + fgkInterCentrModBorder2)*0.5, 0, "MANY");
1856     gMC->Gspos("FLOB", 3, "FAIB", 24., ytub+1.4,  (zlenA*0.5 + fgkInterCentrModBorder2)*0.5, 0, "MANY");
1857     gMC->Gspos("FLOB", 2, "FAIB",-24., ytub+1.4, -(zlenA*0.5 + fgkInterCentrModBorder2)*0.5, 0, "MANY");
1858     gMC->Gspos("FLOB", 1, "FAIB", 24., ytub+1.4, -(zlenA*0.5 + fgkInterCentrModBorder2)*0.5, 0, "MANY");
1859
1860   }
1861
1862 }
1863
1864 //_____________________________________________________________________________
1865 void AliTOFv6T0::MakeSuperModuleServices(Float_t xtof, Float_t ytof, Float_t zlenA) const
1866 {
1867   //
1868   // Make signal cables (FCAB and FCBL/B volumes),
1869   // supemodule cover (FCOV volume) and wall (FSAW volume)
1870   // in FAIA/B volume containers.
1871   //
1872
1873   //const Float_t fgkInterCentrModBorder2 = 57.5;
1874
1875   // honeycomb layer between strips and cards (cm)
1876   //const Float_t fgkModuleCoverThickness = 2.;
1877
1878   Int_t *idtmed = fIdtmed->GetArray()-499;
1879
1880   Int_t idrotm[3];
1881
1882   //const Float_t fgkCBLw   = 13.5; // width of lateral cables and tubes block
1883   //const Float_t fgkSawThickness = 1.;
1884   //const Float_t fgkFEAwidth1 = 19.;
1885   //const Float_t fgkFEAwidth2 = 38.5;
1886
1887   Float_t tubepar[3] = {0., 0.4, xtof*0.5 - fgkCBLw - fgkSawThickness};
1888
1889   // FEA cables definition
1890   Float_t cbpar[3] = {0., 0.5, (tubepar[2] - fgkFEAwidth2*0.5)*0.5};
1891   gMC->Gsvolu("FCAB", "TUBE", idtmed[510], cbpar, 3);    // copper+alu
1892   cbpar[2] = (xtof*0.5 - fgkCBLw - fgkSawThickness - (xtof*0.5 - 25. + fgkFEAwidth1*0.5))*0.5;
1893   gMC->Gsvolu("FCAL", "TUBE", idtmed[510], cbpar, 3);    // copper+alu
1894
1895   // rotation matrix
1896   AliMatrix(idrotm[0], 180., 90., 90., 90., 90., 0.);
1897
1898   // FEA cables positioning
1899   Float_t rowstep = 6.66;
1900   Float_t ytub= 3.65;
1901   Float_t ycab= ytub-3.;
1902   Float_t rowgap[5] = {13.5, 22.9, 16.94, 23.8, 20.4};
1903   Int_t rowb[5] = {6, 7, 6, 19, 7};
1904   Float_t carpos[3] = {25. - xtof*0.5,
1905                        (11.5 - (ytof*0.5 - fgkModuleCoverThickness))*0.5,
1906                        0.};
1907   Int_t row = 1;
1908   Int_t nrow = 0;
1909   Float_t xCable = (xtof*0.5 - fgkCBLw - fgkSawThickness + fgkFEAwidth2*0.5)*0.5;
1910   Float_t xCableL = (xtof*0.5 - fgkCBLw - fgkSawThickness + (xtof*0.5 - 25. + fgkFEAwidth1*0.5))*0.5;
1911   for (Int_t sg= -1; sg< 2; sg+= 2) {
1912     carpos[2] = sg*zlenA*0.5;
1913     for (Int_t nb=0; nb<5; ++nb) {
1914       carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
1915       nrow = row + rowb[nb];
1916       for ( ; row < nrow ; ++row) {
1917
1918         carpos[2] -= sg*rowstep;
1919
1920         if (nb==4)
1921           {
1922           gMC->Gspos("FCAB", 2*row,   "FAIA", xCable,  ycab,             carpos[2]-1.1, idrotm[0], "ONLY");
1923           gMC->Gspos("FCAB", 2*row-1, "FAIA",-xCable,  ycab,             carpos[2]-1.1, idrotm[0], "ONLY");
1924           gMC->Gspos("FCAL", 2*row,   "FAIA", xCableL, ycab-2.*cbpar[1], carpos[2]-1.1, idrotm[0], "ONLY");
1925           gMC->Gspos("FCAL", 2*row-1, "FAIA",-xCableL, ycab-2.*cbpar[1], carpos[2]-1.1, idrotm[0], "ONLY");
1926           }
1927         else
1928           {
1929           gMC->Gspos("FCAB", 2*row,   "FAIA", xCable, ycab,              carpos[2]-sg*1.1, idrotm[0], "ONLY");
1930           gMC->Gspos("FCAB", 2*row-1, "FAIA",-xCable, ycab,              carpos[2]-sg*1.1, idrotm[0], "ONLY");
1931           gMC->Gspos("FCAL", 2*row,   "FAIA", xCableL, ycab-2.*cbpar[1], carpos[2]-sg*1.1, idrotm[0], "ONLY");
1932           gMC->Gspos("FCAL", 2*row-1, "FAIA",-xCableL, ycab-2.*cbpar[1], carpos[2]-sg*1.1, idrotm[0], "ONLY");
1933           }
1934       }
1935     }
1936   }
1937
1938   gMC->Gspos("FCAB", 182, "FAIA", xCable,  ycab,             -1.1, idrotm[0], "ONLY");
1939   gMC->Gspos("FCAB", 181, "FAIA",-xCable,  ycab,             -1.1, idrotm[0], "ONLY");
1940   gMC->Gspos("FCAL", 182, "FAIA", xCableL, ycab-2.*cbpar[1], -1.1, idrotm[0], "ONLY");
1941   gMC->Gspos("FCAL", 181, "FAIA",-xCableL, ycab-2.*cbpar[1], -1.1, idrotm[0], "ONLY");
1942
1943   if (fTOFHoles) {
1944     row = 1;
1945     for (Int_t sg= -1; sg< 2; sg+= 2) {
1946       carpos[2] = sg*zlenA*0.5;
1947       for (Int_t nb=0; nb<4; ++nb) {
1948         carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
1949         nrow = row + rowb[nb];
1950         for ( ; row < nrow ; ++row) {
1951           carpos[2] -= sg*rowstep;
1952           gMC->Gspos("FCAB", 2*row,   "FAIB", xCable,  ycab,             carpos[2]-sg*1.1, idrotm[0], "ONLY");
1953           gMC->Gspos("FCAB", 2*row-1, "FAIB",-xCable,  ycab,             carpos[2]-sg*1.1, idrotm[0], "ONLY");
1954           gMC->Gspos("FCAL", 2*row,   "FAIB", xCableL, ycab-2.*cbpar[1], carpos[2]-sg*1.1, idrotm[0], "ONLY");
1955           gMC->Gspos("FCAL", 2*row-1, "FAIB",-xCableL, ycab-2.*cbpar[1], carpos[2]-sg*1.1, idrotm[0], "ONLY");
1956         }
1957       }
1958     }
1959   }
1960
1961   // Cables and tubes on the side blocks
1962   // constants definition
1963   const Float_t kCBLl   = zlenA*0.5; // length of block
1964   const Float_t kCBLlh  = zlenA*0.5 - fgkInterCentrModBorder2; // length  of block in case of holes
1965   //const Float_t fgkCBLw   = 13.5;      // width of block
1966   //const Float_t fgkCBLh1  = 2.;        // min. height of block
1967   //const Float_t fgkCBLh2  = 12.3;      // max. height of block
1968   //const Float_t fgkSawThickness = 1.; // Al wall thickness
1969
1970   // lateral cable and tube volume definition
1971   Float_t tgal =  (fgkCBLh2 - fgkCBLh1)/(2.*kCBLl);
1972   Float_t cblpar[11];
1973   cblpar[0] = fgkCBLw *0.5;
1974   cblpar[1] = 0.;
1975   cblpar[2] = 0.;
1976   cblpar[3] = kCBLl *0.5;
1977   cblpar[4] = fgkCBLh1 *0.5;
1978   cblpar[5] = fgkCBLh2 *0.5;
1979   cblpar[6] = TMath::ATan(tgal)*kRaddeg;
1980   cblpar[7] = kCBLl *0.5;
1981   cblpar[8] = fgkCBLh1 *0.5;
1982   cblpar[9] = fgkCBLh2 *0.5;
1983   cblpar[10]= cblpar[6];
1984   gMC->Gsvolu("FCBL", "TRAP", idtmed[511], cblpar, 11); // cables and tubes mix 
1985
1986   // Side Al Walls definition
1987   Float_t sawpar[3] = {fgkSawThickness*0.5, fgkCBLh2*0.5, kCBLl};
1988   gMC->Gsvolu("FSAW", "BOX ", idtmed[504], sawpar,  3); // Al
1989
1990   AliMatrix(idrotm[1], 90., 90., 180., 0., 90., 180.);
1991   AliMatrix(idrotm[2], 90., 90., 0., 0., 90., 0.);
1992
1993   // lateral cable and tube volume positioning
1994   Float_t xcoor, ycoor, zcoor;
1995   xcoor = (xtof - fgkCBLw)*0.5 - 2.*sawpar[0];
1996   ycoor = (fgkCBLh1 + fgkCBLh2)*0.25 - (ytof*0.5 - fgkModuleCoverThickness)*0.5;
1997   zcoor = kCBLl*0.5;
1998   gMC->Gspos("FCBL", 1, "FAIA", -xcoor, ycoor, -zcoor, idrotm[1], "ONLY");
1999   gMC->Gspos("FCBL", 2, "FAIA",  xcoor, ycoor, -zcoor, idrotm[1], "ONLY");
2000   gMC->Gspos("FCBL", 3, "FAIA", -xcoor, ycoor,  zcoor, idrotm[2], "ONLY");
2001   gMC->Gspos("FCBL", 4, "FAIA",  xcoor, ycoor,  zcoor, idrotm[2], "ONLY");
2002
2003   if (fTOFHoles) {
2004     cblpar[3] = kCBLlh *0.5;
2005     cblpar[5] = fgkCBLh1*0.5 + kCBLlh*tgal;
2006     cblpar[7] = kCBLlh *0.5;
2007     cblpar[9] = cblpar[5];
2008     gMC->Gsvolu("FCBB", "TRAP", idtmed[511], cblpar, 11); // cables and tubes mix
2009
2010     xcoor = (xtof - fgkCBLw)*0.5 - 2.*sawpar[0];
2011     ycoor = (fgkCBLh1 + 2.*cblpar[5])*0.25 - (ytof*0.5 - fgkModuleCoverThickness)*0.5;
2012     zcoor = kCBLl-kCBLlh*0.5;
2013     gMC->Gspos("FCBB", 1, "FAIB", -xcoor, ycoor, -zcoor, idrotm[1], "ONLY");
2014     gMC->Gspos("FCBB", 2, "FAIB",  xcoor, ycoor, -zcoor, idrotm[1], "ONLY");
2015     gMC->Gspos("FCBB", 3, "FAIB", -xcoor, ycoor,  zcoor, idrotm[2], "ONLY");
2016     gMC->Gspos("FCBB", 4, "FAIB",  xcoor, ycoor,  zcoor, idrotm[2], "ONLY");
2017   }
2018
2019   // lateral cable and tube volume positioning
2020   xcoor = xtof*0.5-sawpar[0];
2021   ycoor = (fgkCBLh2 - ytof*0.5 + fgkModuleCoverThickness)*0.5;
2022   zcoor = 0.;
2023   gMC->Gspos("FSAW", 1, "FAIA", -xcoor, ycoor, zcoor, 0, "ONLY");
2024   gMC->Gspos("FSAW", 2, "FAIA",  xcoor, ycoor, zcoor, 0, "ONLY");
2025
2026   if (fTOFHoles) {
2027     xcoor = xtof*0.5 - sawpar[0];
2028     ycoor = (fgkCBLh2 - ytof*0.5 + fgkModuleCoverThickness)*0.5;
2029     gMC->Gspos("FSAW", 1, "FAIB", -xcoor, ycoor, 0., 0, "ONLY");
2030     gMC->Gspos("FSAW", 2, "FAIB",  xcoor, ycoor, 0., 0, "ONLY");
2031   }
2032
2033   // TOF Supermodule cover definition and positioning
2034   Float_t covpar[3] = {xtof*0.5, 0.075, zlenA*0.5};
2035   gMC->Gsvolu("FCOV", "BOX ", idtmed[504], covpar, 3); // Al
2036   if (fTOFHoles) {
2037     covpar[2] = (zlenA*0.5 - fgkInterCentrModBorder2)*0.5;
2038     gMC->Gsvolu("FCOB", "BOX ", idtmed[504], covpar, 3); // Al
2039     covpar[2] = fgkInterCentrModBorder2;
2040     gMC->Gsvolu("FCOP", "BOX ", idtmed[513], covpar, 3); // Plastic (CH2)
2041   }
2042
2043   xcoor = 0.;
2044   ycoor = 12.5*0.5 - covpar[1];
2045   zcoor = 0.;
2046   gMC->Gspos("FCOV", 0, "FAIA", xcoor, ycoor, zcoor, 0, "ONLY");
2047   if (fTOFHoles) {
2048     zcoor = (zlenA*0.5 + fgkInterCentrModBorder2)*0.5;
2049     gMC->Gspos("FCOB", 1, "FAIB", xcoor, ycoor,  zcoor, 0, "ONLY");
2050     gMC->Gspos("FCOB", 2, "FAIB", xcoor, ycoor, -zcoor, 0, "ONLY");
2051     zcoor = 0.;
2052     gMC->Gspos("FCOP", 0, "FAIB", xcoor, ycoor,  zcoor, 0, "ONLY");
2053   }
2054
2055 }
2056
2057 //_____________________________________________________________________________
2058 void AliTOFv6T0::MakeReadoutCrates(Float_t ytof) const
2059 {
2060   // Services Volumes
2061
2062   // Empty crate weight: 50 Kg, electronics cards + cables ~ 52 Kg.
2063   // Per each side (A and C) the total weight is: 2x102 ~ 204 Kg.
2064   // ... + weight of the connection pannel for the steel cooling system (Cr 18%, Ni 12%, Fe 70%)
2065   // + other remaining elements + various supports
2066
2067   // Each FEA card weight + all supports
2068   // (including all bolts and not including the cable connectors)
2069   //  353.1 g.
2070   // Per each strip there are 4 FEA cards, then
2071   // the total weight of the front-end electonics section is: 353.1 g x 4 = 1412.4 g.
2072
2073   // Services Volumes
2074
2075   // Empty crate weight: 50 Kg, electronics cards + cables ~ 52 Kg.
2076   // Per each side (A and C) the total weight is: 2x102 ~ 204 Kg.
2077   // ... + weight of the connection pannel for the steel cooling system (Cr 18%, Ni 12%, Fe 70%)
2078   // + other remaining elements + various supports
2079
2080   // Each FEA card weight + all supports
2081   // (including all bolts and not including the cable connectors)
2082   //  353.1 g.
2083   // Per each strip there are 4 FEA cards, then
2084   // the total weight of the front-end electonics section is: 353.1 g x 4 = 1412.4 g.
2085   //
2086
2087   Int_t *idtmed = fIdtmed->GetArray()-499;
2088
2089   Int_t idrotm[18];
2090
2091   // volume definition
2092   Float_t serpar[3] = {29.*0.5, 121.*0.5, 90.*0.5};
2093   gMC->Gsvolu("FTOS", "BOX ", idtmed[514], serpar, 3); // Al + Cu + steel
2094
2095   Float_t xcoor, ycoor, zcoor;
2096   zcoor = (118.-90.)*0.5;
2097   Float_t phi = -10.,  ra = fTOFGeometry->Rmin() + ytof*0.5;
2098   for (Int_t i = 0; i < fTOFGeometry->NSectors(); i++) {
2099     phi += 20.;
2100     xcoor = ra * TMath::Cos(phi * kDegrad);
2101     ycoor = ra * TMath::Sin(phi * kDegrad);
2102     AliMatrix(idrotm[i], 90., phi, 90., phi + 270., 0., 0.);
2103     gMC->Gspos("FTOS", i, "BFMO", xcoor, ycoor, zcoor, idrotm[i], "ONLY");
2104   }
2105
2106   zcoor = (90. - 223.)*0.5;
2107   gMC->Gspos("FTOS", 1, "BBCE", ra, 0., zcoor, 0, "ONLY");
2108
2109 }
2110
2111 //_____________________________________________________________________________
2112 void AliTOFv6T0::DrawModule() const
2113 {
2114   //
2115   // Draw a shaded view of the Time Of Flight version 5
2116   //
2117
2118   // Set everything unseen
2119   gMC->Gsatt("*", "seen", -1);
2120
2121   //
2122   //Set volumes visible
2123   // 
2124
2125   //Set ALIC mother transparent
2126   gMC->Gsatt("ALIC","SEEN", 0);
2127
2128 //=====> Level 1
2129   // Level 1 for TOF volumes
2130   gMC->Gsatt("B077","seen", 0);
2131
2132 //=====> Level 2
2133   // Level 2 for TOF volumes
2134   gMC->Gsatt("B071","seen", 0);
2135   gMC->Gsatt("B074","seen", 0);
2136   gMC->Gsatt("B075","seen", 0);
2137   gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
2138   gMC->Gsatt("B080","seen", 0);  // B080 does not has sub-level                
2139
2140   // Level 2 of B071
2141   gMC->Gsatt("B056","seen", 0);  // B056 does not has sub-levels  -
2142   gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
2143   gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
2144   gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
2145   gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
2146
2147   char name[16];
2148   for (Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++) {
2149     sprintf(name, "BREF%d",isec);
2150     gMC->Gsatt(name,"seen", 0);  // all BREF%d sub-levels skipped   -
2151     sprintf(name, "BTRD%d",isec);
2152     gMC->Gsatt(name,"seen", 0);  // all BTRD%d sub-levels skipped   -
2153     sprintf(name, "BTOF%d",isec);
2154     gMC->Gsatt(name,"seen",-2);  // all BTOF%d sub-levels skipped   -
2155   }
2156
2157   gMC->Gdopt("hide", "on");
2158   gMC->Gdopt("shad", "on");
2159   gMC->Gsatt("*", "fill", 7);
2160   gMC->SetClipBox(".");
2161   gMC->SetClipBox("*", 100, 1000, 100, 1000, 100, 1000);
2162   gMC->DefaultRange();
2163   gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .018, .018);
2164   gMC->Gdhead(1111, "Time Of Flight");
2165   gMC->Gdman(18, 3, "MAN");
2166   gMC->Gdopt("hide","off");
2167 }
2168 //_____________________________________________________________________________
2169 void AliTOFv6T0::DrawDetectorModules() const
2170 {
2171   //
2172   // Draw a shaded view of the TOF detector SuperModules version 5
2173   //
2174  
2175   // Set everything unseen
2176   gMC->Gsatt("*", "seen", -1);
2177
2178   //
2179   //Set volumes visible
2180   // 
2181
2182   //Set ALIC mother transparent
2183   gMC->Gsatt("ALIC","SEEN", 0);
2184
2185 //=====> Level 1
2186   // Level 1 for TOF volumes
2187   gMC->Gsatt("B077","seen", 0);
2188
2189 //=====> Level 2
2190   // Level 2 for TOF volumes
2191   gMC->Gsatt("B071","seen", 0);
2192   gMC->Gsatt("B074","seen", 0);
2193   gMC->Gsatt("B075","seen", 0);
2194   gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
2195   gMC->Gsatt("B080","seen", 0);  // B080 does not has sub-level                
2196
2197   // Level 2 of B071
2198   gMC->Gsatt("B056","seen", 0);  // B056 does not has sub-levels  -
2199   gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
2200   gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
2201   gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
2202   gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
2203
2204   char name[16];
2205   for (Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++) {
2206     sprintf(name, "BREF%d",isec);
2207     gMC->Gsatt(name,"seen", 0);  // all BREF%d sub-levels skipped   -
2208     sprintf(name, "BTRD%d",isec);
2209     gMC->Gsatt(name,"seen", 0);  // all BTRD%d sub-levels skipped   -
2210     sprintf(name, "BTOF%d",isec);
2211     gMC->Gsatt(name,"seen", 0);  // all BTOF%d sub-levels skipped   -
2212   }
2213
2214   // Level 3 of B071, B075 and B074
2215   gMC->Gsatt("FTOA","seen",-2);  // all FTOA sub-levels skipped   -
2216   if (fTOFHoles) gMC->Gsatt("FTOB","seen",-2);  // all FTOB sub-levels skipped   -
2217   if (fTOFHoles) gMC->Gsatt("FTOC","seen",-2);  // all FTOC sub-levels skipped   -
2218
2219   // Level 3 of B071, B075 and B074
2220   gMC->Gsatt("FAIA","seen",-1);  // all FAIA sub-levels skipped   -
2221   if (fTOFHoles) gMC->Gsatt("FAIB","seen",-1);  // all FAIB sub-levels skipped   -
2222
2223   // Level 3 of B071, B075 and B074
2224   gMC->Gsatt("FPEA","seen",-2/*1*/);  // all FPEA sub-levels skipped   -
2225   if (fTOFHoles) gMC->Gsatt("FPEB","seen",-2/*1*/);  // all FPEB sub-levels skipped   -
2226
2227   gMC->Gdopt("hide","on");
2228   gMC->Gdopt("shad","on");
2229   gMC->Gsatt("*", "fill", 5);
2230   gMC->SetClipBox(".");
2231   gMC->SetClipBox("*", 100, 1000, 100, 1000, 0, 1000);
2232   gMC->DefaultRange();
2233   gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .018, .018);
2234   gMC->Gdhead(1111,"TOF detector");
2235   gMC->Gdman(18, 3, "MAN");
2236   gMC->Gdopt("hide","off");
2237 }                                 
2238
2239 //_____________________________________________________________________________
2240 void AliTOFv6T0::DrawDetectorStrips() const
2241 {
2242   //
2243   // Draw a shaded view of the TOF strips for version 5
2244   //
2245
2246   // Set everything unseen
2247   gMC->Gsatt("*", "seen", -1);
2248
2249   //
2250   //Set volumes visible
2251   // 
2252   
2253   //Set ALIC mother transparent
2254   gMC->Gsatt("ALIC","SEEN", 0);
2255   
2256 //=====> Level 1
2257   // Level 1 for TOF volumes
2258   gMC->Gsatt("B077","seen", 0);
2259
2260 //=====> Level 2
2261   // Level 2 for TOF volumes
2262   gMC->Gsatt("B071","seen", 0);
2263   gMC->Gsatt("B074","seen", 0);
2264   gMC->Gsatt("B075","seen", 0);
2265   gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
2266   gMC->Gsatt("B080","seen", 0);  // B080 does not has sub-level                
2267
2268   // Level 2 of B071
2269   gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
2270   gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
2271   gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
2272   gMC->Gsatt("B056","seen", 0);  // B056 does not has sub-levels  -
2273   gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
2274
2275   char name[16];
2276   for (Int_t isec=0; isec<fTOFGeometry->NSectors(); isec++) {
2277     sprintf(name, "BREF%d",isec);
2278     gMC->Gsatt(name,"seen", 0);  // all BREF%d sub-levels skipped   -
2279     sprintf(name, "BTRD%d",isec);
2280     gMC->Gsatt(name,"seen", 0);  // all BTRD%d sub-levels skipped   -
2281     sprintf(name, "BTOF%d",isec);
2282     gMC->Gsatt(name,"seen", 0);  // all BTOF%d sub-levels skipped   -
2283   }
2284
2285   // Level 3 of B071, B074 and B075
2286   gMC->Gsatt("FTOA","SEEN", 0);
2287   if (fTOFHoles) gMC->Gsatt("FTOB","SEEN", 0);
2288   if (fTOFHoles) gMC->Gsatt("FTOC","SEEN", 0);
2289
2290   // Level 4 of B071, B074 and B075
2291   gMC->Gsatt("FLTA","SEEN", 0);
2292   if (fTOFHoles) gMC->Gsatt("FLTB","SEEN", 0);
2293   if (fTOFHoles) gMC->Gsatt("FLTC","SEEN", 0);
2294
2295   // Level 5 of B071, B074 and B075
2296   gMC->Gsatt("FAIA","SEEN", 0);
2297   if (fTOFHoles) gMC->Gsatt("FAIB","SEEN", 0);
2298
2299   gMC->Gsatt("FPEA","SEEN", -2/*1*/);
2300   if (fTOFHoles) gMC->Gsatt("FPEB","SEEN", -2/*1*/);
2301
2302   gMC->Gsatt("FSTR","SEEN",-2);  // all FSTR sub-levels skipped   -
2303
2304   gMC->Gsatt("FWZ1","SEEN", 1);
2305   gMC->Gsatt("FWZ2","SEEN", 1);
2306   gMC->Gsatt("FWZ3","SEEN", 1);
2307   gMC->Gsatt("FWZ4","SEEN", 1);
2308   if (fTOFHoles) {
2309     gMC->Gsatt("FWZA","SEEN", 1);
2310     gMC->Gsatt("FWZB","SEEN", 1);
2311     gMC->Gsatt("FWZC","SEEN", 1);
2312   }
2313
2314   // Level 2 of FAIA
2315   // Level 2 of FAIB
2316   gMC->Gsatt("FCA1","SEEN", 0);
2317   gMC->Gsatt("FCA2","SEEN", 0);
2318   gMC->Gsatt("FCAB","SEEN", 0);
2319   gMC->Gsatt("FCAL","SEEN", 0);
2320   gMC->Gsatt("FTUB","SEEN",-1);  // all FTUB sub-levels skipped   -
2321   gMC->Gsatt("FTLN","SEEN", 0);
2322   gMC->Gsatt("FLTN","SEEN", 0);
2323   gMC->Gsatt("FCBL","SEEN", 0);
2324   if (fTOFHoles) gMC->Gsatt("FCBB","SEEN", 0);
2325   gMC->Gsatt("FSAW","SEEN", 0);
2326   gMC->Gsatt("FCOV","SEEN", 0);
2327   if (fTOFHoles) {
2328     gMC->Gsatt("FCOB","SEEN", 0);
2329     gMC->Gsatt("FCOP","SEEN", 0);
2330   }
2331
2332   // Level 2 of FTUB
2333   gMC->Gsatt("FITU","SEEN", 0);
2334
2335   // Level 2 of FSTR
2336   gMC->Gsatt("FHON","SEEN", 1);
2337   gMC->Gsatt("FPC1","SEEN", 1);
2338   gMC->Gsatt("FPC2","SEEN", 1);
2339   gMC->Gsatt("FPCB","SEEN", 1);
2340   gMC->Gsatt("FRGL","SEEN", 1);
2341   gMC->Gsatt("FGLF","SEEN", 1);
2342
2343   // Level 2 of FPCB => Level 3 of FSTR
2344   gMC->Gsatt("FSEN","SEEN", 0);
2345   gMC->Gsatt("FSEZ","SEEN", 0);
2346   gMC->Gsatt("FPAD","SEEN", 1);
2347
2348   gMC->Gdopt("hide","on");
2349   gMC->Gdopt("shad","on");
2350   gMC->Gsatt("*", "fill", 5);
2351   gMC->SetClipBox(".");
2352   gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
2353   gMC->DefaultRange();
2354   gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .018, .018);
2355   gMC->Gdhead(1111,"TOF Strips");
2356   gMC->Gdman(18, 3, "MAN");
2357   gMC->Gdopt("hide","off");
2358 }
2359
2360 //_____________________________________________________________________________
2361 void AliTOFv6T0::CreateMaterials()
2362 {
2363   //
2364   // Define materials for the Time Of Flight
2365   //
2366
2367   //AliTOF::CreateMaterials();
2368
2369   AliMagF *magneticField = (AliMagF*)gAlice->Field();
2370
2371   Int_t   isxfld = magneticField->Integ();
2372   Float_t sxmgmx = magneticField->Max();
2373
2374   //--- Quartz (SiO2) ---
2375   Float_t   aq[2] = { 28.0855,15.9994};
2376   Float_t   zq[2] = { 14.,8. };
2377   Float_t   wq[2] = { 1.,2. };
2378   Float_t   dq = 2.7; // (+5.9%)
2379   Int_t nq = -2;
2380
2381   // --- Nomex (C14H22O2N2) ---
2382   Float_t anox[4] = {12.011,1.00794,15.9994,14.00674};
2383   Float_t znox[4] = { 6.,  1.,  8.,  7.};
2384   Float_t wnox[4] = {14., 22., 2., 2.};
2385   //Float_t dnox  = 0.048; //old value
2386   Float_t dnox  = 0.22;    // (x 4.6)
2387   Int_t nnox   = -4;
2388
2389   // --- G10  {Si, O, C, H, O} ---
2390   Float_t we[7], na[7];
2391
2392   Float_t ag10[5] = {28.0855,15.9994,12.011,1.00794,15.9994};
2393   Float_t zg10[5] = {14., 8., 6., 1., 8.};
2394   Float_t wmatg10[5];
2395   Int_t nlmatg10 = 5;
2396   na[0]= 1. ,   na[1]= 2. ,   na[2]= 0. ,   na[3]= 0. ,   na[4]= 0.;
2397   MaterialMixer(we,ag10,na,5);
2398   wmatg10[0]= we[0]*0.6;
2399   wmatg10[1]= we[1]*0.6;
2400   na[0]= 0. ,   na[1]= 0. ,   na[2]= 14. ,   na[3]= 20. ,   na[4]= 3.;
2401   MaterialMixer(we,ag10,na,5);
2402   wmatg10[2]= we[2]*0.4;
2403   wmatg10[3]= we[3]*0.4;
2404   wmatg10[4]= we[4]*0.4;
2405   AliDebug(1,Form("wg10  %d  %d  %d  %d  %d", wmatg10[0], wmatg10[1], wmatg10[2], wmatg10[3], wmatg10[4]));
2406   //Float_t densg10 = 1.7; //old value
2407   Float_t densg10 = 2.0; // (+17.8%)
2408
2409   // --- Water ---
2410   Float_t awa[2] = {  1.00794, 15.9994 };
2411   Float_t zwa[2] = {  1.,  8. };
2412   Float_t wwa[2] = {  2.,  1. };
2413   Float_t dwa    = 1.0;
2414   Int_t nwa = -2;
2415
2416   // --- Air ---
2417   Float_t aAir[4]={12.011,14.00674,15.9994,39.948};
2418   Float_t zAir[4]={6.,7.,8.,18.};
2419   Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
2420   Float_t dAir   = 1.20479E-3;
2421
2422   // --- Fibre Glass ---
2423   Float_t afg[4] = {28.0855,15.9994,12.011,1.00794};
2424   Float_t zfg[4] = {14., 8., 6., 1.};
2425   Float_t wfg[4] = {0.12906,0.29405,0.51502,0.06187};
2426   //Float_t dfg    = 1.111;
2427   Float_t dfg    = 2.05; // (x1.845)
2428   Int_t nfg      = 4;
2429
2430   // --- Freon C2F4H2 + SF6 ---
2431   Float_t afre[4] = {12.011,1.00794,18.9984032,32.0065};
2432   Float_t zfre[4] = { 6., 1., 9., 16.};
2433   Float_t wfre[4] = {0.21250,0.01787,0.74827,0.021355};
2434   Float_t densfre = 0.00375;
2435   Int_t nfre     = 4;
2436
2437   // --- Cables and tubes {Al, Cu} ---
2438   Float_t acbt[2] = {26.981539,63.546};
2439   Float_t zcbt[2] = {13., 29.};
2440   Float_t wcbt[2] = {0.407,0.593};
2441   Float_t decbt   = 0.68;
2442
2443   // --- Cable {CH2, Al, Cu} ---
2444   Float_t asc[4] = {12.011, 1.00794, 26.981539,63.546};
2445   Float_t zsc[4] = { 6., 1., 13., 29.};
2446   Float_t wsc[4];
2447   for (Int_t ii=0; ii<4; ii++) wsc[ii]=0.;
2448
2449   Float_t wDummy[4], nDummy[4];
2450   for (Int_t ii=0; ii<4; ii++) wDummy[ii]=0.;
2451   for (Int_t ii=0; ii<4; ii++) nDummy[ii]=0.;
2452   nDummy[0] = 1.;
2453   nDummy[1] = 2.;
2454   MaterialMixer(wDummy,asc,nDummy,2);
2455   wsc[0] = 0.4375*wDummy[0];
2456   wsc[1] = 0.4375*wDummy[1];
2457   wsc[2] = 0.3244;
2458   wsc[3] = 0.2381;
2459   Float_t dsc = 1.223;
2460
2461   // --- Crates boxes {Al, Cu, Fe, Cr, Ni} ---
2462   Float_t acra[5]= {26.981539,63.546,55.845,51.9961,58.6934};
2463   Float_t zcra[5]= {13., 29., 26., 24., 28.};
2464   Float_t wcra[5]= {0.7,0.2,0.07,0.018,0.012};
2465   Float_t dcra   = 0.77;
2466
2467   // --- Polietilene CH2 ---
2468   Float_t aPlastic[2] = {12.011, 1.00794};
2469   Float_t zPlastic[2] = { 6., 1.};
2470   Float_t wPlastic[2] = { 1., 2.};
2471   //Float_t dPlastic = 0.92; // PDB value
2472   Float_t dPlastic = 0.93; // (~+1.1%)
2473   Int_t nwPlastic = -2;
2474
2475   AliMixture ( 0, "Air$", aAir, zAir, dAir, 4, wAir);
2476   AliMixture ( 1, "Nomex$", anox, znox, dnox, nnox, wnox);
2477   AliMixture ( 2, "G10$", ag10, zg10, densg10, nlmatg10, wmatg10);
2478   AliMixture ( 3, "fibre glass$", afg, zfg, dfg, nfg, wfg);
2479   AliMaterial( 4, "Al $", 26.981539, 13., 2.7, -8.9, 999.);
2480   Float_t factor = 0.4/1.5*2./3.;
2481   AliMaterial( 5, "Al honeycomb$", 26.981539, 13., 2.7*factor, -8.9/factor, 999.);
2482   AliMixture ( 6, "Freon$", afre, zfre, densfre, nfre, wfre);
2483   AliMixture ( 7, "Glass$", aq, zq, dq, nq, wq);
2484   AliMixture ( 8, "Water$",  awa, zwa, dwa, nwa, wwa);
2485   AliMixture ( 9, "cables+tubes$", acbt, zcbt, decbt, 2, wcbt);
2486   AliMaterial(10, "Cu $", 63.546, 29., 8.96, -1.43, 999.);
2487   AliMixture (11, "cable$", asc, zsc, dsc, 4, wsc);
2488   AliMixture (12, "Al+Cu+steel$", acra, zcra, dcra, 5, wcra);
2489   AliMixture (13, "plastic$", aPlastic, zPlastic, dPlastic, nwPlastic, wPlastic);
2490   Float_t factorHoles = 1./36.5;
2491   AliMaterial(14, "Al honey for holes$", 26.981539, 13., 2.7*factorHoles, -8.9/factorHoles, 999.);
2492
2493   Float_t epsil, stmin, deemax, stemax;
2494
2495   //   STD data
2496   //  EPSIL  = 0.1   ! Tracking precision,
2497   //  STEMAX = 0.1   ! Maximum displacement for multiple scattering
2498   //  DEEMAX = 0.1   ! Maximum fractional energy loss, DLS
2499   //  STMIN  = 0.1
2500
2501   // TOF data
2502   epsil  = .001;  // Tracking precision,
2503   stemax = -1.;   // Maximum displacement for multiple scattering
2504   deemax = -.3;   // Maximum fractional energy loss, DLS
2505   stmin  = -.8;
2506
2507   AliMedium( 1,"Air$",          0, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2508   AliMedium( 2,"Nomex$",        1, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2509   AliMedium( 3,"G10$",          2, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2510   AliMedium( 4,"fibre glass$",  3, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2511   AliMedium( 5,"Al Frame$",     4, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2512   AliMedium( 6,"honeycomb$",    5, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2513   AliMedium( 7,"Fre$",          6, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2514   AliMedium( 8,"Cu-S$",        10, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2515   AliMedium( 9,"Glass$",        7, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2516   AliMedium(10,"Water$",        8, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2517   AliMedium(11,"Cable$",       11, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2518   AliMedium(12,"Cables+Tubes$", 9, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2519   AliMedium(13,"Copper$",      10, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2520   AliMedium(14,"Plastic$",     13, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2521   AliMedium(15,"Crates$",      12, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2522   AliMedium(16,"honey_holes$", 14, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
2523
2524 }
2525 //_____________________________________________________________________________
2526 void AliTOFv6T0::Init()
2527 {
2528   //
2529   // Initialise the detector after the geometry has been defined
2530   //
2531   AliDebug(1, "**************************************"
2532            "  TOF  "
2533            "**************************************");
2534   AliDebug(1, "  Version 4 of TOF initialing, "
2535            "symmetric TOF - Full Coverage version");
2536   
2537   AliTOF::Init();
2538   
2539   fIdFTOA = gMC->VolId("FTOA");
2540   if (fTOFHoles) {
2541     fIdFTOB = gMC->VolId("FTOB");
2542     fIdFTOC = gMC->VolId("FTOC");
2543   }
2544   fIdFLTA = gMC->VolId("FLTA");
2545   if (fTOFHoles) {
2546     fIdFLTB = gMC->VolId("FLTB");
2547     fIdFLTC = gMC->VolId("FLTC");
2548   }
2549
2550   AliDebug(1, "**************************************"
2551            "  TOF  "
2552            "**************************************");
2553 }
2554  
2555 //_____________________________________________________________________________
2556 void AliTOFv6T0::StepManager()
2557 {
2558
2559   //
2560   // Procedure called at each step in the Time Of Flight
2561   //
2562
2563   TLorentzVector mom, pos;
2564   Float_t xm[3],pm[3],xpad[3],ppad[3];
2565   Float_t hits[14];
2566   Int_t   vol[5];
2567   Int_t   sector, plate, padx, padz, strip;
2568   Int_t   copy, padzid, padxid, stripid, i;
2569   Int_t   *idtmed = fIdtmed->GetArray()-499;
2570   Float_t incidenceAngle;
2571
2572   const char* volpath;
2573
2574   Int_t index = 0;
2575
2576   if(
2577      gMC->IsTrackEntering()
2578      && gMC->TrackCharge()
2579      //&& gMC->GetMedium()==idtmed[507]
2580      && gMC->CurrentMedium()==idtmed[507]
2581      && gMC->CurrentVolID(copy)==fIdSens
2582      )
2583   {
2584
2585     AliMC *mcApplication = (AliMC*)gAlice->GetMCApp();
2586
2587     //AddTrackReference(mcApplication->GetCurrentTrackNumber(), AliTrackReference::kTOF);
2588     AddTrackReference(mcApplication->GetCurrentTrackNumber());
2589
2590     // getting information about hit volumes
2591     
2592     padzid=gMC->CurrentVolOffID(1,copy);
2593     padz=copy;
2594     padz--;
2595
2596     padxid=gMC->CurrentVolOffID(0,copy);
2597     padx=copy; 
2598     padx--;
2599     
2600     stripid=gMC->CurrentVolOffID(4,copy);
2601     strip=copy; 
2602     strip--;
2603
2604     gMC->TrackPosition(pos);
2605     gMC->TrackMomentum(mom);
2606
2607     Double_t normMom=1./mom.Rho();
2608
2609     //  getting the coordinates in pad ref system
2610
2611     xm[0] = (Float_t)pos.X();
2612     xm[1] = (Float_t)pos.Y();
2613     xm[2] = (Float_t)pos.Z();
2614
2615     pm[0] = (Float_t)mom.X()*normMom;
2616     pm[1] = (Float_t)mom.Y()*normMom;
2617     pm[2] = (Float_t)mom.Z()*normMom;
2618  
2619     gMC->Gmtod(xm,xpad,1); // from MRS to DRS: coordinates convertion
2620     gMC->Gmtod(pm,ppad,2); // from MRS to DRS: direction cosinus convertion
2621
2622
2623     if (TMath::Abs(ppad[1])>1) {
2624       AliWarning("Abs(ppad) > 1");
2625       ppad[1]=TMath::Sign((Float_t)1,ppad[1]);
2626     }
2627     incidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
2628
2629     plate = -1;
2630     if      (strip <  fTOFGeometry->NStripC()) {
2631       plate = 0;
2632       //strip = strip;
2633     }
2634     else if (strip >= fTOFGeometry->NStripC() && 
2635              strip <  fTOFGeometry->NStripC() + fTOFGeometry->NStripB()) {
2636       plate = 1;
2637       strip = strip - fTOFGeometry->NStripC();
2638     }
2639     else if (strip >= fTOFGeometry->NStripC() + fTOFGeometry->NStripB() &&
2640              strip <  fTOFGeometry->NStripC() + fTOFGeometry->NStripB() + fTOFGeometry->NStripA()) {
2641       plate = 2;
2642       strip = strip - fTOFGeometry->NStripC() - fTOFGeometry->NStripB();
2643     }
2644     else if (strip >= fTOFGeometry->NStripC() + fTOFGeometry->NStripB() + fTOFGeometry->NStripA() &&
2645              strip <  fTOFGeometry->NStripC() + fTOFGeometry->NStripB() + fTOFGeometry->NStripA() + fTOFGeometry->NStripB()) {
2646       plate = 3;
2647       strip = strip - fTOFGeometry->NStripC() - fTOFGeometry->NStripB() - fTOFGeometry->NStripA();
2648     }
2649     else                                {
2650       plate = 4;
2651       strip = strip - fTOFGeometry->NStripC() - fTOFGeometry->NStripB() - fTOFGeometry->NStripA() - fTOFGeometry->NStripB();
2652     }
2653
2654     volpath=gMC->CurrentVolOffName(7);
2655     index=atoi(&volpath[4]);
2656     sector=-1;
2657     sector=index;
2658
2659     //Old 6h convention
2660     // if(index<5){
2661     //   sector=index+13;
2662     //  }
2663     // else{
2664     //   sector=index-5;
2665     // } 
2666  
2667     for(i=0;i<3;++i) {
2668       hits[i]   = pos[i];
2669       hits[i+3] = pm[i];
2670     }
2671
2672     hits[6] = mom.Rho();
2673     hits[7] = pos[3];
2674     hits[8] = xpad[0];
2675     hits[9] = xpad[1];
2676     hits[10]= xpad[2];
2677     hits[11]= incidenceAngle;
2678     hits[12]= gMC->Edep();
2679     hits[13]= gMC->TrackLength();
2680     
2681     vol[0]= sector;
2682     vol[1]= plate;
2683     vol[2]= strip;
2684     vol[3]= padx;
2685     vol[4]= padz;    
2686
2687     AddT0Hit(mcApplication->GetCurrentTrackNumber(),vol, hits);
2688     //AddT0Hit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
2689   }
2690 }
2691 //-------------------------------------------------------------------
2692 void AliTOFv6T0::MaterialMixer(Float_t* p,Float_t* a,Float_t* m,Int_t n) const
2693 {
2694   // a[] atomic weights vector      (in)
2695   //     (atoms present in more compound appear separately)
2696   // m[] number of corresponding atoms in the compound  (in)
2697   Float_t t = 0.;
2698   for (Int_t i = 0; i < n; ++i) {
2699     p[i] = a[i]*m[i];
2700     t  += p[i];
2701   }
2702   for (Int_t i = 0; i < n; ++i) {
2703     p[i] = p[i]/t;
2704     //AliDebug(1,Form((\n weight[%i] = %f (,i,p[i]));
2705   }
2706 }