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