]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - VZERO/AliVZEROv2.cxx
Added graphical reference to help DQM shifter. Updated sim TOF QA histograms. (F...
[u/mrichter/AliRoot.git] / VZERO / AliVZEROv2.cxx
index 1de907a15e6bb63f219469469d9845286e86cec9..ec6242ee65df09a894ec7142ac6c494b5169137b 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)                   // 
-//   New coordinate system implemented in october 2003              //
+//   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     //
 //                                                                  //
 //////////////////////////////////////////////////////////////////////
 
 
 // --- ROOT libraries ---
 #include <TClonesArray.h>
-#include <TGeant3.h>
-#include <TGeometry.h>
+#include <TGeoGlobalMagField.h>
 #include <TLorentzVector.h>
 #include <TMath.h>
-#include <TNode.h>
 #include <TObjectTable.h>
-#include <TTUBE.h>
-#include <TTUBS.h>
-#include <TVirtualMC.h>
 #include <TParticle.h>
+#include <TVirtualMC.h>
 
 // --- AliRoot header files ---
 #include "AliRun.h"
 #include "AliMC.h"
 #include "AliConst.h"
+#include "AliLog.h"
 #include "AliMagF.h"
 #include "AliVZEROLoader.h"
 #include "AliVZEROdigit.h"
@@ -70,13 +70,7 @@ AliVZEROv2::AliVZEROv2(const char *name, const char *title):
 
 // Standard constructor for V-zero Detector  version 2
 
-  Int_t i;
-
-  printf("\n");
-  for(i=0;i<26;i++) printf("*");
-  printf(" Create VZERO object ");
-  for(i=0;i<26;i++) printf("*");
-  printf("\n");
+  AliDebug(2,"Create VZERO object");
   
 }
 
@@ -86,13 +80,7 @@ void AliVZEROv2::CreateGeometry()
 
 // Creates the GEANT geometry of the V-zero Detector  version 2
   
-  Int_t i;
-  
-  printf("\n");
-  for(i=0;i<26;i++) printf("*");
-  printf(" Create VZERO Geometry ");
-  for(i=0;i<26;i++) printf("*");
-  printf("\n");
+  AliDebug(2,"Create VZERO Geometry");
       
   Int_t    *idtmed = fIdtmed->GetArray()-2999;
 
@@ -123,8 +111,11 @@ void AliVZEROv2::CreateGeometry()
   theta       = pi/6.0/2.0;       // half angular opening = 15 degrees
     
   halfThickQua= fThickness1/2.0;  // half thickness of elementary cell (inner ring)
-    
-  zdet        =    90.0 - 0.6 -fThickness/2.0;  // distance to vertex (along Z axis)
+  
+// 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;
@@ -220,11 +211,13 @@ 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");
@@ -257,10 +250,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   offsetFibers =  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;
@@ -299,7 +292,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 * offsetFibers, 0,"ONLY");
+  gMC->Gspos("V0R4",1,"V0R0", 0.0, 0.0 ,  -offset + 2.0 * offsetFibers, 0,"ONLY");
 
 // Elementary cells of ring 5 :
 
@@ -309,13 +302,13 @@ 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 * offsetFibers, 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 * offsetFibers, 0,"ONLY");
+  gMC->Gspos("V0R6",1,"V0R0", 0.0, 0.0 ,  -offset + 2.0 * offsetFibers, 0,"ONLY");
    
   Float_t  phiDeg = 180./6.; 
 
@@ -332,7 +325,7 @@ void AliVZEROv2::CreateGeometry()
   gMC->Gspos("V0RI",1,"ALIC",0.0,0.0,-zdet,0,"ONLY");
  
   ncellsR = (ndetR - 1) * 6;  
-  printf("    Number of cells on Right side =   %d\n",  ncellsR);    
+  AliInfo(Form("Number of cells on Right side =   %d",  ncellsR));    
 
 // Left part :
 
@@ -347,423 +340,9 @@ void AliVZEROv2::CreateGeometry()
   gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,350.0+fThickness1/2.0,0,"ONLY");
  
   ncellsL = (ndetL - 1) * 6;
-  printf("    Number of cells on Left side  =   %d\n",  ncellsL);    
-  for(i=0;i<75;i++) printf("*");
-  printf("\n");
+  AliInfo(Form("Number of cells on Left side  =   %d",  ncellsL));    
            
-}
-            
-//_____________________________________________________________________________
-void AliVZEROv2::BuildGeometry()
-{
-  
-// Builds simple ROOT TNode geometry for event display
-
-  Int_t i;
-
-  printf("\n");
-  for(i=0;i<30;i++) printf("*");
-  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;
-   
-  const int kColorVZERO  = kGreen;
-  top = gAlice->GetGeometry()->GetNode("alice");
-
-  Float_t  height1, height2, height3, height4, height5; 
-  Float_t  height;
-  Float_t  theta;  
-  
-  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  
-
-  theta             =    pi/6.0/2.0;    
-   
-  halfThickQua    =    fThickness1/2.0; 
-  
-  zdet              =    90.0 - 0.6 - fThickness/2.0;   
-  r0                =    4.05;         
-  height            =    height1 + height2 + height3 + height4 + height5;
-  r5                =    r0 + height;
-  
-  Int_t     ndiv    =     1;  
-
-  Float_t   partube[3];
-
-  partube[0] =  r0 - 0.2;
-  partube[1] =  r5 + 1.0;
-  partube[2] = fThickness/2.0;   
-  
-  TTUBE *v0RI = new TTUBE("V0RI", "V0RI", "void", partube[0], partube[1], partube[2]);
-               
-  top->cd();
-  
-  v0Rnode = new TNode("V0RI","V0RI",v0RI,0.0,0.0,-zdet,0);
-  
-  v0Rnode->SetLineColor(kYellow);
-  fNodes->Add(v0Rnode);  
-  v0Rnode->SetVisibility(2);     
-// Rondelles de carbone (epaisseur 3 mm) de maintien des cellules ...
-  
-  partube[0] =   r0;
-  partube[1] =   r5;
-  partube[2] =   +0.3/2.0;
-  
-  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);
-  
-  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]);
-  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]);
-  
-  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];
-  partubs[0]      =  r0;
-  partubs[1]      =  r5;
-  partubs[2]      =  fThickness/2.0;
-  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], 
-                                                  partubs[3], partubs[4]); 
-                                                 
-  v0R0->SetNumberOfDivisions(ndiv);                                              
-
-  Float_t   r1     =  r0 + height1;
-  Float_t   offset = fThickness/2.0 - 0.3 - fThickness1/2.0; 
-  Float_t   offsetFibers = 0.7;
-    
-  partubs[0]     =  r0;
-  partubs[1]     =  r1;
-  partubs[2]     =  fThickness1/2.0;
-
-  TTUBS *v0R1 = new TTUBS("V0R1", "V0R1", "void", partubs[0], partubs[1], partubs[2], 
-                                                  partubs[3], partubs[4]);
-
-  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], 
-                                                  partubs[3], partubs[4]);
-
-  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], 
-                                                  partubs[3], partubs[4]);
-  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], 
-                                                  partubs[3], partubs[4]);
-
-  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], 
-                                                  partubs[3], partubs[4]);
-
-  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], 
-                                                  partubs[3], partubs[4]);
-                                                 
-  v0R6->SetNumberOfDivisions(ndiv);
-               
-  Float_t  phi;
-  Float_t  phiDeg= 180./6.;
-    
-  Int_t    ndetR = 1; 
-
-  char     nameNode[12];  
-  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",ndetR);
-    
-    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",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",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 + 3.0*offsetFibers,0);         
-    v0Rnode4->SetLineColor(kColorVZERO);
-    fNodes->Add(v0Rnode4);
-    ndetR++;
-     
-    sprintf(nameNode,"SUBDER%d",ndetR);
-    v0Rnode0->cd();    
-    v0Rnode5 = new TNode(nameNode,nameNode,v0R5,0.0,0.0, -offset + 4.0*offsetFibers,0);         
-    v0Rnode5->SetLineColor(kColorVZERO);
-    fNodes->Add(v0Rnode5);
-    ndetR++;
-    
-    sprintf(nameNode,"SUBDER%d",ndetR);
-    v0Rnode0->cd();    
-    v0Rnode6 = new TNode(nameNode,nameNode,v0R6,0.0,0.0, -offset + 4.0*offsetFibers,0);         
-    v0Rnode6->SetLineColor(kColorVZERO);
-    fNodes->Add(v0Rnode6);
-    ndetR++;
-       
-    v0Rnode0->SetVisibility(2);
-    
-  }    
-
-// Left side of VZERO :
-     
-  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]);
-               
-  top->cd();
-  
-  v0Lnode = new TNode("V0LE","V0LE",v0LE,0.0,0.0,350.0+fThickness1/2.0,0);
-  
-  v0Lnode->SetLineColor(kBlue);
-  fNodes->Add(v0Lnode);
-  
-  v0Lnode->SetVisibility(2);
-
-  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], 
-                                                  partubs[3], partubs[4]);
-
-  v0L0->SetNumberOfDivisions(ndiv); 
-  v0L0->SetLineColor(7);
-  
-  Float_t   offsetLeft;
-  offsetLeft    = - fThickness1/2.0; 
-
-  Float_t   r1Left =  r0Left + height1Left;        
-      
-  partubs[0]     =  r0Left;
-  partubs[1]     =  r1Left;
-
-  TTUBS *v0L1 = new TTUBS("V0L1", "V0L1", "void", partubs[0], partubs[1], partubs[2], 
-                                                  partubs[3], partubs[4]);
-
-  v0L1->SetNumberOfDivisions(ndiv);
-  
-  Float_t   r2Left =  r1Left + height2Left;       
-  
-  partubs[0]     =  r1Left;
-  partubs[1]     =  r2Left;
-
-  TTUBS *v0L2 = new TTUBS("V0L2", "V0L2", "void", partubs[0], partubs[1], partubs[2], 
-                                                  partubs[3], partubs[4]);
-
-  v0L2->SetNumberOfDivisions(ndiv);
-  
-  Float_t   r3Left  =  r2Left + height3Left;
-  
-  partubs[0]     =  r2Left;
-  partubs[1]     =  r3Left;
-  
-  TTUBS *v0L3 = new TTUBS("V0L3", "V0L3", "void", partubs[0], partubs[1], partubs[2], 
-                                                  partubs[3], partubs[4]);
-  v0L3->SetNumberOfDivisions(ndiv);
-  Float_t   r4Left  =   r3Left + height4Left;
-  
-  partubs[0]     =  r3Left;
-  partubs[1]     =  r4Left;
-
-  TTUBS *v0L4 = new TTUBS("V0L4", "V0L4", "void", partubs[0], partubs[1], partubs[2], 
-                                                  partubs[3], partubs[4]);
-
-  v0L4->SetNumberOfDivisions(ndiv);
-
-  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], 
-                                                  partubs[3], partubs[4]);
-
-
-  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], 
-                                                  partubs[3], partubs[4]);
-                                                 
-  v0L6->SetNumberOfDivisions(ndiv);
-
-  Int_t    ndetL   = 1;
-  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",ndetL);
-    
-    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",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",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",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",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);
-    
-  }    
-     
-}  
+}            
     
 //_____________________________________________________________________________
 void AliVZEROv2::CreateMaterials()
@@ -771,13 +350,7 @@ void AliVZEROv2::CreateMaterials()
 
 // Creates materials used for geometry 
 
-    Int_t i;
-
-    printf("\n");
-    for(i=0;i<25;i++) printf("*");
-    printf(" VZERO create materials ");
-    for(i=0;i<26;i++) printf("*");
-    printf("\n");
+    AliDebug(2,"VZERO create materials");
     
 /*
     Float_t ppckov[14] = { 5.5e-9, 5.7e-9, 5.9e-9, 6.1e-9, 6.3e-9, 6.5e-9, 6.7e-9, 
@@ -808,7 +381,6 @@ void AliVZEROv2::CreateMaterials()
 
     Int_t *idtmed = fIdtmed->GetArray()-2999;
     
-//    TGeant3 *geant3 = (TGeant3*) gMC;
     
 //  Parameters related to Quarz (SiO2) :
  
@@ -837,11 +409,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 +429,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 = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();     // Field type  
+    Float_t sXMGMX = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();       // Field max.
     
     Float_t tmaxfd, stemax, deemax, epsil, stmin;
         
@@ -931,19 +510,12 @@ void AliVZEROv2::CreateMaterials()
 }
 
 //_____________________________________________________________________________
-void AliVZEROv2::DrawModule()
+void AliVZEROv2::DrawModule() const
 {
 
 //  Drawing is done in DrawVZERO.C
 
-   Int_t i;
-
-   printf("\n");
-   for(i=0;i<30;i++) printf("*");
-   printf(" VZERO DrawModule ");
-   for(i=0;i<30;i++) printf("*");
-   printf("\n");
-
+   AliDebug(2,"VZERO DrawModule");
 
 }
 
@@ -953,7 +525,7 @@ void AliVZEROv2::Init()
 // Initialises version 2 of the VZERO Detector
 // Just prints an information message
   
-   printf(" VZERO version %d initialized \n",IsVersion());
+   AliInfo(Form("VZERO version %d initialized",IsVersion()));
    
 //   gMC->SetMaxStep(fMaxStepAlu);
 //   gMC->SetMaxStep(fMaxStepQua);
@@ -979,7 +551,6 @@ void AliVZEROv2::StepManager()
      
      Float_t        theta;
      Float_t        phi;
-     Float_t        kRaddeg = 180.0/TMath::Pi();
      Float_t        ringNumber;
 
      Int_t          ipart;
@@ -995,23 +566,35 @@ void AliVZEROv2::StepManager()
      vol[2]    = gMC->CurrentVolID(copy);
      vol[3]    = copy;
      
-
-     if      ( gMC->CurrentVolID(copy) == gMC->VolId("V0R1") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L1") )
+     static Int_t idV0R1 = gMC->VolId("V0R1");
+     static Int_t idV0L1 = gMC->VolId("V0L1");
+     static Int_t idV0R2 = gMC->VolId("V0R2");
+     static Int_t idV0L2 = gMC->VolId("V0L2");
+     static Int_t idV0R3 = gMC->VolId("V0R3");
+     static Int_t idV0L3 = gMC->VolId("V0L3");
+     static Int_t idV0R4 = gMC->VolId("V0R4");
+     static Int_t idV0L4 = gMC->VolId("V0L4");
+     static Int_t idV0R5 = gMC->VolId("V0R5");
+     static Int_t idV0L5 = gMC->VolId("V0L5");
+     static Int_t idV0R6 = gMC->VolId("V0R6");
+     static Int_t idV0L6 = gMC->VolId("V0L6");
+
+     if      ( gMC->CurrentVolID(copy) == idV0R1 ||
+               gMC->CurrentVolID(copy) == idV0L1 )
               ringNumber = 1.0;
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R2") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L2") ) 
+     else if ( gMC->CurrentVolID(copy) == idV0R2 ||
+               gMC->CurrentVolID(copy) == idV0L2 ) 
               ringNumber = 2.0;  
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R3") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L3") )
+     else if ( gMC->CurrentVolID(copy) == idV0R3 ||
+               gMC->CurrentVolID(copy) == idV0L3 )
               ringNumber = 3.0;
-     else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R4") ||
-               gMC->CurrentVolID(copy) == gMC->VolId("V0L4") )          
+     else if ( gMC->CurrentVolID(copy) == idV0R4 ||
+               gMC->CurrentVolID(copy) == idV0L4 )      
               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") )    
+     else if ( gMC->CurrentVolID(copy) == idV0R5 ||
+               gMC->CurrentVolID(copy) == idV0L5 ||
+              gMC->CurrentVolID(copy) == idV0R6 ||
+              gMC->CurrentVolID(copy) == idV0L6 )        
                ringNumber = 5.0; 
      else
               ringNumber = 0.0;
@@ -1022,8 +605,7 @@ void AliVZEROv2::StepManager()
        step      = gMC->TrackStep();
         eloss    += destep;
        tlength  += step; 
-       
-                
+
         if  ( gMC->IsTrackEntering()  )  {  
        
             gMC->TrackPosition(pos);
@@ -1033,7 +615,14 @@ void AliVZEROv2::StepManager()
             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;
+            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;
+     //PH     AliDebug(2,Form("RingNumber, copy, phi1  = %f %d %f \n", ringNumber,vol[1],angle1)); 
+////////////////////////////////////////////////////////////////////////////   
+                
      
             ipart  = gMC->TrackPid();
 
@@ -1107,20 +696,20 @@ void AliVZEROv2::MakeBranch(Option_t *option)
     
   char branchname[10];
   sprintf(branchname,"%s",GetName());
-  printf(" fBufferSize = %d \n",fBufferSize);
+  AliDebug(2,Form("fBufferSize = %d",fBufferSize));
   
   const char *cH = strstr(option,"H");
   
-  if (fHits   && TreeH() && cH) {
-    TreeH()->Branch(branchname,&fHits, fBufferSize);
-    printf("* AliDetector::MakeBranch * Making Branch %s for hits\n",branchname);
+  if (fHits   && fLoader->TreeH() && cH) {
+    fLoader->TreeH()->Branch(branchname,&fHits, fBufferSize);
+    AliDebug(2,Form("Making Branch %s for hits",branchname));
   }     
 
   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);
+    AliDebug(2,Form("Making Branch %s for digits",branchname));
   }  
    
 }