Removing obsolete includes of TGeant3.h
[u/mrichter/AliRoot.git] / VZERO / AliVZEROv2.cxx
index 1de907a..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)                   // 
-//   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     //
 //                                                                  //
 //////////////////////////////////////////////////////////////////////
 
@@ -34,7 +37,6 @@
 
 // --- ROOT libraries ---
 #include <TClonesArray.h>
-#include <TGeant3.h>
 #include <TGeometry.h>
 #include <TLorentzVector.h>
 #include <TMath.h>
@@ -123,8 +125,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 +225,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 +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   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 +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 * 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 +316,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.; 
 
@@ -420,11 +427,13 @@ void AliVZEROv2::BuildGeometry()
   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]);
   
@@ -473,8 +482,8 @@ void AliVZEROv2::BuildGeometry()
   v0R0->SetNumberOfDivisions(ndiv);                                              
 
   Float_t   r1     =  r0 + height1;
-  Float_t   offset = fThickness/2.0 - 0.3 - fThickness1/2.0; 
-  Float_t   offsetFibers = 0.7;
+  Float_t   offset = fThickness/2.0 - lidThickness - fThickness1/2.0; 
+  Float_t   offsetFibers = 1.0;
     
   partubs[0]     =  r0;
   partubs[1]     =  r1;
@@ -576,21 +585,21 @@ void AliVZEROv2::BuildGeometry()
 
     sprintf(nameNode,"SUBDER%d",ndetR);
     v0Rnode0->cd();    
-    v0Rnode4 = new TNode(nameNode,nameNode,v0R4,0.0,0.0, -offset + 3.0*offsetFibers,0);         
+    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",ndetR);
     v0Rnode0->cd();    
-    v0Rnode5 = new TNode(nameNode,nameNode,v0R5,0.0,0.0, -offset + 4.0*offsetFibers,0);         
+    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",ndetR);
     v0Rnode0->cd();    
-    v0Rnode6 = new TNode(nameNode,nameNode,v0R6,0.0,0.0, -offset + 4.0*offsetFibers,0);         
+    v0Rnode6 = new TNode(nameNode,nameNode,v0R6,0.0,0.0, -offset + 2.0*offsetFibers,0);         
     v0Rnode6->SetLineColor(kColorVZERO);
     fNodes->Add(v0Rnode6);
     ndetR++;
@@ -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);
@@ -1022,8 +1037,7 @@ void AliVZEROv2::StepManager()
        step      = gMC->TrackStep();
         eloss    += destep;
        tlength  += step; 
-       
-                
+
         if  ( gMC->IsTrackEntering()  )  {  
        
             gMC->TrackPosition(pos);
@@ -1033,7 +1047,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;
+     printf(" RingNumber, copy, phi1  = %f %d %f \n\n", ringNumber,vol[1],angle1); 
+////////////////////////////////////////////////////////////////////////////   
+                
      
             ipart  = gMC->TrackPid();