LCOV - code coverage report
Current view: top level - VZERO/VZEROsim - AliVZEROv7.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 2514 2520 99.8 %
Date: 2016-06-14 17:26:59 Functions: 13 14 92.9 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /* $Id$ */
      17             : 
      18             : ///////////////////////////////////////////////////////////////////////
      19             : //                                                                   // 
      20             : //  (V-zero) detector  version 7 as designed by the Lyon and         //
      21             : //   Mexico groups and Carlos Perez Lara from Pontificia Universidad //
      22             : //   Catolica del Peru                                               // 
      23             : //   All comments should be sent to Brigitte CHEYNIS:                //
      24             : //                     b.cheynis@ipnl.in2p3.fr                       // 
      25             : //   Geometry of April 2006 done with ROOT geometrical modeler       //
      26             : //   V0R (now V0C) sits between Z values  -89.5 and  -84.8 cm        // 
      27             : //   V0L (now V0A) sits between Z values +325.0 and +330.0 cm        // 
      28             : //   New coordinate system has been implemented in october 2003      //
      29             : //   Revision of the V0A part by Lizardo Valencia  in July 2008      //
      30             : //                                                                   //
      31             : /////////////////////////////////////////////////////////////////////// 
      32             : 
      33             : // --- Standard libraries ---
      34             : #include <Riostream.h>
      35             : 
      36             : // --- ROOT libraries ---
      37             : #include <TClonesArray.h>
      38             : #include <TGeoGlobalMagField.h>
      39             : #include <TMath.h>
      40             : #include <TParticle.h>
      41             : #include <TVirtualMC.h>
      42             : 
      43             : #include <TGeoManager.h>
      44             : #include <TGeoMatrix.h>
      45             : #include <TGeoMaterial.h>
      46             : #include <TGeoMedium.h>
      47             : #include <TGeoVolume.h>
      48             : #include "TGeoTube.h"
      49             : #include "TGeoArb8.h"
      50             : #include "TGeoCompositeShape.h"
      51             : #include <TTree.h>
      52             : 
      53             : // --- AliRoot header files ---
      54             : #include "AliRun.h"
      55             : #include "AliMC.h"
      56             : #include "AliMagF.h"
      57             : #include "AliVZEROLoader.h"
      58             : #include "AliVZEROdigit.h"
      59             : #include "AliVZEROhit.h"
      60             : #include "AliVZEROv7.h"
      61             : #include "AliLog.h"
      62             : #include "AliTrackReference.h"
      63             :  
      64          12 : ClassImp(AliVZEROv7)
      65             : 
      66             : //_____________________________________________________________________________
      67          12 : AliVZEROv7:: AliVZEROv7():AliVZERO(),
      68          12 :    fCellId(0),
      69          12 :    fTrackPosition(),
      70          12 :    fTrackMomentum(), 
      71          12 :    fV0CHeight1(2.5), 
      72          12 :    fV0CHeight2(4.4), 
      73          12 :    fV0CHeight3(7.4), 
      74          12 :    fV0CHeight4(12.5),
      75          12 :    fV0CRMin(4.6), 
      76          12 :    fV0CRBox(38.0),
      77          12 :    fV0CLidThickness(0.30),
      78          12 :    fV0CCellThickness(2.00),
      79          12 :    fV0CBoxThickness(4.70),
      80          12 :    fV0COffsetFibers(1.125),
      81          12 :    fV0CLightYield(93.75),
      82          12 :    fV0CLightAttenuation(0.05),
      83          12 :    fV0CnMeters(15.0),
      84          12 :    fV0CFibToPhot(0.3),
      85          12 :    fV0AR0(4.2),
      86          12 :    fV0AR1(7.6), 
      87          12 :    fV0AR2(13.8), 
      88          12 :    fV0AR3(22.7),
      89          12 :    fV0AR4(41.3), 
      90          12 :    fV0AR5(43.3), 
      91          12 :    fV0AR6(72.6),
      92          12 :    fV0AR7(92.0), // Distance from origin to outtermost intersection sector7 and sector8 
      93          12 :    fV0ASciWd(2.5), 
      94          12 :    fV0APlaWd(0.5), 
      95          12 :    fV0APlaAl(0.06), 
      96          12 :    fV0AOctWd(0.75), 
      97          12 :    fV0AFraWd(0.2),
      98          12 :    fV0AOctH1(1.0), 
      99          12 :    fV0AOctH2(2.0), 
     100          12 :    fV0ABasHt(2.0),
     101          12 :    fV0AFibRd(0.1),
     102          12 :    fV0APlaEx(4.4),
     103          12 :    fV0APMBWd(24.6), 
     104          12 :    fV0APMBHt(22.0), 
     105          12 :    fV0APMBTh(7.1), 
     106          12 :    fV0APMBWdW(0.3), 
     107          12 :    fV0APMBHtW(1.0),
     108          12 :    fV0APMBAng(30.0), 
     109          12 :    fV0APMBThW(0.3), 
     110          12 :    fV0APMTR1(2.44), 
     111          12 :    fV0APMTR2(2.54), 
     112          12 :    fV0APMTR3(2.54),
     113          12 :    fV0APMTR4(2.70), 
     114          12 :    fV0APMTH(10.0), 
     115          12 :    fV0APMTB(1.0),
     116          12 :    fV0AFEEBWd(26.5),
     117          12 :    fV0AFEEBHt(20.5),
     118          12 :    fV0AFEEBTh(7.5),
     119          12 :    fV0AnMeters(fV0AR6*0.01),
     120          12 :    fV0ALightYield(93.75),
     121          12 :    fV0ALightAttenuation(0.05), 
     122          12 :    fV0AFibToPhot(0.3),
     123          12 :    fVersion(7)
     124          60 : {
     125             : // Standard default constructor 
     126          24 : }
     127             : 
     128             : //_____________________________________________________________________________
     129           1 : AliVZEROv7::AliVZEROv7(const char *name, const char *title):AliVZERO(name,title),
     130           1 :    fCellId(0),
     131           1 :    fTrackPosition(),
     132           1 :    fTrackMomentum(), 
     133           1 :    fV0CHeight1(2.5), 
     134           1 :    fV0CHeight2(4.4), 
     135           1 :    fV0CHeight3(7.4), 
     136           1 :    fV0CHeight4(12.5),
     137           1 :    fV0CRMin(4.6), 
     138           1 :    fV0CRBox(38.0),
     139           1 :    fV0CLidThickness(0.30),
     140           1 :    fV0CCellThickness(2.00),
     141           1 :    fV0CBoxThickness(4.70),
     142           1 :    fV0COffsetFibers(1.125),
     143           1 :    fV0CLightYield(93.75),
     144           1 :    fV0CLightAttenuation(0.05),
     145           1 :    fV0CnMeters(15.0),
     146           1 :    fV0CFibToPhot(0.3),
     147           1 :    fV0AR0(4.2),    
     148           1 :    fV0AR1(7.6), 
     149           1 :    fV0AR2(13.8), 
     150           1 :    fV0AR3(22.7),
     151           1 :    fV0AR4(41.3), 
     152           1 :    fV0AR5(43.3), 
     153           1 :    fV0AR6(72.6),
     154           1 :    fV0AR7(92.0), // Distance from origin to outtermost intersection of sector7 and sector8 
     155           1 :    fV0ASciWd(2.5), 
     156           1 :    fV0APlaWd(0.5), 
     157           1 :    fV0APlaAl(0.06), 
     158           1 :    fV0AOctWd(0.75), 
     159           1 :    fV0AFraWd(0.2),
     160           1 :    fV0AOctH1(1.0), 
     161           1 :    fV0AOctH2(2.0), 
     162           1 :    fV0ABasHt(2.0),
     163           1 :    fV0AFibRd(0.1),
     164           1 :    fV0APlaEx(4.4),
     165           1 :    fV0APMBWd(24.6), 
     166           1 :    fV0APMBHt(22.0), 
     167           1 :    fV0APMBTh(7.1), 
     168           1 :    fV0APMBWdW(0.3), 
     169           1 :    fV0APMBHtW(1.0),
     170           1 :    fV0APMBAng(30.0), 
     171           1 :    fV0APMBThW(0.3), 
     172           1 :    fV0APMTR1(2.44), 
     173           1 :    fV0APMTR2(2.54), 
     174           1 :    fV0APMTR3(2.54),
     175           1 :    fV0APMTR4(2.70), 
     176           1 :    fV0APMTH(10.0), 
     177           1 :    fV0APMTB(1.0),
     178           1 :    fV0AFEEBWd(26.5),
     179           1 :    fV0AFEEBHt(20.5),
     180           1 :    fV0AFEEBTh(7.5),                
     181           1 :    fV0AnMeters(fV0AR6*0.01),
     182           1 :    fV0ALightYield(93.75),
     183           1 :    fV0ALightAttenuation(0.05),
     184           1 :    fV0AFibToPhot(0.3),
     185           1 :    fVersion(7)
     186             : 
     187             : 
     188           5 : {
     189             : // Standard constructor for V-zero Detector  version 7
     190             : 
     191           5 :   AliDebug(2,"Create VZERO object ");
     192             : 
     193             : //  fVersion            =     7;  // version number
     194             : 
     195             : //   // V0C Parameters related to geometry: All in cm
     196             : //   fV0CHeight1         =    2.5; // height of cell 1
     197             : //   fV0CHeight2         =    4.4; // height of cell 2
     198             : //   fV0CHeight3         =    7.4; // height of cell 3
     199             : //   fV0CHeight4         =   12.5; // height of cell 4
     200             : //   fV0CRMin            =    4.6; // inner radius of box
     201             : //   fV0CRBox            =   38.0; // outer radius of box
     202             : //   fV0CLidThickness    =   0.30; // thickness of Carbon lid
     203             : //   fV0CCellThickness   =   2.00; // thickness of elementary cell
     204             : //   fV0CBoxThickness    =   4.70; // thickness of V0C Box
     205             : //   fV0COffsetFibers    =    1.0; // offset to output fibers
     206             : //   // V0C Parameters related to light output
     207             : //   fV0CLightYield         =  93.75; // Light yield in BC408 (93.75 eV per photon)
     208             : //   fV0CLightAttenuation   =   0.05; // Light attenuation in fiber (0.05 per meter)
     209             : //   fV0CnMeters            =   15.0; // Number of meters of clear fibers to PM
     210             : //   fV0CFibToPhot          =    0.3; // Attenuation at fiber-photocathode interface
     211             : // 
     212             : //   // V0A Parameters related to geometry: All in cm
     213             : //   fV0AR0     =  4.2;  // Radius of hole
     214             : //   fV0AR1     =  7.6;  // Maximun radius of 1st cell
     215             : //   fV0AR2     = 13.8; // Maximun radius of 2nd cell
     216             : //   fV0AR3     = 22.7; // Maximun radius of 3rd cell
     217             : //   fV0AR4     = 41.3; // Maximun radius of 4th cell
     218             : //   fV0AR5     = 43.3; // Radius circunscrite to innermost octagon
     219             : //   fV0AR6     = 68.0; // Radius circunscrite to outtermost octagon
     220             : //   fV0ASciWd  =  2.5;  // Scintillator thickness 
     221             : //   fV0APlaWd  =  0.5;  // Plates thinckness
     222             : //   fV0APlaAl  = 0.06; // Plates AlMg3 thinckness
     223             : //   fV0AOctWd  = 0.75; // Innermost octagon thickness
     224             : //   fV0AOctH1  =  1.0;  // Height of innermost octagon
     225             : //   fV0AOctH2  =  2.0;  // Height of outtermost octagon
     226             : //   fV0AFibRd  =  0.1;  // Radius of Fiber
     227             : //   fV0AFraWd  =  0.2;  // Support Frame thickness
     228             : //   fV0APMBWd  = 24.6;  // Width of PM Box
     229             : //   fV0APMBHt  = 22.0;  // Height of PM Box
     230             : //   fV0APMBTh  =  7.1;  // Thickness of PM Box
     231             : //   fV0APMBWdW =  0.3;  // Thickness of PM Box Side1 Wall
     232             : //   fV0APMBHtW =  1.0;  // Thickness of PM Box Side2 Wall
     233             : //   fV0APMBThW =  0.3;  // Thickness of PM Box Top Wall
     234             : //   fV0APMBAng = 30.0;  // Angle between PM Box and Support
     235             : //   fV0APMTR1  = 2.44;  // PMT Glass
     236             : //   fV0APMTR2  = 2.54;  // PMT Glass
     237             : //   fV0APMTR3  = 2.54;  // PMT Cover
     238             : //   fV0APMTR4  = 2.70;  // PMT Cover
     239             : //   fV0APMTH   = 10.0;  // PMT Height
     240             : //   fV0APMTB   =  1.0;  // PMT Basis
     241             : //   fV0APlaEx  =  4.4;  // Plates Extension height
     242             : //   fV0ABasHt  =  2.0;  // Basis Height
     243             : //   // V0A Parameters related to light output
     244             : //   fV0ALightYield         =  93.75;      // Light yield in BC404
     245             : //   fV0ALightAttenuation   =   0.05;      // Light attenuation in WLS fiber, per meter
     246             : //   fV0AnMeters            = fV0AR6*0.01; // Tentative value, in meters
     247             : //   fV0AFibToPhot          =    0.3;      // Attenuation at fiber-photocathode interface
     248           2 : }
     249             : 
     250             : //_____________________________________________________________________________
     251             : void AliVZEROv7::CreateGeometry()
     252             : {
     253             : // Constructs TGeo geometry 
     254             : 
     255           4 :   AliDebug(2,"VZERO ConstructGeometry");
     256           1 :   TGeoVolume *top = gGeoManager->GetVolume("ALIC");
     257             : 
     258             :   ///////////////////////////////////////////////////////////////////////////
     259             :   // Construct the geometry of V0C Detector. Brigitte CHEYNIS
     260             :   
     261             :     const int kColorVZERO  = kGreen;
     262           1 :     TGeoMedium *medV0CAlu = gGeoManager->GetMedium("VZERO_V0CAlu");
     263           1 :     TGeoMedium *medV0CCar = gGeoManager->GetMedium("VZERO_V0CCar");
     264           1 :     TGeoMedium *medV0CSci = gGeoManager->GetMedium("VZERO_V0CSci");
     265           2 :     TGeoVolume *v0RI = new TGeoVolumeAssembly("V0RI");
     266             :     Float_t heightRight, r4Right;
     267           1 :     Float_t zdet = 90.0 - 0.5 - fV0CBoxThickness/2.0;
     268           1 :     heightRight  = fV0CHeight1 + fV0CHeight2 + fV0CHeight3 + fV0CHeight4;
     269           1 :     r4Right      = fV0CRMin + heightRight + 3.0*0.2; // 3 spacings of 2mm between rings
     270             : 
     271             :     // Creation of  carbon lids (3.0 mm thick) to keep V0C box shut :
     272             :     Float_t   partube[3];
     273           1 :     partube[0] =   fV0CRMin;
     274           1 :     partube[1] =   fV0CRBox;
     275           1 :     partube[2] =   fV0CLidThickness/2.0;
     276             :     //    TGeoTube   *sV0CA = new TGeoTube("V0CA", partube[0], partube[1], partube[2]);
     277             :     //    TGeoVolume *v0CA  = new TGeoVolume("V0CA",sV0CA,medV0CCar);
     278             :     //    TGeoTranslation *tr2 = new TGeoTranslation(0.,0., fV0CBoxThickness/2.0-partube[2]);
     279             :     //    TGeoTranslation *tr3 = new TGeoTranslation(0.,0.,-fV0CBoxThickness/2.0+partube[2]);
     280             :     //    v0RI->AddNode(v0CA,1,tr2);
     281             :     //    v0RI->AddNode(v0CA,2,tr3);
     282             :     //    v0CA->SetLineColor(kYellow);
     283             : 
     284             :     Float_t rInt1 = 11.5, rOut1 = 20.0, rInt2 = 9.0;
     285             : 
     286           1 :     TGeoTube   *sV0CA4 = new TGeoTube("V0CA4", partube[0], rInt2, partube[2] - 0.1);
     287           1 :     TGeoVolume *v0CA4  = new TGeoVolume("V0CA4",sV0CA4,medV0CCar);
     288           1 :     TGeoTranslation *tr21 = new TGeoTranslation(0.,0., fV0CBoxThickness/2.0-partube[2] + 0.1);
     289           1 :     v0RI->AddNode(v0CA4,1,tr21);
     290           1 :     v0CA4->SetLineColor(kYellow);
     291             : 
     292           1 :     TGeoTube   *sV0CA5 = new TGeoTube("V0CA5", rInt2, partube[1], partube[2]);
     293           1 :     TGeoVolume *v0CA5  = new TGeoVolume("V0CA5",sV0CA5,medV0CCar);
     294           1 :     TGeoTranslation *tr22 = new TGeoTranslation(0.,0., fV0CBoxThickness/2.0-partube[2]);
     295           1 :     v0RI->AddNode(v0CA5,1,tr22);
     296           1 :     v0CA5->SetLineColor(kYellow);
     297             : 
     298           1 :     TGeoTube   *sV0CA1 = new TGeoTube("V0CA1",partube[0], rInt1, partube[2]);
     299           1 :     TGeoVolume *v0CA1  = new TGeoVolume("V0CA1",sV0CA1,medV0CCar);
     300           1 :     TGeoTranslation *tr31 = new TGeoTranslation(0.,0.,-fV0CBoxThickness/2.0+partube[2]);
     301           1 :     v0RI->AddNode(v0CA1,1,tr31);
     302           1 :     v0CA1->SetLineColor(kYellow);
     303             : 
     304           1 :     TGeoTube   *sV0CA2 = new TGeoTube("V0CA2", rInt1, rOut1, partube[2] - 0.1);
     305           1 :     TGeoVolume *v0CA2  = new TGeoVolume("V0CA2",sV0CA2,medV0CCar);
     306           1 :     TGeoTranslation *tr32 = new TGeoTranslation(0.,0.,-fV0CBoxThickness/2.0+partube[2] - 0.1);
     307           1 :     v0RI->AddNode(v0CA2,1,tr32);
     308           1 :     v0CA2->SetLineColor(kYellow);
     309             : 
     310           1 :     TGeoTube   *sV0CA3 = new TGeoTube("V0CA3", rOut1, partube[1], partube[2]);
     311           1 :     TGeoVolume *v0CA3  = new TGeoVolume("V0CA3",sV0CA3,medV0CCar);
     312           1 :     TGeoTranslation *tr33 = new TGeoTranslation(0.,0.,-fV0CBoxThickness/2.0+partube[2]);
     313           1 :     v0RI->AddNode(v0CA3,1,tr33);
     314           1 :     v0CA3->SetLineColor(kYellow);
     315             : 
     316             :     // Creation of aluminum rings 3.0 mm thick to maintain the v0RI pieces : 
     317           1 :     partube[0] =   fV0CRMin - 0.3;
     318           1 :     partube[1] =   fV0CRMin;
     319           1 :     partube[2] =   fV0CBoxThickness/2.0;
     320           1 :     TGeoTube   *sV0IR = new TGeoTube("V0IR", partube[0], partube[1], partube[2]);
     321           1 :     TGeoVolume *v0IR  = new TGeoVolume("V0IR",sV0IR,medV0CAlu);
     322           1 :     v0RI->AddNode(v0IR,1,0);
     323           1 :     v0IR->SetLineColor(kYellow);
     324           1 :     partube[0] =   fV0CRBox;
     325           1 :     partube[1] =   fV0CRBox + 0.3; 
     326           1 :     partube[2] =   fV0CBoxThickness/2.0;
     327           1 :     TGeoTube   *sV0ER = new TGeoTube("V0ER", partube[0], partube[1], partube[2]);
     328           1 :     TGeoVolume *v0ER  = new TGeoVolume("V0ER",sV0ER,medV0CAlu);
     329           1 :     v0RI->AddNode(v0ER,1,0);
     330           1 :     v0ER->SetLineColor(kYellow);
     331             : 
     332             :     // Creation of assembly V0R0 of scintillator cells within one sector
     333           2 :     TGeoVolume *v0R0 = new TGeoVolumeAssembly("V0R0");                                          
     334             : 
     335             :     // Elementary cell of ring 1  - right part - :
     336             :     // (cells of ring 1 will be shifted by 2.0 cm backwards to output fibers)
     337           1 :     Float_t   r1Right =  fV0CRMin + fV0CHeight1;
     338           1 :     Float_t   offset  = fV0CBoxThickness/2.0 - fV0CLidThickness - fV0CCellThickness/2.0;   
     339             :     Float_t   partubs[5];   
     340           1 :     partubs[0]     =  fV0CRMin;
     341             :     partubs[1]     =  r1Right;
     342           1 :     partubs[2]     =  fV0CCellThickness/2.0;
     343             :     partubs[3]     =  90.0-22.5;
     344             :     partubs[4]     = 135.0-22.5;
     345           1 :     TGeoTubeSeg *sV0R1 = new TGeoTubeSeg("V0R1", partubs[0], partubs[1], partubs[2],
     346             :                                          partubs[3], partubs[4]);
     347           1 :     TGeoVolume  *v0R1  = new TGeoVolume("V0R1",sV0R1,medV0CSci);                                     
     348           1 :     TGeoTranslation *tr4 = new TGeoTranslation(0.,0., offset);
     349           1 :     v0R0->AddNode(v0R1,1,tr4);
     350           1 :     v0R1->SetLineColor(kColorVZERO);
     351             : 
     352             :     // Elementary cell of ring 2 - right part - :
     353             :     // (cells of ring 2 will be shifted by 1.0 cm backwards to output fibers)
     354           1 :     Float_t   r2Right  =  r1Right + fV0CHeight2;  
     355             :     partubs[0]     =  r1Right;  //  must be equal to 7.1
     356             :     partubs[1]     =  r2Right;  //  must be equal to 11.5
     357           1 :     TGeoTubeSeg *sV0R2 = new TGeoTubeSeg("V0R2", partubs[0], partubs[1], partubs[2],
     358             :                                          partubs[3], partubs[4]);
     359           1 :     TGeoVolume  *v0R2  = new TGeoVolume("V0R2",sV0R2,medV0CSci);
     360           1 :     TGeoTranslation *tr5 = new TGeoTranslation(0.0,0.2, offset - fV0COffsetFibers);
     361           1 :     v0R0->AddNode(v0R2,1,tr5);
     362           1 :     v0R2->SetLineColor(kColorVZERO);
     363             : 
     364             :     // Ring 3 - right part -  :
     365           1 :     r2Right  =  r2Right + 0.2;
     366           1 :     Float_t   r3Right  =  r2Right + fV0CHeight3;     
     367             :     partubs[0]     =  r2Right;  //  must be equal to 11.7
     368             :     partubs[1]     =  r3Right;  //  must be equal to 19.1
     369             :     partubs[3]     =  90.0-22.5;
     370             :     partubs[4]     = 112.5-22.5;
     371           1 :     TGeoTubeSeg *sV0R3 = new TGeoTubeSeg("V0R3", partubs[0], partubs[1], partubs[2],
     372             :                                          partubs[3], partubs[4]);
     373           1 :     TGeoVolume  *v0R3  = new TGeoVolume("V0R3",sV0R3,medV0CSci);
     374           1 :     TGeoTranslation *tr6 = new TGeoTranslation(0.,0.2, offset - 2.0*fV0COffsetFibers);
     375           1 :     v0R0->AddNode(v0R3,1,tr6);
     376           1 :     v0R3->SetLineColor(kColorVZERO);
     377             :     partubs[3]     = 112.5-22.5;
     378             :     partubs[4]     = 135.0-22.5;
     379           1 :     TGeoTubeSeg *sV0R4 = new TGeoTubeSeg("V0R4", partubs[0], partubs[1], partubs[2],
     380             :                                          partubs[3], partubs[4]);
     381           1 :     TGeoVolume  *v0R4  = new TGeoVolume("V0R4",sV0R4,medV0CSci);
     382           1 :     v0R0->AddNode(v0R4,1,tr6);
     383           1 :     v0R4->SetLineColor(kColorVZERO);
     384             :   
     385             :     // Ring 4 - right part -  : 
     386           1 :     Float_t x = TMath::ATan(3.5/257.5) * ((180./TMath::Pi()));
     387           1 :     r3Right = r3Right + 0.2 + 0.2;   // + 0.2 because no shift in translation here !!
     388             :     partubs[0]     =  r3Right;  //  must be equal to 19.5
     389             :     partubs[1]     =  r4Right;  //  must be equal to 32.0
     390           1 :     partubs[3]     =  90.0-22.5+x;
     391           1 :     partubs[4]     = 112.5-22.5-x;
     392           2 :     TGeoTubeSeg *sV0R5 = new TGeoTubeSeg("V0R5", partubs[0], partubs[1], partubs[2],
     393           1 :                                          partubs[3], partubs[4]);
     394           1 :     TGeoVolume  *v0R5  = new TGeoVolume("V0R5",sV0R5,medV0CSci);
     395           1 :     TGeoTranslation *tr7 = new TGeoTranslation(0.,0.0, offset - 2.0*fV0COffsetFibers + 0.25);                                         
     396           1 :     v0R0->AddNode(v0R5,1,tr7);
     397           1 :     v0R5->SetLineColor(kColorVZERO);
     398           1 :     partubs[3]     = 112.5-22.5+x;
     399           1 :     partubs[4]     = 135.0-22.5-x;
     400           2 :     TGeoTubeSeg *sV0R6 = new TGeoTubeSeg("V0R6", partubs[0], partubs[1], partubs[2],
     401           1 :                                          partubs[3], partubs[4]);
     402           1 :     TGeoVolume  *v0R6  = new TGeoVolume("V0R6",sV0R6,medV0CSci);
     403           1 :     v0R0->AddNode(v0R6,1,tr7);
     404           1 :     v0R6->SetLineColor(kColorVZERO);
     405             :     Float_t  phi;
     406             :     Float_t  phiDeg= 180./4.;
     407             :     Int_t    nsecR = 1;     // number of sectors in right part of V0
     408          18 :     for (phi = 22.5; phi < 360.0; phi = phi + phiDeg) {
     409           8 :       TGeoRotation  *rot1 = new TGeoRotation("rot1", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 ); 
     410           8 :       v0RI->AddNode(v0R0,nsecR,rot1);    
     411           8 :       nsecR++;        
     412             :     }
     413             : 
     414             :   ///////////////////////////////////////////////////////////////////////////
     415             :   // Construct the geometry of V0A Detector. Carlos PEREZ, PUCP
     416             :   // Revision by Lizardo VALENCIA, UNAM Mexico in July 2008
     417             : 
     418             :     const int kV0AColorSci   = 5;
     419             :     const int kV0AColorPlaIn = 3;
     420             :     const int kV0AColorPlaOu = 41;
     421             :     const int kV0AColorOct   = 7;
     422             :     const int kV0AColorFra   = 6;
     423             :     const int kV0AColorFib   = 11;
     424             :     const int kV0AColorPMG   = 1;
     425             :     const int kV0AColorPMA   = 2;
     426             :     const int kV0AColorFibGlass = 4; 
     427           1 :     TGeoMedium *medV0ASci = gGeoManager->GetMedium("VZERO_V0ASci");
     428           1 :     TGeoMedium *medV0APlaIn = gGeoManager->GetMedium("VZERO_V0APlaIn");
     429           1 :     TGeoMedium *medV0APlaOu = gGeoManager->GetMedium("VZERO_V0APlaOu");
     430           1 :     TGeoMedium *medV0ASup = gGeoManager->GetMedium("VZERO_V0APMA");
     431           1 :     TGeoMedium *medV0AFra = gGeoManager->GetMedium("VZERO_V0ALuc");
     432           1 :     TGeoMedium *medV0AFib = gGeoManager->GetMedium("VZERO_V0AFib");
     433           1 :     TGeoMedium *medV0APMGlass = gGeoManager->GetMedium("VZERO_V0APMG");
     434           1 :     TGeoMedium *medV0APMAlum = gGeoManager->GetMedium("VZERO_V0APMA");
     435           1 :     TGeoMedium *medV0AFibGlass = gGeoManager->GetMedium("VZERO_V0AFibGlass");
     436           1 :     double pi = TMath::Pi();
     437           1 :     double sin225   = TMath::Sin(pi/8.);
     438           1 :     double cos225   = TMath::Cos(pi/8.);
     439           1 :     double sin45    = TMath::Sin(pi/4.); // lucky: Sin45=Cos45
     440           1 :     double cos45    = TMath::Cos(pi/4.); 
     441           1 :     double v0APts[16];
     442           1 :     double sin654   = TMath::Sin(1.14);
     443           1 :     double cos654   = TMath::Cos(1.14);
     444             :     
     445             :     //Defining the master volume for V0A
     446           2 :     TGeoVolume *v0LE = new TGeoVolumeAssembly("V0LE");
     447             : 
     448             :     /// Definition sector 1
     449           2 :     TGeoVolume *v0ASec1 = new TGeoVolumeAssembly("V0ASec1");
     450             :         
     451             :     /// For boolean sustraction
     452             :     double preShapeSec1 = 0.2;
     453           6 :     for (int i=0;i<2;i++) {
     454           2 :       v0APts[0+8*i] = fV0AR0-fV0AFraWd/2.-preShapeSec1;  v0APts[1+8*i] = -preShapeSec1;
     455           2 :       v0APts[2+8*i] = fV0AR0-fV0AFraWd/2.-preShapeSec1;  v0APts[3+8*i] = fV0AFraWd/2.;
     456           2 :       v0APts[4+8*i] = fV0AR4+fV0AFraWd/2.+preShapeSec1;  v0APts[5+8*i] = fV0AFraWd/2.;
     457           2 :       v0APts[6+8*i] = fV0AR4+fV0AFraWd/2.+preShapeSec1;  v0APts[7+8*i] = -preShapeSec1;
     458             :     }
     459           1 :     new TGeoArb8("sV0ACha1Sec1",fV0ASciWd/1.5,v0APts);
     460           6 :     for (int i=0;i<2;i++) {
     461           2 :       v0APts[0+8*i] = fV0AR0*sin45-preShapeSec1;
     462           2 :       v0APts[1+8*i] = (fV0AR0-fV0AFraWd)*sin45-preShapeSec1;
     463           2 :       v0APts[2+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45-preShapeSec1;
     464           2 :       v0APts[3+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
     465           2 :       v0APts[4+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45+preShapeSec1;
     466           2 :       v0APts[5+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45+2.*preShapeSec1;
     467           2 :       v0APts[6+8*i] = (fV0AR4+fV0AFraWd)*sin45+preShapeSec1;
     468           2 :       v0APts[7+8*i] = fV0AR4*sin45+preShapeSec1;
     469             :     }
     470           1 :     new TGeoArb8("sV0ACha2Sec1", fV0ASciWd/2.+2.*preShapeSec1, v0APts);
     471           1 :     new TGeoCompositeShape("sV0ACha12Sec1","sV0ACha1Sec1+sV0ACha2Sec1");
     472           1 :     new TGeoTube("sV0ANail1SciHoleSec1", 0.0, 0.4, 1.65);
     473           1 :     TGeoTranslation *pos1Sec1 = new TGeoTranslation("pos1Sec1", 42.9, 0.51, 0.0);
     474           1 :     pos1Sec1->RegisterYourself();
     475           1 :     new TGeoTube("sV0ANail2SciHoleSec1", 0.0, 0.4, 1.65);
     476           1 :     TGeoTranslation *pos2Sec1 = new TGeoTranslation("pos2Sec1", 30.73,29.98,0.0);
     477           1 :     pos2Sec1->RegisterYourself();
     478           1 :     new TGeoCompositeShape("sV0ANailsSciHolesSec1","sV0ANail1SciHoleSec1:pos1Sec1+sV0ANail2SciHoleSec1:pos2Sec1");
     479           1 :     new TGeoCompositeShape("sV0AChaSec1","sV0ACha12Sec1+sV0ANailsSciHolesSec1");
     480           1 :     new TGeoTubeSeg("sV0AFicR5Sec1", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShapeSec1, 0, 45);
     481           1 :     new TGeoBBox("sV0AFicFEEBSec1", fV0AFEEBWd/2., fV0AFEEBHt/2., fV0AFEEBTh/2.);
     482           1 :     TGeoRotation *rot = new TGeoRotation("rot");
     483           1 :     rot->RotateX(90);
     484           1 :     rot->RotateZ(-90.0);
     485           1 :     double aFEEshiftR2Sec1 = fV0AR6  +  fV0AOctH2 + fV0APlaAl;
     486           1 :     TGeoCombiTrans *posFicFEEBSec1 = new TGeoCombiTrans("posFicFEEBSec1", aFEEshiftR2Sec1*cos225 + 2.0, 0, 7.5, rot);
     487           1 :     posFicFEEBSec1->RegisterYourself();
     488           1 :     rot = new TGeoRotation("rot");
     489           1 :     rot->RotateX(90);
     490           1 :     rot->RotateZ(-90.0+45.0);
     491           1 :     TGeoCombiTrans *posFicFEEBUpSec1 = new TGeoCombiTrans("posFicFEEBUpSec1", (aFEEshiftR2Sec1*cos225 + 2.0 )*cos45, (aFEEshiftR2Sec1*cos225 + 2.0 )*sin45, 7.5, rot);
     492           1 :     posFicFEEBUpSec1->RegisterYourself();
     493           6 :     for (int i=0;i<2;i++) {
     494           2 :     v0APts[0+8*i] = fV0AOctH2/2.;              v0APts[1+8*i] = fV0AFEEBHt/2. + 2.5;
     495           2 :     v0APts[2+8*i] = fV0AOctH2/2.;              v0APts[3+8*i] = -fV0AFEEBHt/2.- 2.5;
     496           2 :     v0APts[4+8*i] = -fV0AOctH2/2.;             v0APts[5+8*i] = -fV0AFEEBHt/2.- 2.5;
     497           2 :     v0APts[6+8*i] = -fV0AOctH2/2.;             v0APts[7+8*i] = fV0AFEEBHt/2.+ 2.5;
     498             :     }
     499           1 :     new TGeoArb8("sV0AFicOct2Sec1", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
     500           1 :     TGeoTranslation *posFicOct2Sec1 = new TGeoTranslation("posFicOct2Sec1",(aFEEshiftR2Sec1*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0,0.0,0.0);
     501           1 :     posFicOct2Sec1->RegisterYourself();  
     502           1 :     rot = new TGeoRotation("rot");
     503           1 :     rot->RotateZ(-90.0+45.0+90.0);
     504           1 :     TGeoCombiTrans *posFicOct2UpSec1 = new TGeoCombiTrans("posFicOct2UpSec1",((aFEEshiftR2Sec1*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0)*cos45,((aFEEshiftR2Sec1*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0)*sin45,0.0,rot);
     505           1 :     posFicOct2UpSec1->RegisterYourself(); 
     506             : 
     507             :     /// Frame
     508           2 :     TGeoVolume *v0AFraSec1 = new TGeoVolumeAssembly("V0AFraSec1");
     509           6 :     for (int i=0;i<2;i++) {
     510           2 :       v0APts[0+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[1+8*i] = 0.;
     511           2 :       v0APts[2+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[3+8*i] = fV0AFraWd/2.;
     512           2 :       v0APts[4+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[5+8*i] = fV0AFraWd/2.;
     513           2 :       v0APts[6+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[7+8*i] = 0.;
     514             :     }
     515           1 :     TGeoArb8 *sV0AFraB1Sec1 = new TGeoArb8("sV0AFraB1Sec1",fV0ASciWd/2.,v0APts);
     516           1 :     TGeoVolume *v0AFraB1Sec1 = new TGeoVolume("V0AFraB1Sec1",sV0AFraB1Sec1,medV0AFra);
     517           6 :     for (int i=0;i<2;i++) {
     518           2 :       v0APts[0+8*i] = fV0AR0*sin45;
     519           2 :       v0APts[1+8*i] = (fV0AR0-fV0AFraWd)*sin45;
     520           2 :       v0APts[2+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
     521           2 :       v0APts[3+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
     522           2 :       v0APts[4+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45;
     523           2 :       v0APts[5+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45;
     524           2 :       v0APts[6+8*i] = (fV0AR4+fV0AFraWd)*sin45;
     525           2 :       v0APts[7+8*i] = fV0AR4*sin45;
     526             :     }
     527           1 :     TGeoArb8 *sV0AFraB2Sec1 = new TGeoArb8("sV0AFraB2Sec1", fV0ASciWd/2., v0APts);
     528           1 :     TGeoVolume *v0AFraB2Sec1 = new TGeoVolume("V0AFraB2Sec1",sV0AFraB2Sec1,medV0AFra);
     529           1 :     v0AFraB1Sec1->SetLineColor(kV0AColorFra); v0AFraB2Sec1->SetLineColor(kV0AColorFra);
     530           1 :     v0AFraSec1->AddNode(v0AFraB1Sec1,1);
     531           1 :     v0AFraSec1->AddNode(v0AFraB2Sec1,1);  
     532           2 :     new TGeoTubeSeg( "sV0AFraR1bSec1", fV0AR0-fV0AFraWd/2.,
     533           1 :                      fV0AR0+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     534           2 :     new TGeoTubeSeg( "sV0AFraR2bSec1", fV0AR1-fV0AFraWd/2.,
     535           1 :                      fV0AR1+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     536           2 :     new TGeoTubeSeg( "sV0AFraR3bSec1", fV0AR2-fV0AFraWd/2.,
     537           1 :                      fV0AR2+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     538           2 :     new TGeoTubeSeg( "sV0AFraR4bSec1", fV0AR3-fV0AFraWd/2.,
     539           1 :                      fV0AR3+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     540           2 :     new TGeoTubeSeg( "sV0AFraR5bSec1", fV0AR4-fV0AFraWd/2.,
     541           1 :                      fV0AR4+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     542           1 :     TGeoCompositeShape *sV0AFraR1Sec1 = new TGeoCompositeShape("sV0AFraR1Sec1","sV0AFraR1bSec1-sV0AChaSec1");
     543           1 :     TGeoCompositeShape *sV0AFraR2Sec1 = new TGeoCompositeShape("sV0AFraR2Sec1","sV0AFraR2bSec1-sV0AChaSec1");
     544           1 :     TGeoCompositeShape *sV0AFraR3Sec1 = new TGeoCompositeShape("sV0AFraR3Sec1","sV0AFraR3bSec1-sV0AChaSec1");
     545           1 :     TGeoCompositeShape *sV0AFraR4Sec1 = new TGeoCompositeShape("sV0AFraR4Sec1","sV0AFraR4bSec1-sV0AChaSec1");
     546           1 :     TGeoCompositeShape *sV0AFraR5Sec1 = new TGeoCompositeShape("sV0AFraR5Sec1","sV0AFraR5bSec1-sV0AChaSec1");
     547           1 :     TGeoVolume *v0AFraR1Sec1 = new TGeoVolume("V0AFraR1Sec1",sV0AFraR1Sec1,medV0AFra);
     548           1 :     TGeoVolume *v0AFraR2Sec1 = new TGeoVolume("V0AFraR2Sec1",sV0AFraR2Sec1,medV0AFra);
     549           1 :     TGeoVolume *v0AFraR3Sec1 = new TGeoVolume("V0AFraR3Sec1",sV0AFraR3Sec1,medV0AFra);
     550           1 :     TGeoVolume *v0AFraR4Sec1 = new TGeoVolume("V0AFraR4Sec1",sV0AFraR4Sec1,medV0AFra);
     551           1 :     TGeoVolume *v0AFraR5Sec1 = new TGeoVolume("V0AFraR5Sec1",sV0AFraR5Sec1,medV0AFra);
     552           1 :     v0AFraR1Sec1->SetLineColor(kV0AColorFra); v0AFraR2Sec1->SetLineColor(kV0AColorFra);
     553           1 :     v0AFraR3Sec1->SetLineColor(kV0AColorFra); v0AFraR4Sec1->SetLineColor(kV0AColorFra);
     554           1 :     v0AFraR5Sec1->SetLineColor(kV0AColorFra);
     555           1 :     v0AFraSec1->AddNode(v0AFraR1Sec1,1); 
     556           1 :     v0AFraSec1->AddNode(v0AFraR2Sec1,1);
     557           1 :     v0AFraSec1->AddNode(v0AFraR3Sec1,1); 
     558           1 :     v0AFraSec1->AddNode(v0AFraR4Sec1,1);
     559           1 :     v0AFraSec1->AddNode(v0AFraR5Sec1,1);
     560           1 :     v0ASec1->AddNode(v0AFraSec1,1);
     561             :     
     562             :     /// Sensitive scintilator
     563           2 :     TGeoVolume *v0ASciSec1 = new TGeoVolumeAssembly("V0ASciSec1");
     564           2 :     new TGeoTubeSeg( "sV0AR1bSec1", fV0AR0+fV0AFraWd/2.,
     565           1 :                      fV0AR1-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     566           2 :     new TGeoTubeSeg( "sV0AR2bSec1", fV0AR1+fV0AFraWd/2.,
     567           1 :                      fV0AR2-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     568           2 :     new TGeoTubeSeg( "sV0AR3bSec1", fV0AR2+fV0AFraWd/2.,
     569           1 :                      fV0AR3-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     570           2 :     new TGeoTubeSeg( "sV0AR4bSec1", fV0AR3+fV0AFraWd/2.,
     571           1 :                      fV0AR4-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     572           1 :     TGeoCompositeShape *sV0AR1Sec1 = new TGeoCompositeShape("sV0AR1Sec1","sV0AR1bSec1-sV0AChaSec1");
     573           1 :     TGeoCompositeShape *sV0AR2Sec1 = new TGeoCompositeShape("sV0AR2Sec1","sV0AR2bSec1-sV0AChaSec1");
     574           1 :     TGeoCompositeShape *sV0AR3Sec1 = new TGeoCompositeShape("sV0AR3Sec1","sV0AR3bSec1-sV0AChaSec1");
     575           1 :     TGeoCompositeShape *sV0AR4Sec1 = new TGeoCompositeShape("sV0AR4Sec1","sV0AR4bSec1-sV0AChaSec1");
     576           1 :     TGeoVolume *v0L1Sec1 = new TGeoVolume("V0L1Sec1",sV0AR1Sec1,medV0ASci);
     577           1 :     TGeoVolume *v0L2Sec1 = new TGeoVolume("V0L2Sec1",sV0AR2Sec1,medV0ASci);
     578           1 :     TGeoVolume *v0L3Sec1 = new TGeoVolume("V0L3Sec1",sV0AR3Sec1,medV0ASci);
     579           1 :     TGeoVolume *v0L4Sec1 = new TGeoVolume("V0L4Sec1",sV0AR4Sec1,medV0ASci);
     580           1 :     v0L1Sec1->SetLineColor(kV0AColorSci); v0L2Sec1->SetLineColor(kV0AColorSci);
     581           1 :     v0L3Sec1->SetLineColor(kV0AColorSci); v0L4Sec1->SetLineColor(kV0AColorSci);
     582           1 :     v0ASec1->AddNode(v0L1Sec1,1);
     583           1 :     v0ASec1->AddNode(v0L2Sec1,1);
     584           1 :     v0ASec1->AddNode(v0L3Sec1,1);
     585           1 :     v0ASec1->AddNode(v0L4Sec1,1);      
     586             :     
     587             :     /// Segment of octagon 
     588           6 :     for (int i=0;i<2;i++) {
     589           2 :     v0APts[0+8*i] =  fV0AR6-fV0AOctH2;           v0APts[1+8*i] = 0.;
     590           2 :       v0APts[2+8*i] = (fV0AR6-fV0AOctH2)*sin45;  v0APts[3+8*i] = (fV0AR6-fV0AOctH2)*sin45;
     591           2 :       v0APts[4+8*i] = fV0AR6*sin45;              v0APts[5+8*i] = fV0AR6*sin45;
     592           2 :       v0APts[6+8*i] = fV0AR6;                    v0APts[7+8*i] = 0.;
     593             :     }
     594           1 :     new TGeoArb8("sV0AOct2Sec1", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
     595           1 :     TGeoCompositeShape *sV0AOct2FEEBSec1 = new TGeoCompositeShape("sV0AOct2FEEBSec1","sV0AOct2Sec1-sV0AFicFEEBSec1:posFicFEEBSec1-sV0AFicFEEBSec1:posFicFEEBUpSec1-sV0AFicOct2Sec1:posFicOct2Sec1-sV0AFicOct2Sec1:posFicOct2UpSec1");
     596           1 :     TGeoVolume *v0AOct2Sec1 = new TGeoVolume("V0AOct2Sec1", sV0AOct2FEEBSec1,medV0ASup);
     597           1 :     v0AOct2Sec1->SetLineColor(kV0AColorOct);
     598           2 :     TGeoVolume *v0ASupSec1 = new TGeoVolumeAssembly("V0ASupSec1");
     599           1 :     v0ASupSec1->AddNode(v0AOct2Sec1,1);
     600           1 :     v0ASec1->AddNode(v0ASupSec1,1);
     601             : 
     602             :     //Bunch of fibers
     603           1 :     v0APts[ 0] = v0APts[ 2] = -13.0;
     604           1 :     v0APts[ 1] = v0APts[ 7] = (fV0ASciWd+fV0AOctWd)/2.-0.01;
     605           1 :     v0APts[ 3] = v0APts[ 5] = (fV0ASciWd+fV0AOctWd)/2.+0.01;
     606           1 :     v0APts[ 4] = v0APts[ 6] = +13.0;
     607           1 :     v0APts[ 8] = v0APts[10] = -10.0;
     608           1 :     v0APts[ 9] = v0APts[15] = 0.;
     609           1 :     v0APts[11] = v0APts[13] = 0.25;
     610           1 :     v0APts[12] = v0APts[14] = +10.0;
     611           1 :     new TGeoArb8("sV0AFib1Sec1", 11.5, v0APts);
     612           1 :     rot = new TGeoRotation("rot");
     613           1 :     rot->RotateX(-90);
     614           1 :     rot->RotateZ(-90.+22.5);
     615           1 :     TGeoCombiTrans *fibpos1Sec1 = new TGeoCombiTrans("fibpos1Sec1", (fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. - 3.8, (fV0AR6-fV0AOctH2+fV0AR5)*sin225/2.-1.8, 0, rot);
     616           1 :     fibpos1Sec1->RegisterYourself();
     617           1 :     TGeoCompositeShape *sV0AFib1HoleSec1 = new TGeoCompositeShape("sV0AFib1HoleSec1","sV0AFib1Sec1:fibpos1Sec1-sV0AFicR5Sec1"); 
     618           1 :     TGeoVolume *v0AFib1HoleSec1 = new TGeoVolume("V0AFib1HoleSec1",sV0AFib1HoleSec1,medV0AFib);
     619           1 :     v0AFib1HoleSec1->SetLineColor(kV0AColorFib);
     620           1 :     new TGeoArb8("sV0AFib2Sec1", 11.5, v0APts);
     621           1 :     rot = new TGeoRotation("rot");
     622           1 :     rot->RotateX(-90);
     623           1 :     rot->RotateY(180);
     624           1 :     rot->RotateZ(-90.+22.5);
     625           1 :     TGeoCombiTrans *fibpos2Sec1 = new TGeoCombiTrans("fibpos2Sec1", (fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. - 3.8, (fV0AR6-fV0AOctH2+fV0AR5)*sin225/2.-1.8, 0, rot);
     626           1 :     fibpos2Sec1->RegisterYourself();
     627           1 :     TGeoCompositeShape *sV0AFib2HoleSec1 = new TGeoCompositeShape("sV0AFib2HoleSec1","sV0AFib2Sec1:fibpos2Sec1-sV0AFicR5Sec1");
     628           1 :     TGeoVolume *v0AFib2HoleSec1 = new TGeoVolume("V0AFib2HoleSec1",sV0AFib2HoleSec1,medV0AFib);
     629           1 :     v0AFib2HoleSec1->SetLineColor(kV0AColorFib);
     630           2 :     TGeoVolume *v0AFibSec1 = new TGeoVolumeAssembly("V0AFibSec1");
     631           1 :     v0AFibSec1->AddNode(v0AFib1HoleSec1,1);
     632           1 :     v0AFibSec1->AddNode(v0AFib2HoleSec1,1);
     633           1 :     v0ASec1->AddNode(v0AFibSec1,1); 
     634             :     
     635             :      /// Plates
     636           1 :     new TGeoTube("sV0ANail1PlaInHoleSec1", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
     637           1 :     new TGeoTube("sV0ANail2PlaInHoleSec1", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
     638           1 :     new TGeoCompositeShape("sV0ANailsPlaInHolesSec1","sV0ANail1PlaInHoleSec1:pos1Sec1+sV0ANail2PlaInHoleSec1:pos2Sec1");
     639           1 :     new TGeoTube("sV0ANail1PlaOuHoleSec1", 0.0, 0.4, (fV0APlaAl)/2.);
     640           1 :     new TGeoTube("sV0ANail2PlaOuHoleSec1", 0.0, 0.4, (fV0APlaAl)/2.);
     641           1 :     new TGeoCompositeShape("sV0ANailsPlaOuHolesSec1","sV0ANail1PlaOuHoleSec1:pos1Sec1+sV0ANail2PlaOuHoleSec1:pos2Sec1");
     642           6 :     for (int i=0;i<2;i++) {
     643           2 :       v0APts[0+8*i] = fV0AR0;                   v0APts[1+8*i] = 0.;
     644           2 :       v0APts[2+8*i] = fV0AR0*sin45;             v0APts[3+8*i] = fV0AR0*sin45;
     645           2 :       v0APts[4+8*i] = fV0AR6 * sin45;   v0APts[5+8*i] = fV0AR6*sin45;
     646           2 :       v0APts[6+8*i] = fV0AR6;           v0APts[7+8*i] = 0.;
     647             :     }
     648           1 :     new TGeoArb8("sV0APlaInSec1", (fV0APlaWd-2*fV0APlaAl)/2., v0APts);
     649           1 :     TGeoCompositeShape *sV0APlaInNailsHolesSec1 = new TGeoCompositeShape("sV0APlaInNailsHolesSec1","sV0APlaInSec1-sV0ANailsPlaInHolesSec1-sV0AFicFEEBSec1:posFicFEEBSec1-sV0AFicFEEBSec1:posFicFEEBUpSec1");
     650           1 :     TGeoVolume *v0APlaInNailsHolesSec1 = new TGeoVolume("V0APlaInNailsHolesSec1", sV0APlaInNailsHolesSec1, medV0APlaIn);
     651           1 :     new TGeoArb8("sV0APlaOuSec1", fV0APlaAl/2., v0APts);
     652           1 :     TGeoCompositeShape *sV0APlaOuNailsHolesSec1 = new TGeoCompositeShape("sV0APlaOuNailsHolesSec1","sV0APlaOuSec1-sV0ANailsPlaOuHolesSec1-sV0AFicFEEBSec1:posFicFEEBSec1-sV0AFicFEEBSec1:posFicFEEBUpSec1"); 
     653           1 :     TGeoVolume *v0APlaOuNailsHolesSec1 = new TGeoVolume("V0APlaOuNailsHolesSec1", sV0APlaOuNailsHolesSec1, medV0APlaOu);
     654           1 :     v0APlaInNailsHolesSec1->SetLineColor(kV0AColorPlaIn); v0APlaOuNailsHolesSec1->SetLineColor(kV0AColorPlaOu);
     655           2 :     TGeoVolume *v0APlaSec1 = new TGeoVolumeAssembly("V0APlaSec1");
     656           1 :     v0APlaSec1->AddNode(v0APlaInNailsHolesSec1,1);
     657           2 :     v0APlaSec1->AddNode(v0APlaOuNailsHolesSec1,1,new TGeoTranslation(0,0,(fV0APlaWd-fV0APlaAl)/2.));
     658           2 :     v0APlaSec1->AddNode(v0APlaOuNailsHolesSec1,2,new TGeoTranslation(0,0,-(fV0APlaWd-fV0APlaAl)/2.));
     659           2 :     v0ASec1->AddNode(v0APlaSec1,1,new TGeoTranslation(0,0,(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
     660           2 :     v0ASec1->AddNode(v0APlaSec1,2,new TGeoTranslation(0,0,-(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
     661             :     
     662             :      /// Non-sensitive scintilator
     663           1 :     new TGeoTubeSeg("sV0AR5S2Sec1", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShapeSec1, 0, 45);
     664           1 :     TGeoCompositeShape *sV0AR5Sec1 = new TGeoCompositeShape("V0AR5Sec1","sV0AR5S2Sec1 - sV0AChaSec1");
     665           1 :     TGeoVolume *v0AR5Sec1 = new TGeoVolume("V0AR5Sec1",sV0AR5Sec1,medV0ASci);
     666           1 :     v0AR5Sec1->SetLineColor(kV0AColorSci);
     667           1 :     v0ASciSec1->AddNode(v0AR5Sec1,1);
     668           1 :     v0ASec1->AddNode(v0ASciSec1,1); 
     669             : 
     670             :     /// PMBox
     671           2 :     TGeoVolume* v0APMSec1 = new TGeoVolumeAssembly("V0APMSec1");
     672           1 :     new TGeoBBox("sV0APMB1Sec1", fV0APMBWd/2., fV0APMBHt/2., fV0APMBTh/2.);
     673           1 :     new TGeoBBox("sV0APMB2Sec1", fV0APMBWd/2.-fV0APMBWdW, fV0APMBHt/2.-fV0APMBHtW, fV0APMBTh/2.-fV0APMBThW);
     674           1 :     TGeoCompositeShape *sV0APMBSec1 = new TGeoCompositeShape("sV0APMBSec1","sV0APMB1Sec1-sV0APMB2Sec1");
     675           1 :     TGeoVolume *v0APMBSec1 = new TGeoVolume("V0APMBSec1",sV0APMBSec1, medV0APMAlum);
     676           1 :     v0APMBSec1->SetLineColor(kV0AColorPMA);
     677           1 :     v0APMSec1->AddNode(v0APMBSec1,1);
     678             : 
     679             :     /// PMTubes
     680           1 :     TGeoTube *sV0APMT1Sec1 = new TGeoTube("sV0APMT1Sec1", fV0APMTR1, fV0APMTR2, fV0APMTH/2.);
     681           1 :     TGeoVolume *v0APMT1Sec1 = new TGeoVolume("V0APMT1Sec1", sV0APMT1Sec1, medV0APMGlass);
     682           1 :     TGeoTube *sV0APMT2Sec1 = new TGeoTube("sV0APMT2Sec1", fV0APMTR3, fV0APMTR4, fV0APMTH/2.);
     683           1 :     TGeoVolume *v0APMT2Sec1 = new TGeoVolume("V0APMT2Sec1", sV0APMT2Sec1, medV0APMAlum);
     684           2 :     TGeoVolume *v0APMTSec1 = new TGeoVolumeAssembly("V0APMTSec1");
     685           1 :     TGeoTube *sV0APMTTSec1 = new TGeoTube("sV0APMTTSec1", 0., fV0APMTR4, fV0APMTB/2.);
     686           1 :     TGeoVolume *v0APMTTSec1 = new TGeoVolume("V0APMTTSec1", sV0APMTTSec1, medV0APMAlum);
     687           1 :     v0APMT1Sec1->SetLineColor(kV0AColorPMG);
     688           1 :     v0APMT2Sec1->SetLineColor(kV0AColorPMA);
     689           1 :     v0APMTTSec1->SetLineColor(kV0AColorPMA);
     690           1 :     rot = new TGeoRotation("rot", 90, 0, 180, 0, 90, 90);
     691           1 :     v0APMTSec1->AddNode(v0APMT1Sec1,1,rot);
     692           1 :     v0APMTSec1->AddNode(v0APMT2Sec1,1,rot);
     693           2 :     v0APMTSec1->AddNode(v0APMTTSec1,1,new TGeoCombiTrans(0,-(fV0APMTH+fV0APMTB)/2.,0,rot));
     694           1 :     double autoShiftSec1 = (fV0APMBWd-2*fV0APMBWdW)/4.;
     695           2 :     v0APMSec1->AddNode(v0APMTSec1, 1, new TGeoTranslation(-1.5*autoShiftSec1, 0, 0));
     696           2 :     v0APMSec1->AddNode(v0APMTSec1, 2, new TGeoTranslation(-0.5*autoShiftSec1, 0, 0));
     697           2 :     v0APMSec1->AddNode(v0APMTSec1, 3, new TGeoTranslation(+0.5*autoShiftSec1, 0, 0));
     698           2 :     v0APMSec1->AddNode(v0APMTSec1, 4, new TGeoTranslation(+1.5*autoShiftSec1, 0, 0));
     699             : 
     700             :     // PM
     701           1 :     rot = new TGeoRotation("rot");
     702           1 :     rot->RotateX(90-fV0APMBAng);
     703           1 :     rot->RotateZ(-90.+22.5);
     704           1 :     double cosAngPMBSec1 = TMath::Cos(fV0APMBAng*TMath::DegToRad());
     705           1 :     double sinAngPMBSec1 = TMath::Sin(fV0APMBAng*TMath::DegToRad());
     706           1 :     double shiftZSec1 = fV0APMBHt/2. * cosAngPMBSec1
     707           1 :       -   ( fV0ASciWd + 2 * fV0AOctWd + 2 * fV0APlaWd )/2.   -   fV0APMBTh/2. * sinAngPMBSec1;
     708           1 :     double shiftRSec1 = fV0AR6  +  fV0AOctH2 + fV0APlaAl;
     709           2 :     v0ASec1->AddNode(v0APMSec1,1, new TGeoCombiTrans( shiftRSec1*cos225+1.07, shiftRSec1*sin225, shiftZSec1, rot));
     710             :     
     711             :     // Aluminium nails 
     712           1 :     TGeoTube *sV0ANail1Sec1 = new TGeoTube("sV0ANail1Sec1", 0.0, 0.4, 5.09/2.);
     713           1 :     TGeoVolume *v0ANail1Sec1 = new TGeoVolume("V0ANail1Sec1", sV0ANail1Sec1, medV0APMAlum);
     714           1 :     v0ANail1Sec1->SetLineColor(kV0AColorPMA);// this is the color for aluminium
     715           2 :     v0ASec1->AddNode(v0ANail1Sec1,1,new TGeoTranslation(42.9, 0.51, 0.0));
     716           1 :     TGeoTube *sV0ANail2Sec1 = new TGeoTube("sV0ANail2Sec1", 0.0, 0.4, 5.09/2.);
     717           1 :     TGeoVolume *v0ANail2Sec1 = new TGeoVolume("V0ANail2Sec1", sV0ANail2Sec1, medV0APMAlum);
     718           1 :     v0ANail2Sec1->SetLineColor(kV0AColorPMA);
     719           2 :     v0ASec1->AddNode(v0ANail2Sec1,1,new TGeoTranslation(30.73,29.98,0.0)); 
     720             :         
     721             :     /// Adding sector to v0LE volume
     722           4 :     for(int i=0; i<1; i++) {
     723           1 :        TGeoRotation *rotation = new TGeoRotation("rotation", 90., i*45., 90., 90.+i*45., 0., 0.);
     724           1 :        v0LE->AddNode(v0ASec1,i+1,rotation);  
     725             :     }
     726             : 
     727             :     //Front end electronics for sector 1
     728             : 
     729             :     //FEEBox
     730           2 :     TGeoVolume* v0AFEE = new TGeoVolumeAssembly("V0AFEE");
     731           1 :     new TGeoBBox("sV0AFEEB1", fV0AFEEBWd/2., fV0AFEEBHt/2., fV0AFEEBTh/2.);
     732           1 :     new TGeoBBox("sV0AFEEB2", fV0AFEEBWd/2.-fV0APMBWdW, fV0AFEEBHt/2.-fV0APMBHtW, fV0AFEEBTh/2.-fV0APMBThW);
     733           1 :     TGeoCompositeShape *sV0AFEEB = new TGeoCompositeShape("sV0AFEEB","sV0AFEEB1-sV0AFEEB2");
     734           1 :     TGeoVolume *v0AFEEB = new TGeoVolume("V0AFEEB",sV0AFEEB, medV0APMAlum);
     735           1 :     v0AFEEB->SetLineColor(kV0AColorPMA);
     736           1 :     v0AFEE->AddNode(v0AFEEB,1);
     737             : 
     738             :     //Mother and daughter boards
     739           6 :     for (int i=0;i<2;i++) {
     740           2 :     v0APts[0+8*i] = -fV0APMBHtW/10.;           v0APts[1+8*i] = fV0AFEEBTh/2.-fV0APMTB;
     741           2 :     v0APts[2+8*i] = fV0APMBHtW/10.;             v0APts[3+8*i] = fV0AFEEBTh/2.-fV0APMTB;
     742           2 :     v0APts[4+8*i] = fV0APMBHtW/10.;            v0APts[5+8*i] = -fV0AFEEBTh/2.+fV0APMTB;
     743           2 :     v0APts[6+8*i] = -fV0APMBHtW/10.;           v0APts[7+8*i] = -fV0AFEEBTh/2.+fV0APMTB;
     744             :     }
     745           1 :     TGeoArb8 *sV0AFEEDaughter = new TGeoArb8("sV0AFEEDaughter", fV0AFEEBTh/2.-fV0APMTB, v0APts);
     746           1 :     TGeoVolume *v0AFEEDaughter = new TGeoVolume("V0AFEEDaughter", sV0AFEEDaughter, medV0AFibGlass);
     747           1 :     v0AFEEDaughter->SetLineColor(kV0AColorFibGlass);
     748           1 :     double spacing = fV0APMBHtW;
     749           2 :     v0AFEE->AddNode(v0AFEEDaughter, 1, new TGeoTranslation(9.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
     750           2 :     v0AFEE->AddNode(v0AFEEDaughter, 2, new TGeoTranslation(6.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
     751           2 :     v0AFEE->AddNode(v0AFEEDaughter, 3, new TGeoTranslation(3.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
     752           2 :     v0AFEE->AddNode(v0AFEEDaughter, 4, new TGeoTranslation(0.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
     753           2 :     v0AFEE->AddNode(v0AFEEDaughter, 5, new TGeoTranslation(-3.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
     754           2 :     v0AFEE->AddNode(v0AFEEDaughter, 6, new TGeoTranslation(-6.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
     755           2 :     v0AFEE->AddNode(v0AFEEDaughter, 7, new TGeoTranslation(-9.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
     756           2 :     v0AFEE->AddNode(v0AFEEDaughter, 8, new TGeoTranslation(-12.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));   
     757           6 :     for (int i=0;i<2;i++) {
     758           2 :     v0APts[0+8*i] = -fV0AFEEBWd/2.+fV0APMBWdW;         v0APts[1+8*i] = fV0AFEEBTh+fV0APMTB;
     759           2 :     v0APts[2+8*i] = fV0AFEEBWd/2.-fV0APMBWdW;          v0APts[3+8*i] = fV0AFEEBTh+fV0APMTB;
     760           2 :     v0APts[4+8*i] = fV0AFEEBWd/2.-fV0APMBWdW;          v0APts[5+8*i] = -fV0AFEEBTh-fV0APMTB;
     761           2 :     v0APts[6+8*i] = -fV0AFEEBWd/2.+fV0APMBWdW;         v0APts[7+8*i] = -fV0AFEEBTh-fV0APMTB;
     762             :     }
     763           1 :     TGeoArb8 *sV0AFEEMother = new TGeoArb8("sV0AFEEMother", fV0APMBHtW/10., v0APts);
     764           1 :     TGeoVolume *v0AFEEMother = new TGeoVolume("V0AFEEMother", sV0AFEEMother, medV0AFibGlass);
     765           1 :     v0AFEEMother->SetLineColor(kV0AColorFibGlass);
     766           2 :     v0AFEE->AddNode(v0AFEEMother, 1, new TGeoTranslation(0.0, 0.0, -fV0AFEEBTh/2.+fV0APMBThW+fV0APMBHtW));
     767           6 :     for (int i=0;i<2;i++) {
     768           2 :       v0APts[0+8*i] = -fV0AFEEBWd/2.+fV0APMBWdW;               v0APts[1+8*i] = (fV0AFEEBTh+fV0APMTB)/2.;
     769           2 :       v0APts[2+8*i] = fV0AFEEBWd/2.-fV0APMBWdW;                v0APts[3+8*i] = (fV0AFEEBTh+fV0APMTB)/2.;
     770           2 :       v0APts[4+8*i] = fV0AFEEBWd/2.-fV0APMBWdW;                v0APts[5+8*i] = (-fV0AFEEBTh-fV0APMTB)/2.;
     771           2 :       v0APts[6+8*i] = -fV0AFEEBWd/2.+fV0APMBWdW;               v0APts[7+8*i] = (-fV0AFEEBTh-fV0APMTB)/2.; 
     772             :     }
     773           1 :     TGeoArb8 *sV0AFEEHalfMother = new TGeoArb8("sV0AFEEHalfMother", fV0APMBHtW/10., v0APts);
     774           1 :     TGeoVolume *v0AFEEHalfMother = new TGeoVolume("V0AFEEHalfMother", sV0AFEEHalfMother, medV0AFibGlass);
     775           1 :     v0AFEEHalfMother->SetLineColor(kV0AColorFibGlass);
     776           2 :     v0AFEE->AddNode(v0AFEEHalfMother, 1, new TGeoTranslation(0.0, -(fV0AFEEBTh+fV0APMTB)/2., -2.0*spacing));
     777             : 
     778             : 
     779             :     //FEE
     780           1 :     rot = new TGeoRotation("rot");
     781           1 :     rot->RotateX(90);
     782           1 :     rot->RotateZ(+90.0);
     783           1 :     double aFEEshiftR = fV0AR6  +  fV0AOctH2 + fV0APlaAl;
     784           2 :     v0LE->AddNode(v0AFEE,1, new TGeoCombiTrans( aFEEshiftR*cos225+2.0, 0, 7.5, rot));
     785           6 :     for (int i=0;i<2;i++) {
     786           2 :     v0APts[0+8*i] = fV0AOctH2/2.;              v0APts[1+8*i] = fV0AFEEBHt/2. + 2.5;
     787           2 :     v0APts[2+8*i] = fV0AOctH2/2.;              v0APts[3+8*i] = -fV0AFEEBHt/2.- 2.5;
     788           2 :     v0APts[4+8*i] = -fV0AOctH2/2.;             v0APts[5+8*i] = -fV0AFEEBHt/2.- 2.5;
     789           2 :     v0APts[6+8*i] = -fV0AOctH2/2.;             v0APts[7+8*i] = fV0AFEEBHt/2.+ 2.5;
     790             :     }
     791           1 :     TGeoArb8 *sV0AFEEOct2 = new TGeoArb8("sV0AFEEOct2", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
     792           1 :     TGeoVolume *v0AFEEOct2 = new TGeoVolume("V0AFEEOct2",sV0AFEEOct2, medV0ASup);
     793           1 :     v0AFEEOct2->SetLineColor(kV0AColorOct);
     794           2 :     v0LE->AddNode(v0AFEEOct2,1, new TGeoTranslation((aFEEshiftR2Sec1*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0,0.0,0.0));
     795             : 
     796             : 
     797             :     /// Definition sector 2
     798           2 :     TGeoVolume *v0ASec2 = new TGeoVolumeAssembly("V0ASec2");
     799             :         
     800             :     /// For boolean sustraction
     801             :     double preShapeSec2 = 0.2;
     802           6 :     for (int i=0;i<2;i++) {
     803           2 :       v0APts[0+8*i] = fV0AR0-fV0AFraWd/2.-preShapeSec2;  v0APts[1+8*i] = -preShapeSec2;
     804           2 :       v0APts[2+8*i] = fV0AR0-fV0AFraWd/2.-preShapeSec2;  v0APts[3+8*i] = fV0AFraWd/2.;
     805           2 :       v0APts[4+8*i] = fV0AR4+fV0AFraWd/2.+preShapeSec2;  v0APts[5+8*i] = fV0AFraWd/2.;
     806           2 :       v0APts[6+8*i] = fV0AR4+fV0AFraWd/2.+preShapeSec2;  v0APts[7+8*i] = -preShapeSec2;
     807             :     }
     808           1 :     new TGeoArb8("sV0ACha1Sec2",fV0ASciWd/1.5,v0APts);
     809           6 :     for (int i=0;i<2;i++) {
     810           2 :       v0APts[0+8*i] = fV0AR0*sin45-preShapeSec2;
     811           2 :       v0APts[1+8*i] = (fV0AR0-fV0AFraWd)*sin45-preShapeSec2;
     812           2 :       v0APts[2+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45-preShapeSec2;
     813           2 :       v0APts[3+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
     814           2 :       v0APts[4+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45+preShapeSec2;
     815           2 :       v0APts[5+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45+2.*preShapeSec2;
     816           2 :       v0APts[6+8*i] = (fV0AR4+fV0AFraWd)*sin45+preShapeSec2;
     817           2 :       v0APts[7+8*i] = fV0AR4*sin45+preShapeSec2;
     818             :     }
     819           1 :     new TGeoArb8("sV0ACha2Sec2", fV0ASciWd/2.+2.*preShapeSec2, v0APts);
     820           1 :     new TGeoCompositeShape("sV0ACha12Sec2","sV0ACha1Sec2+sV0ACha2Sec2");
     821           1 :     new TGeoTube("sV0ANail1SciHoleSec2", 0.0, 0.4, 1.65);
     822           1 :     TGeoTranslation *pos1Sec2 = new TGeoTranslation("pos1Sec2", 42.9, 0.51, 0.0);
     823           1 :     pos1Sec2->RegisterYourself();
     824           1 :     new TGeoTube("sV0ANail2SciHoleSec2", 0.0, 0.4, 1.65);
     825           1 :     TGeoTranslation *pos2Sec2 = new TGeoTranslation("pos2Sec2", 30.73,29.98,0.0);
     826           1 :     pos2Sec2->RegisterYourself();
     827           1 :     new TGeoCompositeShape("sV0ANailsSciHolesSec2","sV0ANail1SciHoleSec2:pos1Sec2+sV0ANail2SciHoleSec2:pos2Sec2");
     828           1 :     new TGeoCompositeShape("sV0AChaSec2","sV0ACha12Sec2+sV0ANailsSciHolesSec2");
     829           1 :     new TGeoTubeSeg("sV0AFicR5Sec2", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShapeSec2, 0, 45);
     830           1 :     new TGeoBBox("sV0AFicFEEBSec2", fV0AFEEBWd/2., fV0AFEEBHt/2., fV0AFEEBTh/2.);
     831           1 :     rot = new TGeoRotation("rot");
     832           1 :     rot->RotateX(90);
     833           1 :     rot->RotateZ(-90.0);
     834           1 :     double aFEEshiftR2Sec2 = fV0AR6  +  fV0AOctH2 + fV0APlaAl;
     835           1 :     TGeoCombiTrans *posFicFEEBSec2 = new TGeoCombiTrans("posFicFEEBSec2", aFEEshiftR2Sec2*cos225 + 2.0, 0, 7.5, rot);
     836           1 :     posFicFEEBSec2->RegisterYourself();
     837           6 :     for (int i=0;i<2;i++) {
     838           2 :     v0APts[0+8*i] = fV0AOctH2/2.;              v0APts[1+8*i] = fV0AFEEBHt/2. + 2.5;
     839           2 :     v0APts[2+8*i] = fV0AOctH2/2.;              v0APts[3+8*i] = -fV0AFEEBHt/2.- 2.5;
     840           2 :     v0APts[4+8*i] = -fV0AOctH2/2.;             v0APts[5+8*i] = -fV0AFEEBHt/2.- 2.5;
     841           2 :     v0APts[6+8*i] = -fV0AOctH2/2.;             v0APts[7+8*i] = fV0AFEEBHt/2.+ 2.5;
     842             :     }
     843           1 :     new TGeoArb8("sV0AFicOct2Sec2", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
     844           1 :     TGeoTranslation *posFicOct2Sec2 = new TGeoTranslation("posFicOct2Sec2",(aFEEshiftR2Sec2*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0,0.0,0.0);
     845           1 :     posFicOct2Sec2->RegisterYourself();  
     846             : 
     847             :     /// Frame
     848           2 :     TGeoVolume *v0AFraSec2 = new TGeoVolumeAssembly("V0AFraSec2");
     849           6 :     for (int i=0;i<2;i++) {
     850           2 :       v0APts[0+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[1+8*i] = 0.;
     851           2 :       v0APts[2+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[3+8*i] = fV0AFraWd/2.;
     852           2 :       v0APts[4+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[5+8*i] = fV0AFraWd/2.;
     853           2 :       v0APts[6+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[7+8*i] = 0.;
     854             :     }
     855           1 :     TGeoArb8 *sV0AFraB1Sec2 = new TGeoArb8("sV0AFraB1Sec2",fV0ASciWd/2.,v0APts);
     856           1 :     TGeoVolume *v0AFraB1Sec2 = new TGeoVolume("V0AFraB1Sec2",sV0AFraB1Sec2,medV0AFra);
     857           6 :     for (int i=0;i<2;i++) {
     858           2 :       v0APts[0+8*i] = fV0AR0*sin45;
     859           2 :       v0APts[1+8*i] = (fV0AR0-fV0AFraWd)*sin45;
     860           2 :       v0APts[2+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
     861           2 :       v0APts[3+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
     862           2 :       v0APts[4+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45;
     863           2 :       v0APts[5+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45;
     864           2 :       v0APts[6+8*i] = (fV0AR4+fV0AFraWd)*sin45;
     865           2 :       v0APts[7+8*i] = fV0AR4*sin45;
     866             :     }
     867           1 :     TGeoArb8 *sV0AFraB2Sec2 = new TGeoArb8("sV0AFraB2Sec2", fV0ASciWd/2., v0APts);
     868           1 :     TGeoVolume *v0AFraB2Sec2 = new TGeoVolume("V0AFraB2Sec2",sV0AFraB2Sec2,medV0AFra);
     869           1 :     v0AFraB1Sec2->SetLineColor(kV0AColorFra); v0AFraB2Sec2->SetLineColor(kV0AColorFra);
     870           1 :     v0AFraSec2->AddNode(v0AFraB1Sec2,1);
     871           1 :     v0AFraSec2->AddNode(v0AFraB2Sec2,1);  
     872           2 :     new TGeoTubeSeg( "sV0AFraR1bSec2", fV0AR0-fV0AFraWd/2.,
     873           1 :                      fV0AR0+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     874           2 :     new TGeoTubeSeg( "sV0AFraR2bSec2", fV0AR1-fV0AFraWd/2.,
     875           1 :                      fV0AR1+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     876           2 :     new TGeoTubeSeg( "sV0AFraR3bSec2", fV0AR2-fV0AFraWd/2.,
     877           1 :                      fV0AR2+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     878           2 :     new TGeoTubeSeg( "sV0AFraR4bSec2", fV0AR3-fV0AFraWd/2.,
     879           1 :                      fV0AR3+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     880           2 :     new TGeoTubeSeg( "sV0AFraR5bSec2", fV0AR4-fV0AFraWd/2.,
     881           1 :                      fV0AR4+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     882           1 :     TGeoCompositeShape *sV0AFraR1Sec2 = new TGeoCompositeShape("sV0AFraR1Sec2","sV0AFraR1bSec2-sV0AChaSec2");
     883           1 :     TGeoCompositeShape *sV0AFraR2Sec2 = new TGeoCompositeShape("sV0AFraR2Sec2","sV0AFraR2bSec2-sV0AChaSec2");
     884           1 :     TGeoCompositeShape *sV0AFraR3Sec2 = new TGeoCompositeShape("sV0AFraR3Sec2","sV0AFraR3bSec2-sV0AChaSec2");
     885           1 :     TGeoCompositeShape *sV0AFraR4Sec2 = new TGeoCompositeShape("sV0AFraR4Sec2","sV0AFraR4bSec2-sV0AChaSec2");
     886           1 :     TGeoCompositeShape *sV0AFraR5Sec2 = new TGeoCompositeShape("sV0AFraR5Sec2","sV0AFraR5bSec2-sV0AChaSec2");
     887           1 :     TGeoVolume *v0AFraR1Sec2 = new TGeoVolume("V0AFraR1Sec2",sV0AFraR1Sec2,medV0AFra);
     888           1 :     TGeoVolume *v0AFraR2Sec2 = new TGeoVolume("V0AFraR2Sec2",sV0AFraR2Sec2,medV0AFra);
     889           1 :     TGeoVolume *v0AFraR3Sec2 = new TGeoVolume("V0AFraR3Sec2",sV0AFraR3Sec2,medV0AFra);
     890           1 :     TGeoVolume *v0AFraR4Sec2 = new TGeoVolume("V0AFraR4Sec2",sV0AFraR4Sec2,medV0AFra);
     891           1 :     TGeoVolume *v0AFraR5Sec2 = new TGeoVolume("V0AFraR5Sec2",sV0AFraR5Sec2,medV0AFra);
     892           1 :     v0AFraR1Sec2->SetLineColor(kV0AColorFra); v0AFraR2Sec2->SetLineColor(kV0AColorFra);
     893           1 :     v0AFraR3Sec2->SetLineColor(kV0AColorFra); v0AFraR4Sec2->SetLineColor(kV0AColorFra);
     894           1 :     v0AFraR5Sec2->SetLineColor(kV0AColorFra);
     895           1 :     v0AFraSec2->AddNode(v0AFraR1Sec2,1); 
     896           1 :     v0AFraSec2->AddNode(v0AFraR2Sec2,1);
     897           1 :     v0AFraSec2->AddNode(v0AFraR3Sec2,1); 
     898           1 :     v0AFraSec2->AddNode(v0AFraR4Sec2,1);
     899           1 :     v0AFraSec2->AddNode(v0AFraR5Sec2,1);
     900           1 :     v0ASec2->AddNode(v0AFraSec2,1);
     901             :     
     902             :     /// Sensitive scintilator
     903           2 :     TGeoVolume *v0ASciSec2 = new TGeoVolumeAssembly("V0ASciSec2");
     904           2 :     new TGeoTubeSeg( "sV0AR1bSec2", fV0AR0+fV0AFraWd/2.,
     905           1 :                      fV0AR1-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     906           2 :     new TGeoTubeSeg( "sV0AR2bSec2", fV0AR1+fV0AFraWd/2.,
     907           1 :                      fV0AR2-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     908           2 :     new TGeoTubeSeg( "sV0AR3bSec2", fV0AR2+fV0AFraWd/2.,
     909           1 :                      fV0AR3-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     910           2 :     new TGeoTubeSeg( "sV0AR4bSec2", fV0AR3+fV0AFraWd/2.,
     911           1 :                      fV0AR4-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
     912           1 :     TGeoCompositeShape *sV0AR1Sec2 = new TGeoCompositeShape("sV0AR1Sec2","sV0AR1bSec2-sV0AChaSec2");
     913           1 :     TGeoCompositeShape *sV0AR2Sec2 = new TGeoCompositeShape("sV0AR2Sec2","sV0AR2bSec2-sV0AChaSec2");
     914           1 :     TGeoCompositeShape *sV0AR3Sec2 = new TGeoCompositeShape("sV0AR3Sec2","sV0AR3bSec2-sV0AChaSec2");
     915           1 :     TGeoCompositeShape *sV0AR4Sec2 = new TGeoCompositeShape("sV0AR4Sec2","sV0AR4bSec2-sV0AChaSec2");
     916           1 :     TGeoVolume *v0L1Sec2 = new TGeoVolume("V0L1Sec2",sV0AR1Sec2,medV0ASci);
     917           1 :     TGeoVolume *v0L2Sec2 = new TGeoVolume("V0L2Sec2",sV0AR2Sec2,medV0ASci);
     918           1 :     TGeoVolume *v0L3Sec2 = new TGeoVolume("V0L3Sec2",sV0AR3Sec2,medV0ASci);
     919           1 :     TGeoVolume *v0L4Sec2 = new TGeoVolume("V0L4Sec2",sV0AR4Sec2,medV0ASci);
     920           1 :     v0L1Sec2->SetLineColor(kV0AColorSci); v0L2Sec2->SetLineColor(kV0AColorSci);
     921           1 :     v0L3Sec2->SetLineColor(kV0AColorSci); v0L4Sec2->SetLineColor(kV0AColorSci);
     922           1 :     v0ASec2->AddNode(v0L1Sec2,1);
     923           1 :     v0ASec2->AddNode(v0L2Sec2,1);
     924           1 :     v0ASec2->AddNode(v0L3Sec2,1);
     925           1 :     v0ASec2->AddNode(v0L4Sec2,1);      
     926             :     
     927             :     /// Segment of octagon 
     928           6 :     for (int i=0;i<2;i++) {
     929           2 :     v0APts[0+8*i] =  fV0AR6-fV0AOctH2;           v0APts[1+8*i] = 0.;
     930           2 :       v0APts[2+8*i] = (fV0AR6-fV0AOctH2)*sin45;  v0APts[3+8*i] = (fV0AR6-fV0AOctH2)*sin45;
     931           2 :       v0APts[4+8*i] = fV0AR6*sin45;              v0APts[5+8*i] = fV0AR6*sin45;
     932           2 :       v0APts[6+8*i] = fV0AR6;                    v0APts[7+8*i] = 0.;
     933             :     }
     934           1 :     new TGeoArb8("sV0AOct2Sec2", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
     935           1 :     TGeoCompositeShape *sV0AOct2FEEBSec2 = new TGeoCompositeShape("sV0AOct2FEEBSec2","sV0AOct2Sec2-sV0AFicFEEBSec2:posFicFEEBSec2-sV0AFicOct2Sec2:posFicOct2Sec2");
     936           1 :     TGeoVolume *v0AOct2Sec2 = new TGeoVolume("V0AOct2Sec2", sV0AOct2FEEBSec2,medV0ASup);
     937           1 :     v0AOct2Sec2->SetLineColor(kV0AColorOct);
     938           2 :     TGeoVolume *v0ASupSec2 = new TGeoVolumeAssembly("V0ASupSec2");
     939           1 :     v0ASupSec2->AddNode(v0AOct2Sec2,1);
     940           1 :     v0ASec2->AddNode(v0ASupSec2,1);
     941             : 
     942             :     //Bunch of fibers
     943           1 :     v0APts[ 0] = v0APts[ 2] = -13.0;
     944           1 :     v0APts[ 1] = v0APts[ 7] = (fV0ASciWd+fV0AOctWd)/2.-0.01;
     945           1 :     v0APts[ 3] = v0APts[ 5] = (fV0ASciWd+fV0AOctWd)/2.+0.01;
     946           1 :     v0APts[ 4] = v0APts[ 6] = +13.0;
     947           1 :     v0APts[ 8] = v0APts[10] = -10.0;
     948           1 :     v0APts[ 9] = v0APts[15] = 0.;
     949           1 :     v0APts[11] = v0APts[13] = 0.25;
     950           1 :     v0APts[12] = v0APts[14] = +10.0;
     951           1 :     new TGeoArb8("sV0AFib1Sec2", 11.5, v0APts);
     952           1 :     rot = new TGeoRotation("rot");
     953           1 :     rot->RotateX(-90);
     954           1 :     rot->RotateZ(-90.+22.5);
     955           1 :     TGeoCombiTrans *fibpos1Sec2 = new TGeoCombiTrans("fibpos1Sec2", (fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. - 3.8, (fV0AR6-fV0AOctH2+fV0AR5)*sin225/2.-1.8, 0, rot);
     956           1 :     fibpos1Sec2->RegisterYourself();
     957           1 :     TGeoCompositeShape *sV0AFib1HoleSec2 = new TGeoCompositeShape("sV0AFib1HoleSec2","sV0AFib1Sec2:fibpos1Sec2-sV0AFicR5Sec2"); 
     958           1 :     TGeoVolume *v0AFib1HoleSec2 = new TGeoVolume("V0AFib1HoleSec2",sV0AFib1HoleSec2,medV0AFib);
     959           1 :     v0AFib1HoleSec2->SetLineColor(kV0AColorFib);
     960           1 :     new TGeoArb8("sV0AFib2Sec2", 11.5, v0APts);
     961           1 :     rot = new TGeoRotation("rot");
     962           1 :     rot->RotateX(-90);
     963           1 :     rot->RotateY(180);
     964           1 :     rot->RotateZ(-90.+22.5);
     965           1 :     TGeoCombiTrans *fibpos2Sec2 = new TGeoCombiTrans("fibpos2Sec2", (fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. - 3.8, (fV0AR6-fV0AOctH2+fV0AR5)*sin225/2.-1.8, 0, rot);
     966           1 :     fibpos2Sec2->RegisterYourself();
     967           1 :     TGeoCompositeShape *sV0AFib2HoleSec2 = new TGeoCompositeShape("sV0AFib2HoleSec2","sV0AFib2Sec2:fibpos2Sec2-sV0AFicR5Sec2");
     968           1 :     TGeoVolume *v0AFib2HoleSec2 = new TGeoVolume("V0AFib2HoleSec2",sV0AFib2HoleSec2,medV0AFib);
     969           1 :     v0AFib2HoleSec2->SetLineColor(kV0AColorFib);
     970           2 :     TGeoVolume *v0AFibSec2 = new TGeoVolumeAssembly("V0AFibSec2");
     971           1 :     v0AFibSec2->AddNode(v0AFib1HoleSec2,1);
     972           1 :     v0AFibSec2->AddNode(v0AFib2HoleSec2,1);
     973           1 :     v0ASec2->AddNode(v0AFibSec2,1); 
     974             :     
     975             :      /// Plates
     976           1 :     new TGeoTube("sV0ANail1PlaInHoleSec2", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
     977           1 :     new TGeoTube("sV0ANail2PlaInHoleSec2", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
     978           1 :     new TGeoCompositeShape("sV0ANailsPlaInHolesSec2","sV0ANail1PlaInHoleSec2:pos1Sec2+sV0ANail2PlaInHoleSec2:pos2Sec2");
     979           1 :     new TGeoTube("sV0ANail1PlaOuHoleSec2", 0.0, 0.4, (fV0APlaAl)/2.);
     980           1 :     new TGeoTube("sV0ANail2PlaOuHoleSec2", 0.0, 0.4, (fV0APlaAl)/2.);
     981           1 :     new TGeoCompositeShape("sV0ANailsPlaOuHolesSec2","sV0ANail1PlaOuHoleSec2:pos1Sec2+sV0ANail2PlaOuHoleSec2:pos2Sec2");
     982           6 :     for (int i=0;i<2;i++) {
     983           2 :       v0APts[0+8*i] = fV0AR0;                   v0APts[1+8*i] = 0.;
     984           2 :       v0APts[2+8*i] = fV0AR0*sin45;             v0APts[3+8*i] = fV0AR0*sin45;
     985           2 :       v0APts[4+8*i] = fV0AR6 * sin45;   v0APts[5+8*i] = fV0AR6*sin45;
     986           2 :       v0APts[6+8*i] = fV0AR6;           v0APts[7+8*i] = 0.;
     987             :     }
     988           1 :     new TGeoArb8("sV0APlaInSec2", (fV0APlaWd-2*fV0APlaAl)/2., v0APts);
     989           1 :     TGeoCompositeShape *sV0APlaInNailsHolesSec2 = new TGeoCompositeShape("sV0APlaInNailsHolesSec2","sV0APlaInSec2-sV0ANailsPlaInHolesSec2-sV0AFicFEEBSec2:posFicFEEBSec2");
     990           1 :     TGeoVolume *v0APlaInNailsHolesSec2 = new TGeoVolume("V0APlaInNailsHolesSec2", sV0APlaInNailsHolesSec2, medV0APlaIn);
     991           1 :     new TGeoArb8("sV0APlaOuSec2", fV0APlaAl/2., v0APts);
     992           1 :     TGeoCompositeShape *sV0APlaOuNailsHolesSec2 = new TGeoCompositeShape("sV0APlaOuNailsHolesSec2","sV0APlaOuSec2-sV0ANailsPlaOuHolesSec2-sV0AFicFEEBSec2:posFicFEEBSec2"); 
     993           1 :     TGeoVolume *v0APlaOuNailsHolesSec2 = new TGeoVolume("V0APlaOuNailsHolesSec2", sV0APlaOuNailsHolesSec2, medV0APlaOu);
     994           1 :     v0APlaInNailsHolesSec2->SetLineColor(kV0AColorPlaIn); v0APlaOuNailsHolesSec2->SetLineColor(kV0AColorPlaOu);
     995           2 :     TGeoVolume *v0APlaSec2 = new TGeoVolumeAssembly("V0APlaSec2");
     996           1 :     v0APlaSec2->AddNode(v0APlaInNailsHolesSec2,1);
     997           2 :     v0APlaSec2->AddNode(v0APlaOuNailsHolesSec2,1,new TGeoTranslation(0,0,(fV0APlaWd-fV0APlaAl)/2.));
     998           2 :     v0APlaSec2->AddNode(v0APlaOuNailsHolesSec2,2,new TGeoTranslation(0,0,-(fV0APlaWd-fV0APlaAl)/2.));
     999           2 :     v0ASec2->AddNode(v0APlaSec2,1,new TGeoTranslation(0,0,(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    1000           2 :     v0ASec2->AddNode(v0APlaSec2,2,new TGeoTranslation(0,0,-(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    1001             :     
    1002             :      /// Non-sensitive scintilator
    1003           1 :     new TGeoTubeSeg("sV0AR5S2Sec2", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShapeSec2, 0, 45);
    1004           1 :     TGeoCompositeShape *sV0AR5Sec2 = new TGeoCompositeShape("V0AR5Sec2","sV0AR5S2Sec2 - sV0AChaSec2");
    1005           1 :     TGeoVolume *v0AR5Sec2 = new TGeoVolume("V0AR5Sec2",sV0AR5Sec2,medV0ASci);
    1006           1 :     v0AR5Sec2->SetLineColor(kV0AColorSci);
    1007           1 :     v0ASciSec2->AddNode(v0AR5Sec2,1);
    1008           1 :     v0ASec2->AddNode(v0ASciSec2,1); 
    1009             : 
    1010             :     /// PMBox
    1011           2 :     TGeoVolume* v0APMSec2 = new TGeoVolumeAssembly("V0APMSec2");
    1012           1 :     new TGeoBBox("sV0APMB1Sec2", fV0APMBWd/2., fV0APMBHt/2., fV0APMBTh/2.);
    1013           1 :     new TGeoBBox("sV0APMB2Sec2", fV0APMBWd/2.-fV0APMBWdW, fV0APMBHt/2.-fV0APMBHtW, fV0APMBTh/2.-fV0APMBThW);
    1014           1 :     TGeoCompositeShape *sV0APMBSec2 = new TGeoCompositeShape("sV0APMBSec2","sV0APMB1Sec2-sV0APMB2Sec2");
    1015           1 :     TGeoVolume *v0APMBSec2 = new TGeoVolume("V0APMBSec2",sV0APMBSec2, medV0APMAlum);
    1016           1 :     v0APMBSec2->SetLineColor(kV0AColorPMA);
    1017           1 :     v0APMSec2->AddNode(v0APMBSec2,1);
    1018             : 
    1019             :     /// PMTubes
    1020           1 :     TGeoTube *sV0APMT1Sec2 = new TGeoTube("sV0APMT1Sec2", fV0APMTR1, fV0APMTR2, fV0APMTH/2.);
    1021           1 :     TGeoVolume *v0APMT1Sec2 = new TGeoVolume("V0APMT1Sec2", sV0APMT1Sec2, medV0APMGlass);
    1022           1 :     TGeoTube *sV0APMT2Sec2 = new TGeoTube("sV0APMT2Sec2", fV0APMTR3, fV0APMTR4, fV0APMTH/2.);
    1023           1 :     TGeoVolume *v0APMT2Sec2 = new TGeoVolume("V0APMT2Sec2", sV0APMT2Sec2, medV0APMAlum);
    1024           2 :     TGeoVolume *v0APMTSec2 = new TGeoVolumeAssembly("V0APMTSec2");
    1025           1 :     TGeoTube *sV0APMTTSec2 = new TGeoTube("sV0APMTTSec2", 0., fV0APMTR4, fV0APMTB/2.);
    1026           1 :     TGeoVolume *v0APMTTSec2 = new TGeoVolume("V0APMTTSec2", sV0APMTTSec2, medV0APMAlum);
    1027           1 :     v0APMT1Sec2->SetLineColor(kV0AColorPMG);
    1028           1 :     v0APMT2Sec2->SetLineColor(kV0AColorPMA);
    1029           1 :     v0APMTTSec2->SetLineColor(kV0AColorPMA);
    1030           1 :     rot = new TGeoRotation("rot", 90, 0, 180, 0, 90, 90);
    1031           1 :     v0APMTSec2->AddNode(v0APMT1Sec2,1,rot);
    1032           1 :     v0APMTSec2->AddNode(v0APMT2Sec2,1,rot);
    1033           2 :     v0APMTSec2->AddNode(v0APMTTSec2,1,new TGeoCombiTrans(0,-(fV0APMTH+fV0APMTB)/2.,0,rot));
    1034           1 :     double autoShiftSec2 = (fV0APMBWd-2*fV0APMBWdW)/4.;
    1035           2 :     v0APMSec2->AddNode(v0APMTSec2, 1, new TGeoTranslation(-1.5*autoShiftSec2, 0, 0));
    1036           2 :     v0APMSec2->AddNode(v0APMTSec2, 2, new TGeoTranslation(-0.5*autoShiftSec2, 0, 0));
    1037           2 :     v0APMSec2->AddNode(v0APMTSec2, 3, new TGeoTranslation(+0.5*autoShiftSec2, 0, 0));
    1038           2 :     v0APMSec2->AddNode(v0APMTSec2, 4, new TGeoTranslation(+1.5*autoShiftSec2, 0, 0));
    1039             : 
    1040             :     // PM
    1041           1 :     rot = new TGeoRotation("rot");
    1042           1 :     rot->RotateX(90-fV0APMBAng);
    1043           1 :     rot->RotateZ(-90.+22.5);
    1044           1 :     double cosAngPMBSec2 = TMath::Cos(fV0APMBAng*TMath::DegToRad());
    1045           1 :     double sinAngPMBSec2 = TMath::Sin(fV0APMBAng*TMath::DegToRad());
    1046           1 :     double shiftZSec2 = fV0APMBHt/2. * cosAngPMBSec2
    1047           1 :       -   ( fV0ASciWd + 2 * fV0AOctWd + 2 * fV0APlaWd )/2.   -   fV0APMBTh/2. * sinAngPMBSec2;
    1048           1 :     double shiftRSec2 = fV0AR6  +  fV0AOctH2 + fV0APlaAl;
    1049           2 :     v0ASec2->AddNode(v0APMSec2,1, new TGeoCombiTrans( shiftRSec2*cos225+1.07, shiftRSec2*sin225, shiftZSec2, rot));
    1050             :     
    1051             :     // Aluminium nails 
    1052           1 :     TGeoTube *sV0ANail1Sec2 = new TGeoTube("sV0ANail1Sec2", 0.0, 0.4, 5.09/2.);
    1053           1 :     TGeoVolume *v0ANail1Sec2 = new TGeoVolume("V0ANail1Sec2", sV0ANail1Sec2, medV0APMAlum);
    1054           1 :     v0ANail1Sec2->SetLineColor(kV0AColorPMA);// this is the color for aluminium
    1055           2 :     v0ASec2->AddNode(v0ANail1Sec2,1,new TGeoTranslation(42.9, 0.51, 0.0));
    1056           1 :     TGeoTube *sV0ANail2Sec2 = new TGeoTube("sV0ANail2Sec2", 0.0, 0.4, 5.09/2.);
    1057           1 :     TGeoVolume *v0ANail2Sec2 = new TGeoVolume("V0ANail2Sec2", sV0ANail2Sec2, medV0APMAlum);
    1058           1 :     v0ANail2Sec2->SetLineColor(kV0AColorPMA);
    1059           2 :     v0ASec2->AddNode(v0ANail2Sec2,1,new TGeoTranslation(30.73,29.98,0.0)); 
    1060             :         
    1061             :     /// Adding sector to v0LE volume
    1062           4 :     for(int i=1; i<2; i++) {
    1063           1 :        TGeoRotation *rotation = new TGeoRotation("rotation", 90., i*45., 90., 90.+i*45., 0., 0.);
    1064           1 :        v0LE->AddNode(v0ASec2,i+1,rotation);  
    1065             :     }
    1066             : 
    1067             :     //FEEBox
    1068           2 :     TGeoVolume* v0AFEE2 = new TGeoVolumeAssembly("V0AFEE2");
    1069           1 :     v0AFEE2->AddNode(v0AFEEB,1);
    1070             : 
    1071             :     //Mother and daughter boards
    1072           2 :     v0AFEE2->AddNode(v0AFEEDaughter, 1, new TGeoTranslation(9.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1073           2 :     v0AFEE2->AddNode(v0AFEEDaughter, 2, new TGeoTranslation(6.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1074           2 :     v0AFEE2->AddNode(v0AFEEDaughter, 3, new TGeoTranslation(3.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1075           2 :     v0AFEE2->AddNode(v0AFEEDaughter, 4, new TGeoTranslation(0.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1076           2 :     v0AFEE2->AddNode(v0AFEEDaughter, 5, new TGeoTranslation(-3.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1077           2 :     v0AFEE2->AddNode(v0AFEEDaughter, 6, new TGeoTranslation(-6.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1078           2 :     v0AFEE2->AddNode(v0AFEEDaughter, 7, new TGeoTranslation(-9.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1079           2 :     v0AFEE2->AddNode(v0AFEEDaughter, 8, new TGeoTranslation(-12.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));   
    1080           2 :     v0AFEE2->AddNode(v0AFEEMother, 1, new TGeoTranslation(0.0, 0.0, -fV0AFEEBTh/2.+fV0APMBThW+fV0APMBHtW));
    1081           2 :     v0AFEE2->AddNode(v0AFEEHalfMother, 1, new TGeoTranslation(0.0, -(fV0AFEEBTh+fV0APMTB)/2., -2.0*spacing));
    1082             : 
    1083             :     //FEE
    1084           1 :     rot = new TGeoRotation("rot");
    1085           1 :     rot->RotateX(90);
    1086           1 :     rot->RotateZ(+90.0-45.0+90);
    1087           2 :     v0LE->AddNode(v0AFEE2,1, new TGeoCombiTrans( (aFEEshiftR2Sec1*cos225 + 2.0)*cos45, (aFEEshiftR2Sec1*cos225 + 2.0)*sin45, 7.5, rot));
    1088           1 :     rot = new TGeoRotation("rot");
    1089           1 :     rot->RotateZ(-90.0+45.0+90.0);
    1090           2 :     v0LE->AddNode(v0AFEEOct2,2, new TGeoCombiTrans(((aFEEshiftR2Sec1*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0)*cos45,((aFEEshiftR2Sec1*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0)*sin45,0.0,rot));
    1091             : 
    1092             :    
    1093             :     //Upper supports
    1094           6 :     for (int i=0;i<2;i++){
    1095           2 :     v0APts[0+8*i] = 0.0;            v0APts[1+8*i] = 45.5;  
    1096           2 :     v0APts[2+8*i] = 0.0;            v0APts[3+8*i] = 70.4;   
    1097           2 :     v0APts[4+8*i] = 4.0;            v0APts[5+8*i] = 68.9;
    1098           2 :     v0APts[6+8*i] = 4.0;            v0APts[7+8*i] = 45.5;  
    1099             :     }
    1100           1 :     TGeoArb8 *sV0ASuppur = new TGeoArb8("sV0ASuppur", 1.65, v0APts);    
    1101           1 :     TGeoVolume *v0ASuppur = new TGeoVolume("V0ASuppur", sV0ASuppur, medV0ASup);
    1102           1 :     v0ASuppur->SetLineColor(kV0AColorOct);
    1103           1 :     v0LE->AddNode(v0ASuppur,1);
    1104           6 :     for (int i=0;i<2;i++){
    1105           2 :     v0APts[0+8*i] = -0.0;           v0APts[1+8*i] = 70.4;
    1106           2 :     v0APts[2+8*i] = -0.0;           v0APts[3+8*i] = 45.5;
    1107           2 :     v0APts[4+8*i] = -4.0;           v0APts[5+8*i] = 45.5;
    1108           2 :     v0APts[6+8*i] = -4.0;           v0APts[7+8*i] = 68.9;
    1109             :     }
    1110           1 :     TGeoArb8 *sV0ASuppul = new TGeoArb8("sV0ASuppul", 1.65, v0APts);    
    1111           1 :     TGeoVolume *v0ASuppul = new TGeoVolume("V0ASuppul", sV0ASuppul, medV0ASup);
    1112           1 :     v0ASuppul->SetLineColor(kV0AColorOct);
    1113           1 :     v0LE->AddNode(v0ASuppul,1);
    1114             : 
    1115             :     /// Definition sector 3
    1116           2 :     TGeoVolume *v0ASec3 = new TGeoVolumeAssembly("V0ASec3");
    1117             :         
    1118             :     /// For boolean sustraction
    1119             :     double preShapeSec3 = 0.2;
    1120           6 :     for (int i=0;i<2;i++) {
    1121           2 :       v0APts[0+8*i] = fV0AR0-fV0AFraWd/2.-preShapeSec3;  v0APts[1+8*i] = -preShapeSec3;
    1122           2 :       v0APts[2+8*i] = fV0AR0-fV0AFraWd/2.-preShapeSec3;  v0APts[3+8*i] = fV0AFraWd/2.;
    1123           2 :       v0APts[4+8*i] = fV0AR4+fV0AFraWd/2.+preShapeSec3;  v0APts[5+8*i] = fV0AFraWd/2.;
    1124           2 :       v0APts[6+8*i] = fV0AR4+fV0AFraWd/2.+preShapeSec3;  v0APts[7+8*i] = -preShapeSec3;
    1125             :     }
    1126           1 :     new TGeoArb8("sV0ACha1Sec3",fV0ASciWd/1.5,v0APts);
    1127           6 :     for (int i=0;i<2;i++) {
    1128           2 :       v0APts[0+8*i] = fV0AR0*sin45-preShapeSec3;
    1129           2 :       v0APts[1+8*i] = (fV0AR0-fV0AFraWd)*sin45-preShapeSec3;
    1130           2 :       v0APts[2+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45-preShapeSec3;
    1131           2 :       v0APts[3+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
    1132           2 :       v0APts[4+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45+preShapeSec3;
    1133           2 :       v0APts[5+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45+2.*preShapeSec3;
    1134           2 :       v0APts[6+8*i] = (fV0AR4+fV0AFraWd)*sin45+preShapeSec3;
    1135           2 :       v0APts[7+8*i] = fV0AR4*sin45+preShapeSec3;
    1136             :     }
    1137           1 :     new TGeoArb8("sV0ACha2Sec3", fV0ASciWd/2.+2.*preShapeSec3, v0APts);
    1138           1 :     new TGeoCompositeShape("sV0ACha12Sec3","sV0ACha1Sec3+sV0ACha2Sec3");
    1139           1 :     new TGeoTube("sV0ANail1SciHoleSec3", 0.0, 0.4, 1.65);
    1140           1 :     TGeoTranslation *pos1Sec3 = new TGeoTranslation("pos1Sec3", 42.9, 0.51, 0.0);
    1141           1 :     pos1Sec3->RegisterYourself();
    1142           1 :     new TGeoTube("sV0ANail2SciHoleSec3", 0.0, 0.4, 1.65);
    1143           1 :     TGeoTranslation *pos2Sec3 = new TGeoTranslation("pos2Sec3", 30.73,29.98,0.0);
    1144           1 :     pos2Sec3->RegisterYourself();
    1145           1 :     new TGeoCompositeShape("sV0ANailsSciHolesSec3","sV0ANail1SciHoleSec3:pos1Sec3+sV0ANail2SciHoleSec3:pos2Sec3");
    1146           1 :     new TGeoCompositeShape("sV0AChaSec3","sV0ACha12Sec3+sV0ANailsSciHolesSec3");
    1147           1 :     new TGeoTubeSeg("sV0AFicR5Sec3", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShapeSec3, 0, 45);
    1148           1 :     new TGeoBBox("sV0AFicFEEBSec3", fV0AFEEBWd/2., fV0AFEEBHt/2., fV0AFEEBTh/2.);
    1149           1 :     double aFEEshiftR2Sec3 = fV0AR6  +  fV0AOctH2 + fV0APlaAl;
    1150           1 :     rot = new TGeoRotation("rot");
    1151           1 :     rot->RotateX(90);
    1152           1 :     rot->RotateZ(-90.0+45.0);
    1153           1 :     TGeoCombiTrans *posFicFEEBSec3 = new TGeoCombiTrans("posFicFEEBSec3", (aFEEshiftR2Sec3*cos225 + 2.0 )*cos45, (aFEEshiftR2Sec3*cos225 + 2.0 )*sin45, 7.5, rot);
    1154           1 :     posFicFEEBSec3->RegisterYourself();
    1155           6 :     for (int i=0;i<2;i++) {
    1156           2 :     v0APts[0+8*i] = fV0AOctH2/2.;              v0APts[1+8*i] = fV0AFEEBHt/2. + 2.5;
    1157           2 :     v0APts[2+8*i] = fV0AOctH2/2.;              v0APts[3+8*i] = -fV0AFEEBHt/2.- 2.5;
    1158           2 :     v0APts[4+8*i] = -fV0AOctH2/2.;             v0APts[5+8*i] = -fV0AFEEBHt/2.- 2.5;
    1159           2 :     v0APts[6+8*i] = -fV0AOctH2/2.;             v0APts[7+8*i] = fV0AFEEBHt/2.+ 2.5;
    1160             :     }
    1161           1 :     new TGeoArb8("sV0AFicOct2Sec3", (fV0ASciWd+2*fV0AOctWd)/2., v0APts); 
    1162           1 :     rot = new TGeoRotation("rot");
    1163           1 :     rot->RotateZ(-90.0+45.0+90.0);
    1164           1 :     TGeoCombiTrans *posFicOct2UpSec3 = new TGeoCombiTrans("posFicOct2UpSec3",((aFEEshiftR2Sec3*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0)*cos45,((aFEEshiftR2Sec3*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0)*sin45,0.0,rot);
    1165           1 :     posFicOct2UpSec3->RegisterYourself();
    1166             : 
    1167             :     /// Frame
    1168           2 :     TGeoVolume *v0AFraSec3 = new TGeoVolumeAssembly("V0AFraSec3");
    1169           6 :     for (int i=0;i<2;i++) {
    1170           2 :       v0APts[0+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[1+8*i] = 0.;
    1171           2 :       v0APts[2+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[3+8*i] = fV0AFraWd/2.;
    1172           2 :       v0APts[4+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[5+8*i] = fV0AFraWd/2.;
    1173           2 :       v0APts[6+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[7+8*i] = 0.;
    1174             :     }
    1175           1 :     TGeoArb8 *sV0AFraB1Sec3 = new TGeoArb8("sV0AFraB1Sec3",fV0ASciWd/2.,v0APts);
    1176           1 :     TGeoVolume *v0AFraB1Sec3 = new TGeoVolume("V0AFraB1Sec3",sV0AFraB1Sec3,medV0AFra);
    1177           6 :     for (int i=0;i<2;i++) {
    1178           2 :       v0APts[0+8*i] = fV0AR0*sin45;
    1179           2 :       v0APts[1+8*i] = (fV0AR0-fV0AFraWd)*sin45;
    1180           2 :       v0APts[2+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
    1181           2 :       v0APts[3+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
    1182           2 :       v0APts[4+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45;
    1183           2 :       v0APts[5+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45;
    1184           2 :       v0APts[6+8*i] = (fV0AR4+fV0AFraWd)*sin45;
    1185           2 :       v0APts[7+8*i] = fV0AR4*sin45;
    1186             :     }
    1187           1 :     TGeoArb8 *sV0AFraB2Sec3 = new TGeoArb8("sV0AFraB2Sec3", fV0ASciWd/2., v0APts);
    1188           1 :     TGeoVolume *v0AFraB2Sec3 = new TGeoVolume("V0AFraB2Sec3",sV0AFraB2Sec3,medV0AFra);
    1189           1 :     v0AFraB1Sec3->SetLineColor(kV0AColorFra); v0AFraB2Sec3->SetLineColor(kV0AColorFra);
    1190           1 :     v0AFraSec3->AddNode(v0AFraB1Sec3,1);
    1191           1 :     v0AFraSec3->AddNode(v0AFraB2Sec3,1);  
    1192           2 :     new TGeoTubeSeg( "sV0AFraR1bSec3", fV0AR0-fV0AFraWd/2.,
    1193           1 :                      fV0AR0+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1194           2 :     new TGeoTubeSeg( "sV0AFraR2bSec3", fV0AR1-fV0AFraWd/2.,
    1195           1 :                      fV0AR1+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1196           2 :     new TGeoTubeSeg( "sV0AFraR3bSec3", fV0AR2-fV0AFraWd/2.,
    1197           1 :                      fV0AR2+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1198           2 :     new TGeoTubeSeg( "sV0AFraR4bSec3", fV0AR3-fV0AFraWd/2.,
    1199           1 :                      fV0AR3+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1200           2 :     new TGeoTubeSeg( "sV0AFraR5bSec3", fV0AR4-fV0AFraWd/2.,
    1201           1 :                      fV0AR4+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1202           1 :     TGeoCompositeShape *sV0AFraR1Sec3 = new TGeoCompositeShape("sV0AFraR1Sec3","sV0AFraR1bSec3-sV0AChaSec3");
    1203           1 :     TGeoCompositeShape *sV0AFraR2Sec3 = new TGeoCompositeShape("sV0AFraR2Sec3","sV0AFraR2bSec3-sV0AChaSec3");
    1204           1 :     TGeoCompositeShape *sV0AFraR3Sec3 = new TGeoCompositeShape("sV0AFraR3Sec3","sV0AFraR3bSec3-sV0AChaSec3");
    1205           1 :     TGeoCompositeShape *sV0AFraR4Sec3 = new TGeoCompositeShape("sV0AFraR4Sec3","sV0AFraR4bSec3-sV0AChaSec3");
    1206           1 :     TGeoCompositeShape *sV0AFraR5Sec3 = new TGeoCompositeShape("sV0AFraR5Sec3","sV0AFraR5bSec3-sV0AChaSec3");
    1207           1 :     TGeoVolume *v0AFraR1Sec3 = new TGeoVolume("V0AFraR1Sec3",sV0AFraR1Sec3,medV0AFra);
    1208           1 :     TGeoVolume *v0AFraR2Sec3 = new TGeoVolume("V0AFraR2Sec3",sV0AFraR2Sec3,medV0AFra);
    1209           1 :     TGeoVolume *v0AFraR3Sec3 = new TGeoVolume("V0AFraR3Sec3",sV0AFraR3Sec3,medV0AFra);
    1210           1 :     TGeoVolume *v0AFraR4Sec3 = new TGeoVolume("V0AFraR4Sec3",sV0AFraR4Sec3,medV0AFra);
    1211           1 :     TGeoVolume *v0AFraR5Sec3 = new TGeoVolume("V0AFraR5Sec3",sV0AFraR5Sec3,medV0AFra);
    1212           1 :     v0AFraR1Sec3->SetLineColor(kV0AColorFra); v0AFraR2Sec3->SetLineColor(kV0AColorFra);
    1213           1 :     v0AFraR3Sec3->SetLineColor(kV0AColorFra); v0AFraR4Sec3->SetLineColor(kV0AColorFra);
    1214           1 :     v0AFraR5Sec3->SetLineColor(kV0AColorFra);
    1215           1 :     v0AFraSec3->AddNode(v0AFraR1Sec3,1); 
    1216           1 :     v0AFraSec3->AddNode(v0AFraR2Sec3,1);
    1217           1 :     v0AFraSec3->AddNode(v0AFraR3Sec3,1); 
    1218           1 :     v0AFraSec3->AddNode(v0AFraR4Sec3,1);
    1219           1 :     v0AFraSec3->AddNode(v0AFraR5Sec3,1);
    1220           1 :     v0ASec3->AddNode(v0AFraSec3,1);
    1221             :     
    1222             :     /// Sensitive scintilator
    1223           2 :     TGeoVolume *v0ASciSec3 = new TGeoVolumeAssembly("V0ASciSec3");
    1224           2 :     new TGeoTubeSeg( "sV0AR1bSec3", fV0AR0+fV0AFraWd/2.,
    1225           1 :                      fV0AR1-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1226           2 :     new TGeoTubeSeg( "sV0AR2bSec3", fV0AR1+fV0AFraWd/2.,
    1227           1 :                      fV0AR2-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1228           2 :     new TGeoTubeSeg( "sV0AR3bSec3", fV0AR2+fV0AFraWd/2.,
    1229           1 :                      fV0AR3-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1230           2 :     new TGeoTubeSeg( "sV0AR4bSec3", fV0AR3+fV0AFraWd/2.,
    1231           1 :                      fV0AR4-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1232           1 :     TGeoCompositeShape *sV0AR1Sec3 = new TGeoCompositeShape("sV0AR1Sec3","sV0AR1bSec3-sV0AChaSec3");
    1233           1 :     TGeoCompositeShape *sV0AR2Sec3 = new TGeoCompositeShape("sV0AR2Sec3","sV0AR2bSec3-sV0AChaSec3");
    1234           1 :     TGeoCompositeShape *sV0AR3Sec3 = new TGeoCompositeShape("sV0AR3Sec3","sV0AR3bSec3-sV0AChaSec3");
    1235           1 :     TGeoCompositeShape *sV0AR4Sec3 = new TGeoCompositeShape("sV0AR4Sec3","sV0AR4bSec3-sV0AChaSec3");
    1236           1 :     TGeoVolume *v0L1Sec3 = new TGeoVolume("V0L1Sec3",sV0AR1Sec3,medV0ASci);
    1237           1 :     TGeoVolume *v0L2Sec3 = new TGeoVolume("V0L2Sec3",sV0AR2Sec3,medV0ASci);
    1238           1 :     TGeoVolume *v0L3Sec3 = new TGeoVolume("V0L3Sec3",sV0AR3Sec3,medV0ASci);
    1239           1 :     TGeoVolume *v0L4Sec3 = new TGeoVolume("V0L4Sec3",sV0AR4Sec3,medV0ASci);
    1240           1 :     v0L1Sec3->SetLineColor(kV0AColorSci); v0L2Sec3->SetLineColor(kV0AColorSci);
    1241           1 :     v0L3Sec3->SetLineColor(kV0AColorSci); v0L4Sec3->SetLineColor(kV0AColorSci);
    1242           1 :     v0ASec3->AddNode(v0L1Sec3,1);
    1243           1 :     v0ASec3->AddNode(v0L2Sec3,1);
    1244           1 :     v0ASec3->AddNode(v0L3Sec3,1);
    1245           1 :     v0ASec3->AddNode(v0L4Sec3,1);      
    1246             :     
    1247             :     /// Segment of octagon 
    1248           6 :     for (int i=0;i<2;i++) {
    1249           2 :     v0APts[0+8*i] =  fV0AR6-fV0AOctH2;           v0APts[1+8*i] = 0.;
    1250           2 :       v0APts[2+8*i] = (fV0AR6-fV0AOctH2)*sin45;  v0APts[3+8*i] = (fV0AR6-fV0AOctH2)*sin45;
    1251           2 :       v0APts[4+8*i] = fV0AR6*sin45;              v0APts[5+8*i] = fV0AR6*sin45;
    1252           2 :       v0APts[6+8*i] = fV0AR6;                    v0APts[7+8*i] = 0.;
    1253             :     }
    1254           1 :     new TGeoArb8("sV0AOct2Sec3", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
    1255           1 :     TGeoCompositeShape *sV0AOct2FEEBSec3 = new TGeoCompositeShape("sV0AOct2FEEBSec3","sV0AOct2Sec3-sV0AFicOct2Sec3:posFicOct2UpSec3-sV0AFicFEEBSec3:posFicFEEBSec3");
    1256           1 :     TGeoVolume *v0AOct2Sec3 = new TGeoVolume("V0AOct2Sec3", sV0AOct2FEEBSec3,medV0ASup);
    1257           1 :     v0AOct2Sec3->SetLineColor(kV0AColorOct);
    1258           2 :     TGeoVolume *v0ASupSec3 = new TGeoVolumeAssembly("V0ASupSec3");
    1259           1 :     v0ASupSec3->AddNode(v0AOct2Sec3,1);
    1260           1 :     v0ASec3->AddNode(v0ASupSec3,1);
    1261             : 
    1262             :     //Bunch of fibers
    1263           1 :     v0APts[ 0] = v0APts[ 2] = -13.0;
    1264           1 :     v0APts[ 1] = v0APts[ 7] = (fV0ASciWd+fV0AOctWd)/2.-0.01;
    1265           1 :     v0APts[ 3] = v0APts[ 5] = (fV0ASciWd+fV0AOctWd)/2.+0.01;
    1266           1 :     v0APts[ 4] = v0APts[ 6] = +13.0;
    1267           1 :     v0APts[ 8] = v0APts[10] = -10.0;
    1268           1 :     v0APts[ 9] = v0APts[15] = 0.;
    1269           1 :     v0APts[11] = v0APts[13] = 0.25;
    1270           1 :     v0APts[12] = v0APts[14] = +10.0;
    1271           1 :     new TGeoArb8("sV0AFib1Sec3", 11.5, v0APts);
    1272           1 :     rot = new TGeoRotation("rot");
    1273           1 :     rot->RotateX(-90);
    1274           1 :     rot->RotateZ(-90.+22.5);
    1275           1 :     TGeoCombiTrans *fibpos1Sec3 = new TGeoCombiTrans("fibpos1Sec3", (fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. - 3.8, (fV0AR6-fV0AOctH2+fV0AR5)*sin225/2.-1.8, 0, rot);
    1276           1 :     fibpos1Sec3->RegisterYourself();
    1277           1 :     TGeoCompositeShape *sV0AFib1HoleSec3 = new TGeoCompositeShape("sV0AFib1HoleSec3","sV0AFib1Sec3:fibpos1Sec3-sV0AFicR5Sec3"); 
    1278           1 :     TGeoVolume *v0AFib1HoleSec3 = new TGeoVolume("V0AFib1HoleSec3",sV0AFib1HoleSec3,medV0AFib);
    1279           1 :     v0AFib1HoleSec3->SetLineColor(kV0AColorFib);
    1280           1 :     new TGeoArb8("sV0AFib2Sec3", 11.5, v0APts);
    1281           1 :     rot = new TGeoRotation("rot");
    1282           1 :     rot->RotateX(-90);
    1283           1 :     rot->RotateY(180);
    1284           1 :     rot->RotateZ(-90.+22.5);
    1285           1 :     TGeoCombiTrans *fibpos2Sec3 = new TGeoCombiTrans("fibpos2Sec3", (fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. - 3.8, (fV0AR6-fV0AOctH2+fV0AR5)*sin225/2.-1.8, 0, rot);
    1286           1 :     fibpos2Sec3->RegisterYourself();
    1287           1 :     TGeoCompositeShape *sV0AFib2HoleSec3 = new TGeoCompositeShape("sV0AFib2HoleSec3","sV0AFib2Sec3:fibpos2Sec3-sV0AFicR5Sec3");
    1288           1 :     TGeoVolume *v0AFib2HoleSec3 = new TGeoVolume("V0AFib2HoleSec3",sV0AFib2HoleSec3,medV0AFib);
    1289           1 :     v0AFib2HoleSec3->SetLineColor(kV0AColorFib);
    1290           2 :     TGeoVolume *v0AFibSec3 = new TGeoVolumeAssembly("V0AFibSec3");
    1291           1 :     v0AFibSec3->AddNode(v0AFib1HoleSec3,1);
    1292           1 :     v0AFibSec3->AddNode(v0AFib2HoleSec3,1);
    1293           1 :     v0ASec3->AddNode(v0AFibSec3,1); 
    1294             :     
    1295             :      /// Plates
    1296           1 :     new TGeoTube("sV0ANail1PlaInHoleSec3", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
    1297           1 :     new TGeoTube("sV0ANail2PlaInHoleSec3", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
    1298           1 :     new TGeoCompositeShape("sV0ANailsPlaInHolesSec3","sV0ANail1PlaInHoleSec3:pos1Sec3+sV0ANail2PlaInHoleSec3:pos2Sec3");
    1299           1 :     new TGeoTube("sV0ANail1PlaOuHoleSec3", 0.0, 0.4, (fV0APlaAl)/2.);
    1300           1 :     new TGeoTube("sV0ANail2PlaOuHoleSec3", 0.0, 0.4, (fV0APlaAl)/2.);
    1301           1 :     new TGeoCompositeShape("sV0ANailsPlaOuHolesSec3","sV0ANail1PlaOuHoleSec3:pos1Sec3+sV0ANail2PlaOuHoleSec3:pos2Sec3");
    1302           6 :     for (int i=0;i<2;i++) {
    1303           2 :       v0APts[0+8*i] = fV0AR0;                   v0APts[1+8*i] = 0.;
    1304           2 :       v0APts[2+8*i] = fV0AR0*sin45;             v0APts[3+8*i] = fV0AR0*sin45;
    1305           2 :       v0APts[4+8*i] = fV0AR6 * sin45;   v0APts[5+8*i] = fV0AR6*sin45;
    1306           2 :       v0APts[6+8*i] = fV0AR6;           v0APts[7+8*i] = 0.;
    1307             :     }
    1308           1 :     new TGeoArb8("sV0APlaInSec3", (fV0APlaWd-2*fV0APlaAl)/2., v0APts);
    1309           1 :     TGeoCompositeShape *sV0APlaInNailsHolesSec3 = new TGeoCompositeShape("sV0APlaInNailsHolesSec3","sV0APlaInSec3-sV0ANailsPlaInHolesSec3-sV0AFicFEEBSec3:posFicFEEBSec3");
    1310           1 :     TGeoVolume *v0APlaInNailsHolesSec3 = new TGeoVolume("V0APlaInNailsHolesSec3", sV0APlaInNailsHolesSec3, medV0APlaIn);
    1311           1 :     new TGeoArb8("sV0APlaOuSec3", fV0APlaAl/2., v0APts);
    1312           1 :     TGeoCompositeShape *sV0APlaOuNailsHolesSec3 = new TGeoCompositeShape("sV0APlaOuNailsHolesSec3","sV0APlaOuSec3-sV0ANailsPlaOuHolesSec3-sV0AFicFEEBSec3:posFicFEEBSec3"); 
    1313           1 :     TGeoVolume *v0APlaOuNailsHolesSec3 = new TGeoVolume("V0APlaOuNailsHolesSec3", sV0APlaOuNailsHolesSec3, medV0APlaOu);
    1314           1 :     v0APlaInNailsHolesSec3->SetLineColor(kV0AColorPlaIn); v0APlaOuNailsHolesSec3->SetLineColor(kV0AColorPlaOu);
    1315           2 :     TGeoVolume *v0APlaSec3 = new TGeoVolumeAssembly("V0APlaSec3");
    1316           1 :     v0APlaSec3->AddNode(v0APlaInNailsHolesSec3,1);
    1317           2 :     v0APlaSec3->AddNode(v0APlaOuNailsHolesSec3,1,new TGeoTranslation(0,0,(fV0APlaWd-fV0APlaAl)/2.));
    1318           2 :     v0APlaSec3->AddNode(v0APlaOuNailsHolesSec3,2,new TGeoTranslation(0,0,-(fV0APlaWd-fV0APlaAl)/2.));
    1319           2 :     v0ASec3->AddNode(v0APlaSec3,1,new TGeoTranslation(0,0,(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    1320           2 :     v0ASec3->AddNode(v0APlaSec3,2,new TGeoTranslation(0,0,-(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    1321             :     
    1322             :      /// Non-sensitive scintilator
    1323           1 :     new TGeoTubeSeg("sV0AR5S2Sec3", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShapeSec3, 0, 45);
    1324           1 :     TGeoCompositeShape *sV0AR5Sec3 = new TGeoCompositeShape("V0AR5Sec3","sV0AR5S2Sec3 - sV0AChaSec3");
    1325           1 :     TGeoVolume *v0AR5Sec3 = new TGeoVolume("V0AR5Sec3",sV0AR5Sec3,medV0ASci);
    1326           1 :     v0AR5Sec3->SetLineColor(kV0AColorSci);
    1327           1 :     v0ASciSec3->AddNode(v0AR5Sec3,1);
    1328           1 :     v0ASec3->AddNode(v0ASciSec3,1); 
    1329             : 
    1330             :     /// PMBox
    1331           2 :     TGeoVolume* v0APMSec3 = new TGeoVolumeAssembly("V0APMSec3");
    1332           1 :     new TGeoBBox("sV0APMB1Sec3", fV0APMBWd/2., fV0APMBHt/2., fV0APMBTh/2.);
    1333           1 :     new TGeoBBox("sV0APMB2Sec3", fV0APMBWd/2.-fV0APMBWdW, fV0APMBHt/2.-fV0APMBHtW, fV0APMBTh/2.-fV0APMBThW);
    1334           1 :     TGeoCompositeShape *sV0APMBSec3 = new TGeoCompositeShape("sV0APMBSec3","sV0APMB1Sec3-sV0APMB2Sec3");
    1335           1 :     TGeoVolume *v0APMBSec3 = new TGeoVolume("V0APMBSec3",sV0APMBSec3, medV0APMAlum);
    1336           1 :     v0APMBSec3->SetLineColor(kV0AColorPMA);
    1337           1 :     v0APMSec3->AddNode(v0APMBSec3,1);
    1338             : 
    1339             :     /// PMTubes
    1340           1 :     TGeoTube *sV0APMT1Sec3 = new TGeoTube("sV0APMT1Sec3", fV0APMTR1, fV0APMTR2, fV0APMTH/2.);
    1341           1 :     TGeoVolume *v0APMT1Sec3 = new TGeoVolume("V0APMT1Sec3", sV0APMT1Sec3, medV0APMGlass);
    1342           1 :     TGeoTube *sV0APMT2Sec3 = new TGeoTube("sV0APMT2Sec3", fV0APMTR3, fV0APMTR4, fV0APMTH/2.);
    1343           1 :     TGeoVolume *v0APMT2Sec3 = new TGeoVolume("V0APMT2Sec3", sV0APMT2Sec3, medV0APMAlum);
    1344           2 :     TGeoVolume *v0APMTSec3 = new TGeoVolumeAssembly("V0APMTSec3");
    1345           1 :     TGeoTube *sV0APMTTSec3 = new TGeoTube("sV0APMTTSec3", 0., fV0APMTR4, fV0APMTB/2.);
    1346           1 :     TGeoVolume *v0APMTTSec3 = new TGeoVolume("V0APMTTSec3", sV0APMTTSec3, medV0APMAlum);
    1347           1 :     v0APMT1Sec3->SetLineColor(kV0AColorPMG);
    1348           1 :     v0APMT2Sec3->SetLineColor(kV0AColorPMA);
    1349           1 :     v0APMTTSec3->SetLineColor(kV0AColorPMA);
    1350           1 :     rot = new TGeoRotation("rot", 90, 0, 180, 0, 90, 90);
    1351           1 :     v0APMTSec3->AddNode(v0APMT1Sec3,1,rot);
    1352           1 :     v0APMTSec3->AddNode(v0APMT2Sec3,1,rot);
    1353           2 :     v0APMTSec3->AddNode(v0APMTTSec3,1,new TGeoCombiTrans(0,-(fV0APMTH+fV0APMTB)/2.,0,rot));
    1354           1 :     double autoShiftSec3 = (fV0APMBWd-2*fV0APMBWdW)/4.;
    1355           2 :     v0APMSec3->AddNode(v0APMTSec3, 1, new TGeoTranslation(-1.5*autoShiftSec3, 0, 0));
    1356           2 :     v0APMSec3->AddNode(v0APMTSec3, 2, new TGeoTranslation(-0.5*autoShiftSec3, 0, 0));
    1357           2 :     v0APMSec3->AddNode(v0APMTSec3, 3, new TGeoTranslation(+0.5*autoShiftSec3, 0, 0));
    1358           2 :     v0APMSec3->AddNode(v0APMTSec3, 4, new TGeoTranslation(+1.5*autoShiftSec3, 0, 0));
    1359             : 
    1360             :     // PM
    1361           1 :     rot = new TGeoRotation("rot");
    1362           1 :     rot->RotateX(90-fV0APMBAng);
    1363           1 :     rot->RotateZ(-90.+22.5);
    1364           1 :     double cosAngPMBSec3 = TMath::Cos(fV0APMBAng*TMath::DegToRad());
    1365           1 :     double sinAngPMBSec3 = TMath::Sin(fV0APMBAng*TMath::DegToRad());
    1366           1 :     double shiftZSec3 = fV0APMBHt/2. * cosAngPMBSec3
    1367           1 :       -   ( fV0ASciWd + 2 * fV0AOctWd + 2 * fV0APlaWd )/2.   -   fV0APMBTh/2. * sinAngPMBSec3;
    1368           1 :     double shiftRSec3 = fV0AR6  +  fV0AOctH2 + fV0APlaAl;
    1369           2 :     v0ASec3->AddNode(v0APMSec3,1, new TGeoCombiTrans( shiftRSec3*cos225+1.07, shiftRSec3*sin225, shiftZSec3, rot));
    1370             :     
    1371             :     // Aluminium nails 
    1372           1 :     TGeoTube *sV0ANail1Sec3 = new TGeoTube("sV0ANail1Sec3", 0.0, 0.4, 5.09/2.);
    1373           1 :     TGeoVolume *v0ANail1Sec3 = new TGeoVolume("V0ANail1Sec3", sV0ANail1Sec3, medV0APMAlum);
    1374           1 :     v0ANail1Sec3->SetLineColor(kV0AColorPMA);// this is the color for aluminium
    1375           2 :     v0ASec3->AddNode(v0ANail1Sec3,1,new TGeoTranslation(42.9, 0.51, 0.0));
    1376           1 :     TGeoTube *sV0ANail2Sec3 = new TGeoTube("sV0ANail2Sec3", 0.0, 0.4, 5.09/2.);
    1377           1 :     TGeoVolume *v0ANail2Sec3 = new TGeoVolume("V0ANail2Sec3", sV0ANail2Sec3, medV0APMAlum);
    1378           1 :     v0ANail2Sec3->SetLineColor(kV0AColorPMA);
    1379           2 :     v0ASec3->AddNode(v0ANail2Sec3,1,new TGeoTranslation(30.73,29.98,0.0)); 
    1380             :         
    1381             :     /// Adding sector to v0LE volume
    1382           4 :     for(int i=2; i<3; i++) {
    1383           1 :        TGeoRotation *rotation = new TGeoRotation("rotation", 90., i*45., 90., 90.+i*45., 0., 0.);
    1384           1 :        v0LE->AddNode(v0ASec3,i+1,rotation);  
    1385             :     }
    1386             : 
    1387             :     //FEEBox
    1388           2 :     TGeoVolume* v0AFEE3 = new TGeoVolumeAssembly("V0AFEE3");
    1389           1 :     v0AFEE3->AddNode(v0AFEEB,1);
    1390             : 
    1391             :     //Mother and daughter boards
    1392           2 :     v0AFEE3->AddNode(v0AFEEDaughter, 1, new TGeoTranslation(9.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1393           2 :     v0AFEE3->AddNode(v0AFEEDaughter, 2, new TGeoTranslation(6.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1394           2 :     v0AFEE3->AddNode(v0AFEEDaughter, 3, new TGeoTranslation(3.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1395           2 :     v0AFEE3->AddNode(v0AFEEDaughter, 4, new TGeoTranslation(0.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1396           2 :     v0AFEE3->AddNode(v0AFEEDaughter, 5, new TGeoTranslation(-3.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1397           2 :     v0AFEE3->AddNode(v0AFEEDaughter, 6, new TGeoTranslation(-6.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1398           2 :     v0AFEE3->AddNode(v0AFEEDaughter, 7, new TGeoTranslation(-9.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1399           2 :     v0AFEE3->AddNode(v0AFEEDaughter, 8, new TGeoTranslation(-12.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));   
    1400           2 :     v0AFEE3->AddNode(v0AFEEMother, 1, new TGeoTranslation(0.0, 0.0, -fV0AFEEBTh/2.+fV0APMBThW+fV0APMBHtW));
    1401           2 :     v0AFEE3->AddNode(v0AFEEHalfMother, 1, new TGeoTranslation(0.0, -(fV0AFEEBTh+fV0APMTB)/2., -2.0*spacing));
    1402             : 
    1403             :     //FEE
    1404           1 :     rot = new TGeoRotation("rot");
    1405           1 :     rot->RotateX(90);
    1406           1 :     rot->RotateZ(-90.0+45.0-90);
    1407           2 :     v0LE->AddNode(v0AFEE3,1, new TGeoCombiTrans( -(aFEEshiftR2Sec1*cos225 + 2.0)*cos45, (aFEEshiftR2Sec1*cos225 + 2.0)*sin45, 7.5, rot) );
    1408           1 :     rot = new TGeoRotation("rot");
    1409           1 :     rot->RotateZ(+90.0-45.0-90.0);
    1410           2 :     v0LE->AddNode(v0AFEEOct2,3, new TGeoCombiTrans(-((aFEEshiftR2Sec1*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0)*cos45,((aFEEshiftR2Sec1*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0)*sin45,0.0,rot)); 
    1411             : 
    1412             : 
    1413             :     /// Definition sector 4
    1414           2 :     TGeoVolume *v0ASec4 = new TGeoVolumeAssembly("V0ASec4");
    1415             :         
    1416             :     /// For boolean sustraction
    1417             :     double preShapeSec4 = 0.2;
    1418           6 :     for (int i=0;i<2;i++) {
    1419           2 :       v0APts[0+8*i] = fV0AR0-fV0AFraWd/2.-preShapeSec4;  v0APts[1+8*i] = -preShapeSec4;
    1420           2 :       v0APts[2+8*i] = fV0AR0-fV0AFraWd/2.-preShapeSec4;  v0APts[3+8*i] = fV0AFraWd/2.;
    1421           2 :       v0APts[4+8*i] = fV0AR4+fV0AFraWd/2.+preShapeSec4;  v0APts[5+8*i] = fV0AFraWd/2.;
    1422           2 :       v0APts[6+8*i] = fV0AR4+fV0AFraWd/2.+preShapeSec4;  v0APts[7+8*i] = -preShapeSec4;
    1423             :     }
    1424           1 :     new TGeoArb8("sV0ACha1Sec4",fV0ASciWd/1.5,v0APts);
    1425           6 :     for (int i=0;i<2;i++) {
    1426           2 :       v0APts[0+8*i] = fV0AR0*sin45-preShapeSec4;
    1427           2 :       v0APts[1+8*i] = (fV0AR0-fV0AFraWd)*sin45-preShapeSec4;
    1428           2 :       v0APts[2+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45-preShapeSec4;
    1429           2 :       v0APts[3+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
    1430           2 :       v0APts[4+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45+preShapeSec4;
    1431           2 :       v0APts[5+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45+2.*preShapeSec4;
    1432           2 :       v0APts[6+8*i] = (fV0AR4+fV0AFraWd)*sin45+preShapeSec4;
    1433           2 :       v0APts[7+8*i] = fV0AR4*sin45+preShapeSec4;
    1434             :     }
    1435           1 :     new TGeoArb8("sV0ACha2Sec4", fV0ASciWd/2.+2.*preShapeSec4, v0APts);
    1436           1 :     new TGeoCompositeShape("sV0ACha12Sec4","sV0ACha1Sec4+sV0ACha2Sec4");
    1437           1 :     new TGeoTube("sV0ANail1SciHoleSec4", 0.0, 0.4, 1.65);
    1438           1 :     TGeoTranslation *pos1Sec4 = new TGeoTranslation("pos1Sec4", 42.9, 0.51, 0.0);
    1439           1 :     pos1Sec4->RegisterYourself();
    1440           1 :     new TGeoTube("sV0ANail2SciHoleSec4", 0.0, 0.4, 1.65);
    1441           1 :     TGeoTranslation *pos2Sec4 = new TGeoTranslation("pos2Sec4", 30.73,29.98,0.0);
    1442           1 :     pos2Sec4->RegisterYourself();
    1443           1 :     new TGeoCompositeShape("sV0ANailsSciHolesSec4","sV0ANail1SciHoleSec4:pos1Sec4+sV0ANail2SciHoleSec4:pos2Sec4");
    1444           1 :     new TGeoCompositeShape("sV0AChaSec4","sV0ACha12Sec4+sV0ANailsSciHolesSec4");
    1445           1 :     new TGeoTubeSeg("sV0AFicR5Sec4", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShapeSec4, 0, 45);
    1446           1 :     new TGeoBBox("sV0AFicFEEBSec4", fV0AFEEBWd/2., fV0AFEEBHt/2., fV0AFEEBTh/2.);
    1447           1 :     rot = new TGeoRotation("rot");
    1448           1 :     rot->RotateX(90);
    1449           1 :     rot->RotateZ(-90.0);
    1450           1 :     double aFEEshiftR2Sec4 = fV0AR6  +  fV0AOctH2 + fV0APlaAl;
    1451           1 :     TGeoCombiTrans *posFicFEEBSec4 = new TGeoCombiTrans("posFicFEEBSec4", aFEEshiftR2Sec4*cos225 + 2.0, 0, 7.5, rot);
    1452           1 :     posFicFEEBSec4->RegisterYourself();
    1453           1 :     rot = new TGeoRotation("rot");
    1454           1 :     rot->RotateX(90);
    1455           1 :     rot->RotateZ(-90.0+45.0);
    1456           1 :     TGeoCombiTrans *posFicFEEBUpSec4 = new TGeoCombiTrans("posFicFEEBUpSec4", (aFEEshiftR2Sec4*cos225 + 2.0 )*cos45, (aFEEshiftR2Sec4*cos225 + 2.0 )*sin45, 7.5, rot);
    1457           1 :     posFicFEEBUpSec4->RegisterYourself();
    1458           6 :     for (int i=0;i<2;i++) {
    1459           2 :     v0APts[0+8*i] = fV0AOctH2/2.;              v0APts[1+8*i] = fV0AFEEBHt/2. + 2.5;
    1460           2 :     v0APts[2+8*i] = fV0AOctH2/2.;              v0APts[3+8*i] = -fV0AFEEBHt/2.- 2.5;
    1461           2 :     v0APts[4+8*i] = -fV0AOctH2/2.;             v0APts[5+8*i] = -fV0AFEEBHt/2.- 2.5;
    1462           2 :     v0APts[6+8*i] = -fV0AOctH2/2.;             v0APts[7+8*i] = fV0AFEEBHt/2.+ 2.5;
    1463             :     }
    1464           1 :     new TGeoArb8("sV0AFicOct2Sec4", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
    1465           1 :     TGeoTranslation *posFicOct2Sec4 = new TGeoTranslation("posFicOct2Sec4",(aFEEshiftR2Sec4*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0,0.0,0.0);
    1466           1 :     posFicOct2Sec4->RegisterYourself();  
    1467           1 :     rot = new TGeoRotation("rot");
    1468           1 :     rot->RotateZ(-90.0+45.0+90.0);
    1469           1 :     TGeoCombiTrans *posFicOct2UpSec4 = new TGeoCombiTrans("posFicOct2UpSec4",((aFEEshiftR2Sec4*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0)*cos45,((aFEEshiftR2Sec4*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0)*sin45,0.0,rot);
    1470           1 :     posFicOct2UpSec4->RegisterYourself(); 
    1471             : 
    1472             :     /// Frame
    1473           2 :     TGeoVolume *v0AFraSec4 = new TGeoVolumeAssembly("V0AFraSec4");
    1474           6 :     for (int i=0;i<2;i++) {
    1475           2 :       v0APts[0+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[1+8*i] = 0.;
    1476           2 :       v0APts[2+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[3+8*i] = fV0AFraWd/2.;
    1477           2 :       v0APts[4+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[5+8*i] = fV0AFraWd/2.;
    1478           2 :       v0APts[6+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[7+8*i] = 0.;
    1479             :     }
    1480           1 :     TGeoArb8 *sV0AFraB1Sec4 = new TGeoArb8("sV0AFraB1Sec4",fV0ASciWd/2.,v0APts);
    1481           1 :     TGeoVolume *v0AFraB1Sec4 = new TGeoVolume("V0AFraB1Sec4",sV0AFraB1Sec4,medV0AFra);
    1482           6 :     for (int i=0;i<2;i++) {
    1483           2 :       v0APts[0+8*i] = fV0AR0*sin45;
    1484           2 :       v0APts[1+8*i] = (fV0AR0-fV0AFraWd)*sin45;
    1485           2 :       v0APts[2+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
    1486           2 :       v0APts[3+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45;
    1487           2 :       v0APts[4+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45;
    1488           2 :       v0APts[5+8*i] = (fV0AR4+fV0AFraWd/2.)*sin45;
    1489           2 :       v0APts[6+8*i] = (fV0AR4+fV0AFraWd)*sin45;
    1490           2 :       v0APts[7+8*i] = fV0AR4*sin45;
    1491             :     }
    1492           1 :     TGeoArb8 *sV0AFraB2Sec4 = new TGeoArb8("sV0AFraB2Sec4", fV0ASciWd/2., v0APts);
    1493           1 :     TGeoVolume *v0AFraB2Sec4 = new TGeoVolume("V0AFraB2Sec4",sV0AFraB2Sec4,medV0AFra);
    1494           1 :     v0AFraB1Sec4->SetLineColor(kV0AColorFra); v0AFraB2Sec4->SetLineColor(kV0AColorFra);
    1495           1 :     v0AFraSec4->AddNode(v0AFraB1Sec4,1);
    1496           1 :     v0AFraSec4->AddNode(v0AFraB2Sec4,1);  
    1497           2 :     new TGeoTubeSeg( "sV0AFraR1bSec4", fV0AR0-fV0AFraWd/2.,
    1498           1 :                      fV0AR0+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1499           2 :     new TGeoTubeSeg( "sV0AFraR2bSec4", fV0AR1-fV0AFraWd/2.,
    1500           1 :                      fV0AR1+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1501           2 :     new TGeoTubeSeg( "sV0AFraR3bSec4", fV0AR2-fV0AFraWd/2.,
    1502           1 :                      fV0AR2+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1503           2 :     new TGeoTubeSeg( "sV0AFraR4bSec4", fV0AR3-fV0AFraWd/2.,
    1504           1 :                      fV0AR3+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1505           2 :     new TGeoTubeSeg( "sV0AFraR5bSec4", fV0AR4-fV0AFraWd/2.,
    1506           1 :                      fV0AR4+fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1507           1 :     TGeoCompositeShape *sV0AFraR1Sec4 = new TGeoCompositeShape("sV0AFraR1Sec4","sV0AFraR1bSec4-sV0AChaSec4");
    1508           1 :     TGeoCompositeShape *sV0AFraR2Sec4 = new TGeoCompositeShape("sV0AFraR2Sec4","sV0AFraR2bSec4-sV0AChaSec4");
    1509           1 :     TGeoCompositeShape *sV0AFraR3Sec4 = new TGeoCompositeShape("sV0AFraR3Sec4","sV0AFraR3bSec4-sV0AChaSec4");
    1510           1 :     TGeoCompositeShape *sV0AFraR4Sec4 = new TGeoCompositeShape("sV0AFraR4Sec4","sV0AFraR4bSec4-sV0AChaSec4");
    1511           1 :     TGeoCompositeShape *sV0AFraR5Sec4 = new TGeoCompositeShape("sV0AFraR5Sec4","sV0AFraR5bSec4-sV0AChaSec4");
    1512           1 :     TGeoVolume *v0AFraR1Sec4 = new TGeoVolume("V0AFraR1Sec4",sV0AFraR1Sec4,medV0AFra);
    1513           1 :     TGeoVolume *v0AFraR2Sec4 = new TGeoVolume("V0AFraR2Sec4",sV0AFraR2Sec4,medV0AFra);
    1514           1 :     TGeoVolume *v0AFraR3Sec4 = new TGeoVolume("V0AFraR3Sec4",sV0AFraR3Sec4,medV0AFra);
    1515           1 :     TGeoVolume *v0AFraR4Sec4 = new TGeoVolume("V0AFraR4Sec4",sV0AFraR4Sec4,medV0AFra);
    1516           1 :     TGeoVolume *v0AFraR5Sec4 = new TGeoVolume("V0AFraR5Sec4",sV0AFraR5Sec4,medV0AFra);
    1517           1 :     v0AFraR1Sec4->SetLineColor(kV0AColorFra); v0AFraR2Sec4->SetLineColor(kV0AColorFra);
    1518           1 :     v0AFraR3Sec4->SetLineColor(kV0AColorFra); v0AFraR4Sec4->SetLineColor(kV0AColorFra);
    1519           1 :     v0AFraR5Sec4->SetLineColor(kV0AColorFra);
    1520           1 :     v0AFraSec4->AddNode(v0AFraR1Sec4,1); 
    1521           1 :     v0AFraSec4->AddNode(v0AFraR2Sec4,1);
    1522           1 :     v0AFraSec4->AddNode(v0AFraR3Sec4,1); 
    1523           1 :     v0AFraSec4->AddNode(v0AFraR4Sec4,1);
    1524           1 :     v0AFraSec4->AddNode(v0AFraR5Sec4,1);
    1525           1 :     v0ASec4->AddNode(v0AFraSec4,1);
    1526             :     
    1527             :     /// Sensitive scintilator
    1528           2 :     TGeoVolume *v0ASciSec4 = new TGeoVolumeAssembly("V0ASciSec4");
    1529           2 :     new TGeoTubeSeg( "sV0AR1bSec4", fV0AR0+fV0AFraWd/2.,
    1530           1 :                      fV0AR1-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1531           2 :     new TGeoTubeSeg( "sV0AR2bSec4", fV0AR1+fV0AFraWd/2.,
    1532           1 :                      fV0AR2-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1533           2 :     new TGeoTubeSeg( "sV0AR3bSec4", fV0AR2+fV0AFraWd/2.,
    1534           1 :                      fV0AR3-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1535           2 :     new TGeoTubeSeg( "sV0AR4bSec4", fV0AR3+fV0AFraWd/2.,
    1536           1 :                      fV0AR4-fV0AFraWd/2., fV0ASciWd/2., 0, 45);
    1537           1 :     TGeoCompositeShape *sV0AR1Sec4 = new TGeoCompositeShape("sV0AR1Sec4","sV0AR1bSec4-sV0AChaSec4");
    1538           1 :     TGeoCompositeShape *sV0AR2Sec4 = new TGeoCompositeShape("sV0AR2Sec4","sV0AR2bSec4-sV0AChaSec4");
    1539           1 :     TGeoCompositeShape *sV0AR3Sec4 = new TGeoCompositeShape("sV0AR3Sec4","sV0AR3bSec4-sV0AChaSec4");
    1540           1 :     TGeoCompositeShape *sV0AR4Sec4 = new TGeoCompositeShape("sV0AR4Sec4","sV0AR4bSec4-sV0AChaSec4");
    1541           1 :     TGeoVolume *v0L1Sec4 = new TGeoVolume("V0L1Sec4",sV0AR1Sec4,medV0ASci);
    1542           1 :     TGeoVolume *v0L2Sec4 = new TGeoVolume("V0L2Sec4",sV0AR2Sec4,medV0ASci);
    1543           1 :     TGeoVolume *v0L3Sec4 = new TGeoVolume("V0L3Sec4",sV0AR3Sec4,medV0ASci);
    1544           1 :     TGeoVolume *v0L4Sec4 = new TGeoVolume("V0L4Sec4",sV0AR4Sec4,medV0ASci);
    1545           1 :     v0L1Sec4->SetLineColor(kV0AColorSci); v0L2Sec4->SetLineColor(kV0AColorSci);
    1546           1 :     v0L3Sec4->SetLineColor(kV0AColorSci); v0L4Sec4->SetLineColor(kV0AColorSci);
    1547           1 :     v0ASec4->AddNode(v0L1Sec4,1);
    1548           1 :     v0ASec4->AddNode(v0L2Sec4,1);
    1549           1 :     v0ASec4->AddNode(v0L3Sec4,1);
    1550           1 :     v0ASec4->AddNode(v0L4Sec4,1);      
    1551             :     
    1552             :     /// Segment of octagon 
    1553           6 :     for (int i=0;i<2;i++) {
    1554           2 :     v0APts[0+8*i] =  fV0AR6-fV0AOctH2;           v0APts[1+8*i] = 0.;
    1555           2 :       v0APts[2+8*i] = (fV0AR6-fV0AOctH2)*sin45;  v0APts[3+8*i] = (fV0AR6-fV0AOctH2)*sin45;
    1556           2 :       v0APts[4+8*i] = fV0AR6*sin45;              v0APts[5+8*i] = fV0AR6*sin45;
    1557           2 :       v0APts[6+8*i] = fV0AR6;                    v0APts[7+8*i] = 0.;
    1558             :     }
    1559           1 :     new TGeoArb8("sV0AOct2Sec4", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
    1560           1 :     TGeoCompositeShape *sV0AOct2FEEBSec4 = new TGeoCompositeShape("sV0AOct2FEEBSec4","sV0AOct2Sec4-sV0AFicFEEBSec4:posFicFEEBSec4-sV0AFicFEEBSec4:posFicFEEBUpSec4-sV0AFicOct2Sec4:posFicOct2Sec4-sV0AFicOct2Sec4:posFicOct2UpSec4");
    1561           1 :     TGeoVolume *v0AOct2Sec4 = new TGeoVolume("V0AOct2Sec4", sV0AOct2FEEBSec4,medV0ASup);
    1562           1 :     v0AOct2Sec4->SetLineColor(kV0AColorOct);
    1563           2 :     TGeoVolume *v0ASupSec4 = new TGeoVolumeAssembly("V0ASupSec4");
    1564           1 :     v0ASupSec4->AddNode(v0AOct2Sec4,1);
    1565           1 :     v0ASec4->AddNode(v0ASupSec4,1);
    1566             : 
    1567             :     //Bunch of fibers
    1568           1 :     v0APts[ 0] = v0APts[ 2] = -13.0;
    1569           1 :     v0APts[ 1] = v0APts[ 7] = (fV0ASciWd+fV0AOctWd)/2.-0.01;
    1570           1 :     v0APts[ 3] = v0APts[ 5] = (fV0ASciWd+fV0AOctWd)/2.+0.01;
    1571           1 :     v0APts[ 4] = v0APts[ 6] = +13.0;
    1572           1 :     v0APts[ 8] = v0APts[10] = -10.0;
    1573           1 :     v0APts[ 9] = v0APts[15] = 0.;
    1574           1 :     v0APts[11] = v0APts[13] = 0.25;
    1575           1 :     v0APts[12] = v0APts[14] = +10.0;
    1576           1 :     new TGeoArb8("sV0AFib1Sec4", 11.5, v0APts);
    1577           1 :     rot = new TGeoRotation("rot");
    1578           1 :     rot->RotateX(-90);
    1579           1 :     rot->RotateZ(-90.+22.5);
    1580           1 :     TGeoCombiTrans *fibpos1Sec4 = new TGeoCombiTrans("fibpos1Sec4", (fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. - 3.8, (fV0AR6-fV0AOctH2+fV0AR5)*sin225/2.-1.8, 0, rot);
    1581           1 :     fibpos1Sec4->RegisterYourself();
    1582           1 :     TGeoCompositeShape *sV0AFib1HoleSec4 = new TGeoCompositeShape("sV0AFib1HoleSec4","sV0AFib1Sec4:fibpos1Sec4-sV0AFicR5Sec4"); 
    1583           1 :     TGeoVolume *v0AFib1HoleSec4 = new TGeoVolume("V0AFib1HoleSec4",sV0AFib1HoleSec4,medV0AFib);
    1584           1 :     v0AFib1HoleSec4->SetLineColor(kV0AColorFib);
    1585           1 :     new TGeoArb8("sV0AFib2Sec4", 11.5, v0APts);
    1586           1 :     rot = new TGeoRotation("rot");
    1587           1 :     rot->RotateX(-90);
    1588           1 :     rot->RotateY(180);
    1589           1 :     rot->RotateZ(-90.+22.5);
    1590           1 :     TGeoCombiTrans *fibpos2Sec4 = new TGeoCombiTrans("fibpos2Sec4", (fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. - 3.8, (fV0AR6-fV0AOctH2+fV0AR5)*sin225/2.-1.8, 0, rot);
    1591           1 :     fibpos2Sec4->RegisterYourself();
    1592           1 :     TGeoCompositeShape *sV0AFib2HoleSec4 = new TGeoCompositeShape("sV0AFib2HoleSec4","sV0AFib2Sec4:fibpos2Sec4-sV0AFicR5Sec4");
    1593           1 :     TGeoVolume *v0AFib2HoleSec4 = new TGeoVolume("V0AFib2HoleSec4",sV0AFib2HoleSec4,medV0AFib);
    1594           1 :     v0AFib2HoleSec4->SetLineColor(kV0AColorFib);
    1595           2 :     TGeoVolume *v0AFibSec4 = new TGeoVolumeAssembly("V0AFibSec4");
    1596           1 :     v0AFibSec4->AddNode(v0AFib1HoleSec4,1);
    1597           1 :     v0AFibSec4->AddNode(v0AFib2HoleSec4,1);
    1598           1 :     v0ASec4->AddNode(v0AFibSec4,1); 
    1599             :     
    1600             :      /// Plates
    1601           1 :     new TGeoTube("sV0ANail1PlaInHoleSec4", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
    1602           1 :     new TGeoTube("sV0ANail2PlaInHoleSec4", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
    1603           1 :     new TGeoCompositeShape("sV0ANailsPlaInHolesSec4","sV0ANail1PlaInHoleSec4:pos1Sec4+sV0ANail2PlaInHoleSec4:pos2Sec4");
    1604           1 :     new TGeoTube("sV0ANail1PlaOuHoleSec4", 0.0, 0.4, (fV0APlaAl)/2.);
    1605           1 :     new TGeoTube("sV0ANail2PlaOuHoleSec4", 0.0, 0.4, (fV0APlaAl)/2.);
    1606           1 :     new TGeoCompositeShape("sV0ANailsPlaOuHolesSec4","sV0ANail1PlaOuHoleSec4:pos1Sec4+sV0ANail2PlaOuHoleSec4:pos2Sec4");
    1607           6 :     for (int i=0;i<2;i++) {
    1608           2 :       v0APts[0+8*i] = fV0AR0;                   v0APts[1+8*i] = 0.;
    1609           2 :       v0APts[2+8*i] = fV0AR0*sin45;             v0APts[3+8*i] = fV0AR0*sin45;
    1610           2 :       v0APts[4+8*i] = fV0AR6 * sin45;   v0APts[5+8*i] = fV0AR6*sin45;
    1611           2 :       v0APts[6+8*i] = fV0AR6;           v0APts[7+8*i] = 0.;
    1612             :     }
    1613           1 :     new TGeoArb8("sV0APlaInSec4", (fV0APlaWd-2*fV0APlaAl)/2., v0APts);
    1614           1 :     TGeoCompositeShape *sV0APlaInNailsHolesSec4 = new TGeoCompositeShape("sV0APlaInNailsHolesSec4","sV0APlaInSec4-sV0ANailsPlaInHolesSec4-sV0AFicFEEBSec4:posFicFEEBSec4-sV0AFicFEEBSec4:posFicFEEBUpSec4");
    1615           1 :     TGeoVolume *v0APlaInNailsHolesSec4 = new TGeoVolume("V0APlaInNailsHolesSec4", sV0APlaInNailsHolesSec4, medV0APlaIn);
    1616           1 :     new TGeoArb8("sV0APlaOuSec4", fV0APlaAl/2., v0APts);
    1617           1 :     TGeoCompositeShape *sV0APlaOuNailsHolesSec4 = new TGeoCompositeShape("sV0APlaOuNailsHolesSec4","sV0APlaOuSec4-sV0ANailsPlaOuHolesSec4-sV0AFicFEEBSec4:posFicFEEBSec4-sV0AFicFEEBSec4:posFicFEEBUpSec4");  
    1618           1 :     TGeoVolume *v0APlaOuNailsHolesSec4 = new TGeoVolume("V0APlaOuNailsHolesSec4", sV0APlaOuNailsHolesSec4, medV0APlaOu);
    1619           1 :     v0APlaInNailsHolesSec4->SetLineColor(kV0AColorPlaIn); v0APlaOuNailsHolesSec4->SetLineColor(kV0AColorPlaOu);
    1620           2 :     TGeoVolume *v0APlaSec4 = new TGeoVolumeAssembly("V0APlaSec4");
    1621           1 :     v0APlaSec4->AddNode(v0APlaInNailsHolesSec4,1);
    1622           2 :     v0APlaSec4->AddNode(v0APlaOuNailsHolesSec4,1,new TGeoTranslation(0,0,(fV0APlaWd-fV0APlaAl)/2.));
    1623           2 :     v0APlaSec4->AddNode(v0APlaOuNailsHolesSec4,2,new TGeoTranslation(0,0,-(fV0APlaWd-fV0APlaAl)/2.));
    1624           2 :     v0ASec4->AddNode(v0APlaSec4,1,new TGeoTranslation(0,0,(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    1625           2 :     v0ASec4->AddNode(v0APlaSec4,2,new TGeoTranslation(0,0,-(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    1626             :     
    1627             :      /// Non-sensitive scintilator
    1628           1 :     new TGeoTubeSeg("sV0AR5S2Sec4", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShapeSec4, 0, 45);
    1629           1 :     TGeoCompositeShape *sV0AR5Sec4 = new TGeoCompositeShape("V0AR5Sec4","sV0AR5S2Sec4 - sV0AChaSec4");
    1630           1 :     TGeoVolume *v0AR5Sec4 = new TGeoVolume("V0AR5Sec4",sV0AR5Sec4,medV0ASci);
    1631           1 :     v0AR5Sec4->SetLineColor(kV0AColorSci);
    1632           1 :     v0ASciSec4->AddNode(v0AR5Sec4,1);
    1633           1 :     v0ASec4->AddNode(v0ASciSec4,1); 
    1634             : 
    1635             :     /// PMBox
    1636           2 :     TGeoVolume* v0APMSec4 = new TGeoVolumeAssembly("V0APMSec4");
    1637           1 :     new TGeoBBox("sV0APMB1Sec4", fV0APMBWd/2., fV0APMBHt/2., fV0APMBTh/2.);
    1638           1 :     new TGeoBBox("sV0APMB2Sec4", fV0APMBWd/2.-fV0APMBWdW, fV0APMBHt/2.-fV0APMBHtW, fV0APMBTh/2.-fV0APMBThW);
    1639           1 :     TGeoCompositeShape *sV0APMBSec4 = new TGeoCompositeShape("sV0APMBSec4","sV0APMB1Sec4-sV0APMB2Sec4");
    1640           1 :     TGeoVolume *v0APMBSec4 = new TGeoVolume("V0APMBSec4",sV0APMBSec4, medV0APMAlum);
    1641           1 :     v0APMBSec4->SetLineColor(kV0AColorPMA);
    1642           1 :     v0APMSec4->AddNode(v0APMBSec4,1);
    1643             : 
    1644             :     /// PMTubes
    1645           1 :     TGeoTube *sV0APMT1Sec4 = new TGeoTube("sV0APMT1Sec4", fV0APMTR1, fV0APMTR2, fV0APMTH/2.);
    1646           1 :     TGeoVolume *v0APMT1Sec4 = new TGeoVolume("V0APMT1Sec4", sV0APMT1Sec4, medV0APMGlass);
    1647           1 :     TGeoTube *sV0APMT2Sec4 = new TGeoTube("sV0APMT2Sec4", fV0APMTR3, fV0APMTR4, fV0APMTH/2.);
    1648           1 :     TGeoVolume *v0APMT2Sec4 = new TGeoVolume("V0APMT2Sec4", sV0APMT2Sec4, medV0APMAlum);
    1649           2 :     TGeoVolume *v0APMTSec4 = new TGeoVolumeAssembly("V0APMTSec4");
    1650           1 :     TGeoTube *sV0APMTTSec4 = new TGeoTube("sV0APMTTSec4", 0., fV0APMTR4, fV0APMTB/2.);
    1651           1 :     TGeoVolume *v0APMTTSec4 = new TGeoVolume("V0APMTTSec4", sV0APMTTSec4, medV0APMAlum);
    1652           1 :     v0APMT1Sec4->SetLineColor(kV0AColorPMG);
    1653           1 :     v0APMT2Sec4->SetLineColor(kV0AColorPMA);
    1654           1 :     v0APMTTSec4->SetLineColor(kV0AColorPMA);
    1655           1 :     rot = new TGeoRotation("rot", 90, 0, 180, 0, 90, 90);
    1656           1 :     v0APMTSec4->AddNode(v0APMT1Sec4,1,rot);
    1657           1 :     v0APMTSec4->AddNode(v0APMT2Sec4,1,rot);
    1658           2 :     v0APMTSec4->AddNode(v0APMTTSec4,1,new TGeoCombiTrans(0,-(fV0APMTH+fV0APMTB)/2.,0,rot));
    1659           1 :     double autoShiftSec4 = (fV0APMBWd-2*fV0APMBWdW)/4.;
    1660           2 :     v0APMSec4->AddNode(v0APMTSec4, 1, new TGeoTranslation(-1.5*autoShiftSec4, 0, 0));
    1661           2 :     v0APMSec4->AddNode(v0APMTSec4, 2, new TGeoTranslation(-0.5*autoShiftSec4, 0, 0));
    1662           2 :     v0APMSec4->AddNode(v0APMTSec4, 3, new TGeoTranslation(+0.5*autoShiftSec4, 0, 0));
    1663           2 :     v0APMSec4->AddNode(v0APMTSec4, 4, new TGeoTranslation(+1.5*autoShiftSec4, 0, 0));
    1664             : 
    1665             :     // PM
    1666           1 :     rot = new TGeoRotation("rot");
    1667           1 :     rot->RotateX(90-fV0APMBAng);
    1668           1 :     rot->RotateZ(-90.+22.5);
    1669           1 :     double cosAngPMBSec4 = TMath::Cos(fV0APMBAng*TMath::DegToRad());
    1670           1 :     double sinAngPMBSec4 = TMath::Sin(fV0APMBAng*TMath::DegToRad());
    1671           1 :     double shiftZSec4 = fV0APMBHt/2. * cosAngPMBSec4
    1672           1 :       -   ( fV0ASciWd + 2 * fV0AOctWd + 2 * fV0APlaWd )/2.   -   fV0APMBTh/2. * sinAngPMBSec4;
    1673           1 :     double shiftRSec4 = fV0AR6  +  fV0AOctH2 + fV0APlaAl;
    1674           2 :     v0ASec4->AddNode(v0APMSec4,1, new TGeoCombiTrans( shiftRSec4*cos225+1.07, shiftRSec4*sin225, shiftZSec4, rot));
    1675             :     
    1676             :     // Aluminium nails 
    1677           1 :     TGeoTube *sV0ANail1Sec4 = new TGeoTube("sV0ANail1Sec4", 0.0, 0.4, 5.09/2.);
    1678           1 :     TGeoVolume *v0ANail1Sec4 = new TGeoVolume("V0ANail1Sec4", sV0ANail1Sec4, medV0APMAlum);
    1679           1 :     v0ANail1Sec4->SetLineColor(kV0AColorPMA);// this is the color for aluminium
    1680           2 :     v0ASec4->AddNode(v0ANail1Sec4,1,new TGeoTranslation(42.9, 0.51, 0.0));
    1681           1 :     TGeoTube *sV0ANail2Sec4 = new TGeoTube("sV0ANail2Sec4", 0.0, 0.4, 5.09/2.);
    1682           1 :     TGeoVolume *v0ANail2Sec4 = new TGeoVolume("V0ANail2Sec4", sV0ANail2Sec4, medV0APMAlum);
    1683           1 :     v0ANail2Sec4->SetLineColor(kV0AColorPMA);
    1684           2 :     v0ASec4->AddNode(v0ANail2Sec4,1,new TGeoTranslation(30.73,29.98,0.0));     
    1685             :         
    1686             :     /// Adding sector to v0LE volume
    1687           4 :     for(int i=3; i<4; i++) {
    1688           1 :        TGeoRotation *rotation = new TGeoRotation("rotation", 90., i*45., 90., 90.+i*45., 0., 0.);
    1689           1 :        v0LE->AddNode(v0ASec4,i+1,rotation);  
    1690             :     }
    1691             : 
    1692             :     //FEEBox
    1693           2 :     TGeoVolume* v0AFEE4 = new TGeoVolumeAssembly("V0AFEE4"); 
    1694           1 :     v0AFEE4->AddNode(v0AFEEB,1);
    1695             : 
    1696             :     //Mother and daughter boards
    1697           2 :     v0AFEE4->AddNode(v0AFEEDaughter, 1, new TGeoTranslation(9.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1698           2 :     v0AFEE4->AddNode(v0AFEEDaughter, 2, new TGeoTranslation(6.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1699           2 :     v0AFEE4->AddNode(v0AFEEDaughter, 3, new TGeoTranslation(3.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1700           2 :     v0AFEE4->AddNode(v0AFEEDaughter, 4, new TGeoTranslation(0.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1701           2 :     v0AFEE4->AddNode(v0AFEEDaughter, 5, new TGeoTranslation(-3.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1702           2 :     v0AFEE4->AddNode(v0AFEEDaughter, 6, new TGeoTranslation(-6.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1703           2 :     v0AFEE4->AddNode(v0AFEEDaughter, 7, new TGeoTranslation(-9.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));
    1704           2 :     v0AFEE4->AddNode(v0AFEEDaughter, 8, new TGeoTranslation(-12.0*spacing, fV0AFEEBTh/2.+2.0*fV0APMTB, fV0APMBHtW/2.));   
    1705           2 :     v0AFEE4->AddNode(v0AFEEMother, 1, new TGeoTranslation(0.0, 0.0, -fV0AFEEBTh/2.+fV0APMBThW+fV0APMBHtW));
    1706           2 :     v0AFEE4->AddNode(v0AFEEHalfMother, 1, new TGeoTranslation(0.0, -(fV0AFEEBTh+fV0APMTB)/2., -2.0*spacing));
    1707             : 
    1708             :     //FEE
    1709           1 :     rot = new TGeoRotation("rot");
    1710           1 :     rot->RotateX(90);
    1711           1 :     rot->RotateZ(-90.0);
    1712           2 :     v0LE->AddNode(v0AFEE4,1, new TGeoCombiTrans( -aFEEshiftR2Sec1*cos225-2.0, 0, 7.5, rot));   
    1713           2 :     v0LE->AddNode(v0AFEEOct2,4, new TGeoTranslation(-1.0*((aFEEshiftR2Sec1*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0),0.0,0.0));
    1714             : 
    1715             : 
    1716             :     //Definition of sector 5
    1717           2 :     TGeoVolume *v0ASec5 = new TGeoVolumeAssembly("V0ASec5"); 
    1718             : 
    1719             :     /// For boolean sustraction
    1720             :     double preShape5 = 0.2;
    1721           6 :     for (int i=0;i<2;i++) {
    1722           2 :       v0APts[0+8*i] = -fV0AR0+fV0AFraWd/2.;  v0APts[1+8*i] = fV0AFraWd/2.;
    1723           2 :       v0APts[2+8*i] = -fV0AR0+fV0AFraWd/2.;  v0APts[3+8*i] = -2*preShape5;
    1724           2 :       v0APts[4+8*i] = -fV0AR4-fV0AFraWd/2.-preShape5;  v0APts[5+8*i] = -2*preShape5;
    1725           2 :       v0APts[6+8*i] = -fV0AR4-fV0AFraWd/2.-preShape5;  v0APts[7+8*i] = fV0AFraWd/2.;
    1726             :     }
    1727           1 :     new TGeoArb8("sV0ACha15",fV0ASciWd/1.5,v0APts);
    1728           6 :     for (int i=0;i<2;i++) {
    1729           2 :       v0APts[0+8*i] = -fV0AR0*cos45+preShape5;
    1730           2 :       v0APts[1+8*i] = -(fV0AR0-fV0AFraWd)*sin45+preShape5;
    1731           2 :       v0APts[2+8*i] = -(fV0AR0-fV0AFraWd/2.)*cos45+preShape5;
    1732           2 :       v0APts[3+8*i] = -(fV0AR0-fV0AFraWd/2.)*sin45;
    1733           2 :       v0APts[4+8*i] = -(fV0AR4+fV0AFraWd/2.)*cos45-preShape5;
    1734           2 :       v0APts[5+8*i] = -(fV0AR4+fV0AFraWd/2.)*sin45-2.*preShape5;
    1735           2 :       v0APts[6+8*i] = -(fV0AR4+fV0AFraWd)*cos45-preShape5;
    1736           2 :       v0APts[7+8*i] = -fV0AR4*sin45-preShape5;
    1737             :     }
    1738           1 :     new TGeoArb8("sV0ACha25", fV0ASciWd/2.+2.*preShape5, v0APts);
    1739           1 :     new TGeoCompositeShape("sV0ACha125","sV0ACha15+sV0ACha25");
    1740           1 :     new TGeoTube("sV0ANail15Hole", 0.0, 0.4, 1.65);
    1741           1 :     TGeoTranslation *pos15 = new TGeoTranslation("pos15", -42.9, -0.51, 0.0);
    1742           1 :     pos15->RegisterYourself();
    1743           1 :     new TGeoTube("sV0ANail25Hole", 0.0, 0.4, 1.65);
    1744           1 :     TGeoTranslation *pos25 = new TGeoTranslation("pos25",-30.8,-30.04,0.0); 
    1745           1 :     pos25->RegisterYourself();
    1746           1 :     TGeoTranslation *pos35 = new TGeoTranslation("pos35",-30.05,-30.79,0.0);  
    1747           1 :     pos35->RegisterYourself();
    1748           1 :     new TGeoCompositeShape("sV0ANailsHoles5","sV0ANail15Hole:pos15+sV0ANail25Hole:pos25");
    1749           1 :     new TGeoCompositeShape("sV0ACha5","sV0ACha125+sV0ANailsHoles5");
    1750           1 :     new TGeoTubeSeg("sV0AFicR55", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2. +2*preShape5, 180.0, 225.0);
    1751           1 :     new TGeoTube("sV0ANail1PlaInHole5", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
    1752           1 :     new TGeoTube("sV0ANail2PlaInHole5", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
    1753           1 :     new TGeoTube("sV0ANail3PlaInHole5", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
    1754           1 :     new TGeoCompositeShape("sV0ANailsPlaInHoles5","sV0ANail1PlaInHole5:pos15+sV0ANail2PlaInHole5:pos25+sV0ANail3PlaInHole5:pos35");
    1755           1 :     new TGeoTube("sV0ANail1PlaOuHole5", 0.0, 0.4, (fV0APlaAl)/2.);
    1756           1 :     new TGeoTube("sV0ANail2PlaOuHole5", 0.0, 0.4, (fV0APlaAl)/2.);
    1757           1 :     new TGeoTube("sV0ANail3PlaOuHole5", 0.0, 0.4, (fV0APlaAl)/2.);
    1758           1 :     new TGeoCompositeShape("sV0ANailsPlaOuHoles5","sV0ANail1PlaOuHole5:pos15+sV0ANail2PlaOuHole5:pos25+sV0ANail3PlaOuHole5:pos35");
    1759           1 :     rot = new TGeoRotation("rot");
    1760           1 :     rot->RotateX(90);
    1761           1 :     rot->RotateZ(-90.0);
    1762           1 :     TGeoCombiTrans *posFicFEEBSec5 = new TGeoCombiTrans("posFicFEEBSec5", -aFEEshiftR2Sec1*cos225 - 2.0, 0, 7.5, rot);
    1763           1 :     posFicFEEBSec5->RegisterYourself();
    1764           1 :     TGeoTranslation *posFicOct2Sec5 = new TGeoTranslation("posFicOct2Sec5",-1.0*((aFEEshiftR2Sec1*cos225 + 2.0) - fV0AFEEBTh/2. - 1.0),0.0,0.0);
    1765           1 :     posFicOct2Sec5->RegisterYourself(); 
    1766             : 
    1767             :     /// Frame
    1768           2 :     TGeoVolume *v0AFra5 = new TGeoVolumeAssembly("V0AFra5");
    1769           6 :     for (int i=0;i<2;i++) { 
    1770           2 :       v0APts[0+8*i] = -fV0AR0+fV0AFraWd/2.;  v0APts[1+8*i] = 0.0;
    1771           2 :       v0APts[2+8*i] = -fV0AR0+fV0AFraWd/2.;  v0APts[3+8*i] = -fV0AFraWd/8.;
    1772           2 :       v0APts[4+8*i] = -fV0AR4-fV0AFraWd/2.;  v0APts[5+8*i] = -fV0AFraWd/8.;
    1773           2 :       v0APts[6+8*i] = -fV0AR4-fV0AFraWd/2.;  v0APts[7+8*i] = 0.0;
    1774             :     }    
    1775           1 :     TGeoArb8 *sV0AFraB15 = new TGeoArb8("sV0AFraB15",fV0ASciWd/2.,v0APts);
    1776           1 :     TGeoVolume *v0AFraB15 = new TGeoVolume("V0AFraB15",sV0AFraB15,medV0AFra);
    1777           6 :     for (int i=0;i<2;i++) {
    1778           2 :       v0APts[0+8*i] = -fV0AR0*cos45;
    1779           2 :       v0APts[1+8*i] = -(fV0AR0-fV0AFraWd)*sin45;
    1780           2 :       v0APts[2+8*i] = -(fV0AR0-fV0AFraWd/2.)*cos45;
    1781           2 :       v0APts[3+8*i] = -(fV0AR0-fV0AFraWd/2.)*sin45;
    1782           2 :       v0APts[4+8*i] = -(fV0AR4+fV0AFraWd/2.)*cos45;
    1783           2 :       v0APts[5+8*i] = -(fV0AR4+fV0AFraWd/2.)*sin45;
    1784           2 :       v0APts[6+8*i] = -(fV0AR4+fV0AFraWd)*cos45;
    1785           2 :       v0APts[7+8*i] = -fV0AR4*sin45;
    1786             :     }
    1787           1 :     TGeoArb8 *sV0AFraB25 = new TGeoArb8("sV0AFraB25", fV0ASciWd/2., v0APts);
    1788           1 :     TGeoVolume *v0AFraB25 = new TGeoVolume("V0AFraB25",sV0AFraB25,medV0AFra);
    1789           1 :     v0AFraB15->SetLineColor(kV0AColorFra); v0AFraB25->SetLineColor(kV0AColorFra);
    1790           1 :     v0AFra5->AddNode(v0AFraB15,1);
    1791           1 :     v0AFra5->AddNode(v0AFraB25,1);  // Prefer 2 GeoObjects insted of 3 GeoMovements
    1792           2 :     new TGeoTubeSeg( "sV0AFraR1b5", fV0AR0-fV0AFraWd/2.,
    1793           1 :                      fV0AR0+fV0AFraWd/2., fV0ASciWd/2., 180.0, 225.0);
    1794           2 :     new TGeoTubeSeg( "sV0AFraR2b5", fV0AR1-fV0AFraWd/2.,
    1795           1 :                      fV0AR1+fV0AFraWd/2., fV0ASciWd/2., 180.0, 225.0);
    1796           2 :     new TGeoTubeSeg( "sV0AFraR3b5", fV0AR2-fV0AFraWd/2.,
    1797           1 :                      fV0AR2+fV0AFraWd/2., fV0ASciWd/2., 180.0, 225.0);
    1798           2 :     new TGeoTubeSeg( "sV0AFraR4b5", fV0AR3-fV0AFraWd/2.,
    1799           1 :                      fV0AR3+fV0AFraWd/2., fV0ASciWd/2., 180.0, 225.0);
    1800           2 :     new TGeoTubeSeg( "sV0AFraR5b5", fV0AR4-fV0AFraWd/2.,
    1801           1 :                      fV0AR4+fV0AFraWd/2., fV0ASciWd/2., 180.0, 225.0);
    1802           1 :     TGeoCompositeShape *sV0AFraR15 = new TGeoCompositeShape("sV0AFraR15","sV0AFraR1b5-sV0ACha5");
    1803           1 :     TGeoCompositeShape *sV0AFraR25 = new TGeoCompositeShape("sV0AFraR25","sV0AFraR2b5-sV0ACha5");
    1804           1 :     TGeoCompositeShape *sV0AFraR35 = new TGeoCompositeShape("sV0AFraR35","sV0AFraR3b5-sV0ACha5");
    1805           1 :     TGeoCompositeShape *sV0AFraR45 = new TGeoCompositeShape("sV0AFraR45","sV0AFraR4b5-sV0ACha5");
    1806           1 :     TGeoCompositeShape *sV0AFraR55 = new TGeoCompositeShape("sV0AFraR55","sV0AFraR5b5-sV0ACha5");
    1807           1 :     TGeoVolume *v0AFraR15 = new TGeoVolume("V0AFraR15",sV0AFraR15,medV0AFra);
    1808           1 :     TGeoVolume *v0AFraR25 = new TGeoVolume("V0AFraR25",sV0AFraR25,medV0AFra);
    1809           1 :     TGeoVolume *v0AFraR35 = new TGeoVolume("V0AFraR35",sV0AFraR35,medV0AFra);
    1810           1 :     TGeoVolume *v0AFraR45 = new TGeoVolume("V0AFraR45",sV0AFraR45,medV0AFra);
    1811           1 :     TGeoVolume *v0AFraR55 = new TGeoVolume("V0AFraR55",sV0AFraR55,medV0AFra);
    1812           1 :     v0AFraR15->SetLineColor(kV0AColorFra); v0AFraR25->SetLineColor(kV0AColorFra);
    1813           1 :     v0AFraR35->SetLineColor(kV0AColorFra); v0AFraR45->SetLineColor(kV0AColorFra);
    1814           1 :     v0AFraR55->SetLineColor(kV0AColorFra);
    1815           1 :     v0AFra5->AddNode(v0AFraR15,1);
    1816           1 :     v0AFra5->AddNode(v0AFraR25,1);
    1817           1 :     v0AFra5->AddNode(v0AFraR35,1);
    1818           1 :     v0AFra5->AddNode(v0AFraR45,1);
    1819           1 :     v0AFra5->AddNode(v0AFraR55,1);
    1820           1 :     v0ASec5->AddNode(v0AFra5,1);
    1821             : 
    1822             :     /// Sensitive scintilator
    1823           2 :     TGeoVolume *v0ASci5 = new TGeoVolumeAssembly("V0ASci5");
    1824           2 :     new TGeoTubeSeg( "sV0AR1b5", fV0AR0+fV0AFraWd/2.,
    1825           1 :                      fV0AR1-fV0AFraWd/2., fV0ASciWd/2., 180.0, 225.0);
    1826           2 :     new TGeoTubeSeg( "sV0AR2b5", fV0AR1+fV0AFraWd/2.,
    1827           1 :                      fV0AR2-fV0AFraWd/2., fV0ASciWd/2., 180.0, 225.0);
    1828           2 :     new TGeoTubeSeg( "sV0AR3b5", fV0AR2+fV0AFraWd/2.,
    1829           1 :                      fV0AR3-fV0AFraWd/2., fV0ASciWd/2., 180.0, 225.0);
    1830           2 :     new TGeoTubeSeg( "sV0AR4b5", fV0AR3+fV0AFraWd/2.,
    1831           1 :                      fV0AR4-fV0AFraWd/2., fV0ASciWd/2., 180.0, 225.0);
    1832           1 :     TGeoCompositeShape *sV0AR15 = new TGeoCompositeShape("sV0AR15","sV0AR1b5-sV0ACha5");
    1833           1 :     TGeoCompositeShape *sV0AR25 = new TGeoCompositeShape("sV0AR25","sV0AR2b5-sV0ACha5");
    1834           1 :     TGeoCompositeShape *sV0AR35 = new TGeoCompositeShape("sV0AR35","sV0AR3b5-sV0ACha5");
    1835           1 :     TGeoCompositeShape *sV0AR45 = new TGeoCompositeShape("sV0AR45","sV0AR4b5-sV0ACha5");
    1836           1 :     TGeoVolume *v0L15 = new TGeoVolume("V0L15",sV0AR15,medV0ASci);
    1837           1 :     TGeoVolume *v0L25 = new TGeoVolume("V0L25",sV0AR25,medV0ASci);
    1838           1 :     TGeoVolume *v0L35 = new TGeoVolume("V0L35",sV0AR35,medV0ASci);
    1839           1 :     TGeoVolume *v0L45 = new TGeoVolume("V0L45",sV0AR45,medV0ASci);
    1840           1 :     v0L15->SetLineColor(kV0AColorSci); v0L25->SetLineColor(kV0AColorSci);
    1841           1 :     v0L35->SetLineColor(kV0AColorSci); v0L45->SetLineColor(kV0AColorSci);
    1842           1 :     v0ASci5->AddNode(v0L15,1);
    1843           1 :     v0ASci5->AddNode(v0L25,1);
    1844           1 :     v0ASci5->AddNode(v0L35,1);
    1845           1 :     v0ASci5->AddNode(v0L45,1);
    1846             : 
    1847             :      /// Segment of octagon  
    1848           6 :     for (int i=0;i<2;i++) {
    1849           2 :     v0APts[0+8*i] = -fV0AR6+fV0AOctH2;           v0APts[1+8*i] = 0.;
    1850           2 :     v0APts[2+8*i] = -(fV0AR7-fV0AOctH2)*cos654;   v0APts[3+8*i] = -(fV0AR7-fV0AOctH2)*sin654;
    1851           2 :     v0APts[4+8*i] = -fV0AR7*cos654;              v0APts[5+8*i] = -fV0AR7*sin654;
    1852           2 :     v0APts[6+8*i] = -fV0AR6;                     v0APts[7+8*i] = 0.;
    1853             :     }
    1854           1 :     new TGeoArb8("sV0AOct25", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
    1855           1 :     TGeoCompositeShape *sV0AOct2FEEB5 = new TGeoCompositeShape("sV0AOct2FEEB5","sV0AOct25-sV0AFicFEEBSec1:posFicFEEBSec5-sV0AFicOct2Sec1:posFicOct2Sec5");
    1856           1 :     TGeoVolume *v0AOct25 = new TGeoVolume("V0AOct25", sV0AOct2FEEB5,medV0ASup);
    1857           1 :     v0AOct25->SetLineColor(kV0AColorOct);
    1858           2 :     TGeoVolume *v0ASup5 = new TGeoVolumeAssembly("V0ASup5");
    1859           1 :     v0ASup5->AddNode(v0AOct25,1);
    1860           1 :     v0ASec5->AddNode(v0ASup5,1);
    1861             : 
    1862             :     //Bunch of fibers
    1863           1 :     v0APts[ 0] = v0APts[ 2] = -14.0;
    1864           1 :     v0APts[ 1] = v0APts[ 7] = (fV0ASciWd+fV0AOctWd)/2.-0.01;
    1865           1 :     v0APts[ 3] = v0APts[ 5] = (fV0ASciWd+fV0AOctWd)/2.+0.01;
    1866           1 :     v0APts[ 4] = v0APts[ 6] = +14.0;
    1867           1 :     v0APts[ 8] = v0APts[10] = -10.0;
    1868           1 :     v0APts[ 9] = v0APts[15] = 0.;
    1869           1 :     v0APts[11] = v0APts[13] = 0.25;
    1870           1 :     v0APts[12] = v0APts[14] = +10.0;
    1871           1 :     new TGeoArb8("sV0AFib15", 11.8, v0APts); 
    1872           1 :     rot = new TGeoRotation("rot");
    1873           1 :     rot->RotateX(-90);
    1874           1 :     rot->RotateZ(90+22.5);
    1875           2 :     TGeoCombiTrans *fib15pos = new TGeoCombiTrans("fib15pos", -(fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. +
    1876           1 :     3.3, -(fV0AR6-fV0AOctH2+fV0AR5)*sin225/2. + 1.5, 0, rot);
    1877           1 :     fib15pos->RegisterYourself();
    1878           1 :     TGeoCompositeShape *sV0AFib15Hole = new TGeoCompositeShape("sV0AFib15Hole", "sV0AFib15:fib15pos-sV0AFicR55");
    1879           1 :     TGeoVolume *v0AFib15Hole = new TGeoVolume("V0AFib15",sV0AFib15Hole,medV0AFib);
    1880           1 :     v0AFib15Hole->SetLineColor(kV0AColorFib);
    1881           1 :     new TGeoArb8("sV0AFib25", 11.8, v0APts);
    1882           1 :     rot = new TGeoRotation("rot");
    1883           1 :     rot->RotateX(-90);
    1884           1 :     rot->RotateY(180);
    1885           1 :     rot->RotateZ(90+22.5);
    1886           2 :     TGeoCombiTrans *fib25pos = new TGeoCombiTrans("fib25pos", -(fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. +
    1887           1 :     3.3, -(fV0AR6-fV0AOctH2+fV0AR5)*sin225/2. + 1.5, 0, rot);
    1888           1 :     fib25pos->RegisterYourself();
    1889           1 :     TGeoCompositeShape *sV0AFib25Hole = new TGeoCompositeShape("sV0AFib25Hole","sV0AFib25:fib25pos-sV0AFicR55");
    1890           1 :     TGeoVolume *v0AFib25Hole = new TGeoVolume("V0AFib25Hole",sV0AFib25Hole,medV0AFib);
    1891           1 :     v0AFib25Hole->SetLineColor(kV0AColorFib);
    1892           2 :     TGeoVolume *v0AFib5 = new TGeoVolumeAssembly("V0AFib5");    
    1893           1 :     v0AFib5->AddNode(v0AFib15Hole,1);
    1894           1 :     v0AFib5->AddNode(v0AFib25Hole,1);
    1895           1 :     v0ASec5->AddNode(v0AFib5,1);
    1896             :             
    1897             :     /// Non-sensitive scintilator
    1898           1 :     new TGeoTubeSeg("sV0AR5S25", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShape5, 180.0, 225.0);
    1899           1 :     TGeoCompositeShape *sV0AR55 = new TGeoCompositeShape("V0AR55","sV0AR5S25 - sV0ACha5");
    1900           1 :     TGeoVolume *v0AR55 = new TGeoVolume("V0AR55",sV0AR55,medV0ASci);
    1901           1 :     v0AR55->SetLineColor(kV0AColorSci);
    1902           1 :     v0ASci5->AddNode(v0AR55,1);
    1903           1 :     v0ASec5->AddNode(v0ASci5,1);
    1904             : 
    1905             :     /// Plates 
    1906           6 :     for (int i=0;i<2;i++) {
    1907           2 :       v0APts[0+8*i] = -fV0AR0;                  v0APts[1+8*i] = 0.;
    1908           2 :       v0APts[2+8*i] = -fV0AR0*cos654;           v0APts[3+8*i] = -fV0AR0*sin654;
    1909           2 :       v0APts[4+8*i] = -fV0AR7*cos654;           v0APts[5+8*i] = -fV0AR7*sin654;
    1910           2 :       v0APts[6+8*i] = -fV0AR6;                  v0APts[7+8*i] = 0.;
    1911             :     }
    1912           1 :     new TGeoArb8("sV0APlaIn5", (fV0APlaWd-2*fV0APlaAl)/2., v0APts);
    1913           1 :     TGeoCompositeShape *sV0APlaInNailsHoles5 = new TGeoCompositeShape("sV0APlaInNailsHoles5","sV0APlaIn5-sV0ANailsPlaInHoles5-sV0AFicFEEBSec1:posFicFEEBSec5");
    1914           1 :     TGeoVolume *v0APlaInNailsHoles5 = new TGeoVolume("V0APlaInNailsHoles5", sV0APlaInNailsHoles5, medV0APlaIn);
    1915           1 :     new TGeoArb8("sV0APlaOu5", fV0APlaAl/2., v0APts);
    1916           1 :     TGeoCompositeShape *sV0APlaOuNailsHoles5 = new TGeoCompositeShape("sV0APlaOuNailsHoles5","sV0APlaOu5-sV0ANailsPlaOuHoles5-sV0AFicFEEBSec1:posFicFEEBSec5");  
    1917           1 :     TGeoVolume *v0APlaOuNailsHoles5 = new TGeoVolume("V0APlaOuNailsHoles5", sV0APlaOuNailsHoles5, medV0APlaOu);
    1918           1 :     v0APlaInNailsHoles5->SetLineColor(kV0AColorPlaIn); v0APlaOuNailsHoles5->SetLineColor(kV0AColorPlaOu);
    1919           2 :     TGeoVolume *v0APla5 = new TGeoVolumeAssembly("V0APla5");
    1920           1 :     v0APla5->AddNode(v0APlaInNailsHoles5,1);
    1921           2 :     v0APla5->AddNode(v0APlaOuNailsHoles5,1,new TGeoTranslation(0,0,(fV0APlaWd-fV0APlaAl)/2.));
    1922           2 :     v0APla5->AddNode(v0APlaOuNailsHoles5,2,new TGeoTranslation(0,0,-(fV0APlaWd-fV0APlaAl)/2.));
    1923           2 :     v0ASec5->AddNode(v0APla5,1,new TGeoTranslation(0,0,(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    1924           2 :     v0ASec5->AddNode(v0APla5,2,new TGeoTranslation(0,0,-(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    1925             :     
    1926             :     /// PMBox 
    1927           2 :     TGeoVolume* v0APM5 = new TGeoVolumeAssembly("V0APM5");
    1928           1 :     new TGeoBBox("sV0APMB15", fV0APMBWd/2., fV0APMBHt/2., fV0APMBTh/2.);
    1929           1 :     new TGeoBBox("sV0APMB25", fV0APMBWd/2.-fV0APMBWdW, fV0APMBHt/2.-fV0APMBHtW, fV0APMBTh/2.-fV0APMBThW);
    1930           1 :     TGeoCompositeShape *sV0APMB5 = new TGeoCompositeShape("sV0APMB5","sV0APMB15-sV0APMB25");
    1931           1 :     TGeoVolume *v0APMB5 = new TGeoVolume("V0APMB5",sV0APMB5, medV0APMAlum);
    1932           1 :     v0APMB5->SetLineColor(kV0AColorPMA);
    1933           1 :     v0APM5->AddNode(v0APMB5,1);
    1934             : 
    1935             :     /// PMTubes 
    1936           1 :     TGeoTube *sV0APMT15 = new TGeoTube("sV0APMT15", fV0APMTR1, fV0APMTR2, fV0APMTH/2.);
    1937           1 :     TGeoVolume *v0APMT15 = new TGeoVolume("V0APMT15", sV0APMT15, medV0APMGlass);
    1938           1 :     TGeoTube *sV0APMT25 = new TGeoTube("sV0APMT25", fV0APMTR3, fV0APMTR4, fV0APMTH/2.);
    1939           1 :     TGeoVolume *v0APMT25 = new TGeoVolume("V0APMT25", sV0APMT25, medV0APMAlum);
    1940           2 :     TGeoVolume *v0APMT5 = new TGeoVolumeAssembly("V0APMT5");
    1941           1 :     TGeoTube *sV0APMTT5 = new TGeoTube("sV0APMTT5", 0., fV0APMTR4, fV0APMTB/2.);
    1942           1 :     TGeoVolume *v0APMTT5 = new TGeoVolume("V0APMTT5", sV0APMTT5, medV0APMAlum);
    1943           1 :     v0APMT5->SetLineColor(kV0AColorPMG);
    1944           1 :     v0APMT25->SetLineColor(kV0AColorPMA);
    1945           1 :     v0APMTT5->SetLineColor(kV0AColorPMA);
    1946           1 :     rot = new TGeoRotation("rot", 90, 0, 180, 0, 90, 90);
    1947           1 :     v0APMT5->AddNode(v0APMT15,1,rot);
    1948           1 :     v0APMT5->AddNode(v0APMT25,1,rot);
    1949           2 :     v0APMT5->AddNode(v0APMTT5,1,new TGeoCombiTrans(0,(fV0APMTH+fV0APMTB)/2.,0,rot));
    1950           1 :     double autoShift5 = (fV0APMBWd-2*fV0APMBWdW)/4.;
    1951           2 :     v0APM5->AddNode(v0APMT5, 1, new TGeoTranslation(-1.5*autoShift5, 0, 0));
    1952           2 :     v0APM5->AddNode(v0APMT5, 2, new TGeoTranslation(-0.5*autoShift5, 0, 0));
    1953           2 :     v0APM5->AddNode(v0APMT5, 3, new TGeoTranslation(+0.5*autoShift5, 0, 0));
    1954           2 :     v0APM5->AddNode(v0APMT5, 4, new TGeoTranslation(+1.5*autoShift5, 0, 0));
    1955             : 
    1956             :     /// PM 
    1957           1 :     rot = new TGeoRotation("rot");
    1958           1 :     rot->RotateX(-90+30);
    1959           1 :     rot->RotateY(0); 
    1960           1 :     rot->RotateZ(-65-3);
    1961           1 :     double cosAngPMB5 = TMath::Cos(fV0APMBAng*TMath::DegToRad());
    1962           1 :     double sinAngPMB5 = TMath::Sin(fV0APMBAng*TMath::DegToRad());
    1963           1 :     double shiftZ5 = fV0APMBHt/2. * cosAngPMB5
    1964           1 :       -   ( fV0ASciWd + 2 * fV0AOctWd + 2 * fV0APlaWd )/2.   -   fV0APMBTh/2. * sinAngPMB5;
    1965           1 :     double shiftR5 = fV0AR6  +  fV0AOctH2 + fV0APlaAl;
    1966           2 :     v0ASec5->AddNode(v0APM5,1, new TGeoCombiTrans( -shiftR5*cos225-1.3, -shiftR5*sin225, shiftZ5, rot));
    1967             : 
    1968             :     // Aluminium nails
    1969           1 :     TGeoTube *sV0ANail51 = new TGeoTube("sV0ANail51", 0.0, 0.4, 5.09/2.);
    1970           1 :     TGeoVolume *v0ANail51 = new TGeoVolume("V0ANail51", sV0ANail51, medV0APMAlum);
    1971           1 :     v0ANail51->SetLineColor(kV0AColorPMA);// this is the color for aluminium
    1972           2 :     v0ASec5->AddNode(v0ANail51,1,new TGeoTranslation(-42.9,-0.51,0.0));
    1973           1 :     TGeoTube *sV0ANail52 = new TGeoTube("sV0ANail52", 0.0, 0.4, 5.09/2.);
    1974           1 :     TGeoVolume *v0ANail52 = new TGeoVolume("V0ANail52", sV0ANail52, medV0APMAlum);
    1975           1 :     v0ANail52->SetLineColor(kV0AColorPMA);
    1976           2 :     v0ASec5->AddNode(v0ANail52,1,new TGeoTranslation(-30.8,-30.04,0.0)); 
    1977             :             
    1978             :     // Adding sector to v0LE volume
    1979           1 :     v0LE->AddNode(v0ASec5, 1);  
    1980             :     
    1981             : 
    1982             :     //Definition of  sector 6
    1983           2 :     TGeoVolume *v0ASec6 = new TGeoVolumeAssembly("V0ASec6");
    1984             : 
    1985             :     /// For boolean sustraction
    1986             :     double preShape6 = 0.2;
    1987           6 :     for (int i=0;i<2;i++) {
    1988           2 :     v0APts[0+8*i] = -preShape6;                      v0APts[1+8*i] = -fV0AR0+fV0AFraWd/2.-preShape6;
    1989           2 :     v0APts[2+8*i] = 0.0;                    v0APts[3+8*i] = -fV0AR0+fV0AFraWd/2.-preShape6;
    1990           2 :     v0APts[4+8*i] = 0.0;                    v0APts[5+8*i] = -fV0AR4-fV0AFraWd/2.+preShape6;
    1991           2 :     v0APts[6+8*i] = -preShape6;                      v0APts[7+8*i] = -fV0AR4-fV0AFraWd/2.+preShape6;
    1992             :     }
    1993           1 :     new TGeoArb8("sV0ACha16",fV0ASciWd/1.5,v0APts);
    1994           6 :     for (int i=0;i<2;i++) {
    1995           2 :     v0APts[0+8*i] = -fV0AR0*cos45+preShape6;
    1996           2 :     v0APts[1+8*i] = -(fV0AR0-fV0AFraWd)*sin45+preShape6;
    1997           2 :     v0APts[2+8*i] = -(fV0AR0-fV0AFraWd/2.)*cos45+preShape6;
    1998           2 :     v0APts[3+8*i] = -(fV0AR0-fV0AFraWd/2.)*sin45;
    1999           2 :     v0APts[4+8*i] = -(fV0AR4+fV0AFraWd/2.)*cos45-preShape6;
    2000           2 :     v0APts[5+8*i] = -(fV0AR4+fV0AFraWd/2.)*sin45-preShape6;
    2001           2 :     v0APts[6+8*i] = -(fV0AR4+fV0AFraWd)*cos45-preShape6;
    2002           2 :     v0APts[7+8*i] = -fV0AR4*sin45-preShape6;
    2003             :     }
    2004           1 :     new TGeoArb8("sV0ACha26", fV0ASciWd/2.+2.*preShape6, v0APts);
    2005           1 :     new TGeoCompositeShape("sV0ACha126","sV0ACha16+sV0ACha26");
    2006           1 :     new TGeoTube("sV0ANail16Hole", 0.0, 0.4, 1.65);
    2007           1 :     TGeoTranslation *pos16 = new TGeoTranslation("pos16",-0.51,-42.9,0.0);
    2008           1 :     pos16->RegisterYourself();
    2009           1 :     new TGeoTube("sV0ANail26Hole", 0.0, 0.4, 1.65);
    2010           1 :     TGeoTranslation *pos26 = new TGeoTranslation("pos26",-30.05,-30.79,0.0);  
    2011           1 :     pos26->RegisterYourself();
    2012           1 :     new TGeoCompositeShape("sV0ANailsHoles6","sV0ANail16Hole:pos16+sV0ANail26Hole:pos26");
    2013           1 :     new TGeoCompositeShape("sV0ACha6","sV0ACha126+sV0ANailsHoles6");
    2014           1 :     new TGeoTubeSeg("sV0AFicR56", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShape6, 225, 270.0);
    2015           1 :     new TGeoTube("sV0ANail1PlaInHole6", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);    
    2016           1 :     new TGeoTube("sV0ANail1PlaOuHole6", 0.0, 0.4, (fV0APlaAl)/2.);
    2017             :       
    2018             :     /// Frame
    2019           2 :     TGeoVolume *v0AFra6 = new TGeoVolumeAssembly("V0AFra6");
    2020           6 :     for (int i=0;i<2;i++) {
    2021           2 :     v0APts[0+8*i] = -fV0AFraWd/2.;         v0APts[1+8*i] = -fV0AR0-fV0AFraWd/2.;
    2022           2 :     v0APts[2+8*i] = 0.;                    v0APts[3+8*i] = -fV0AR0-fV0AFraWd/2.;
    2023           2 :     v0APts[4+8*i] = 0.;                    v0APts[5+8*i] = -fV0AR4+fV0AFraWd/2.;
    2024           2 :     v0APts[6+8*i] = -fV0AFraWd/2.;         v0APts[7+8*i] = -fV0AR4+fV0AFraWd/2.;
    2025             :     }
    2026           1 :     TGeoArb8 *sV0AFraB16 = new TGeoArb8("sV0AFraB16",fV0ASciWd/2.,v0APts);
    2027           1 :     TGeoVolume *v0AFraB16 = new TGeoVolume("V0AFraB16",sV0AFraB16,medV0AFra);
    2028           6 :     for (int i=0;i<2;i++) {
    2029           2 :     v0APts[0+8*i] = -(fV0AR0+fV0AFraWd/2.)*cos45;
    2030           2 :     v0APts[1+8*i] = -(fV0AR0+fV0AFraWd/2.)*sin45;
    2031           2 :     v0APts[2+8*i] = -fV0AR0*cos45;
    2032           2 :     v0APts[3+8*i] = -(fV0AR0+fV0AFraWd)*sin45;
    2033           2 :     v0APts[4+8*i] = -(fV0AR4-fV0AFraWd/6.)*cos45;
    2034           2 :     v0APts[5+8*i] = -fV0AR4*sin45;
    2035           2 :     v0APts[6+8*i] = -(fV0AR4-fV0AFraWd)*cos45;
    2036           2 :     v0APts[7+8*i] = -(fV0AR4-fV0AFraWd/2.)*sin45;
    2037             :     }
    2038           1 :     TGeoArb8 *sV0AFraB26 = new TGeoArb8("sV0AFraB26", fV0ASciWd/2., v0APts);
    2039           1 :     TGeoVolume *v0AFraB26 = new TGeoVolume("V0AFraB26",sV0AFraB26,medV0AFra);
    2040           1 :     v0AFraB16->SetLineColor(kV0AColorFra); v0AFraB26->SetLineColor(kV0AColorFra);
    2041           1 :     v0AFra6->AddNode(v0AFraB16,1);
    2042           1 :     v0AFra6->AddNode(v0AFraB26,1);  // Prefer 2 GeoObjects insted of 3 GeoMovements
    2043           2 :     new TGeoTubeSeg( "sV0AFraR1b6", fV0AR0-fV0AFraWd/2.,
    2044           1 :              fV0AR0+fV0AFraWd/2., fV0ASciWd/2., 225.0, 270.0);
    2045           2 :     new TGeoTubeSeg( "sV0AFraR2b6", fV0AR1-fV0AFraWd/2.,
    2046           1 :              fV0AR1+fV0AFraWd/2., fV0ASciWd/2., 225.0, 270.0);
    2047           2 :     new TGeoTubeSeg( "sV0AFraR3b6", fV0AR2-fV0AFraWd/2.,
    2048           1 :              fV0AR2+fV0AFraWd/2., fV0ASciWd/2., 225.0, 270.0);
    2049           2 :     new TGeoTubeSeg( "sV0AFraR4b6", fV0AR3-fV0AFraWd/2.,
    2050           1 :              fV0AR3+fV0AFraWd/2., fV0ASciWd/2., 225.0, 270.0);
    2051           2 :     new TGeoTubeSeg( "sV0AFraR5b6", fV0AR4-fV0AFraWd/2.,
    2052           1 :              fV0AR4+fV0AFraWd/2., fV0ASciWd/2., 225.0, 270.0);
    2053           1 :     TGeoCompositeShape *sV0AFraR16 = new TGeoCompositeShape("sV0AFraR16","sV0AFraR1b6-sV0ACha6");
    2054           1 :     TGeoCompositeShape *sV0AFraR26 = new TGeoCompositeShape("sV0AFraR26","sV0AFraR2b6-sV0ACha6");
    2055           1 :     TGeoCompositeShape *sV0AFraR36 = new TGeoCompositeShape("sV0AFraR36","sV0AFraR3b6-sV0ACha6");
    2056           1 :     TGeoCompositeShape *sV0AFraR46 = new TGeoCompositeShape("sV0AFraR46","sV0AFraR4b6-sV0ACha6");
    2057           1 :     TGeoCompositeShape *sV0AFraR56 = new TGeoCompositeShape("sV0AFraR56","sV0AFraR5b6-sV0ACha6");
    2058           1 :     TGeoVolume *v0AFraR16 = new TGeoVolume("V0AFraR16",sV0AFraR16,medV0AFra);
    2059           1 :     TGeoVolume *v0AFraR26 = new TGeoVolume("V0AFraR26",sV0AFraR26,medV0AFra);
    2060           1 :     TGeoVolume *v0AFraR36 = new TGeoVolume("V0AFraR36",sV0AFraR36,medV0AFra);
    2061           1 :     TGeoVolume *v0AFraR46 = new TGeoVolume("V0AFraR46",sV0AFraR46,medV0AFra);
    2062           1 :     TGeoVolume *v0AFraR56 = new TGeoVolume("V0AFraR56",sV0AFraR56,medV0AFra);
    2063           1 :     v0AFraR16->SetLineColor(kV0AColorFra); v0AFraR26->SetLineColor(kV0AColorFra);
    2064           1 :     v0AFraR36->SetLineColor(kV0AColorFra); v0AFraR46->SetLineColor(kV0AColorFra);
    2065           1 :     v0AFraR56->SetLineColor(kV0AColorFra);
    2066           1 :     v0AFra6->AddNode(v0AFraR16,1);
    2067           1 :     v0AFra6->AddNode(v0AFraR26,1);
    2068           1 :     v0AFra6->AddNode(v0AFraR36,1);
    2069           1 :     v0AFra6->AddNode(v0AFraR46,1);
    2070           1 :     v0AFra6->AddNode(v0AFraR56,1);
    2071           1 :     v0ASec6->AddNode(v0AFra6,1);
    2072             : 
    2073             :     /// Sensitive scintilator
    2074           2 :     TGeoVolume *v0ASci6 = new TGeoVolumeAssembly("V0ASci6");
    2075           2 :     new TGeoTubeSeg( "sV0AR1b6", fV0AR0+fV0AFraWd/2.,
    2076           1 :                      fV0AR1-fV0AFraWd/2., fV0ASciWd/2., 225.0, 270.0);
    2077           2 :     new TGeoTubeSeg( "sV0AR2b6", fV0AR1+fV0AFraWd/2.,
    2078           1 :              fV0AR2-fV0AFraWd/2., fV0ASciWd/2., 225.0, 270.0);
    2079           2 :     new TGeoTubeSeg( "sV0AR3b6", fV0AR2+fV0AFraWd/2.,
    2080           1 :              fV0AR3-fV0AFraWd/2., fV0ASciWd/2., 225.0, 270.0);
    2081           2 :     new TGeoTubeSeg( "sV0AR4b6", fV0AR3+fV0AFraWd/2.,
    2082           1 :              fV0AR4-fV0AFraWd/2., fV0ASciWd/2., 225.0, 270.0);
    2083           1 :     TGeoCompositeShape *sV0AR16 = new TGeoCompositeShape("sV0AR16","sV0AR1b6-sV0ACha6");
    2084           1 :     TGeoCompositeShape *sV0AR26 = new TGeoCompositeShape("sV0AR26","sV0AR2b6-sV0ACha6");
    2085           1 :     TGeoCompositeShape *sV0AR36 = new TGeoCompositeShape("sV0AR36","sV0AR3b6-sV0ACha6");
    2086           1 :     TGeoCompositeShape *sV0AR46 = new TGeoCompositeShape("sV0AR46","sV0AR4b6-sV0ACha6");
    2087           1 :     TGeoVolume *v0L16 = new TGeoVolume("V0L16",sV0AR16,medV0ASci);
    2088           1 :     TGeoVolume *v0L26 = new TGeoVolume("V0L26",sV0AR26,medV0ASci);
    2089           1 :     TGeoVolume *v0L36 = new TGeoVolume("V0L36",sV0AR36,medV0ASci);
    2090           1 :     TGeoVolume *v0L46 = new TGeoVolume("V0L46",sV0AR46,medV0ASci);
    2091           1 :     v0L16->SetLineColor(kV0AColorSci); v0L26->SetLineColor(kV0AColorSci);
    2092           1 :     v0L36->SetLineColor(kV0AColorSci); v0L46->SetLineColor(kV0AColorSci);
    2093           1 :     v0ASci6->AddNode(v0L16,1);
    2094           1 :     v0ASci6->AddNode(v0L26,1);
    2095           1 :     v0ASci6->AddNode(v0L36,1);
    2096           1 :     v0ASci6->AddNode(v0L46,1);
    2097             :     
    2098             :     // Bunch of fibers
    2099           6 :     for (int i=0;i<2;i++) {
    2100           2 :     v0APts[0+8*i] = -10.0;          v0APts[1+8*i] = 13.1;  
    2101           2 :     v0APts[2+8*i] = 10.0;           v0APts[3+8*i] = 13.1;   
    2102           2 :     v0APts[4+8*i] = 8.0;            v0APts[5+8*i] = -29.0;  
    2103           2 :     v0APts[6+8*i] = -12.0;          v0APts[7+8*i] = -12.0;  
    2104             :     }   
    2105           1 :     new TGeoArb8("sV0AFib16", 0.01, v0APts);      
    2106           1 :     rot = new TGeoRotation("rot");
    2107           1 :     rot->RotateX(2.0); 
    2108           1 :     rot->RotateY(180.0);
    2109           1 :     rot->RotateZ(90+22.5);
    2110           1 :     TGeoCombiTrans *fib16pos = new TGeoCombiTrans("fib16pos", -40.0 + 3.3, -50.0 + 1.5, 0.5, rot);
    2111           1 :     fib16pos->RegisterYourself();
    2112           1 :     TGeoCompositeShape *sV0AFib16Hole = new TGeoCompositeShape("sV0AFib16Hole", "sV0AFib16:fib16pos-sV0AFicR56");
    2113           1 :     TGeoVolume *v0AFib16Hole = new TGeoVolume("V0AFib16Hole",sV0AFib16Hole,medV0AFib);
    2114           1 :     v0AFib16Hole->SetLineColor(kV0AColorFib);
    2115           1 :     new TGeoArb8("sV0AFib26", 0.01, v0APts);      
    2116           1 :     rot = new TGeoRotation("rot");
    2117           1 :     rot->RotateX(-2.0); 
    2118           1 :     rot->RotateY(180.0); 
    2119           1 :     rot->RotateZ(90+22.5);
    2120           1 :     TGeoCombiTrans *fib26pos = new TGeoCombiTrans("fib26pos", -40.0 + 3.3, -50.0 + 1.5, -0.5, rot);
    2121           1 :     fib26pos->RegisterYourself();
    2122           1 :     TGeoCompositeShape *sV0AFib26Hole = new TGeoCompositeShape("sV0AFib26Hole", "sV0AFib26:fib26pos-sV0AFicR56");
    2123           1 :     TGeoVolume *v0AFib26Hole = new TGeoVolume("V0AFib26Hole",sV0AFib26Hole,medV0AFib);
    2124           1 :     v0AFib26Hole->SetLineColor(kV0AColorFib);
    2125           2 :     TGeoVolume *v0AFib6 = new TGeoVolumeAssembly("V0AFib6");
    2126           1 :     v0AFib6->AddNode(v0AFib16Hole,1); 
    2127           1 :     v0AFib6->AddNode(v0AFib26Hole,1);
    2128           1 :     v0ASec6->AddNode(v0AFib6,1);
    2129             : 
    2130             :     /// Non-sensitive scintilator
    2131           1 :     new TGeoTubeSeg("sV0AR5S26", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShape6, 225.0, 270.0);
    2132           1 :     TGeoCompositeShape *sV0AR56 = new TGeoCompositeShape("V0AR56","sV0AR5S26 - sV0ACha6");
    2133           1 :     TGeoVolume *v0AR56 = new TGeoVolume("V0AR56",sV0AR56,medV0ASci);
    2134           1 :     v0AR56->SetLineColor(kV0AColorSci);
    2135           1 :     v0ASci6->AddNode(v0AR56,1);
    2136           1 :     v0ASec6->AddNode(v0ASci6,1);
    2137             : 
    2138             :     /// Segment of octagon   
    2139           6 :     for (int i=0;i<2;i++) {
    2140           2 :     v0APts[0+8*i] = 0.;                          v0APts[1+8*i] = -(fV0AR7-fV0AOctH2)*sin654;
    2141           2 :     v0APts[2+8*i] = 0.;                          v0APts[3+8*i] = -fV0AR7*sin654;
    2142           2 :     v0APts[4+8*i] = -fV0AR7*cos654;              v0APts[5+8*i] = -fV0AR7*sin654;
    2143           2 :     v0APts[6+8*i] = -(fV0AR7-fV0AOctH2)*cos654;  v0APts[7+8*i] = -(fV0AR7-fV0AOctH2)*sin654;
    2144             :     }
    2145           1 :     TGeoArb8 *sV0AOct26 = new TGeoArb8("sV0AOct26", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
    2146           1 :     TGeoVolume *v0AOct26 = new TGeoVolume("V0AOct26", sV0AOct26,medV0ASup);
    2147           1 :     v0AOct26->SetLineColor(kV0AColorOct);
    2148           2 :     TGeoVolume *v0ASup6 = new TGeoVolumeAssembly("V0ASup6");
    2149           1 :     v0ASup6->AddNode(v0AOct26,1);
    2150           1 :     v0ASec6->AddNode(v0ASup6,1);
    2151             : 
    2152             :     /// Plates
    2153           6 :     for (int i=0;i<2;i++) {
    2154           2 :     v0APts[0+8*i] = 0.;                 v0APts[1+8*i] = -fV0AR0;
    2155           2 :     v0APts[2+8*i] = 0.;                 v0APts[3+8*i] = -fV0AR7*sin654;
    2156           2 :     v0APts[4+8*i] = -fV0AR7*cos654;     v0APts[5+8*i] = -fV0AR7*sin654;
    2157           2 :     v0APts[6+8*i] = -fV0AR0*cos654;             v0APts[7+8*i] = -fV0AR0*sin654;
    2158             :     }
    2159           1 :     new TGeoArb8("sV0APlaIn6", (fV0APlaWd-2*fV0APlaAl)/2., v0APts);
    2160           1 :     TGeoCompositeShape *sV0APlaInNailsHoles6 = new TGeoCompositeShape("sV0APlaInNailsHoles6","sV0APlaIn6-sV0ANail1PlaInHole6:pos16");
    2161           1 :     TGeoVolume *v0APlaInNailsHoles6 = new TGeoVolume("V0APlaInNailsHoles6", sV0APlaInNailsHoles6, medV0APlaIn);
    2162           1 :     new TGeoArb8("sV0APlaOu6", fV0APlaAl/2., v0APts);
    2163           1 :     TGeoCompositeShape *sV0APlaOuNailsHoles6 = new TGeoCompositeShape("sV0APlaOuNailsHoles6","sV0APlaOu6-sV0ANail1PlaOuHole6:pos16"); 
    2164           1 :     TGeoVolume *v0APlaOuNailsHoles6 = new TGeoVolume("V0APlaOuNailsHoles6", sV0APlaOuNailsHoles6, medV0APlaOu);
    2165           1 :     v0APlaInNailsHoles6->SetLineColor(kV0AColorPlaIn); v0APlaOuNailsHoles6->SetLineColor(kV0AColorPlaOu);
    2166           2 :     TGeoVolume *v0APla6 = new TGeoVolumeAssembly("V0APla6");
    2167           1 :     v0APla6->AddNode(v0APlaInNailsHoles6,1);
    2168           2 :     v0APla6->AddNode(v0APlaOuNailsHoles6,1,new TGeoTranslation(0,0,(fV0APlaWd-fV0APlaAl)/2.));
    2169           2 :     v0APla6->AddNode(v0APlaOuNailsHoles6,2,new TGeoTranslation(0,0,-(fV0APlaWd-fV0APlaAl)/2.));
    2170           2 :     v0ASec6->AddNode(v0APla6,1,new TGeoTranslation(0,0,(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    2171           2 :     v0ASec6->AddNode(v0APla6,2,new TGeoTranslation(0,0,-(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    2172             :     
    2173             :     /// PMBox  
    2174           2 :     TGeoVolume* v0APM6 = new TGeoVolumeAssembly("V0APM6");
    2175           1 :     new TGeoBBox("sV0APMB16", fV0APMBWd/2., fV0APMBHt/2., fV0APMBTh/2.);
    2176           1 :     new TGeoBBox("sV0APMB26", fV0APMBWd/2.-fV0APMBWdW, fV0APMBHt/2.-fV0APMBHtW, fV0APMBTh/2.-fV0APMBThW);
    2177           1 :     TGeoCompositeShape *sV0APMB6 = new TGeoCompositeShape("sV0APMB6","sV0APMB16-sV0APMB26");
    2178           1 :     TGeoVolume *v0APMB6 = new TGeoVolume("V0APMB6",sV0APMB6, medV0APMAlum);
    2179           1 :     v0APMB6->SetLineColor(kV0AColorPMA);
    2180           1 :     v0APM6->AddNode(v0APMB6,1);
    2181             : 
    2182             :     /// PMTubes 
    2183           1 :     TGeoTube *sV0APMT16 = new TGeoTube("sV0APMT16", fV0APMTR1, fV0APMTR2, fV0APMTH/2.);
    2184           1 :     TGeoVolume *v0APMT16 = new TGeoVolume("V0APMT16", sV0APMT16, medV0APMGlass);
    2185           1 :     TGeoTube *sV0APMT26 = new TGeoTube("sV0APMT26", fV0APMTR3, fV0APMTR4, fV0APMTH/2.);
    2186           1 :     TGeoVolume *v0APMT26 = new TGeoVolume("V0APMT26", sV0APMT26, medV0APMAlum);
    2187           2 :     TGeoVolume *v0APMT6 = new TGeoVolumeAssembly("V0APMT6"); 
    2188           1 :     TGeoTube *sV0APMTT6 = new TGeoTube("sV0APMTT6", 0., fV0APMTR4, fV0APMTB/2.);
    2189           1 :     TGeoVolume *v0APMTT6 = new TGeoVolume("V0APMTT6", sV0APMTT6, medV0APMAlum);
    2190           1 :     v0APMT6->SetLineColor(kV0AColorPMG);
    2191           1 :     v0APMT26->SetLineColor(kV0AColorPMA);
    2192           1 :     v0APMTT6->SetLineColor(kV0AColorPMA);
    2193           1 :     rot = new TGeoRotation("rot", 90, 0, 180, 0, 90, 90);
    2194           1 :     v0APMT6->AddNode(v0APMT16,1,rot);
    2195           1 :     v0APMT6->AddNode(v0APMT26,1,rot);
    2196           2 :     v0APMT6->AddNode(v0APMTT6,1,new TGeoCombiTrans(0,(fV0APMTH+fV0APMTB)/2.,0,rot));
    2197           1 :     double autoShift6 = (fV0APMBWd-2*fV0APMBWdW)/4.;
    2198           2 :     v0APM6->AddNode(v0APMT6, 1, new TGeoTranslation(-1.5*autoShift6, 0, 0));
    2199           2 :     v0APM6->AddNode(v0APMT6, 2, new TGeoTranslation(-0.5*autoShift6, 0, 0));
    2200           2 :     v0APM6->AddNode(v0APMT6, 3, new TGeoTranslation(+0.5*autoShift6, 0, 0));
    2201           2 :     v0APM6->AddNode(v0APMT6, 4, new TGeoTranslation(+1.5*autoShift6, 0, 0));
    2202             : 
    2203             :     /// PM 
    2204           1 :     rot = new TGeoRotation("rot");
    2205           1 :     rot->RotateX(-90+30);
    2206           1 :     rot->RotateY(0);
    2207           1 :     rot->RotateZ(-65-3);
    2208           1 :     double cosAngPMB6 = TMath::Cos(fV0APMBAng*TMath::DegToRad());
    2209           1 :     double sinAngPMB6 = TMath::Sin(fV0APMBAng*TMath::DegToRad());
    2210           1 :     double shiftZ6 = fV0APMBHt/2. * cosAngPMB6
    2211           1 :       -   ( fV0ASciWd + 2 * fV0AOctWd + 2 * fV0APlaWd )/2.   -   fV0APMBTh/2. * sinAngPMB6;
    2212           1 :     double shiftR6 = fV0AR6  + fV0AR1 + fV0AOctWd + fV0APlaAl/3.;
    2213           2 :     v0ASec6->AddNode(v0APM6,1, new TGeoCombiTrans( -shiftR6*cos45-1.3, -shiftR6*sin45, shiftZ6, rot));   
    2214             :     
    2215             :     /// Support
    2216           1 :     TGeoBBox *sV0ASuppbl = new TGeoBBox("sV0ASuppbl", 2.0, 18.13, fV0ASciWd/2.);       
    2217           1 :     TGeoVolume *v0ASuppbl = new TGeoVolume("V0ASuppbl", sV0ASuppbl, medV0ASup);
    2218           1 :     v0ASuppbl->SetLineColor(kV0AColorOct);
    2219           2 :     v0ASec6->AddNode(v0ASuppbl,1,new TGeoTranslation(-2.0,-63.64,0.0));
    2220             :     
    2221             :     // Aluminium nail
    2222           1 :     TGeoTube *sV0ANail61 = new TGeoTube("sV0ANail61", 0.0, 0.4, 5.09/2.);
    2223           1 :     TGeoVolume *v0ANail61 = new TGeoVolume("V0ANail61", sV0ANail61, medV0APMAlum);
    2224           1 :     v0ANail61->SetLineColor(kV0AColorPMA);// this is the color for aluminium
    2225           2 :     v0ASec6->AddNode(v0ANail61,1,new TGeoTranslation(-0.51,-42.9,0.0));  
    2226           1 :     TGeoTube *sV0ANail62 = new TGeoTube("sV0ANail62", 0.0, 0.4, 5.09/2.);
    2227           1 :     TGeoVolume *v0ANail62 = new TGeoVolume("V0ANail62", sV0ANail62, medV0APMAlum);
    2228           1 :     v0ANail62->SetLineColor(kV0AColorPMA);
    2229           2 :     v0ASec6->AddNode(v0ANail62,1,new TGeoTranslation(-30.05,-30.79,0.0));  
    2230             : 
    2231             :     // Adding sector to v0LE volume
    2232           1 :     v0LE->AddNode(v0ASec6, 1); 
    2233             :  
    2234             :      
    2235             :      //Definition of sector 7
    2236           2 :     TGeoVolume *v0ASec7 = new TGeoVolumeAssembly("V0ASec7");
    2237             : 
    2238             :     /// For boolean sustraction
    2239             :     double preShape7 = 0.2;
    2240           6 :     for (int i=0;i<2;i++) {
    2241           2 :     v0APts[0+8*i] = 0.0;                      v0APts[1+8*i] = -fV0AR0+fV0AFraWd/2.-preShape7;
    2242           2 :     v0APts[2+8*i] = fV0AFraWd/2.;                    v0APts[3+8*i] = -fV0AR0+fV0AFraWd/2.-preShape7;
    2243           2 :     v0APts[4+8*i] = fV0AFraWd/2.;                    v0APts[5+8*i] = -fV0AR4-fV0AFraWd/2.+preShape7;
    2244           2 :     v0APts[6+8*i] = 0.0;                      v0APts[7+8*i] = -fV0AR4-fV0AFraWd/2.+preShape7;
    2245             :     }
    2246           1 :     new TGeoArb8("sV0ACha17",fV0ASciWd/1.5,v0APts);
    2247           6 :     for (int i=0;i<2;i++) {
    2248           2 :     v0APts[0+8*i] = (fV0AR0-fV0AFraWd/2.)*cos45-preShape7;
    2249           2 :     v0APts[1+8*i] =  -(fV0AR0-fV0AFraWd/2.)*sin45;
    2250           2 :     v0APts[2+8*i] = fV0AR0*cos45-preShape7;
    2251           2 :     v0APts[3+8*i] =  -(fV0AR0-fV0AFraWd)*sin45+preShape7;
    2252           2 :     v0APts[4+8*i] = (fV0AR4+fV0AFraWd)*cos45+preShape7;
    2253           2 :     v0APts[5+8*i] =  -fV0AR4*sin45-preShape7;
    2254           2 :     v0APts[6+8*i] = (fV0AR4+fV0AFraWd/2.)*cos45+preShape7;
    2255           2 :     v0APts[7+8*i] =  -(fV0AR4+fV0AFraWd/2.)*sin45-2.*preShape7;
    2256             :     }
    2257           1 :     new TGeoArb8("sV0ACha27", fV0ASciWd/2.+2.*preShape7, v0APts);
    2258           1 :     new TGeoCompositeShape("sV0ACha127","sV0ACha17+sV0ACha27");
    2259           1 :     new TGeoTube("sV0ANail17Hole", 0.0, 0.4, 1.65);
    2260           1 :     TGeoTranslation *pos17 = new TGeoTranslation("pos17",0.51,-42.9,0.0);
    2261           1 :     pos17->RegisterYourself();
    2262           1 :     new TGeoTube("sV0ANail27Hole", 0.0, 0.4, 1.65);
    2263           1 :     TGeoTranslation *pos27 = new TGeoTranslation("pos27",30.05,-30.79,0.0);   
    2264           1 :     pos27->RegisterYourself();
    2265           1 :     new TGeoCompositeShape("sV0ANailsHoles7","sV0ANail17Hole:pos17+sV0ANail27Hole:pos27");
    2266           1 :     new TGeoCompositeShape("sV0ACha7","sV0ACha127+sV0ANailsHoles7");
    2267           1 :     new TGeoTubeSeg("sV0AFicR57", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShape7, 270.0, 315.0);
    2268           1 :     new TGeoTube("sV0ANail1PlaInHole7", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);    
    2269           1 :     new TGeoTube("sV0ANail1PlaOuHole7", 0.0, 0.4, (fV0APlaAl)/2.); 
    2270             : 
    2271             :     /// Frame
    2272           2 :     TGeoVolume *v0AFra7 = new TGeoVolumeAssembly("V0AFra7");
    2273           6 :     for (int i=0;i<2;i++) {
    2274           2 :     v0APts[0+8*i] = 0.;                              v0APts[1+8*i] = -fV0AR0-fV0AFraWd/2.;
    2275           2 :     v0APts[2+8*i] = fV0AFraWd/2.;                    v0APts[3+8*i] = -fV0AR0-fV0AFraWd/2.;
    2276           2 :     v0APts[4+8*i] = fV0AFraWd/2.;                    v0APts[5+8*i] = -fV0AR4+fV0AFraWd/2.;
    2277           2 :     v0APts[6+8*i] = 0.;                              v0APts[7+8*i] = -fV0AR4+fV0AFraWd/2.;
    2278             :     }
    2279           1 :     TGeoArb8 *sV0AFraB17 = new TGeoArb8("sV0AFraB17",fV0ASciWd/2.,v0APts);
    2280           1 :     TGeoVolume *v0AFraB17 = new TGeoVolume("V0AFraB17",sV0AFraB17,medV0AFra);
    2281           6 :     for (int i=0;i<2;i++) {
    2282           2 :     v0APts[0+8*i] = fV0AR0*cos45-fV0AFraWd;
    2283           2 :     v0APts[1+8*i] =  -(fV0AR0-fV0AFraWd)*sin45;
    2284           2 :     v0APts[2+8*i] = (fV0AR0-fV0AFraWd/2.)*cos45;
    2285           2 :     v0APts[3+8*i] = -(fV0AR0-fV0AFraWd/2.)*sin45;
    2286           2 :     v0APts[4+8*i] = (fV0AR4+fV0AFraWd/2.)*cos45/2.;
    2287           2 :     v0APts[5+8*i] = -fV0AR4*sin45/2.;
    2288           2 :     v0APts[6+8*i] = (fV0AR4+fV0AFraWd/4.)*cos45/2.;
    2289           2 :     v0APts[7+8*i] = -(fV0AR4+fV0AFraWd/2.)*sin45/2.;
    2290             :     }
    2291           1 :     TGeoArb8 *sV0AFraB27 = new TGeoArb8("sV0AFraB27", fV0ASciWd/2., v0APts);
    2292           1 :     TGeoVolume *v0AFraB27 = new TGeoVolume("V0AFraB27",sV0AFraB27,medV0AFra);
    2293           1 :     v0AFraB17->SetLineColor(kV0AColorFra); v0AFraB27->SetLineColor(kV0AColorFra);
    2294           1 :     v0AFra7->AddNode(v0AFraB17,1);
    2295           1 :     v0AFra7->AddNode(v0AFraB27,1);  // Prefer 2 GeoObjects insted of 3 GeoMovements
    2296           2 :     new TGeoTubeSeg( "sV0AFraR1b7", fV0AR0-fV0AFraWd/2.,
    2297           1 :              fV0AR0+fV0AFraWd/2., fV0ASciWd/2., 270.0, 315.0);
    2298           2 :     new TGeoTubeSeg( "sV0AFraR2b7", fV0AR1-fV0AFraWd/2.,
    2299           1 :              fV0AR1+fV0AFraWd/2., fV0ASciWd/2., 270.0, 315.0);
    2300           2 :     new TGeoTubeSeg( "sV0AFraR3b7", fV0AR2-fV0AFraWd/2.,
    2301           1 :              fV0AR2+fV0AFraWd/2., fV0ASciWd/2., 270.0, 315.0);
    2302           2 :     new TGeoTubeSeg( "sV0AFraR4b7", fV0AR3-fV0AFraWd/2.,
    2303           1 :              fV0AR3+fV0AFraWd/2., fV0ASciWd/2., 270.0, 315.0);
    2304           2 :     new TGeoTubeSeg( "sV0AFraR5b7", fV0AR4-fV0AFraWd/2.,
    2305           1 :              fV0AR4+fV0AFraWd/2., fV0ASciWd/2., 270.0, 315.0);
    2306           1 :     TGeoCompositeShape *sV0AFraR17 = new TGeoCompositeShape("sV0AFraR17","sV0AFraR1b7-sV0ACha7");
    2307           1 :     TGeoCompositeShape *sV0AFraR27 = new TGeoCompositeShape("sV0AFraR27","sV0AFraR2b7-sV0ACha7");
    2308           1 :     TGeoCompositeShape *sV0AFraR37 = new TGeoCompositeShape("sV0AFraR37","sV0AFraR3b7-sV0ACha7");
    2309           1 :     TGeoCompositeShape *sV0AFraR47 = new TGeoCompositeShape("sV0AFraR47","sV0AFraR4b7-sV0ACha7");
    2310           1 :     TGeoCompositeShape *sV0AFraR57 = new TGeoCompositeShape("sV0AFraR57","sV0AFraR5b7-sV0ACha7");
    2311           1 :     TGeoVolume *v0AFraR17 = new TGeoVolume("V0AFraR17",sV0AFraR17,medV0AFra);
    2312           1 :     TGeoVolume *v0AFraR27 = new TGeoVolume("V0AFraR27",sV0AFraR27,medV0AFra);
    2313           1 :     TGeoVolume *v0AFraR37 = new TGeoVolume("V0AFraR37",sV0AFraR37,medV0AFra);
    2314           1 :     TGeoVolume *v0AFraR47 = new TGeoVolume("V0AFraR47",sV0AFraR47,medV0AFra);
    2315           1 :     TGeoVolume *v0AFraR57 = new TGeoVolume("V0AFraR57",sV0AFraR57,medV0AFra);
    2316           1 :     v0AFraR17->SetLineColor(kV0AColorFra); v0AFraR27->SetLineColor(kV0AColorFra);
    2317           1 :     v0AFraR37->SetLineColor(kV0AColorFra); v0AFraR47->SetLineColor(kV0AColorFra);
    2318           1 :     v0AFraR57->SetLineColor(kV0AColorFra);
    2319           1 :     v0AFra7->AddNode(v0AFraR17,1);
    2320           1 :     v0AFra7->AddNode(v0AFraR27,1);
    2321           1 :     v0AFra7->AddNode(v0AFraR37,1);
    2322           1 :     v0AFra7->AddNode(v0AFraR47,1);
    2323           1 :     v0AFra7->AddNode(v0AFraR57,1);
    2324           1 :     v0ASec7->AddNode(v0AFra7,1);
    2325             : 
    2326             :     /// Sensitive scintilator
    2327           2 :     TGeoVolume *v0ASci7 = new TGeoVolumeAssembly("V0ASci7");
    2328           2 :     new TGeoTubeSeg( "sV0AR1b7", fV0AR0+fV0AFraWd/2.,
    2329           1 :              fV0AR1-fV0AFraWd/2., fV0ASciWd/2., 270.0, 315.0);
    2330           2 :     new TGeoTubeSeg( "sV0AR2b7", fV0AR1+fV0AFraWd/2.,
    2331           1 :              fV0AR2-fV0AFraWd/2., fV0ASciWd/2., 270.0, 315.0);
    2332           2 :     new TGeoTubeSeg( "sV0AR3b7", fV0AR2+fV0AFraWd/2.,
    2333           1 :              fV0AR3-fV0AFraWd/2., fV0ASciWd/2., 270.0, 315.0);
    2334           2 :     new TGeoTubeSeg( "sV0AR4b7", fV0AR3+fV0AFraWd/2.,
    2335           1 :              fV0AR4-fV0AFraWd/2., fV0ASciWd/2., 270.0, 315.0);
    2336           1 :     TGeoCompositeShape *sV0AR17 = new TGeoCompositeShape("sV0AR17","sV0AR1b7-sV0ACha7");
    2337           1 :     TGeoCompositeShape *sV0AR27 = new TGeoCompositeShape("sV0AR27","sV0AR2b7-sV0ACha7");
    2338           1 :     TGeoCompositeShape *sV0AR37 = new TGeoCompositeShape("sV0AR37","sV0AR3b7-sV0ACha7");
    2339           1 :     TGeoCompositeShape *sV0AR47 = new TGeoCompositeShape("sV0AR47","sV0AR4b7-sV0ACha7");
    2340           1 :     TGeoVolume *v0L17 = new TGeoVolume("V0L17",sV0AR17,medV0ASci);
    2341           1 :     TGeoVolume *v0L27 = new TGeoVolume("V0L27",sV0AR27,medV0ASci);
    2342           1 :     TGeoVolume *v0L37 = new TGeoVolume("V0L37",sV0AR37,medV0ASci);
    2343           1 :     TGeoVolume *v0L47 = new TGeoVolume("V0L47",sV0AR47,medV0ASci);
    2344           1 :     v0L17->SetLineColor(kV0AColorSci); v0L27->SetLineColor(kV0AColorSci);
    2345           1 :     v0L37->SetLineColor(kV0AColorSci); v0L47->SetLineColor(kV0AColorSci);
    2346           1 :     v0ASci7->AddNode(v0L17,1);
    2347           1 :     v0ASci7->AddNode(v0L27,1);
    2348           1 :     v0ASci7->AddNode(v0L37,1);
    2349           1 :     v0ASci7->AddNode(v0L47,1);
    2350             :     
    2351             :     // Bunch of fibers
    2352           6 :     for (int i=0;i<2;i++) {
    2353           2 :     v0APts[0+8*i] = -10.0;            v0APts[1+8*i] = 13.1;
    2354           2 :     v0APts[2+8*i] = 10.0;            v0APts[3+8*i] = 13.1;
    2355           2 :     v0APts[4+8*i] = 8.0;            v0APts[5+8*i] = -29.0;
    2356           2 :     v0APts[6+8*i] = -12.0;            v0APts[7+8*i] = -12.0;
    2357             :     }   
    2358           1 :     new TGeoArb8("sV0AFib17", 0.01, v0APts);      
    2359           1 :     rot = new TGeoRotation("rot");
    2360           1 :     rot->RotateX(-2.0); 
    2361           1 :     rot->RotateY(0.0);
    2362           1 :     rot->RotateZ(248.0);
    2363           1 :     TGeoCombiTrans *fib17pos = new TGeoCombiTrans("fib17pos", 40.0 - 3.3, -50.0 + 1.5, 0.5, rot);
    2364           1 :     fib17pos->RegisterYourself();
    2365           1 :     TGeoCompositeShape *sV0AFib17Hole = new TGeoCompositeShape("sV0AFib17Hole", "sV0AFib17:fib17pos-sV0AFicR57");
    2366           1 :     TGeoVolume *v0AFib17Hole = new TGeoVolume("V0AFib17Hole",sV0AFib17Hole,medV0AFib);
    2367           1 :     v0AFib17Hole->SetLineColor(kV0AColorFib);
    2368           1 :     new TGeoArb8("sV0AFib27", 0.01, v0APts);      
    2369           1 :     rot = new TGeoRotation("rot");
    2370           1 :     rot->RotateX(2.0); 
    2371           1 :     rot->RotateY(0.0);
    2372           1 :     rot->RotateZ(248.0);
    2373           1 :     TGeoCombiTrans *fib27pos = new TGeoCombiTrans("fib27pos", 40.0 - 3.3, -50.0 + 1.5, -0.5, rot);
    2374           1 :     fib27pos->RegisterYourself();
    2375           1 :     TGeoCompositeShape *sV0AFib27Hole = new TGeoCompositeShape("sV0AFib27Hole", "sV0AFib27:fib27pos-sV0AFicR57");
    2376           1 :     TGeoVolume *v0AFib27Hole = new TGeoVolume("V0AFib27Hole",sV0AFib27Hole,medV0AFib);
    2377           1 :     v0AFib27Hole->SetLineColor(kV0AColorFib);
    2378           2 :     TGeoVolume *v0AFib7 = new TGeoVolumeAssembly("V0AFib7");
    2379           1 :     v0AFib7->AddNode(v0AFib17Hole,1); 
    2380           1 :     v0AFib7->AddNode(v0AFib27Hole,1);
    2381           1 :     v0ASec7->AddNode(v0AFib7,1);
    2382             : 
    2383             :     /// Non-sensitive scintilator
    2384           1 :     new TGeoTubeSeg("sV0AR5S27", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShape7, 270.0, 315.0);
    2385           1 :     TGeoCompositeShape *sV0AR57 = new TGeoCompositeShape("V0AR57","sV0AR5S27 - sV0ACha7");
    2386           1 :     TGeoVolume *v0AR57 = new TGeoVolume("V0AR57",sV0AR57,medV0ASci);
    2387           1 :     v0AR57->SetLineColor(kV0AColorSci);
    2388           1 :     v0ASci7->AddNode(v0AR57,1);
    2389           1 :     v0ASec7->AddNode(v0ASci7,1);
    2390             : 
    2391             :     /// Segment of octagon   
    2392           6 :     for (int i=0;i<2;i++) {
    2393           2 :     v0APts[0+8*i] = 0.;                          v0APts[1+8*i] = -fV0AR7*sin654;
    2394           2 :     v0APts[2+8*i] = 0.;                          v0APts[3+8*i] = -(fV0AR7-fV0AOctH2)*sin654;
    2395           2 :     v0APts[4+8*i] = (fV0AR7-fV0AOctH2)*cos654;   v0APts[5+8*i] = -(fV0AR7-fV0AOctH2)*sin654;
    2396           2 :     v0APts[6+8*i] = fV0AR7*cos654;               v0APts[7+8*i] = -fV0AR7*sin654;
    2397             :     }
    2398           1 :     TGeoArb8 *sV0AOct27 = new TGeoArb8("sV0AOct27", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
    2399           1 :     TGeoVolume *v0AOct27 = new TGeoVolume("V0AOct27", sV0AOct27,medV0ASup);
    2400           1 :     v0AOct27->SetLineColor(kV0AColorOct);
    2401           2 :     TGeoVolume *v0ASup7 = new TGeoVolumeAssembly("V0ASup7");
    2402           1 :     v0ASup7->AddNode(v0AOct27,1);
    2403           1 :     v0ASec7->AddNode(v0ASup7,1);
    2404             : 
    2405             :     /// Plates
    2406           6 :     for (int i=0;i<2;i++) {
    2407           2 :     v0APts[0+8*i] = 0.;                 v0APts[1+8*i] = -fV0AR7*sin654;
    2408           2 :     v0APts[2+8*i] = 0.;                 v0APts[3+8*i] = -fV0AR0;
    2409           2 :     v0APts[4+8*i] = fV0AR0*cos654;      v0APts[5+8*i] = -fV0AR0*sin654;
    2410           2 :     v0APts[6+8*i] = fV0AR7*cos654;      v0APts[7+8*i] = -fV0AR7*sin654;
    2411             :     }
    2412           1 :     new TGeoArb8("sV0APlaIn7", (fV0APlaWd-2*fV0APlaAl)/2., v0APts);
    2413           1 :     TGeoCompositeShape *sV0APlaInNailsHoles7 = new TGeoCompositeShape("sV0APlaInNailsHoles7","sV0APlaIn7-sV0ANail1PlaInHole7:pos17");
    2414           1 :     TGeoVolume *v0APlaInNailsHoles7 = new TGeoVolume("V0APlaInNailsHoles7", sV0APlaInNailsHoles7, medV0APlaIn);
    2415           1 :     new TGeoArb8("sV0APlaOu7", fV0APlaAl/2., v0APts);
    2416           1 :     TGeoCompositeShape *sV0APlaOuNailsHoles7 = new TGeoCompositeShape("sV0APlaOuNailsHoles7","sV0APlaOu7-sV0ANail1PlaOuHole7:pos17"); 
    2417           1 :     TGeoVolume *v0APlaOuNailsHoles7 = new TGeoVolume("V0APlaOuNailsHoles7", sV0APlaOuNailsHoles7, medV0APlaOu);
    2418           1 :     v0APlaInNailsHoles7->SetLineColor(kV0AColorPlaIn); v0APlaOuNailsHoles7->SetLineColor(kV0AColorPlaOu);
    2419           2 :     TGeoVolume *v0APla7 = new TGeoVolumeAssembly("V0APla7");
    2420           1 :     v0APla7->AddNode(v0APlaInNailsHoles7,1);
    2421           2 :     v0APla7->AddNode(v0APlaOuNailsHoles7,1,new TGeoTranslation(0,0,(fV0APlaWd-fV0APlaAl)/2.));
    2422           2 :     v0APla7->AddNode(v0APlaOuNailsHoles7,2,new TGeoTranslation(0,0,-(fV0APlaWd-fV0APlaAl)/2.));
    2423           2 :     v0ASec7->AddNode(v0APla7,1,new TGeoTranslation(0,0,(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    2424           2 :     v0ASec7->AddNode(v0APla7,2,new TGeoTranslation(0,0,-(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    2425             :     
    2426             :     /// PMBox  
    2427           2 :     TGeoVolume* v0APM7 = new TGeoVolumeAssembly("V0APM7");
    2428           1 :     new TGeoBBox("sV0APMB17", fV0APMBWd/2., fV0APMBHt/2., fV0APMBTh/2.);
    2429           1 :     new TGeoBBox("sV0APMB27", fV0APMBWd/2.-fV0APMBWdW, fV0APMBHt/2.-fV0APMBHtW, fV0APMBTh/2.-fV0APMBThW);
    2430           1 :     TGeoCompositeShape *sV0APMB7 = new TGeoCompositeShape("sV0APMB7","sV0APMB17-sV0APMB27");
    2431           1 :     TGeoVolume *v0APMB7 = new TGeoVolume("V0APMB7",sV0APMB7, medV0APMAlum);
    2432           1 :     v0APMB7->SetLineColor(kV0AColorPMA);
    2433           1 :     v0APM7->AddNode(v0APMB7,1);
    2434             :     
    2435             :     /// PMTubes 
    2436           1 :     TGeoTube *sV0APMT17 = new TGeoTube("sV0APMT17", fV0APMTR1, fV0APMTR2, fV0APMTH/2.);
    2437           1 :     TGeoVolume *v0APMT17 = new TGeoVolume("V0APMT17", sV0APMT17, medV0APMGlass);
    2438           1 :     TGeoTube *sV0APMT27 = new TGeoTube("sV0APMT27", fV0APMTR3, fV0APMTR4, fV0APMTH/2.);
    2439           1 :     TGeoVolume *v0APMT27 = new TGeoVolume("V0APMT27", sV0APMT27, medV0APMAlum);
    2440           2 :     TGeoVolume *v0APMT7 = new TGeoVolumeAssembly("V0APMT7"); // pk si no choca con la 752 o con la 794
    2441           1 :     TGeoTube *sV0APMTT7 = new TGeoTube("sV0APMTT7", 0., fV0APMTR4, fV0APMTB/2.);
    2442           1 :     TGeoVolume *v0APMTT7 = new TGeoVolume("V0APMTT7", sV0APMTT7, medV0APMAlum);
    2443           1 :     v0APMT7->SetLineColor(kV0AColorPMG);
    2444           1 :     v0APMT27->SetLineColor(kV0AColorPMA);
    2445           1 :     v0APMTT7->SetLineColor(kV0AColorPMA);
    2446           1 :     rot = new TGeoRotation("rot", 90, 0, 180, 0, 90, 90);
    2447           1 :     v0APMT7->AddNode(v0APMT17,1,rot);
    2448           1 :     v0APMT7->AddNode(v0APMT27,1,rot);
    2449           2 :     v0APMT7->AddNode(v0APMTT7,1,new TGeoCombiTrans(0,(fV0APMTH+fV0APMTB)/2.,0,rot));
    2450           2 :     v0APM7->AddNode(v0APMT7, 1, new TGeoTranslation(-1.5*autoShiftSec1, 0, 0));
    2451           2 :     v0APM7->AddNode(v0APMT7, 2, new TGeoTranslation(-0.5*autoShiftSec1, 0, 0));
    2452           2 :     v0APM7->AddNode(v0APMT7, 3, new TGeoTranslation(+0.5*autoShiftSec1, 0, 0));
    2453           2 :     v0APM7->AddNode(v0APMT7, 4, new TGeoTranslation(+1.5*autoShiftSec1, 0, 0));
    2454             : 
    2455             :     /// PM 
    2456           1 :     rot = new TGeoRotation("rot");
    2457           1 :     rot->RotateX(-90+30);
    2458           1 :     rot->RotateY(0);
    2459           1 :     rot->RotateZ(65+3);
    2460           1 :     double shiftZ7 = fV0APMBHt/2. * cosAngPMBSec1
    2461           1 :       -   ( fV0ASciWd + 2 * fV0AOctWd + 2 * fV0APlaWd )/2.   -   fV0APMBTh/2. * sinAngPMBSec1;
    2462           1 :     double shiftR7 = fV0AR6  + fV0AR1 + fV0AOctWd + fV0APlaAl/3.;
    2463           2 :     v0ASec7->AddNode(v0APM7,1, new TGeoCombiTrans( shiftR7*cos45+1.3, -shiftR7*sin45, shiftZ7, rot)); 
    2464             :     
    2465             :     // Aluminium nail
    2466           1 :     TGeoTube *sV0ANail71 = new TGeoTube("sV0ANail71", 0.0, 0.4, 5.09/2.);
    2467           1 :     TGeoVolume *v0ANail71 = new TGeoVolume("V0ANail71", sV0ANail71, medV0APMAlum);
    2468           1 :     v0ANail71->SetLineColor(kV0AColorPMA);// this is the color for aluminium
    2469           2 :     v0ASec7->AddNode(v0ANail71,1,new TGeoTranslation(0.51,-42.9,0.0));
    2470           1 :     TGeoTube *sV0ANail72 = new TGeoTube("sV0ANail72", 0.0, 0.4, 5.09/2.);
    2471           1 :     TGeoVolume *v0ANail72 = new TGeoVolume("V0ANail72", sV0ANail72, medV0APMAlum);
    2472           1 :     v0ANail72->SetLineColor(kV0AColorPMA);
    2473           2 :     v0ASec7->AddNode(v0ANail72,1,new TGeoTranslation(30.05,-30.79,0.0));  
    2474             : 
    2475             :     // Support
    2476           1 :     TGeoBBox *sV0ASuppbr = new TGeoBBox("sV0ASuppbr", 2.0, 18.13, fV0ASciWd/2.);      
    2477           1 :     TGeoVolume *v0ASuppbr = new TGeoVolume("V0ASuppbr", sV0ASuppbr, medV0ASup);
    2478           1 :     v0ASuppbr->SetLineColor(kV0AColorOct);
    2479           2 :     v0ASec7->AddNode(v0ASuppbr,1,new TGeoTranslation(2.0,-63.64,0.0));
    2480             :     
    2481             :     // Adding sector to v0LE volume 
    2482           1 :     v0LE->AddNode(v0ASec7,1);
    2483             :     
    2484             : 
    2485             :    //Definition of sector 8
    2486           2 :    TGeoVolume *v0ASec8 = new TGeoVolumeAssembly("V0ASec8"); 
    2487             :   
    2488             :   /// For boolean sustraction
    2489             :       double preShape8 = 0.2;
    2490           6 :       for (int i=0;i<2;i++) {
    2491           2 :       v0APts[0+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[1+8*i] = -2*preShape8;
    2492           2 :       v0APts[2+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[3+8*i] = 0.0;
    2493           2 :       v0APts[4+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[5+8*i] = 0.0;
    2494           2 :       v0APts[6+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[7+8*i] = -2*preShape8;
    2495             :     }
    2496           1 :     new TGeoArb8("sV0ACha18",fV0ASciWd/1.5,v0APts);
    2497           6 :     for (int i=0;i<2;i++) {
    2498           2 :       v0APts[0+8*i] = (fV0AR0-fV0AFraWd/2.)*sin45-preShape8;
    2499           2 :       v0APts[1+8*i] = -(fV0AR0-fV0AFraWd/2.)*sin45;
    2500           2 :       v0APts[2+8*i] = fV0AR0*sin45-fV0AFraWd/2.-preShape8;
    2501           2 :       v0APts[3+8*i] = -(fV0AR0-fV0AFraWd)*sin45+preShape8;
    2502           2 :       v0APts[4+8*i] = (fV0AR4+3*fV0AFraWd/2.)*sin45+preShape8;
    2503           2 :       v0APts[5+8*i] = -fV0AR4*sin45-preShape8;
    2504           2 :       v0APts[6+8*i] = (fV0AR4+fV0AFraWd)*sin45+preShape8; 
    2505           2 :       v0APts[7+8*i] = -(fV0AR4+fV0AFraWd/2.)*sin45-2.*preShape8;
    2506             :     }
    2507           1 :     new TGeoArb8("sV0ACha28", fV0ASciWd/2.+2.*preShape8, v0APts);
    2508           1 :     new TGeoCompositeShape("sV0ACha128","sV0ACha18+sV0ACha28");
    2509           1 :     new TGeoTube("sV0ANail18Hole", 0.0, 0.4, 1.65);
    2510           1 :     TGeoTranslation *pos18 = new TGeoTranslation("pos18",42.9,-.51,0.0);
    2511           1 :     pos18->RegisterYourself();
    2512           1 :     new TGeoTube("sV0ANail28Hole", 0.0, 0.4, 1.65);
    2513           1 :     TGeoTranslation *pos28 = new TGeoTranslation("pos28",30.8,-30.04,0.0);
    2514           1 :     pos28->RegisterYourself();    
    2515           1 :     TGeoTranslation *pos38 = new TGeoTranslation("pos38",30.05,-30.79,0.0);  
    2516           1 :     pos38->RegisterYourself();
    2517           1 :     new TGeoCompositeShape("sV0ANailsHoles8","sV0ANail18Hole:pos18+sV0ANail28Hole:pos28");
    2518           1 :     new TGeoCompositeShape("sV0ACha8","sV0ACha128+sV0ANailsHoles8");
    2519           1 :     new TGeoTubeSeg("sV0AFicR58", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2. +2*preShape8, 315.0, 360.0);
    2520           1 :     new TGeoTube("sV0ANail1PlaInHole8", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
    2521           1 :     new TGeoTube("sV0ANail2PlaInHole8", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
    2522           1 :     new TGeoTube("sV0ANail3PlaInHole8", 0.0, 0.4, (fV0APlaWd-2*fV0APlaAl)/2.);
    2523           1 :     new TGeoCompositeShape("sV0ANailsPlaInHoles8","sV0ANail1PlaInHole8:pos18+sV0ANail2PlaInHole8:pos28+sV0ANail3PlaInHole8:pos38");
    2524           1 :     new TGeoTube("sV0ANail1PlaOuHole8", 0.0, 0.4, (fV0APlaAl)/2.);
    2525           1 :     new TGeoTube("sV0ANail2PlaOuHole8", 0.0, 0.4, (fV0APlaAl)/2.);
    2526           1 :     new TGeoTube("sV0ANail3PlaOuHole8", 0.0, 0.4, (fV0APlaAl)/2.);
    2527           1 :     new TGeoCompositeShape("sV0ANailsPlaOuHoles8","sV0ANail1PlaOuHole8:pos18+sV0ANail2PlaOuHole8:pos28+sV0ANail3PlaOuHole8:pos38");
    2528             :     
    2529             :     /// Frame 
    2530           2 :     TGeoVolume *v0AFra8 = new TGeoVolumeAssembly("V0AFra8"); 
    2531           6 :     for (int i=0;i<2;i++) {
    2532           2 :       v0APts[0+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[1+8*i] = 0.0;
    2533           2 :       v0APts[2+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[3+8*i] = 0.0;
    2534           2 :       v0APts[4+8*i] = fV0AR4+fV0AFraWd/2.;  v0APts[5+8*i] = -fV0AFraWd/8.;
    2535           2 :       v0APts[6+8*i] = fV0AR0-fV0AFraWd/2.;  v0APts[7+8*i] = -fV0AFraWd/8.;
    2536             :     }    
    2537           1 :     TGeoArb8 *sV0AFraB18 = new TGeoArb8("sV0AFraB18",fV0ASciWd/2.,v0APts);
    2538           1 :     TGeoVolume *v0AFraB18 = new TGeoVolume("V0AFraB18",sV0AFraB18,medV0AFra);  
    2539           6 :     for (int i=0;i<2;i++) {
    2540           2 :       v0APts[0+8*i] = (fV0AR0-fV0AFraWd/4.)*sin45;
    2541           2 :       v0APts[1+8*i] = -(fV0AR0-fV0AFraWd/2.)*sin45; 
    2542           2 :       v0APts[2+8*i] = fV0AR0*sin45-fV0AFraWd/2.; 
    2543           2 :       v0APts[3+8*i] = -(fV0AR0-fV0AFraWd)*sin45;
    2544           2 :       v0APts[4+8*i] = (fV0AR4+3*fV0AFraWd/2.)*sin45/2.;
    2545           2 :       v0APts[5+8*i] = -fV0AR4*sin45/2.;
    2546           2 :       v0APts[6+8*i] = (fV0AR4+fV0AFraWd)*sin45/2.;
    2547           2 :       v0APts[7+8*i] = -(fV0AR4+fV0AFraWd/2.)*sin45/2.;
    2548             :     }
    2549           1 :     TGeoArb8 *sV0AFraB28 = new TGeoArb8("sV0AFraB28", fV0ASciWd/2., v0APts);
    2550           1 :     TGeoVolume *v0AFraB28 = new TGeoVolume("V0AFraB28",sV0AFraB28,medV0AFra);
    2551           1 :     v0AFraB18->SetLineColor(kV0AColorFra); v0AFraB28->SetLineColor(kV0AColorFra);
    2552           1 :     v0AFra8->AddNode(v0AFraB18,1);
    2553           1 :     v0AFra8->AddNode(v0AFraB28,1);  // Prefer 2 GeoObjects insted of 3 GeoMovements
    2554           2 :     new TGeoTubeSeg( "sV0AFraR1b8", fV0AR0-fV0AFraWd/2.,
    2555           1 :                      fV0AR0+fV0AFraWd/2., fV0ASciWd/2., 315.0, 360.0);
    2556           2 :     new TGeoTubeSeg( "sV0AFraR2b8", fV0AR1-fV0AFraWd/2.,
    2557           1 :                      fV0AR1+fV0AFraWd/2., fV0ASciWd/2., 315.0, 360.0);
    2558           2 :     new TGeoTubeSeg( "sV0AFraR3b8", fV0AR2-fV0AFraWd/2.,
    2559           1 :                      fV0AR2+fV0AFraWd/2., fV0ASciWd/2., 315.0, 360.0);
    2560           2 :     new TGeoTubeSeg( "sV0AFraR4b8", fV0AR3-fV0AFraWd/2.,
    2561           1 :                      fV0AR3+fV0AFraWd/2., fV0ASciWd/2., 315.0, 360.0);
    2562           2 :     new TGeoTubeSeg( "sV0AFraR5b8", fV0AR4-fV0AFraWd/2.,
    2563           1 :                      fV0AR4+fV0AFraWd/2., fV0ASciWd/2., 315.0, 360.0);
    2564           1 :     TGeoCompositeShape *sV0AFraR18 = new TGeoCompositeShape("sV0AFraR18","sV0AFraR1b8-sV0ACha8");
    2565           1 :     TGeoCompositeShape *sV0AFraR28 = new TGeoCompositeShape("sV0AFraR28","sV0AFraR2b8-sV0ACha8");
    2566           1 :     TGeoCompositeShape *sV0AFraR38 = new TGeoCompositeShape("sV0AFraR38","sV0AFraR3b8-sV0ACha8");
    2567           1 :     TGeoCompositeShape *sV0AFraR48 = new TGeoCompositeShape("sV0AFraR48","sV0AFraR4b8-sV0ACha8");
    2568           1 :     TGeoCompositeShape *sV0AFraR58 = new TGeoCompositeShape("sV0AFraR58","sV0AFraR5b8-sV0ACha8");
    2569           1 :     TGeoVolume *v0AFraR18 = new TGeoVolume("V0AFraR18",sV0AFraR18,medV0AFra);
    2570           1 :     TGeoVolume *v0AFraR28 = new TGeoVolume("V0AFraR28",sV0AFraR28,medV0AFra);
    2571           1 :     TGeoVolume *v0AFraR38 = new TGeoVolume("V0AFraR38",sV0AFraR38,medV0AFra);
    2572           1 :     TGeoVolume *v0AFraR48 = new TGeoVolume("V0AFraR48",sV0AFraR48,medV0AFra);
    2573           1 :     TGeoVolume *v0AFraR58 = new TGeoVolume("V0AFraR58",sV0AFraR58,medV0AFra);
    2574           1 :     v0AFraR18->SetLineColor(kV0AColorFra); v0AFraR28->SetLineColor(kV0AColorFra);
    2575           1 :     v0AFraR38->SetLineColor(kV0AColorFra); v0AFraR48->SetLineColor(kV0AColorFra);
    2576           1 :     v0AFraR58->SetLineColor(kV0AColorFra);
    2577           1 :     v0AFra8->AddNode(v0AFraR18,1);
    2578           1 :     v0AFra8->AddNode(v0AFraR28,1);
    2579           1 :     v0AFra8->AddNode(v0AFraR38,1);
    2580           1 :     v0AFra8->AddNode(v0AFraR48,1);
    2581           1 :     v0AFra8->AddNode(v0AFraR58,1);
    2582           1 :     v0ASec8->AddNode(v0AFra8,1);
    2583             : 
    2584             :     /// Sensitive scintilator
    2585           2 :     TGeoVolume *v0ASci8 = new TGeoVolumeAssembly("V0ASci8");
    2586           2 :     new TGeoTubeSeg( "sV0AR1b8", fV0AR0+fV0AFraWd/2.,
    2587           1 :                      fV0AR1-fV0AFraWd/2., fV0ASciWd/2., 315.0, 360.0);
    2588           2 :     new TGeoTubeSeg( "sV0AR2b8", fV0AR1+fV0AFraWd/2.,
    2589           1 :                      fV0AR2-fV0AFraWd/2., fV0ASciWd/2., 315.0, 360.0);
    2590           2 :     new TGeoTubeSeg( "sV0AR3b8", fV0AR2+fV0AFraWd/2.,
    2591           1 :                      fV0AR3-fV0AFraWd/2., fV0ASciWd/2., 315.0, 360.0);
    2592           2 :     new TGeoTubeSeg( "sV0AR4b8", fV0AR3+fV0AFraWd/2.,
    2593           1 :                      fV0AR4-fV0AFraWd/2., fV0ASciWd/2., 315.0, 360.0);
    2594           1 :     TGeoCompositeShape *sV0AR18 = new TGeoCompositeShape("sV0AR18","sV0AR1b8-sV0ACha8");
    2595           1 :     TGeoCompositeShape *sV0AR28 = new TGeoCompositeShape("sV0AR28","sV0AR2b8-sV0ACha8");
    2596           1 :     TGeoCompositeShape *sV0AR38 = new TGeoCompositeShape("sV0AR38","sV0AR3b8-sV0ACha8");
    2597           1 :     TGeoCompositeShape *sV0AR48 = new TGeoCompositeShape("sV0AR48","sV0AR4b8-sV0ACha8");
    2598           1 :     TGeoVolume *v0L18 = new TGeoVolume("V0L18",sV0AR18,medV0ASci);
    2599           1 :     TGeoVolume *v0L28 = new TGeoVolume("V0L28",sV0AR28,medV0ASci);
    2600           1 :     TGeoVolume *v0L38 = new TGeoVolume("V0L38",sV0AR38,medV0ASci);
    2601           1 :     TGeoVolume *v0L48 = new TGeoVolume("V0L48",sV0AR48,medV0ASci);
    2602           1 :     v0L18->SetLineColor(kV0AColorSci); v0L28->SetLineColor(kV0AColorSci);
    2603           1 :     v0L38->SetLineColor(kV0AColorSci); v0L48->SetLineColor(kV0AColorSci);
    2604           1 :     v0ASci8->AddNode(v0L18,1);
    2605           1 :     v0ASci8->AddNode(v0L28,1);
    2606           1 :     v0ASci8->AddNode(v0L38,1);
    2607           1 :     v0ASci8->AddNode(v0L48,1); 
    2608             : 
    2609             :     /// Segment of octagon   
    2610           6 :     for (int i=0;i<2;i++) {
    2611           2 :     v0APts[0+8*i] = fV0AR6;                      v0APts[1+8*i] = 0.;
    2612           2 :     v0APts[2+8*i] = fV0AR7*cos654;               v0APts[3+8*i] = -fV0AR7*sin654;
    2613           2 :     v0APts[4+8*i] = (fV0AR7-fV0AOctH2)*cos654;   v0APts[5+8*i] = -(fV0AR7-fV0AOctH2)*sin654;
    2614           2 :     v0APts[6+8*i] = fV0AR6-fV0AOctH2;            v0APts[7+8*i] = 0.;
    2615             :     }
    2616           1 :     new TGeoArb8("sV0AOct28", (fV0ASciWd+2*fV0AOctWd)/2., v0APts);
    2617           1 :     TGeoCompositeShape *sV0AOct2FEEB8 = new TGeoCompositeShape("sV0AOct2FEEB8","sV0AOct28-sV0AFicFEEBSec1:posFicFEEBSec1-sV0AFicOct2Sec1:posFicOct2Sec1");
    2618           1 :     TGeoVolume *v0AOct28 = new TGeoVolume("V0AOct28", sV0AOct2FEEB8,medV0ASup);
    2619           1 :     v0AOct28->SetLineColor(kV0AColorOct);
    2620           2 :     TGeoVolume *v0ASup8 = new TGeoVolumeAssembly("V0ASup8");
    2621           1 :     v0ASup8->AddNode(v0AOct28,1);
    2622           1 :     v0ASec8->AddNode(v0ASup8,1);
    2623             : 
    2624             :     //Bunch of fibers
    2625           1 :     v0APts[ 0] = v0APts[ 2] = -14.0;
    2626           1 :     v0APts[ 1] = v0APts[ 7] = (fV0ASciWd+fV0AOctWd)/2.-0.01;
    2627           1 :     v0APts[ 3] = v0APts[ 5] = (fV0ASciWd+fV0AOctWd)/2.+0.01;
    2628           1 :     v0APts[ 4] = v0APts[ 6] = +14.0;
    2629           1 :     v0APts[ 8] = v0APts[10] = -10.0;
    2630           1 :     v0APts[ 9] = v0APts[15] = 0.;
    2631           1 :     v0APts[11] = v0APts[13] = 0.25;
    2632           1 :     v0APts[12] = v0APts[14] = +10.0;
    2633           1 :     new TGeoArb8("sV0AFib18", 11.8, v0APts); 
    2634           1 :     rot = new TGeoRotation("rot");
    2635           1 :     rot->RotateX(-90);
    2636           1 :     rot->RotateZ(-90-22.5);
    2637           1 :     TGeoCombiTrans *fib18pos = new TGeoCombiTrans("fib18pos", (fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. - 3.3, -(fV0AR6-fV0AOctH2+fV0AR5)*sin225/2. + 1.5, 0, rot);
    2638           1 :     fib18pos->RegisterYourself();
    2639           1 :     TGeoCompositeShape *sV0AFib18Hole = new TGeoCompositeShape("sV0AFib18Hole", "sV0AFib18:fib18pos-sV0AFicR58");
    2640           1 :     TGeoVolume *v0AFib18Hole = new TGeoVolume("V0AFib18",sV0AFib18Hole,medV0AFib);
    2641           1 :     v0AFib18Hole->SetLineColor(kV0AColorFib);
    2642           1 :     new TGeoArb8("sV0AFib28", 11.8, v0APts);
    2643           1 :     rot = new TGeoRotation("rot");
    2644           1 :     rot->RotateX(-90);
    2645           1 :     rot->RotateY(180);
    2646           1 :     rot->RotateZ(-90-22.5);
    2647           1 :     TGeoCombiTrans *fib28pos = new TGeoCombiTrans("fib28pos", (fV0AR6-fV0AOctH2+fV0AR5)*cos225/2. - 3.3, -(fV0AR6-fV0AOctH2+fV0AR5)*sin225/2. + 1.5, 0, rot);
    2648           1 :     fib28pos->RegisterYourself();
    2649           1 :     TGeoCompositeShape *sV0AFib28Hole = new TGeoCompositeShape("sV0AFib28Hole", "sV0AFib28:fib28pos-sV0AFicR58");
    2650           1 :     TGeoVolume *v0AFib28Hole = new TGeoVolume("V0AFib28Hole",sV0AFib28Hole,medV0AFib);
    2651           1 :     v0AFib28Hole->SetLineColor(kV0AColorFib);
    2652           2 :     TGeoVolume *v0AFib8 = new TGeoVolumeAssembly("V0AFib8");    
    2653           1 :     v0AFib8->AddNode(v0AFib18Hole,1);
    2654           1 :     v0AFib8->AddNode(v0AFib28Hole,1);
    2655           1 :     v0ASec8->AddNode(v0AFib8,1);
    2656             :              
    2657             :     /// Non-sensitive scintilator   
    2658           1 :     new TGeoTubeSeg("sV0AR5S28", fV0AR4+fV0AFraWd/2., fV0AR4 + fV0AR0, fV0ASciWd/2.+2*preShape8, 315.0, 360.0);
    2659           1 :     TGeoCompositeShape *sV0AR58 = new TGeoCompositeShape("V0AR58","sV0AR5S28 - sV0ACha8");
    2660           1 :     TGeoVolume *v0AR58 = new TGeoVolume("V0AR58",sV0AR58,medV0ASci);
    2661           1 :     v0AR58->SetLineColor(kV0AColorSci);
    2662           1 :     v0ASci8->AddNode(v0AR58,1);
    2663           1 :     v0ASec8->AddNode(v0ASci8,1); 
    2664             :     
    2665             :     /// Plates
    2666           6 :     for (int i=0;i<2;i++) {
    2667           2 :       v0APts[0+8*i] = fV0AR0;                   v0APts[1+8*i] = 0.;
    2668           2 :       v0APts[2+8*i] = fV0AR6;                   v0APts[3+8*i] = 0.;
    2669           2 :       v0APts[4+8*i] = fV0AR7*cos654;            v0APts[5+8*i] = -fV0AR7*sin654;
    2670           2 :       v0APts[6+8*i] = fV0AR0*cos654;            v0APts[7+8*i] = -fV0AR0*sin654;
    2671             :     }
    2672           1 :     new TGeoArb8("sV0APlaIn8", (fV0APlaWd-2*fV0APlaAl)/2., v0APts);
    2673           1 :     TGeoCompositeShape *sV0APlaInNailsHoles8 = new TGeoCompositeShape("sV0APlaInNailsHoles8","sV0APlaIn8-sV0ANailsPlaInHoles8-sV0AFicFEEBSec1:posFicFEEBSec1");
    2674           1 :     TGeoVolume *v0APlaInNailsHoles8 = new TGeoVolume("V0APlaInNailsHoles8", sV0APlaInNailsHoles8, medV0APlaIn);
    2675           1 :     new TGeoArb8("sV0APlaOu8", fV0APlaAl/2., v0APts);
    2676           1 :     TGeoCompositeShape *sV0APlaOuNailsHoles8 = new TGeoCompositeShape("sV0APlaOuNailsHoles8","sV0APlaOu8-sV0ANailsPlaOuHoles8-sV0AFicFEEBSec1:posFicFEEBSec1"); 
    2677           1 :     TGeoVolume *v0APlaOuNailsHoles8 = new TGeoVolume("V0APlaOuNailsHoles8", sV0APlaOuNailsHoles8, medV0APlaOu);
    2678           1 :     v0APlaInNailsHoles8->SetLineColor(kV0AColorPlaIn); v0APlaOuNailsHoles8->SetLineColor(kV0AColorPlaOu);
    2679           2 :     TGeoVolume *v0APla8 = new TGeoVolumeAssembly("V0APla8");
    2680           1 :     v0APla8->AddNode(v0APlaInNailsHoles8,1);
    2681           2 :     v0APla8->AddNode(v0APlaOuNailsHoles8,1,new TGeoTranslation(0,0,(fV0APlaWd-fV0APlaAl)/2.));
    2682           2 :     v0APla8->AddNode(v0APlaOuNailsHoles8,2,new TGeoTranslation(0,0,-(fV0APlaWd-fV0APlaAl)/2.));
    2683           2 :     v0ASec8->AddNode(v0APla8,1,new TGeoTranslation(0,0,(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    2684           2 :     v0ASec8->AddNode(v0APla8,2,new TGeoTranslation(0,0,-(fV0ASciWd+2*fV0AOctWd+fV0APlaWd)/2.));
    2685             : 
    2686             :     /// PMBox 
    2687           2 :     TGeoVolume* v0APM8 = new TGeoVolumeAssembly("V0APM1");
    2688           1 :     new TGeoBBox("sV0APMB18", fV0APMBWd/2., fV0APMBHt/2., fV0APMBTh/2.);
    2689           1 :     new TGeoBBox("sV0APMB28", fV0APMBWd/2.-fV0APMBWdW, fV0APMBHt/2.-fV0APMBHtW, fV0APMBTh/2.-fV0APMBThW);
    2690           1 :     TGeoCompositeShape *sV0APMB8 = new TGeoCompositeShape("sV0APMB8","sV0APMB18-sV0APMB28");
    2691           1 :     TGeoVolume *v0APMB8 = new TGeoVolume("V0APMB8",sV0APMB8, medV0APMAlum);
    2692           1 :     v0APMB8->SetLineColor(kV0AColorPMA);
    2693           1 :     v0APM8->AddNode(v0APMB8,1);
    2694             : 
    2695             :     /// PMTubes 
    2696           1 :     TGeoTube *sV0APMT18 = new TGeoTube("sV0APMT18", fV0APMTR1, fV0APMTR2, fV0APMTH/2.);
    2697           1 :     TGeoVolume *v0APMT18 = new TGeoVolume("V0APMT18", sV0APMT18, medV0APMGlass);
    2698           1 :     TGeoTube *sV0APMT28 = new TGeoTube("sV0APMT28", fV0APMTR3, fV0APMTR4, fV0APMTH/2.);
    2699           1 :     TGeoVolume *v0APMT28 = new TGeoVolume("V0APMT28", sV0APMT28, medV0APMAlum);
    2700           2 :     TGeoVolume *v0APMT8 = new TGeoVolumeAssembly("V0APMT8");
    2701           1 :     TGeoTube *sV0APMTT8 = new TGeoTube("sV0APMTT8", 0., fV0APMTR4, fV0APMTB/2.);
    2702           1 :     TGeoVolume *v0APMTT8 = new TGeoVolume("V0APMTT8", sV0APMTT8, medV0APMAlum);
    2703           1 :     v0APMT8->SetLineColor(kV0AColorPMG);
    2704           1 :     v0APMT28->SetLineColor(kV0AColorPMA);
    2705           1 :     v0APMTT8->SetLineColor(kV0AColorPMA);
    2706           1 :     rot = new TGeoRotation("rot", 90, 0, 180, 0, 90, 90);
    2707           1 :     v0APMT8->AddNode(v0APMT18,1,rot);
    2708           1 :     v0APMT8->AddNode(v0APMT28,1,rot);
    2709           2 :     v0APMT8->AddNode(v0APMTT8,1,new TGeoCombiTrans(0,(fV0APMTH+fV0APMTB)/2.,0,rot));
    2710           1 :     double autoShift8 = (fV0APMBWd-2*fV0APMBWdW)/4.;
    2711           2 :     v0APM8->AddNode(v0APMT8, 1, new TGeoTranslation(-1.5*autoShift8, 0, 0));
    2712           2 :     v0APM8->AddNode(v0APMT8, 2, new TGeoTranslation(-0.5*autoShift8, 0, 0));
    2713           2 :     v0APM8->AddNode(v0APMT8, 3, new TGeoTranslation(+0.5*autoShift8, 0, 0));
    2714           2 :     v0APM8->AddNode(v0APMT8, 4, new TGeoTranslation(+1.5*autoShift8, 0, 0));
    2715             : 
    2716             :     /// PM 
    2717           1 :     rot = new TGeoRotation("rot");
    2718           1 :     rot->RotateX(-90+30);
    2719           1 :     rot->RotateY(0);
    2720           1 :     rot->RotateZ(65+3);
    2721           1 :     double shiftZ8 = fV0APMBHt/2. * cosAngPMBSec1
    2722           1 :       -   ( fV0ASciWd + 2 * fV0AOctWd + 2 * fV0APlaWd )/2.   -   fV0APMBTh/2. * sinAngPMBSec1;
    2723           1 :     double shiftR8 = fV0AR6  +  fV0AOctH2 + fV0APlaAl;
    2724           2 :     v0ASec8->AddNode(v0APM8,1, new TGeoCombiTrans( shiftR8*cos225 + 1.3, -shiftR8*sin225, shiftZ8, rot));
    2725             : 
    2726             :     // Aluminium nails
    2727           1 :     TGeoTube *sV0ANail81 = new TGeoTube("sV0ANail81", 0.0, 0.4, 5.09/2.);
    2728           1 :     TGeoVolume *v0ANail81 = new TGeoVolume("V0ANail81", sV0ANail81, medV0APMAlum);
    2729           1 :     v0ANail81->SetLineColor(kV0AColorPMA);// this is the color for aluminium
    2730           2 :     v0ASec8->AddNode(v0ANail81,1,new TGeoTranslation(42.9,-.51,0.0));
    2731           1 :     TGeoTube *sV0ANail82 = new TGeoTube("sV0ANail82", 0.0, 0.4, 5.09/2.);
    2732           1 :     TGeoVolume *v0ANail82 = new TGeoVolume("V0ANail82", sV0ANail82, medV0APMAlum); 
    2733           1 :     v0ANail82->SetLineColor(kV0AColorPMA);
    2734           2 :     v0ASec8->AddNode(v0ANail82,1,new TGeoTranslation(30.8,-30.04,0.0));  
    2735             :       
    2736             :     // Adding sector to v0LE volume 
    2737           1 :     v0LE->AddNode(v0ASec8, 1);    
    2738             :       
    2739             :     // Adding detectors to top volume
    2740           2 :     TGeoVolume *vZERO = new TGeoVolumeAssembly("VZERO");
    2741           2 :     vZERO->AddNode(v0RI,1,new TGeoTranslation(0, 0, -zdet));
    2742           2 :     vZERO->AddNode(v0LE,1,new TGeoTranslation(0, 0, +329.0));
    2743           1 :     top->AddNode(vZERO,1);
    2744           1 : }
    2745             : 
    2746             : //_____________________________________________________________________________
    2747             : void AliVZEROv7::AddAlignableVolumes() const
    2748             : {
    2749             :   //
    2750             :   // Create entries for alignable volumes associating the symbolic volume
    2751             :   // name with the corresponding volume path. Needs to be syncronized with
    2752             :   // eventual changes in the geometry.
    2753             :   // 
    2754           2 :   TString vpC = "/ALIC_1/VZERO_1/V0RI_1";
    2755           1 :   TString vpA = "/ALIC_1/VZERO_1/V0LE_1";
    2756           1 :   TString snC = "VZERO/V0C";
    2757           1 :   TString snA = "VZERO/V0A";
    2758             :   
    2759           4 :   if(!gGeoManager->SetAlignableEntry(snC.Data(),vpC.Data()))
    2760           0 :     AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", snC.Data(),vpC.Data()));
    2761           4 :   if(!gGeoManager->SetAlignableEntry(snA.Data(),vpA.Data()))
    2762           0 :     AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", snA.Data(),vpA.Data()));
    2763             : 
    2764           1 : } 
    2765             : 
    2766             : //_____________________________________________________________________________
    2767             : void AliVZEROv7::CreateMaterials()
    2768             : {
    2769             : 
    2770             : // Creates materials used for geometry 
    2771             : 
    2772           4 :   AliDebug(2,"Create materials");
    2773             :   // Parameters for simulation scope
    2774           1 :   Int_t     fieldType       = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();     // Field type 
    2775           1 :   Double_t  maxField        = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();       // Field max.
    2776             :   Double_t  maxBending      = 10;    // Max Angle
    2777             :   Double_t  maxStepSize     = 0.01;  // Max step size 
    2778             :   Double_t  maxEnergyLoss   = 1;     // Max Delta E
    2779             :   Double_t  precision       = 0.003; // Precision
    2780             :   Double_t  minStepSize     = 0.003; // Minimum step size 
    2781             : 
    2782             :   Int_t    id;
    2783             :   Double_t a, z, radLength, absLength;
    2784           1 :   Float_t density, as[4], zs[4], ws[4];
    2785             : 
    2786             : // Parameters  for V0CPrePlates: Aluminium
    2787             :    a = 26.98; 
    2788             :    z = 13.00;
    2789             :    density     = 2.7;
    2790             :    radLength   = 8.9;
    2791             :    absLength   = 37.2;
    2792             :    id = 2;
    2793           1 :    AliMaterial( id, "V0CAlu", a, z, density, radLength, absLength, 0, 0);
    2794           1 :    AliMedium(id, "V0CAlu", id, 1, fieldType, maxField, maxBending, maxStepSize,
    2795             :              maxEnergyLoss, precision, minStepSize);
    2796             :                     
    2797             : // Parameters  for V0CPlates: Carbon 
    2798             :    a = 12.01; 
    2799             :    z =  6.00;
    2800             :    density   = 2.265;
    2801             :    radLength = 18.8;
    2802             :    absLength = 49.9;
    2803             :    id = 3;
    2804           1 :    AliMaterial(id, "V0CCar",  a, z, density, radLength, absLength, 0, 0);
    2805           1 :    AliMedium(id, "V0CCar", id, 1, fieldType, maxField, maxBending, maxStepSize,
    2806             :              maxEnergyLoss, precision, minStepSize);
    2807             :             
    2808             : // Parameters  for V0Cscintillator: BC408
    2809           1 :    as[0] = 1.00794;     as[1] = 12.011;
    2810           1 :    zs[0] = 1.;          zs[1] = 6.;
    2811           1 :    ws[0] = 1.;          ws[1] = 1.;
    2812             :    density      = 1.032;
    2813             :    id           = 4;
    2814           1 :    AliMixture(id, "V0CSci", as, zs, density, -2, ws);
    2815           1 :    AliMedium(id,"V0CSci", id, 1, fieldType, maxField, maxBending, maxStepSize,
    2816             :              maxEnergyLoss, precision, minStepSize);
    2817             : 
    2818             : // Parameters for V0Ascintilator: BC404
    2819           1 :    as[0] = 1.00794;     as[1] = 12.011;
    2820           1 :    zs[0] = 1.;          zs[1] = 6.;
    2821           1 :    ws[0] = 5.21;        ws[1] = 4.74;
    2822             :    density      = 1.032;
    2823             :    id           = 5;
    2824           1 :    AliMixture(id, "V0ASci", as, zs, density, -2, ws);
    2825           1 :    AliMedium(id,  "V0ASci", id, 1, fieldType, maxField, maxBending, maxStepSize,
    2826             :              maxEnergyLoss, precision, minStepSize);
    2827             : 
    2828             : // Parameters for V0ALuc: Lucita but for the simulation BC404
    2829           1 :    as[0] = 1.00794;     as[1] = 12.011;
    2830           1 :    zs[0] = 1.;          zs[1] = 6.;
    2831           1 :    ws[0] = 5.21;        ws[1] = 4.74;
    2832             :    density      = 1.032;
    2833             :    id           = 6;
    2834           1 :    AliMixture(id, "V0ALuc", as, zs, density, -2, ws);
    2835           1 :    AliMedium(id, "V0ALuc", id, 1, fieldType, maxField, maxBending, maxStepSize,
    2836             :              maxEnergyLoss, precision, minStepSize);
    2837             : 
    2838             : // Parameters for V0Aplate: EuroComposite - EC-PI 626 PS - AlMg3
    2839           1 :    as[0] = 26.982;      as[1] = 24.305;
    2840           1 :    zs[0] = 13.;         zs[1] = 12.;
    2841           1 :    ws[0] = 1.;          ws[1] = 3.;
    2842             :    density      = 3.034;
    2843             :    id           = 7;
    2844           1 :    AliMixture(id, "V0APlaOu", as, zs, density, -2, ws);
    2845           1 :    AliMedium(id, "V0APlaOu", id, 1, fieldType, maxField, maxBending, maxStepSize,
    2846             :              maxEnergyLoss, precision, minStepSize);
    2847             : 
    2848             : // Parameters for V0Aplate: EuroComposite - EC-PI 626 PS - EC-PI 6.4-42
    2849           1 :    as[0] = 1.00794;     as[1] = 12.011;
    2850           1 :    zs[0] = 1.;          zs[1] = 6.;
    2851           1 :    ws[0] = 5.21;        ws[1] = 4.74;
    2852             :    density      = 0.042;
    2853             :    id           = 8;
    2854           1 :    AliMixture(id, "V0APlaIn", as, zs, density, -2, ws);
    2855           1 :    AliMedium(id, "V0APlaIn", id, 1, fieldType, maxField, maxBending, maxStepSize,
    2856             :              maxEnergyLoss, precision, minStepSize);
    2857             : 
    2858             : // Parameters for V0Afiber: BC9929AMC Plastic Scintillating Fiber from Saint-Gobain
    2859           1 :    as[0] = 1.00794;     as[1] = 12.011;
    2860           1 :    zs[0] = 1.;          zs[1] = 6.;
    2861           1 :    ws[0] = 4.82;        ws[1] = 4.85;
    2862             :    density      = 1.05;
    2863             :    id           = 9;
    2864           1 :    AliMixture(id, "V0AFib", as, zs, density, -2, ws);
    2865           1 :    AliMedium(id, "V0AFib", id, 1, fieldType, maxField, maxBending, maxStepSize,
    2866             :              maxEnergyLoss, precision, minStepSize);
    2867             : 
    2868             : // Parameters for V0APMA: Aluminium
    2869             :    a = 26.98; 
    2870             :    z = 13.00;
    2871             :    density     = 2.7;
    2872             :    radLength   = 8.9;
    2873             :    absLength   = 37.2;
    2874             :    id = 10;
    2875           1 :    AliMaterial(id, "V0APMA",  a, z, density, radLength, absLength, 0, 0);
    2876           1 :    AliMedium(id, "V0APMA", id, 1, fieldType, maxField, maxBending, maxStepSize,
    2877             :              maxEnergyLoss, precision, minStepSize);
    2878             : 
    2879             : // Parameters for V0APMG: Glass for the simulation Aluminium
    2880             :    a = 26.98; 
    2881             :    z = 13.00;
    2882             :    density   = 2.7;
    2883             :    radLength = 8.9;
    2884             :    absLength = 37.2;
    2885             :    id = 11;
    2886           1 :    AliMaterial(id, "V0APMG",  a, z, density, radLength, absLength, 0, 0);
    2887           1 :    AliMedium(id, "V0APMG", id, 1, fieldType, maxField, maxBending, maxStepSize,
    2888             :              maxEnergyLoss, precision, minStepSize);
    2889             : 
    2890             : // Parameters for V0AFiberGlass: Material for mother and daughter boards
    2891           1 :    as[0] = 1.00794;     as[1] = 12.011;       as[2] = 16.0;          as[3] = 28.09;
    2892           1 :    zs[0] = 1.;          zs[1] = 6.;           zs[2] = 8.;            zs[3] = 14.;
    2893           1 :    ws[0] = 736.0;       ws[1] = 462.0;        ws[2] = 292.0;         ws[3] = 68.0;
    2894             :    density      = 1.9;
    2895             :    id           = 12;
    2896           1 :    AliMixture(id, "V0AFibGlass", as, zs, density, -4, ws);
    2897           1 :    AliMedium(id, "V0AFibGlass", id, 1, fieldType, maxField, maxBending, maxStepSize,
    2898             :              maxEnergyLoss, precision, minStepSize); 
    2899             :    
    2900           1 : }
    2901             : 
    2902             : //_____________________________________________________________________________
    2903             : void AliVZEROv7::DrawGeometry() 
    2904             : {
    2905             : //  Drawing of V0 geometry done in DrawV0.C
    2906             : 
    2907           0 :    AliDebug(2,"DrawGeometry");
    2908           0 : }
    2909             : 
    2910             : //_____________________________________________________________________________
    2911             : void AliVZEROv7::Init()
    2912             : {
    2913             : // Initialises version of the VZERO Detector given in Config
    2914             : // Just prints an information message
    2915             : 
    2916             : //   AliInfo(Form("VZERO version %d initialized \n",IsVersion()));
    2917             :    
    2918           4 :    AliDebug(1,"VZERO version 7 initialized");
    2919           1 :    AliVZERO::Init();  
    2920           1 : }
    2921             : 
    2922             : //_____________________________________________________________________________
    2923             : void AliVZEROv7::StepManager()
    2924             : {
    2925             : // Step Manager, called at each step  
    2926             : 
    2927       11020 :   Int_t     copy;
    2928             :   static    Int_t   vol[4];
    2929             :   static    Float_t hits[21];
    2930             :   static    Float_t eloss, tlength;
    2931             :   static    Int_t   nPhotonsInStep = 0;
    2932             :   static    Int_t   nPhotons = 0; 
    2933             :   static    Int_t   numStep = 0;
    2934             :   Int_t     ringNumber;
    2935             :   Float_t   destep, step;
    2936        5510 :   numStep += 1; 
    2937             : 
    2938             :   //   We keep only charged tracks : 
    2939       11061 :   if ( !TVirtualMC::GetMC()->TrackCharge() || !TVirtualMC::GetMC()->IsTrackAlive() ) return;
    2940             : 
    2941        2589 :   vol[0]    = TVirtualMC::GetMC()->CurrentVolOffID(1, vol[1]);
    2942        2589 :   vol[2]    = TVirtualMC::GetMC()->CurrentVolID(copy);
    2943        2589 :   vol[3]    = copy;
    2944        2593 :   static Int_t idV0R1 = TVirtualMC::GetMC()->VolId("V0R1");
    2945             : 
    2946        2593 :   static Int_t idV0L11 = TVirtualMC::GetMC()->VolId("V0L1Sec1");
    2947        2593 :   static Int_t idV0L12 = TVirtualMC::GetMC()->VolId("V0L1Sec2");
    2948        2593 :   static Int_t idV0L13 = TVirtualMC::GetMC()->VolId("V0L1Sec3");
    2949        2593 :   static Int_t idV0L14 = TVirtualMC::GetMC()->VolId("V0L1Sec4");
    2950        2593 :   static Int_t idV0L15 = TVirtualMC::GetMC()->VolId("V0L15");
    2951        2593 :   static Int_t idV0L16 = TVirtualMC::GetMC()->VolId("V0L16");
    2952        2593 :   static Int_t idV0L17 = TVirtualMC::GetMC()->VolId("V0L17");
    2953        2593 :   static Int_t idV0L18 = TVirtualMC::GetMC()->VolId("V0L18");  
    2954        2593 :   static Int_t idV0R2 = TVirtualMC::GetMC()->VolId("V0R2");
    2955             : 
    2956        2593 :   static Int_t idV0L21 = TVirtualMC::GetMC()->VolId("V0L2Sec1");
    2957        2593 :   static Int_t idV0L22 = TVirtualMC::GetMC()->VolId("V0L2Sec2");
    2958        2593 :   static Int_t idV0L23 = TVirtualMC::GetMC()->VolId("V0L2Sec3");
    2959        2593 :   static Int_t idV0L24 = TVirtualMC::GetMC()->VolId("V0L2Sec4");
    2960        2593 :   static Int_t idV0L25 = TVirtualMC::GetMC()->VolId("V0L25");
    2961        2593 :   static Int_t idV0L26 = TVirtualMC::GetMC()->VolId("V0L26");
    2962        2593 :   static Int_t idV0L27 = TVirtualMC::GetMC()->VolId("V0L27");
    2963        2593 :   static Int_t idV0L28 = TVirtualMC::GetMC()->VolId("V0L28");
    2964        2593 :   static Int_t idV0R3 = TVirtualMC::GetMC()->VolId("V0R3");
    2965             : 
    2966        2593 :   static Int_t idV0L31 = TVirtualMC::GetMC()->VolId("V0L3Sec1");
    2967        2593 :   static Int_t idV0L32 = TVirtualMC::GetMC()->VolId("V0L3Sec2");
    2968        2593 :   static Int_t idV0L33 = TVirtualMC::GetMC()->VolId("V0L3Sec3");
    2969        2593 :   static Int_t idV0L34 = TVirtualMC::GetMC()->VolId("V0L3Sec4");
    2970        2593 :   static Int_t idV0L35 = TVirtualMC::GetMC()->VolId("V0L35");
    2971        2593 :   static Int_t idV0L36 = TVirtualMC::GetMC()->VolId("V0L36");
    2972        2593 :   static Int_t idV0L37 = TVirtualMC::GetMC()->VolId("V0L37");
    2973        2593 :   static Int_t idV0L38 = TVirtualMC::GetMC()->VolId("V0L38");
    2974        2593 :   static Int_t idV0R4 = TVirtualMC::GetMC()->VolId("V0R4");
    2975             : 
    2976        2593 :   static Int_t idV0L41 = TVirtualMC::GetMC()->VolId("V0L4Sec1");
    2977        2593 :   static Int_t idV0L42 = TVirtualMC::GetMC()->VolId("V0L4Sec2");
    2978        2593 :   static Int_t idV0L43 = TVirtualMC::GetMC()->VolId("V0L4Sec3");
    2979        2593 :   static Int_t idV0L44 = TVirtualMC::GetMC()->VolId("V0L4Sec4");
    2980        2593 :   static Int_t idV0L45 = TVirtualMC::GetMC()->VolId("V0L45");
    2981        2593 :   static Int_t idV0L46 = TVirtualMC::GetMC()->VolId("V0L46");
    2982        2593 :   static Int_t idV0L47 = TVirtualMC::GetMC()->VolId("V0L47");
    2983        2593 :   static Int_t idV0L48 = TVirtualMC::GetMC()->VolId("V0L48");
    2984        2593 :   static Int_t idV0R5 = TVirtualMC::GetMC()->VolId("V0R5");
    2985        2593 :   static Int_t idV0R6 = TVirtualMC::GetMC()->VolId("V0R6");
    2986             :   bool   hitOnV0C = true;
    2987             :   double lightYield;
    2988             :   double lightAttenuation;
    2989             :   double nMeters; 
    2990             :   double fibToPhot;
    2991        5145 :   if      ( TVirtualMC::GetMC()->CurrentVolID(copy) == idV0R1   || 
    2992        2585 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L11  || 
    2993        2585 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L12  || 
    2994        2562 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L13  || 
    2995        2562 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L14  || 
    2996        2558 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L15  ||  
    2997        2558 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L16  || 
    2998        2556 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L17  || 
    2999        2556 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L18  
    3000             :       )
    3001          50 :       ringNumber = 1;
    3002             :   
    3003        4866 :   else if ( TVirtualMC::GetMC()->CurrentVolID(copy) == idV0R2  || 
    3004        2528 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L21 || 
    3005        2389 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L22 || 
    3006        2338 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L23 || 
    3007        2338 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L24 || 
    3008        2336 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L25 || 
    3009        2336 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L26 || 
    3010        2336 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L27 || 
    3011        2327 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L28 
    3012             :       )
    3013         243 :       ringNumber = 2; 
    3014             :   
    3015        4414 :   else if ( TVirtualMC::GetMC()->CurrentVolID(copy) == idV0R3  || 
    3016        2281 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0R4  || 
    3017        2277 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L31 || 
    3018        2260 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L32 || 
    3019        2142 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L33 || 
    3020        2142 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L34 || 
    3021        2137 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L35 || 
    3022        2132 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L36 || 
    3023        2118 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L37 || 
    3024        2118 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L38 
    3025             :       ) 
    3026         199 :       ringNumber = 3;
    3027        4144 :   else if ( TVirtualMC::GetMC()->CurrentVolID(copy) == idV0R5  || 
    3028        2096 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0R6  || 
    3029        2088 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L41 || 
    3030        2084 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L42 || 
    3031        2052 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L43 || 
    3032        2051 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L44 || 
    3033        2051 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L45 || 
    3034        2047 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L46 || 
    3035        2047 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L47 || 
    3036        2047 :             TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L48 
    3037          90 :       ) ringNumber = 4;        
    3038             :   
    3039             :   else ringNumber = 0;
    3040             :   
    3041        2589 :   if  (ringNumber) {
    3042             :       if (
    3043         665 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L11 || 
    3044         582 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L12 || 
    3045         559 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L13 || 
    3046         559 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L14 || 
    3047         555 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L15 || 
    3048         555 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L16 || 
    3049         553 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L17 || 
    3050         553 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L18 || 
    3051         536 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L21 || 
    3052         397 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L22 || 
    3053         346 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L23 || 
    3054         346 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L24 || 
    3055         344 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L25 || 
    3056         344 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L26 || 
    3057         344 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L27 || 
    3058         335 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L28 || 
    3059         304 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L31 || 
    3060         287 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L32 || 
    3061         169 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L33 || 
    3062         169 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L34 || 
    3063         164 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L35 || 
    3064         159 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L36 || 
    3065         145 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L37 || 
    3066         145 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L38 || 
    3067         124 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L41 || 
    3068         120 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L42 || 
    3069          88 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L43 || 
    3070          87 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L44 || 
    3071          87 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L45 || 
    3072          83 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L46 || 
    3073          83 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L47 || 
    3074          83 :           TVirtualMC::GetMC()->CurrentVolID(copy) == idV0L48
    3075             :           )
    3076         539 :           hitOnV0C = false;
    3077             : 
    3078         582 :     destep = TVirtualMC::GetMC()->Edep();
    3079         582 :     step   = TVirtualMC::GetMC()->TrackStep();
    3080         582 :     if (hitOnV0C) {
    3081          43 :       lightYield = fV0CLightYield;
    3082          43 :       lightAttenuation = fV0CLightAttenuation;
    3083          43 :       nMeters = fV0CnMeters;
    3084          43 :       fibToPhot = fV0CFibToPhot;
    3085          43 :     } else {
    3086         539 :       lightYield = fV0ALightYield;
    3087         539 :       lightAttenuation = fV0ALightAttenuation;
    3088         539 :       nMeters = fV0AnMeters;
    3089         539 :       fibToPhot = fV0AFibToPhot;
    3090             :     }
    3091         582 :     nPhotonsInStep  = Int_t(destep / (lightYield *1e-9) );      
    3092         582 :     nPhotonsInStep  = gRandom->Poisson(nPhotonsInStep);
    3093         582 :     eloss    += destep;
    3094         582 :     tlength  += step;    
    3095         582 :     if ( TVirtualMC::GetMC()->IsTrackEntering() ) { 
    3096          79 :       nPhotons  =  nPhotonsInStep;
    3097          79 :       TVirtualMC::GetMC()->TrackPosition(fTrackPosition);
    3098          79 :       TVirtualMC::GetMC()->TrackMomentum(fTrackMomentum);
    3099         158 :       Float_t pt  = TMath::Sqrt( fTrackMomentum.Px() * fTrackMomentum.Px()
    3100          79 :                                  + fTrackMomentum.Py() * fTrackMomentum.Py() );
    3101          79 :       TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
    3102          79 :       hits[0]  = fTrackPosition.X();
    3103          79 :       hits[1]  = fTrackPosition.Y();
    3104          79 :       hits[2]  = fTrackPosition.Z();             
    3105          79 :       hits[3]  = Float_t (TVirtualMC::GetMC()->TrackPid()); 
    3106          79 :       hits[4]  = TVirtualMC::GetMC()->TrackTime();
    3107          79 :       hits[5]  = TVirtualMC::GetMC()->TrackCharge();
    3108          79 :       hits[6]  = fTrackMomentum.Theta()*TMath::RadToDeg();
    3109          79 :       hits[7]  = fTrackMomentum.Phi()*TMath::RadToDeg();
    3110          79 :       hits[8]  = ringNumber;
    3111          79 :       hits[9]  = pt;
    3112          79 :       hits[10] = fTrackMomentum.P();
    3113          79 :       hits[11] = fTrackMomentum.Px();
    3114          79 :       hits[12] = fTrackMomentum.Py();
    3115          79 :       hits[13] = fTrackMomentum.Pz();
    3116          79 :       hits[14] = par->Vx();
    3117          79 :       hits[15] = par->Vy();
    3118          79 :       hits[16] = par->Vz();
    3119          79 :       tlength  = 0.0;
    3120          79 :       eloss    = 0.0;       
    3121             : 
    3122             :       //////////////////////////
    3123             :       ///// Display V0A geometry
    3124             :       //      if (!hitOnV0C) {
    3125             :       //        FILE *of;
    3126             :       //        of = fopen("V0A.out", "a");
    3127             :       //        // x, y, z, ringnumber, cellid
    3128             :       //        fprintf( of, "%f %f %f %f %d \n",  hits[0], hits[1], hits[2], hits[8], GetCellId (vol, hits) );
    3129             :       //        fclose(of);
    3130             :       //      }
    3131             :       //////////////////////////
    3132          79 :     }
    3133         582 :     nPhotons  = nPhotons + nPhotonsInStep;
    3134        1618 :     if( TVirtualMC::GetMC()->IsTrackExiting() || TVirtualMC::GetMC()->IsTrackStop() || TVirtualMC::GetMC()->IsTrackDisappeared()){
    3135          64 :       nPhotons = nPhotons - Int_t((Float_t(nPhotons) * lightAttenuation * nMeters));
    3136          64 :       nPhotons = nPhotons - Int_t( Float_t(nPhotons) * fibToPhot);
    3137          64 :       hits[17] = eloss;
    3138          64 :       hits[18] = tlength;
    3139          64 :       hits[19] = nPhotons;
    3140          64 :       hits[20] = GetCellId (vol, hits);
    3141          64 :       AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
    3142          64 :       tlength         = 0.0;
    3143          64 :       eloss           = 0.0; 
    3144          64 :       nPhotons        = 0;
    3145          64 :       nPhotonsInStep  = 0;
    3146          64 :       numStep         = 0;  
    3147          64 :     }
    3148        1085 :     if( TVirtualMC::GetMC()->IsTrackEntering() || TVirtualMC::GetMC()->IsTrackExiting() ) {
    3149         143 :       AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kVZERO);
    3150         143 :     }
    3151             :   }
    3152        8099 : }
    3153             : 
    3154             : //_____________________________________________________________________________
    3155             : void AliVZEROv7::AddHit(Int_t track, Int_t *vol, Float_t *hits)
    3156             : {
    3157             : //  Adds a VZERO hit
    3158             : 
    3159         128 :   TClonesArray &lhits = *fHits;
    3160          64 :   new(lhits[fNhits++]) AliVZEROhit(fIshunt,track,vol,hits);
    3161          64 : }
    3162             : 
    3163             : //_____________________________________________________________________________
    3164             : void AliVZEROv7::MakeBranch(Option_t *option)
    3165             : {
    3166             : // Creates new branches in the current Root Tree
    3167             :     
    3168           8 :   TString branchname(Form("%s",GetName()));
    3169          20 :   AliDebug(2,Form("fBufferSize = %d",fBufferSize));
    3170           4 :   const char *cH = strstr(option,"H");
    3171          12 :   if (fHits   && fLoader->TreeH() && cH) {
    3172          12 :     fLoader->TreeH()->Branch(branchname.Data(),&fHits, fBufferSize);
    3173          20 :     AliDebug(2,Form("Making Branch %s for hits",branchname.Data()));
    3174             :   }     
    3175           4 :   const char *cD = strstr(option,"D");
    3176          12 :   if (fDigits   && fLoader->TreeD() && cD) {
    3177           0 :     fLoader->TreeD()->Branch(branchname.Data(),&fDigits, fBufferSize);
    3178           0 :     AliDebug(2,Form("Making Branch %s for digits",branchname.Data()));
    3179             :   }  
    3180           4 : }
    3181             : 
    3182             : //_____________________________________________________________________________
    3183             : Int_t AliVZEROv7::GetCellId(Int_t *vol, Float_t *hits) 
    3184             : {
    3185             :   //   Returns Id of scintillator cell
    3186             :   //   Right side from  0 to 47 
    3187             :   //   Left  side from 48 to 79
    3188             :   //   hits[8] = ring number (1 to 4)
    3189             :   //   vol[1]  = copy number (1 to 8)
    3190             : 
    3191         128 :   Int_t index      = vol[1];
    3192          64 :   Int_t ringNumber = Int_t(hits[8]);
    3193          64 :   fCellId          = 0;
    3194             : 
    3195          64 :   Float_t phi = Float_t(TMath::ATan2(Double_t(hits[1]),Double_t(hits[0])) ); 
    3196          64 :   Float_t kRaddeg = 180.0/TMath::Pi();
    3197             :   phi = kRaddeg * phi;
    3198             : 
    3199         115 :   if (index < 7) index = index + 8;
    3200             : 
    3201          64 :   if (hits[2] < 0.0) {
    3202          20 :     if(ringNumber < 3) {
    3203           7 :       index = (index - 7) + ( ( ringNumber - 1 ) * 8);
    3204          20 :     } else if (ringNumber >= 3) { 
    3205          25 :       if ( TVirtualMC::GetMC()->CurrentVolID(vol[1]) == TVirtualMC::GetMC()->VolId("V0R3") || TVirtualMC::GetMC()->CurrentVolID(vol[1])
    3206          13 :            == TVirtualMC::GetMC()->VolId("V0R5") )  index = (index*2-14)+((ringNumber-2)*16);
    3207          35 :       if ( TVirtualMC::GetMC()->CurrentVolID(vol[1]) == TVirtualMC::GetMC()->VolId("V0R4") || TVirtualMC::GetMC()->CurrentVolID(vol[1])
    3208          17 :            == TVirtualMC::GetMC()->VolId("V0R6") )  index = (index*2-13)+((ringNumber-2)*16);
    3209             :     }
    3210          20 :     fCellId   = index;           
    3211          64 :   } else if (hits[2] > 0.0) {
    3212             :     //    cout << " vol[0] = " << vol[0] << " copy : " << vol[1] 
    3213             :     //   << " called " << TVirtualMC::GetMC()->VolName(vol[0]) << endl;
    3214             :     // cout << " vol[2] = " << vol[2] << " copy : " << vol[3] 
    3215             :     //   << " called " << TVirtualMC::GetMC()->VolName(vol[2]) << endl;
    3216             :     // upper half
    3217             : 
    3218          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L1Sec1")) fCellId =  47 + 1;
    3219          47 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L1Sec2")) fCellId =  47 + 2;
    3220          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L1Sec3")) fCellId =  47 + 3;
    3221          46 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L1Sec4")) fCellId =  47 + 4;
    3222             : 
    3223          48 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L2Sec1")) fCellId =  47 +  9;
    3224          52 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L2Sec2")) fCellId =  47 + 10;
    3225          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L2Sec3")) fCellId =  47 + 11;
    3226          45 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L2Sec4")) fCellId =  47 + 12;
    3227             : 
    3228          46 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L3Sec1")) fCellId =  47 + 17;
    3229          46 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L3Sec2")) fCellId =  47 + 18;
    3230          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L3Sec3")) fCellId =  47 + 19;
    3231          45 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L3Sec4")) fCellId =  47 + 20;
    3232             : 
    3233          46 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L4Sec1")) fCellId =  47 + 25;
    3234          54 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L4Sec2")) fCellId =  47 + 26;
    3235          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L4Sec3")) fCellId =  47 + 27;
    3236          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L4Sec4")) fCellId =  47 + 28;
    3237             : 
    3238             :     // lower half 
    3239          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L15")) fCellId = 48+4;
    3240          45 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L16")) fCellId = 48+5;
    3241          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L17")) fCellId = 48+6;
    3242          45 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L18")) fCellId = 48+7;
    3243          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L25")) fCellId = 8+48+4;
    3244          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L26")) fCellId = 8+48+5;
    3245          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L27")) fCellId = 8+48+6;
    3246          46 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L28")) fCellId = 8+48+7;
    3247          45 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L35")) fCellId = 16+48+4;
    3248          45 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L36")) fCellId = 16+48+5;
    3249          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L37")) fCellId = 16+48+6;
    3250          46 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L38")) fCellId = 16+48+7;
    3251          45 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L45")) fCellId = 24+48+4;
    3252          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L46")) fCellId = 24+48+5;
    3253          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L47")) fCellId = 24+48+6;
    3254          44 :       if (TVirtualMC::GetMC()->CurrentVolID(vol[2]) == TVirtualMC::GetMC()->VolId("V0L48")) fCellId = 24+48+7;
    3255             :   }
    3256             : 
    3257          64 :   return fCellId;
    3258             : }
    3259             : 

Generated by: LCOV version 1.11