Removing obsolete includes of TGeant3.h
[u/mrichter/AliRoot.git] / VZERO / AliVZEROv2.cxx
index 258bdee..68d6e75 100755 (executable)
 //  (V-zero) detector  version 2  as designed by the Lyon group     //
 //   All comments should be sent to Brigitte CHEYNIS :              //
 //                                  b.cheynis@ipnl.in2p3.fr         // 
-//   Geometry of the  4th of november 2002                          //
+//   Geometry of the  26th of november 2003                         //
 //  (circular instead of trapezoidal shapes as in previous versions //
-//   plus changes in cell dimensions and offsets)                   // 
+//   plus changes in cell dimensions and offsets) :                 // 
+//   Scintillating cells are now 2 cm thick instead of 0.7 cm       //
+//   V0R sits between Z values  -89.4 and  -85.0 cm                 //
+//   V0L sits between Z values +350.0 and +352.0 cm                 //
+//   New coordinate system has been implemented in october 2003     //
 //                                                                  //
 //////////////////////////////////////////////////////////////////////
 
+// --- Standard libraries ---
 #include <Riostream.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include <TBRIK.h>
-#include <TBox.h>
-#include <TCONE.h>
+// --- ROOT libraries ---
 #include <TClonesArray.h>
-#include <TGeant3.h>
 #include <TGeometry.h>
-#include <TH1.h>
 #include <TLorentzVector.h>
 #include <TMath.h>
 #include <TNode.h>
 #include <TObjectTable.h>
-#include <TPCON.h>
-#include <TPGON.h>
-#include <TSPHE.h>
-#include <TShape.h>
-#include <TTRAP.h>
-#include <TTRD2.h>
 #include <TTUBE.h>
 #include <TTUBS.h>
 #include <TVirtualMC.h>
 #include <TParticle.h>
 
-#include "AliLoader.h"
-#include "AliMagF.h"
+// --- AliRoot header files ---
 #include "AliRun.h"
+#include "AliMC.h"
+#include "AliConst.h"
+#include "AliMagF.h"
+#include "AliVZEROLoader.h"
 #include "AliVZEROdigit.h"
 #include "AliVZEROhit.h"
 #include "AliVZEROv2.h"
 
 ClassImp(AliVZEROv2)
 
-//--------------------------------------------------------------------
+//_____________________________________________________________________________
 AliVZEROv2:: AliVZEROv2():AliVZERO()
 {
-
+// Standard default constructor 
 }
-//--------------------------------------------------------------------
+
+//_____________________________________________________________________________
 AliVZEROv2::AliVZEROv2(const char *name, const char *title):
  AliVZERO(name,title)
 {
 
-// Standard constructor for V-zeroR Detector (right part)  version 0
+// Standard constructor for V-zero Detector  version 2
 
   Int_t i;
 
@@ -83,7 +82,7 @@ AliVZEROv2::AliVZEROv2(const char *name, const char *title):
   
 }
 
-//-------------------------------------------------------------------------
+//_____________________________________________________________________________
 void AliVZEROv2::CreateGeometry()
 {
 
@@ -99,11 +98,11 @@ void AliVZEROv2::CreateGeometry()
       
   Int_t    *idtmed = fIdtmed->GetArray()-2999;
 
-  Int_t    n_detec_R = 1;
-  Int_t    n_detec_L = 1;
+  Int_t    ndetR = 1;
+  Int_t    ndetL = 1;
  
-  Int_t    n_cells_R = 1;
-  Int_t    n_cells_L = 1;
+  Int_t    ncellsR = 1;
+  Int_t    ncellsL = 1;
   
   Int_t    idrotm[999];
  
@@ -111,29 +110,32 @@ void AliVZEROv2::CreateGeometry()
   Float_t  height;
   Float_t  theta;  
   
-  Float_t  half_thick_qua;
+  Float_t  halfThickQua;
   
   Float_t  zdet;
   Float_t  r0, r5;
   Float_t  pi = TMath::Pi();
     
-  height1           =     1.82;           // height of cell 1, in cm
-  height2           =     3.81;           // height of cell 2, in cm
-  height3           =     4.72;           // height of cell 3, in cm
-  height4           =     7.12;           // height of cell 4, in cm
-  height5           =    10.83;           // height of cell 5, in cm
+  height1     =     1.82;         // height of cell 1, in cm
+  height2     =     3.81;         // height of cell 2, in cm
+  height3     =     4.72;         // height of cell 3, in cm
+  height4     =     7.12;         // height of cell 4, in cm
+  height5     =    10.83;         // height of cell 5, in cm
   
-  theta             = pi/6.0/2.0;       // half angular opening = 15 degrees
-    
-  half_thick_qua    = fThickness1/2.0;   // half thickness of elementary cell (inner ring)
+  theta       = pi/6.0/2.0;       // half angular opening = 15 degrees
     
-  zdet              =    90.0 - 0.6 -fThickness/2.0;  // distance to vertex (along Z axis)
-  r0                =    4.05;            // closest distance to center of the beam pipe
-  height            =    height1 + height2 + height3 + height4 + height5;
-  r5                =    r0 + height;
+  halfThickQua= fThickness1/2.0;  // half thickness of elementary cell (inner ring)
+  
+// distance 0.6 cm in zdet accounts for the fact V0R box back lid sits 0.6 away from 
+// absorber nose sitting at 90 cm. Will use -zdet later...
+   
+  zdet        =    90.0 - 0.6 -fThickness/2.0;  // distance to vertex (along Z axis)   
+  r0          =    4.05;          // closest distance to center of the beam pipe
+  height      =    height1 + height2 + height3 + height4 + height5;
+  r5          =    r0 + height;
 
-// Creation of mother volume V0LE - left part - :
-// Entrance face at  -350.0 cm ...
+// Creation of mother volume v0LE - left part - :
+// Entrance face at  +350.0 cm  (new coordinate system) ...
 
    Float_t   partube[3];
    
@@ -144,64 +146,64 @@ void AliVZEROv2::CreateGeometry()
    gMC->Gsvolu("V0LE","TUBE",idtmed[3005],partube,3);
      
 // Creation of five rings - left part - :
-// Entrance face at -350.0 cm ... 
+// Entrance face at +350.0 cm  (new coordinate system) ... 
 
-// Mother volume V0L0 in which will be set 5 scintillator cells 
+// Mother volume v0L0 in which will be set 5 scintillator cells 
 
   Float_t   partubs[5];  
     
-  Float_t   r0_left      =   4.3;   
-  Float_t   height1_left =   2.6; 
-  Float_t   height2_left =   4.1;
-  Float_t   height3_left =   6.4;
-  Float_t   height4_left =  10.2;
-  Float_t   height5_left =  16.9;
-  Float_t   height_left  = height1_left + height2_left + height3_left 
-                                        + height4_left + height5_left;
-  Float_t   r5_left      = r0_left  + height_left; 
-  
-  partubs[0]      =  r0_left;
-  partubs[1]      =  r5_left;
+  Float_t   r0Left      =   4.3;   
+  Float_t   height1Left =   2.6; 
+  Float_t   height2Left =   4.1;
+  Float_t   height3Left =   6.4;
+  Float_t   height4Left =  10.2;
+  Float_t   height5Left =  16.9;
+  Float_t   heightLeft  = height1Left + height2Left + height3Left 
+                                      + height4Left + height5Left;
+  Float_t   r5Left      = r0Left  + heightLeft; 
+  
+  partubs[0]      =  r0Left;
+  partubs[1]      =  r5Left;
   partubs[2]      =  fThickness1/2.0;
   partubs[3]      =  90.0-15.0;
   partubs[4]      = 120.0-15.0;
 
   gMC->Gsvolu("V0L0","TUBS",idtmed[3010],partubs,5);  // air volume
   
-  Float_t  r1_left =  r0_left + height1_left;        
+  Float_t  r1Left =  r0Left + height1Left;        
      
-  partubs[0]     =  r0_left;
-  partubs[1]     =  r1_left;
+  partubs[0]     =  r0Left;
+  partubs[1]     =  r1Left;
 
   gMC->Gsvolu("V0L1","TUBS",idtmed[3005],partubs,5);  // quartz volume
   gMC->Gspos("V0L1",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY"); 
 
-  Float_t   r2_left  =   r1_left + height2_left;       
+  Float_t   r2Left  =   r1Left + height2Left;       
   
-  partubs[0]     =  r1_left;
-  partubs[1]     =  r2_left;
+  partubs[0]     =  r1Left;
+  partubs[1]     =  r2Left;
 
   gMC->Gsvolu("V0L2","TUBS",idtmed[3005],partubs,5);  // quartz volume
   gMC->Gspos("V0L2",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY"); 
   
-  Float_t   r3_left =   r2_left + height3_left;
+  Float_t   r3Left =   r2Left + height3Left;
    
-  partubs[0]     =  r2_left;
-  partubs[1]     =  r3_left;
+  partubs[0]     =  r2Left;
+  partubs[1]     =  r3Left;
 
   gMC->Gsvolu("V0L3","TUBS",idtmed[3005],partubs,5);  // quartz volume
   gMC->Gspos("V0L3",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
   
-  Float_t   r4_left =  r3_left + height4_left;
+  Float_t   r4Left =  r3Left + height4Left;
    
-  partubs[0]     =  r3_left;
-  partubs[1]     =  r4_left;
+  partubs[0]     =  r3Left;
+  partubs[1]     =  r4Left;
 
   gMC->Gsvolu("V0L4","TUBS",idtmed[3005],partubs,5);  // quartz volume
   gMC->Gspos("V0L4",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
 
-  partubs[0]     =  r4_left;
-  partubs[1]     =  r5_left;
+  partubs[0]     =  r4Left;
+  partubs[1]     =  r5Left;
   partubs[3]     =  90.0-15.0;
   partubs[4]     = 120.0-30.0;
   
@@ -215,7 +217,7 @@ void AliVZEROv2::CreateGeometry()
   gMC->Gspos("V0L6",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
   
 
-// Creation of mother volume V0RI - right part - :
+// Creation of mother volume v0RI - right part - :
   
   partube[0] = r0 - 0.2;
   partube[1] = r5 + 1.0;
@@ -223,17 +225,19 @@ void AliVZEROv2::CreateGeometry()
       
   gMC->Gsvolu("V0RI","TUBE",idtmed[3010],partube,3);
   
-// Creation of  carbon lids (3 mm thick) to keep V0RI box shut...
+// Creation of  carbon lids (2 mm thick) to keep v0RI box shut...
+
+  Float_t  lidThickness = 0.2;
  
   partube[0] =   r0;
   partube[1] =   r5;
-  partube[2] =   +0.3/2.0;
+  partube[2] =   +lidThickness/2.0;
     
   gMC->Gsvolu("V0CA","TUBE",idtmed[3001],partube,3); 
   gMC->Gspos("V0CA",1,"V0RI",0.0,0.0, fThickness/2.0-partube[2],0,"ONLY");
   gMC->Gspos("V0CA",2,"V0RI",0.0,0.0,-fThickness/2.0+partube[2],0,"ONLY");
   
-// Creation of aluminum rings to maintain the V0RI pieces ...
+// Creation of aluminum rings to maintain the v0RI pieces ...
 
   partube[0] =   r0 - 0.2;
   partube[1] =   r0;
@@ -249,7 +253,7 @@ void AliVZEROv2::CreateGeometry()
   gMC->Gsvolu("V0ER","TUBE",idtmed[3003],partube,3);    
   gMC->Gspos("V0ER",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
   
-// Mother volume V0R0 in which will be set 5  scintillator cells 
+// Mother volume v0R0 in which will be set 5  scintillator cells 
   
   partubs[0]      =  r0;
   partubs[1]      =  r5;
@@ -260,10 +264,10 @@ void AliVZEROv2::CreateGeometry()
   gMC->Gsvolu("V0R0","TUBS",idtmed[3010],partubs,5);  // air volume 
 
 // Elementary cell of ring 1 :
-// (the cells will be shifted by 3 mm to output fibers) 
+// (cells 2 and 3  will be shifted by 1 cm to output fibers) 
    
-  Float_t   offset_fibers =  0.7;
-  Float_t   offset        =  fThickness/2.0 - 0.3 - fThickness1/2.0; 
+  Float_t   offsetFibers  =  1.0;
+  Float_t   offset        =  fThickness/2.0 - lidThickness - fThickness1/2.0; 
   Float_t   r1            =  r0 + height1;
       
   partubs[0]     =  r0;
@@ -271,7 +275,7 @@ void AliVZEROv2::CreateGeometry()
   partubs[2]     =  fThickness1/2.0;
   
   gMC->Gsvolu("V0R1","TUBS",idtmed[3005],partubs,5);  // scintillator volume
-  gMC->Gspos("V0R1",1,"V0R0", 0.0, 0.0 , offset, 0,"ONLY"); 
+  gMC->Gspos("V0R1",1,"V0R0", 0.0, 0.0 , -offset, 0,"ONLY"); 
 
 // Elementary cell of ring 2 :
 
@@ -281,7 +285,7 @@ void AliVZEROv2::CreateGeometry()
   partubs[1]     =  r2;
 
   gMC->Gsvolu("V0R2","TUBS",idtmed[3005],partubs,5);  // scintillator volume
-  gMC->Gspos("V0R2",1,"V0R0", 0.0, 0.0 , offset - offset_fibers, 0,"ONLY"); 
+  gMC->Gspos("V0R2",1,"V0R0", 0.0, 0.0 , -offset + offsetFibers, 0,"ONLY"); 
 
 
 // Elementary cell of ring 3 :
@@ -292,7 +296,7 @@ void AliVZEROv2::CreateGeometry()
   partubs[1]     =  r3;
 
   gMC->Gsvolu("V0R3","TUBS",idtmed[3005],partubs,5);  // scintillator volume
-  gMC->Gspos("V0R3",1,"V0R0", 0.0, 0.0 , offset -  2.0 * offset_fibers, 0,"ONLY");
+  gMC->Gspos("V0R3",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
 
 // Elementary cell of ring 4 :
   
@@ -302,7 +306,7 @@ void AliVZEROv2::CreateGeometry()
   partubs[1]     =  r4;
 
   gMC->Gsvolu("V0R4","TUBS",idtmed[3005],partubs,5);  // scintillator volume
-  gMC->Gspos("V0R4",1,"V0R0", 0.0, 0.0 ,  offset - 3.0 * offset_fibers, 0,"ONLY");
+  gMC->Gspos("V0R4",1,"V0R0", 0.0, 0.0 ,  -offset + 2.0 * offsetFibers, 0,"ONLY");
 
 // Elementary cells of ring 5 :
 
@@ -312,45 +316,45 @@ void AliVZEROv2::CreateGeometry()
   partubs[4]     = 120.0-30.0;
   
   gMC->Gsvolu("V0R5","TUBS",idtmed[3005],partubs,5);  // scintillator volume
-  gMC->Gspos("V0R5",1,"V0R0", 0.0, 0.0 , offset - 4.0 * offset_fibers, 0,"ONLY");  
+  gMC->Gspos("V0R5",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");  
 
   partubs[3]     = 120.0-30.0;
   partubs[4]     = 120.0-15.0;
   
   gMC->Gsvolu("V0R6","TUBS",idtmed[3005],partubs,5);  // scintillator volume
-  gMC->Gspos("V0R6",1,"V0R0", 0.0, 0.0 ,  offset - 4.0 * offset_fibers, 0,"ONLY");
+  gMC->Gspos("V0R6",1,"V0R0", 0.0, 0.0 ,  -offset + 2.0 * offsetFibers, 0,"ONLY");
    
-  Float_t  phi_deg = 180./6.; 
+  Float_t  phiDeg = 180./6.; 
 
 // Right part : 
  
-  for(Float_t  phi = 15.0; phi < 360.0; phi = phi + phi_deg)
+  for(Float_t  phi = 15.0; phi < 360.0; phi = phi + phiDeg)
       {        
        AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
-        gMC->Gspos("V0R0",n_detec_R,"V0RI",0.0,
+        gMC->Gspos("V0R0",ndetR,"V0RI",0.0,
                          0.0,0.0,idrotm[902],"ONLY");
-       n_detec_R++;
+       ndetR++;
        }
 
-  gMC->Gspos("V0RI",1,"ALIC",0.0,0.0,zdet,0,"ONLY");
+  gMC->Gspos("V0RI",1,"ALIC",0.0,0.0,-zdet,0,"ONLY");
  
-  n_cells_R = (n_detec_R - 1) * 6;  
-  printf("    Number of cells on Right side =   %d\n",  n_cells_R);    
+  ncellsR = (ndetR - 1) * 6;  
+  printf("    Number of cells on Right side =   %d\n",  ncellsR);    
 
 // Left part :
 
-  for(Float_t  phi = 15.0; phi < 360.0; phi = phi + phi_deg)
+  for(Float_t  phi = 15.0; phi < 360.0; phi = phi + phiDeg)
       {       
        AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
-        gMC->Gspos("V0L0",n_detec_L,"V0LE",0.0,
+        gMC->Gspos("V0L0",ndetL,"V0LE",0.0,
                          0.0,0.0,idrotm[902],"ONLY");
-        n_detec_L++;
+        ndetL++;
        }
 
-  gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,-350.0-fThickness1/2.0,0,"ONLY");
+  gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,350.0+fThickness1/2.0,0,"ONLY");
  
-  n_cells_L = (n_detec_L - 1) * 6;
-  printf("    Number of cells on Left side  =   %d\n",  n_cells_L);    
+  ncellsL = (ndetL - 1) * 6;
+  printf("    Number of cells on Left side  =   %d\n",  ncellsL);    
   for(i=0;i<75;i++) printf("*");
   printf("\n");
            
@@ -369,23 +373,23 @@ void AliVZEROv2::BuildGeometry()
   printf(" VZERO BuildGeometry ");
   for(i=0;i<30;i++) printf("*");
   printf("\n");
-  TNode *Top; 
 
-  TNode *V0Rnode, *V0Rnode0, *V0Rnode6 , *V0Rnode7, *V0Rnode8, *V0Rnode9;
-  TNode *V0Rnode1, *V0Rnode2, *V0Rnode3, *V0Rnode4, *V0Rnode5;
-  TNode *V0Lnode, *V0Lnode0;
-  TNode *V0Lnode1, *V0Lnode2, *V0Lnode3, *V0Lnode4, *V0Lnode5, *V0Lnode6;
+  TNode *top; 
+
+  TNode *v0Rnode, *v0Rnode0, *v0Rnode6 , *v0Rnode7, *v0Rnode8, *v0Rnode9;
+  TNode *v0Rnode1, *v0Rnode2, *v0Rnode3, *v0Rnode4, *v0Rnode5;
+  TNode *v0Lnode, *v0Lnode0;
+  TNode *v0Lnode1, *v0Lnode2, *v0Lnode3, *v0Lnode4, *v0Lnode5, *v0Lnode6;
    
   const int kColorVZERO  = kGreen;
  
-  Top = gAlice->GetGeometry()->GetNode("alice");
+  top = gAlice->GetGeometry()->GetNode("alice");
 
   Float_t  height1, height2, height3, height4, height5; 
   Float_t  height;
   Float_t  theta;  
   
-  Float_t  half_thick_qua;
+  Float_t  halfThickQua;
   Float_t  zdet;
   Float_t  r0, r5;
   Float_t  pi = TMath::Pi();
@@ -398,7 +402,7 @@ void AliVZEROv2::BuildGeometry()
 
   theta             =    pi/6.0/2.0;    
    
-  half_thick_qua    =    fThickness1/2.0; 
+  halfThickQua    =    fThickness1/2.0; 
   
   zdet              =    90.0 - 0.6 - fThickness/2.0;   
   r0                =    4.05;         
@@ -413,54 +417,56 @@ void AliVZEROv2::BuildGeometry()
   partube[1] =  r5 + 1.0;
   partube[2] = fThickness/2.0;   
   
-  TTUBE *V0RI = new TTUBE("V0RI", "V0RI", "void", partube[0], partube[1], partube[2]);
+  TTUBE *v0RI = new TTUBE("V0RI", "V0RI", "void", partube[0], partube[1], partube[2]);
                
-  Top->cd();
+  top->cd();
   
-  V0Rnode = new TNode("V0RI","V0RI",V0RI,0.0,0.0,+zdet,0);
+  v0Rnode = new TNode("V0RI","V0RI",v0RI,0.0,0.0,-zdet,0);
   
-  V0Rnode->SetLineColor(kYellow);
-  fNodes->Add(V0Rnode);  
-  V0Rnode->SetVisibility(2);     
+  v0Rnode->SetLineColor(kYellow);
+  fNodes->Add(v0Rnode);  
+  v0Rnode->SetVisibility(2);     
  
-// Rondelles de carbone (epaisseur 3 mm) de maintien des cellules ...
+// Rondelles de carbone (epaisseur 2 mm) de maintien des cellules ...
+
+  Float_t  lidThickness = 0.2;
   
   partube[0] =   r0;
   partube[1] =   r5;
-  partube[2] =   +0.3/2.0;
+  partube[2] =   +lidThickness/2.0;
   
-  TTUBE  *V0CA = new TTUBE("V0CA", "V0CA", "void",partube[0], partube[1], partube[2]);
+  TTUBE  *v0CA = new TTUBE("V0CA", "V0CA", "void",partube[0], partube[1], partube[2]);
   
-  V0Rnode->cd();
-  V0Rnode6 = new TNode("V0CA", "V0CA",V0CA,0.0,0.0, fThickness/2.0-partube[2],0);       
-  V0Rnode6->SetLineColor(kYellow);
-  fNodes->Add(V0Rnode6); 
-  V0Rnode->cd();
-  V0Rnode7 = new TNode("V0CA", "V0CA",V0CA,0.0,0.0,-fThickness/2.0+partube[2],0);       
-  V0Rnode7->SetLineColor(kYellow);
-  fNodes->Add(V0Rnode7);
+  v0Rnode->cd();
+  v0Rnode6 = new TNode("V0CA", "V0CA",v0CA,0.0,0.0, fThickness/2.0-partube[2],0);       
+  v0Rnode6->SetLineColor(kYellow);
+  fNodes->Add(v0Rnode6); 
+  v0Rnode->cd();
+  v0Rnode7 = new TNode("V0CA", "V0CA",v0CA,0.0,0.0,-fThickness/2.0+partube[2],0);       
+  v0Rnode7->SetLineColor(kYellow);
+  fNodes->Add(v0Rnode7);
   
   partube[0] =   r0 - 0.2;
   partube[1] =   r0;
   partube[2] =   +fThickness/2.0;
   
-  TTUBE *V0IR = new TTUBE("V0IR","V0IR","void", partube[0], partube[1], partube[2]);
+  TTUBE *v0IR = new TTUBE("V0IR","V0IR","void", partube[0], partube[1], partube[2]);
  
-  V0Rnode->cd();
-  V0Rnode8 = new TNode("V0IR", "V0IR",V0IR,0.0,0.0,0.0,0);
-  V0Rnode8->SetLineColor(kYellow);
-  fNodes->Add(V0Rnode8);
+  v0Rnode->cd();
+  v0Rnode8 = new TNode("V0IR", "V0IR",v0IR,0.0,0.0,0.0,0);
+  v0Rnode8->SetLineColor(kYellow);
+  fNodes->Add(v0Rnode8);
 
   partube[0] =   r5;
   partube[1] =   r5 + 1.0; 
   partube[2] =   +fThickness/2.0;
 
-  TTUBE  *V0ER = new TTUBE("V0ER","V0ER","void", partube[0], partube[1], partube[2]);
+  TTUBE  *v0ER = new TTUBE("V0ER","V0ER","void", partube[0], partube[1], partube[2]);
   
-  V0Rnode->cd();
-  V0Rnode9 = new TNode("V0ER", "V0ER",V0ER,0.0,0.0,0.0,0);
-  V0Rnode9->SetLineColor(kYellow);
-  fNodes->Add(V0Rnode9);
+  v0Rnode->cd();
+  v0Rnode9 = new TNode("V0ER", "V0ER",v0ER,0.0,0.0,0.0,0);
+  v0Rnode9->SetLineColor(kYellow);
+  fNodes->Add(v0Rnode9);
   
   Float_t   partubs[5];
  
@@ -470,307 +476,310 @@ void AliVZEROv2::BuildGeometry()
   partubs[3]      =  90.0-15.0;
   partubs[4]      = 120.0-15.0;
 
-  TTUBS  *V0R0 = new TTUBS("V0R0", "V0R0", "void",partubs[0], partubs[1], partubs[2], 
+  TTUBS  *v0R0 = new TTUBS("V0R0", "V0R0", "void",partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]); 
                                                  
-  V0R0->SetNumberOfDivisions(ndiv);                                              
+  v0R0->SetNumberOfDivisions(ndiv);                                              
 
   Float_t   r1     =  r0 + height1;
-  Float_t   offset = fThickness/2.0 - 0.3 - fThickness1/2.0; 
-  Float_t   offset_fibers = 0.7;
+  Float_t   offset = fThickness/2.0 - lidThickness - fThickness1/2.0; 
+  Float_t   offsetFibers = 1.0;
     
   partubs[0]     =  r0;
   partubs[1]     =  r1;
   partubs[2]     =  fThickness1/2.0;
 
-  TTUBS *V0R1 = new TTUBS("V0R1", "V0R1", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0R1 = new TTUBS("V0R1", "V0R1", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
 
-  V0R1->SetNumberOfDivisions(ndiv);
+  v0R1->SetNumberOfDivisions(ndiv);
   
   Float_t   r2   =  r1 + height2;       
   
   partubs[0]     =  r1;
   partubs[1]     =  r2;
 
-  TTUBS *V0R2 = new TTUBS("V0R2", "V0R2", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0R2 = new TTUBS("V0R2", "V0R2", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
 
-  V0R2->SetNumberOfDivisions(ndiv);
+  v0R2->SetNumberOfDivisions(ndiv);
   
   Float_t   r3   =  r2 + height3;
    
   partubs[0]     =  r2;
   partubs[1]     =  r3;
   
-  TTUBS *V0R3 = new TTUBS("V0R3", "V0R3", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0R3 = new TTUBS("V0R3", "V0R3", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
-  V0R3->SetNumberOfDivisions(ndiv);
+  v0R3->SetNumberOfDivisions(ndiv);
  
   Float_t   r4   =  r3 + height4;
    
   partubs[0]     =  r3;
   partubs[1]     =  r4;
 
-  TTUBS *V0R4 = new TTUBS("V0R4", "V0R4", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0R4 = new TTUBS("V0R4", "V0R4", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
 
-  V0R4->SetNumberOfDivisions(ndiv);
+  v0R4->SetNumberOfDivisions(ndiv);
 
   partubs[0]     =  r4;
   partubs[1]     =  r5;
   partubs[3]     =  90.0-15.0;
   partubs[4]     = 120.0-30.0;
   
-  TTUBS *V0R5 = new TTUBS("V0R5", "V0R5", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0R5 = new TTUBS("V0R5", "V0R5", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
 
-  V0R5->SetNumberOfDivisions(ndiv);
+  v0R5->SetNumberOfDivisions(ndiv);
 
   partubs[3]     = 120.0-30.0;
   partubs[4]     = 120.0-15.0;
   
-  TTUBS *V0R6 = new TTUBS("V0R6", "V0R6", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0R6 = new TTUBS("V0R6", "V0R6", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
                                                  
-  V0R6->SetNumberOfDivisions(ndiv);
+  v0R6->SetNumberOfDivisions(ndiv);
                
   Float_t  phi;
-  Float_t  phi_deg= 180./6.;
+  Float_t  phiDeg= 180./6.;
     
-  Int_t    n_detec_R = 1; 
+  Int_t    ndetR = 1; 
 
-  char     NameNode[12];  
+  char     nameNode[12];  
  
-  for (phi = 15.0; phi < 360.0; phi = phi + phi_deg)
+  for (phi = 15.0; phi < 360.0; phi = phi + phiDeg)
   
   {
      
     TRotMatrix* mat920 = new TRotMatrix("rot920","rot920", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );        
      
-    sprintf(NameNode,"SUBDER%d",n_detec_R);
+    sprintf(nameNode,"SUBDER%d",ndetR);
     
-    V0Rnode->cd();
-    V0Rnode0 = new TNode(NameNode,NameNode,V0R0,0.0,0.0, 0.0,mat920);   
-    V0Rnode0->SetLineColor(kYellow);
-    fNodes->Add(V0Rnode0);
-    n_detec_R++;
+    v0Rnode->cd();
+    v0Rnode0 = new TNode(nameNode,nameNode,v0R0,0.0,0.0, 0.0,mat920);   
+    v0Rnode0->SetLineColor(kYellow);
+    fNodes->Add(v0Rnode0);
+    ndetR++;
     
-    sprintf(NameNode,"SUBDER%d",n_detec_R);
-    V0Rnode0->cd();    
-    V0Rnode1 = new TNode(NameNode,NameNode,V0R1,0.0,0.0, offset,0);     
-    V0Rnode1->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Rnode1);
-    n_detec_R++;
+    sprintf(nameNode,"SUBDER%d",ndetR);
+    v0Rnode0->cd();    
+    v0Rnode1 = new TNode(nameNode,nameNode,v0R1,0.0,0.0, -offset,0);    
+    v0Rnode1->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Rnode1);
+    ndetR++;
     
-    sprintf(NameNode,"SUBDER%d",n_detec_R);
-    V0Rnode0->cd();    
-    V0Rnode2 = new TNode(NameNode,NameNode,V0R2,0.0,0.0, offset - offset_fibers,0);     
-    V0Rnode2->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Rnode2);
-    n_detec_R++;
-
-    sprintf(NameNode,"SUBDER%d",n_detec_R);
-    V0Rnode0->cd();    
-    V0Rnode3 = new TNode(NameNode,NameNode,V0R3,0.0,0.0, offset - 2.0*offset_fibers,0);         
-    V0Rnode3->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Rnode3);
-    n_detec_R++;
-
-    sprintf(NameNode,"SUBDER%d",n_detec_R);
-    V0Rnode0->cd();    
-    V0Rnode4 = new TNode(NameNode,NameNode,V0R4,0.0,0.0, offset - 3.0*offset_fibers,0);         
-    V0Rnode4->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Rnode4);
-    n_detec_R++;
+    sprintf(nameNode,"SUBDER%d",ndetR);
+    v0Rnode0->cd();    
+    v0Rnode2 = new TNode(nameNode,nameNode,v0R2,0.0,0.0, -offset + offsetFibers,0);     
+    v0Rnode2->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Rnode2);
+    ndetR++;
+
+    sprintf(nameNode,"SUBDER%d",ndetR);
+    v0Rnode0->cd();    
+    v0Rnode3 = new TNode(nameNode,nameNode,v0R3,0.0,0.0, -offset + 2.0*offsetFibers,0);         
+    v0Rnode3->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Rnode3);
+    ndetR++;
+
+    sprintf(nameNode,"SUBDER%d",ndetR);
+    v0Rnode0->cd();    
+    v0Rnode4 = new TNode(nameNode,nameNode,v0R4,0.0,0.0, -offset + 2.0*offsetFibers,0);         
+    v0Rnode4->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Rnode4);
+    ndetR++;
      
-    sprintf(NameNode,"SUBDER%d",n_detec_R);
-    V0Rnode0->cd();    
-    V0Rnode5 = new TNode(NameNode,NameNode,V0R5,0.0,0.0, offset - 4.0*offset_fibers,0);         
-    V0Rnode5->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Rnode5);
-    n_detec_R++;
+    sprintf(nameNode,"SUBDER%d",ndetR);
+    v0Rnode0->cd();    
+    v0Rnode5 = new TNode(nameNode,nameNode,v0R5,0.0,0.0, -offset + 2.0*offsetFibers,0);         
+    v0Rnode5->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Rnode5);
+    ndetR++;
     
-    sprintf(NameNode,"SUBDER%d",n_detec_R);
-    V0Rnode0->cd();    
-    V0Rnode6 = new TNode(NameNode,NameNode,V0R6,0.0,0.0, offset - 4.0*offset_fibers,0);         
-    V0Rnode6->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Rnode6);
-    n_detec_R++;
+    sprintf(nameNode,"SUBDER%d",ndetR);
+    v0Rnode0->cd();    
+    v0Rnode6 = new TNode(nameNode,nameNode,v0R6,0.0,0.0, -offset + 2.0*offsetFibers,0);         
+    v0Rnode6->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Rnode6);
+    ndetR++;
        
-    V0Rnode0->SetVisibility(2);
+    v0Rnode0->SetVisibility(2);
     
   }    
 
 // Left side of VZERO :
      
-  Float_t   r0_left      =   4.3;   
-  Float_t   height1_left =   2.6; 
-  Float_t   height2_left =   4.1;
-  Float_t   height3_left =   6.4;
-  Float_t   height4_left =  10.2;
-  Float_t   height5_left =  16.9;
-  Float_t   height_left  = height1_left + height2_left + height3_left 
-                                        + height4_left + height5_left;
-  Float_t   r5_left      = r0_left  + height_left; 
-
-  partube[0] =  r0_left;
-  partube[1] =  r5_left;
+  Float_t   r0Left      =   4.3;   
+  Float_t   height1Left =   2.6; 
+  Float_t   height2Left =   4.1;
+  Float_t   height3Left =   6.4;
+  Float_t   height4Left =  10.2;
+  Float_t   height5Left =  16.9;
+  Float_t   heightLeft  = height1Left + height2Left + height3Left 
+                                        + height4Left + height5Left;
+  Float_t   r5Left      = r0Left  + heightLeft; 
+
+  partube[0] =  r0Left;
+  partube[1] =  r5Left;
   partube[2] =  fThickness1/2.0; 
   
-  TTUBE *V0LE = new TTUBE("V0LE", "V0LE", "void", partube[0], partube[1], partube[2]);
+  TTUBE *v0LE = new TTUBE("V0LE", "V0LE", "void", partube[0], partube[1], partube[2]);
                
-  Top->cd();
+  top->cd();
   
-  V0Lnode = new TNode("V0LE","V0LE",V0LE,0.0,0.0,-350.0-fThickness1/2.0,0);
+  v0Lnode = new TNode("V0LE","V0LE",v0LE,0.0,0.0,350.0+fThickness1/2.0,0);
   
-  V0Lnode->SetLineColor(kBlue);
-  fNodes->Add(V0Lnode);
+  v0Lnode->SetLineColor(kBlue);
+  fNodes->Add(v0Lnode);
   
-  V0Lnode->SetVisibility(2);
+  v0Lnode->SetVisibility(2);
 
-  partubs[0]      =  r0_left;
-  partubs[1]      =  r5_left;
+  partubs[0]      =  r0Left;
+  partubs[1]      =  r5Left;
   partubs[2]      =  fThickness1/2.0;
   partubs[3]      =  90.0-15.0;
   partubs[4]      = 120.0-15.0;
   
-  TTUBS *V0L0 = new TTUBS("V0L0", "V0L0", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0L0 = new TTUBS("V0L0", "V0L0", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
 
-  V0L0->SetNumberOfDivisions(ndiv); 
-  V0L0->SetLineColor(7);
+  v0L0->SetNumberOfDivisions(ndiv); 
+  v0L0->SetLineColor(7);
   
-  Float_t   offset_left;
-  offset_left    = - fThickness1/2.0; 
+  Float_t   offsetLeft;
+  offsetLeft    = - fThickness1/2.0; 
 
-  Float_t   r1_left =  r0_left + height1_left;        
+  Float_t   r1Left =  r0Left + height1Left;        
       
-  partubs[0]     =  r0_left;
-  partubs[1]     =  r1_left;
+  partubs[0]     =  r0Left;
+  partubs[1]     =  r1Left;
 
-  TTUBS *V0L1 = new TTUBS("V0L1", "V0L1", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0L1 = new TTUBS("V0L1", "V0L1", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
 
-  V0L1->SetNumberOfDivisions(ndiv);
+  v0L1->SetNumberOfDivisions(ndiv);
   
-  Float_t   r2_left =  r1_left + height2_left;       
+  Float_t   r2Left =  r1Left + height2Left;       
   
-  partubs[0]     =  r1_left;
-  partubs[1]     =  r2_left;
+  partubs[0]     =  r1Left;
+  partubs[1]     =  r2Left;
 
-  TTUBS *V0L2 = new TTUBS("V0L2", "V0L2", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0L2 = new TTUBS("V0L2", "V0L2", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
 
-  V0L2->SetNumberOfDivisions(ndiv);
+  v0L2->SetNumberOfDivisions(ndiv);
   
-  Float_t   r3_left  =  r2_left + height3_left;
+  Float_t   r3Left  =  r2Left + height3Left;
   
-  partubs[0]     =  r2_left;
-  partubs[1]     =  r3_left;
+  partubs[0]     =  r2Left;
+  partubs[1]     =  r3Left;
   
-  TTUBS *V0L3 = new TTUBS("V0L3", "V0L3", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0L3 = new TTUBS("V0L3", "V0L3", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
-  V0L3->SetNumberOfDivisions(ndiv);
+  v0L3->SetNumberOfDivisions(ndiv);
  
-  Float_t   r4_left  =   r3_left + height4_left;
+  Float_t   r4Left  =   r3Left + height4Left;
   
-  partubs[0]     =  r3_left;
-  partubs[1]     =  r4_left;
+  partubs[0]     =  r3Left;
+  partubs[1]     =  r4Left;
 
-  TTUBS *V0L4 = new TTUBS("V0L4", "V0L4", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0L4 = new TTUBS("V0L4", "V0L4", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
 
-  V0L4->SetNumberOfDivisions(ndiv);
+  v0L4->SetNumberOfDivisions(ndiv);
 
-  partubs[0]     =  r4_left;
-  partubs[1]     =  r5_left;
+  partubs[0]     =  r4Left;
+  partubs[1]     =  r5Left;
   partubs[3]     =  90.0-15.0;
   partubs[4]     = 120.0-30.0;
   
-  TTUBS *V0L5 = new TTUBS("V0L5", "V0L5", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0L5 = new TTUBS("V0L5", "V0L5", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
 
 
-  V0L5->SetNumberOfDivisions(ndiv);
+  v0L5->SetNumberOfDivisions(ndiv);
 
   partubs[3]     = 120.0-30.0;
   partubs[4]     = 120.0-15.0;
   
-  TTUBS *V0L6 = new TTUBS("V0L6", "V0L6", "void", partubs[0], partubs[1], partubs[2], 
+  TTUBS *v0L6 = new TTUBS("V0L6", "V0L6", "void", partubs[0], partubs[1], partubs[2], 
                                                   partubs[3], partubs[4]);
                                                  
-  V0L6->SetNumberOfDivisions(ndiv);
+  v0L6->SetNumberOfDivisions(ndiv);
 
-  Int_t    n_detec_L   = 1;
+  Int_t    ndetL   = 1;
  
-  for (phi = 15.0; phi < 360.0; phi = phi + phi_deg)
+  for (phi = 15.0; phi < 360.0; phi = phi + phiDeg)
   
   {
      
     TRotMatrix* mat920 = new TRotMatrix("rot920","rot920", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );        
     
  
-    sprintf(NameNode,"SUBDEL%d",n_detec_L);
+    sprintf(nameNode,"SUBDEL%d",ndetL);
     
-    V0Lnode->cd();
-    V0Lnode0 = new TNode(NameNode,NameNode,V0L0,0.0,0.0, offset_left + half_thick_qua,mat920);  
-    V0Lnode0->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Lnode0);
-    n_detec_L++;
+    v0Lnode->cd();
+    v0Lnode0 = new TNode(nameNode,nameNode,v0L0,0.0,0.0, offsetLeft + halfThickQua,mat920);     
+    v0Lnode0->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Lnode0);
+    ndetL++;
     
-    sprintf(NameNode,"SUBDEL%d",n_detec_L);
-    V0Lnode0->cd();    
-    V0Lnode1 = new TNode(NameNode,NameNode,V0L1,0.0,0.0, 0.0,0);        
-    V0Lnode1->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Lnode1);
-    n_detec_L++;
+    sprintf(nameNode,"SUBDEL%d",ndetL);
+    v0Lnode0->cd();    
+    v0Lnode1 = new TNode(nameNode,nameNode,v0L1,0.0,0.0, 0.0,0);        
+    v0Lnode1->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Lnode1);
+    ndetL++;
     
-    sprintf(NameNode,"SUBDEL%d",n_detec_L);
-    V0Lnode0->cd();    
-    V0Lnode2 = new TNode(NameNode,NameNode,V0L2,0.0,0.0, 0.0,0);        
-    V0Lnode2->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Lnode2);
-    n_detec_L++;
-
-
-    sprintf(NameNode,"SUBDEL%d",n_detec_L);
-    V0Lnode0->cd();    
-    V0Lnode3 = new TNode(NameNode,NameNode,V0L3,0.0,0.0, 0.0,0);        
-    V0Lnode3->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Lnode3);
-    n_detec_L++;
-
-    sprintf(NameNode,"SUBDEL%d",n_detec_L);
-    V0Lnode0->cd();    
-    V0Lnode4 = new TNode(NameNode,NameNode,V0L4,0.0,0.0, 0.0,0);        
-    V0Lnode4->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Lnode4);
-    n_detec_L++;
+    sprintf(nameNode,"SUBDEL%d",ndetL);
+    v0Lnode0->cd();    
+    v0Lnode2 = new TNode(nameNode,nameNode,v0L2,0.0,0.0, 0.0,0);        
+    v0Lnode2->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Lnode2);
+    ndetL++;
+
+
+    sprintf(nameNode,"SUBDEL%d",ndetL);
+    v0Lnode0->cd();    
+    v0Lnode3 = new TNode(nameNode,nameNode,v0L3,0.0,0.0, 0.0,0);        
+    v0Lnode3->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Lnode3);
+    ndetL++;
+
+    sprintf(nameNode,"SUBDEL%d",ndetL);
+    v0Lnode0->cd();    
+    v0Lnode4 = new TNode(nameNode,nameNode,v0L4,0.0,0.0, 0.0,0);        
+    v0Lnode4->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Lnode4);
+    ndetL++;
      
-    sprintf(NameNode,"SUBDEL%d",n_detec_L);
-    V0Lnode0->cd();    
-    V0Lnode5 = new TNode(NameNode,NameNode,V0L5,0.0,0.0, 0.0,0);        
-    V0Lnode5->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Lnode5);
-    n_detec_L++;
+    sprintf(nameNode,"SUBDEL%d",ndetL);
+    v0Lnode0->cd();    
+    v0Lnode5 = new TNode(nameNode,nameNode,v0L5,0.0,0.0, 0.0,0);        
+    v0Lnode5->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Lnode5);
+    ndetL++;
     
-    sprintf(NameNode,"SUBDEL%d",n_detec_L);
-    V0Lnode0->cd();    
-    V0Lnode6 = new TNode(NameNode,NameNode,V0L6,0.0,0.0, 0.0,0);        
-    V0Lnode6->SetLineColor(kColorVZERO);
-    fNodes->Add(V0Lnode6);
-    n_detec_L++;
+    sprintf(nameNode,"SUBDEL%d",ndetL);
+    v0Lnode0->cd();    
+    v0Lnode6 = new TNode(nameNode,nameNode,v0L6,0.0,0.0, 0.0,0);        
+    v0Lnode6->SetLineColor(kColorVZERO);
+    fNodes->Add(v0Lnode6);
+    ndetL++;
        
-    V0Lnode0->SetVisibility(2);
+    v0Lnode0->SetVisibility(2);
     
   }    
-      
+     
 }  
     
-//------------------------------------------------------------------------
+//_____________________________________________________________________________
 void AliVZEROv2::CreateMaterials()
 {
+
+// Creates materials used for geometry 
+
     Int_t i;
 
     printf("\n");
@@ -808,7 +817,6 @@ void AliVZEROv2::CreateMaterials()
 
     Int_t *idtmed = fIdtmed->GetArray()-2999;
     
-//    TGeant3 *geant3 = (TGeant3*) gMC;
     
 //  Parameters related to Quarz (SiO2) :
  
@@ -837,11 +845,18 @@ void AliVZEROv2::CreateMaterials()
     Float_t zscin[2] = {1.,6.};
     Float_t wscin[2] = {1.,1.};
     Float_t denscin  = 1.032;
-    
+
+// AIR
+
+    Float_t aAir[4]={12.,14.,16.,36.};
+    Float_t zAir[4]={6.,7.,8.,18.};
+    Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
+    Float_t dAir = 1.20479E-3;
+        
 //  Definition of materials :
        
-    AliMaterial( 1, "AIR A$", 14.61, 7.3, .001205, 30420., 67500, 0, 0);
-    AliMaterial(11, "AIR I$", 14.61, 7.3, .001205, 30420., 67500, 0, 0);
+    AliMixture( 1, "AIR A$", aAir,zAir,dAir,4,wAir);
+    AliMixture(11, "AIR I$", aAir,zAir,dAir,4,wAir);
     AliMaterial( 2, "CARBON$"  , 12.01, 6.0, 2.265, 18.8, 49.9, 0, 0);
     AliMixture(  3, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
     AliMaterial( 4, "ALUMINIUM1$", 26.98, 13., 2.7, 8.9, 37.2, 0, 0);
@@ -850,8 +865,8 @@ void AliVZEROv2::CreateMaterials()
     AliMixture( 6, "Scintillator$",ascin,zscin,denscin,-2,wscin);
     
      
-    Int_t   ISXFLD = gAlice->Field()->Integ();
-    Float_t SXMGMX = gAlice->Field()->Max();
+    Int_t   iSXFLD = gAlice->Field()->Integ();
+    Float_t sXMGMX = gAlice->Field()->Max();
     
     Float_t tmaxfd, stemax, deemax, epsil, stmin;
         
@@ -862,28 +877,28 @@ void AliVZEROv2::CreateMaterials()
     stmin  = 0.001;
   
 //  Active Air :    
-    AliMedium(1, "ACTIVE AIR$", 1, 1, ISXFLD, SXMGMX,
+    AliMedium(1, "ACTIVE AIR$", 1, 1, iSXFLD, sXMGMX,
               10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
 
 //  Inactive air : 
   
-    AliMedium(11, "INACTIVE AIR$", 11, 0, ISXFLD, SXMGMX,
+    AliMedium(11, "INACTIVE AIR$", 11, 0, iSXFLD, sXMGMX,
               10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
     
-    AliMedium(2, "CARBON$ ", 2,  1, ISXFLD, SXMGMX,
+    AliMedium(2, "CARBON$ ", 2,  1, iSXFLD, sXMGMX,
               tmaxfd, stemax, deemax, epsil, stmin, 0, 0);   
 
-    AliMedium(3, "QUARZ$", 3, 1, ISXFLD, SXMGMX,
+    AliMedium(3, "QUARZ$", 3, 1, iSXFLD, sXMGMX,
               tmaxfd, fMaxStepQua, fMaxDestepQua, epsil, stmin, 0, 0);
     
-    AliMedium(4,"ALUMINUM1$",4, 1, ISXFLD, SXMGMX,
+    AliMedium(4,"ALUMINUM1$",4, 1, iSXFLD, sXMGMX,
               tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
              
 
-    AliMedium(5,"ALUMINUM2$",5, 1, ISXFLD, SXMGMX,
+    AliMedium(5,"ALUMINUM2$",5, 1, iSXFLD, sXMGMX,
               tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);    
 
-    AliMedium(6,"SCINTILLATOR$",6, 1, ISXFLD, SXMGMX, 10.0, 0.1, 0.1, 0.003, 0.003, 0, 0);
+    AliMedium(6,"SCINTILLATOR$",6, 1, iSXFLD, sXMGMX, 10.0, 0.1, 0.1, 0.003, 0.003, 0, 0);
 
     gMC->Gstpar(idtmed[3000], "LOSS", 1.);  //  [3000] = air ACTIF  [3010] = air INACTIF
     gMC->Gstpar(idtmed[3000], "HADR", 1.);
@@ -927,10 +942,10 @@ void AliVZEROv2::CreateMaterials()
 
 //    gMC->SetCerenkov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);    
 //    gMC->SetCerenkov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
-                                   
-    
+                                       
 }
-//---------------------------------------------------------------------
+
+//_____________________________________________________________________________
 void AliVZEROv2::DrawModule()
 {
 
@@ -947,10 +962,10 @@ void AliVZEROv2::DrawModule()
 
 }
 
-//-------------------------------------------------------------------
+//_____________________________________________________________________________
 void AliVZEROv2::Init()
 {
-// Initialises version 1 of the VZERO Detector
+// Initialises version 2 of the VZERO Detector
 // Just prints an information message
   
    printf(" VZERO version %d initialized \n",IsVersion());
@@ -962,10 +977,12 @@ void AliVZEROv2::Init()
   
 }
 
-//-------------------------------------------------------------------
 
+//_____________________________________________________________________________
 void AliVZEROv2::StepManager()
 {
+// Step Manager, called at each step 
    
      Int_t     copy;
      static    Int_t   vol[4];
@@ -977,8 +994,8 @@ void AliVZEROv2::StepManager()
      
      Float_t        theta;
      Float_t        phi;
-     Float_t        kRaddeg = 180/TMath::Pi();
-     Float_t        RingNumber;
+     Float_t        kRaddeg = 180.0/TMath::Pi();
+     Float_t        ringNumber;
 
      Int_t          ipart;
      Float_t        destep, step;
@@ -996,42 +1013,48 @@ void AliVZEROv2::StepManager()
 
      if      ( gMC->CurrentVolID(copy) == gMC->VolId("V0R1") ||
                gMC->CurrentVolID(copy) == gMC->VolId("V0L1") )
-              RingNumber = 1.0;
+              ringNumber = 1.0;
      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R2") ||
                gMC->CurrentVolID(copy) == gMC->VolId("V0L2") ) 
-              RingNumber = 2.0;  
+              ringNumber = 2.0;  
      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R3") ||
                gMC->CurrentVolID(copy) == gMC->VolId("V0L3") )
-              RingNumber = 3.0;
+              ringNumber = 3.0;
      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R4") ||
                gMC->CurrentVolID(copy) == gMC->VolId("V0L4") )          
-              RingNumber = 4.0; 
+              ringNumber = 4.0; 
      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R5") ||
                gMC->CurrentVolID(copy) == gMC->VolId("V0L5") ||
               gMC->CurrentVolID(copy) == gMC->VolId("V0L6") ||
               gMC->CurrentVolID(copy) == gMC->VolId("V0R6") )    
-               RingNumber = 5.0; 
+               ringNumber = 5.0; 
      else
-              RingNumber = 0.0;
+              ringNumber = 0.0;
 
-     if  (  RingNumber > 0.5  ) { 
+     if  (  ringNumber > 0.5  ) { 
      
         destep    = gMC->Edep();
        step      = gMC->TrackStep();
         eloss    += destep;
        tlength  += step; 
-       
-                
+
         if  ( gMC->IsTrackEntering()  )  {  
        
             gMC->TrackPosition(pos);
      
             gMC->TrackMomentum(mom);      
             Double_t tc   = mom[0]*mom[0]+mom[1]*mom[1];
-            Double_t Pt   = TMath::Sqrt(tc);
-           Double_t Pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
-            theta   = Float_t(TMath::ATan2(Pt,Double_t(mom[2])))*kRaddeg;
-            phi     = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
+            Double_t pt   = TMath::Sqrt(tc);
+           Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
+            theta   = Float_t(TMath::ATan2(pt,Double_t(mom[2])))*kRaddeg;
+            phi     = Float_t(TMath::ATan2(Double_t(pos[1]),Double_t(pos[0])))*kRaddeg;
+
+////////////////////////////////////////////////////////////////////////////         
+     Float_t angle1 = Float_t(TMath::ATan2(Double_t(pos[1]),Double_t(pos[0])))*kRaddeg;
+     if(angle1 < 0.0) angle1 = angle1 + 360.0;
+     printf(" RingNumber, copy, phi1  = %f %d %f \n\n", ringNumber,vol[1],angle1); 
+////////////////////////////////////////////////////////////////////////////   
+                
      
             ipart  = gMC->TrackPid();
 
@@ -1044,15 +1067,15 @@ void AliVZEROv2::StepManager()
             hits[5]  = gMC->TrackCharge();
            hits[6]  = theta;
            hits[7]  = phi;
-           hits[8]  = RingNumber;
+           hits[8]  = ringNumber;
         
-           hits[9]  = Pt;
-           hits[10] = Pmom;
+           hits[9]  = pt;
+           hits[10] = pmom;
            hits[11] = mom[0];
            hits[12] = mom[1];
            hits[13] = mom[2];
            
-           TParticle *par = gAlice->Particle(gAlice->GetCurrentTrackNumber());
+           TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
             hits[14] = par->Vx();
             hits[15] = par->Vy();
             hits[16] = par->Vz();
@@ -1067,11 +1090,10 @@ void AliVZEROv2::StepManager()
         hits[17] =   eloss;
         hits[18] = tlength;
         
-         AddHit(gAlice->GetCurrentTrackNumber(), vol, hits);
+         AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
                 
         tlength  = 0.0;
         eloss    = 0.0; 
-
          
         } 
     }
@@ -1082,42 +1104,42 @@ void AliVZEROv2::StepManager()
 void AliVZEROv2::AddHit(Int_t track, Int_t *vol, Float_t *hits)
 {
   
-  //  Add a VZERO hit
+//  Adds a VZERO hit
   
-
   TClonesArray &lhits = *fHits;
   new(lhits[fNhits++]) AliVZEROhit(fIshunt,track,vol,hits);
 }
 
-//---------------------------------------------------------------------
+//_____________________________________________________________________________
 void AliVZEROv2::AddDigits(Int_t *tracks, Int_t* digits) 
 {
 
+//  Adds a VZERO digit
+
    TClonesArray  &ldigits = *fDigits;
    new(ldigits[fNdigits++]) AliVZEROdigit(tracks, digits);
 }
 
-//---------------------------------------------------------------------
+//_____________________________________________________________________________
 void AliVZEROv2::MakeBranch(Option_t *option)
 {
   
-  // Creates new branches in the current Root Tree
-  
-  
+// Creates new branches in the current Root Tree
+    
   char branchname[10];
   sprintf(branchname,"%s",GetName());
   printf(" fBufferSize = %d \n",fBufferSize);
   
-  const char *H = strstr(option,"H");
+  const char *cH = strstr(option,"H");
   
-  if (fHits   && TreeH() && H) {
+  if (fHits   && TreeH() && cH) {
     TreeH()->Branch(branchname,&fHits, fBufferSize);
     printf("* AliDetector::MakeBranch * Making Branch %s for hits\n",branchname);
   }     
 
-  const char *D = strstr(option,"D");
-  //
-  if (fDigits   && fLoader->TreeD() && D) {
+  const char *cD = strstr(option,"D");
+  
+  if (fDigits   && fLoader->TreeD() && cD) {
     fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize);
     printf("* AliDetector::MakeBranch * Making Branch %s for digits\n",branchname);
   }