]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - VZERO/AliVZEROv5.cxx
Copy constructor and assignment operator
[u/mrichter/AliRoot.git] / VZERO / AliVZEROv5.cxx
index bc96f87503912eeb014d398cede5abfbfca6fe8e..76d1d1b2ddef7715b135788c54a210ac45416a3c 100755 (executable)
 
 // --- ROOT libraries ---
 #include <TClonesArray.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 "AliVZEROdigit.h"
 #include "AliVZEROhit.h"
 #include "AliVZEROv5.h"
+#include "AliLog.h"
  
 ClassImp(AliVZEROv5)
 
 //_____________________________________________________________________________
-AliVZEROv5:: AliVZEROv5():AliVZERO()
+AliVZEROv5:: AliVZEROv5():AliVZERO(),
+   fCellId(0),
+   fTrackPosition(),
+   fTrackMomentum(), 
+   fLightYield(93.75),
+   fLightAttenuation(0.05),
+   fnMeters(15.0),
+   fFibToPhot(0.3)
 {
 // Standard default constructor 
 }
 
 //_____________________________________________________________________________
 AliVZEROv5::AliVZEROv5(const char *name, const char *title):
- AliVZERO(name,title)
+   AliVZERO(name,title),
+   fCellId(0),
+   fTrackPosition(),
+   fTrackMomentum(),
+   fLightYield(93.75),
+   fLightAttenuation(0.05),
+   fnMeters(15.0),
+   fFibToPhot(0.3)    
 {
 
 // Standard constructor for V-zero Detector  version 5
 
-  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");
-      
-  fLightYield              =  93.75; // Light yield in BC408 (93.75 eV per photon)
-  fLightAttenuation        =   0.05; // Light attenuation in fiber (0.05 per meter)
-  fnMeters                 =   15.0; // Number of meters of clear fibers to PM
-  fFibToPhot               =    0.3; // Attenuation at fiber-photocathode interface
+  AliDebug(2,"Create VZERO object ");
+//       
+//   fLightYield              =  93.75; // Light yield in BC408 (93.75 eV per photon)
+//   fLightAttenuation        =   0.05; // Light attenuation in fiber (0.05 per meter)
+//   fnMeters                 =   15.0; // Number of meters of clear fibers to PM
+//   fFibToPhot               =    0.3; // Attenuation at fiber-photocathode interface
 }
 
 //_____________________________________________________________________________
@@ -90,13 +96,7 @@ void AliVZEROv5::CreateGeometry()
 
 // Creates the GEANT geometry of the V-zero Detector  version 5
   
-  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 Geometry ");
       
   Int_t    *idtmed = fIdtmed->GetArray()-2999;
 
@@ -321,7 +321,7 @@ void AliVZEROv5::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\n",  ncellsR));
 
 // Left part :
   
@@ -336,395 +336,17 @@ void AliVZEROv5::CreateGeometry()
   gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,339.0+fThickness1/2.0,0,"ONLY");
  
   ncellsL = (ndetL - 1) * 4;
-  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\n",  ncellsL));    
            
 }
             
-//_____________________________________________________________________________
-void AliVZEROv5::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, *v0Rnode7, *v0Rnode8, *v0Rnode9, *v0Rnode10;
-  TNode *v0Rnode1, *v0Rnode2, *v0Rnode3, *v0Rnode4, *v0Rnode5, *v0Rnode6;
-  TNode *v0Lnode, *v0Lnode0;
-  TNode *v0Lnode1, *v0Lnode2, *v0Lnode3, *v0Lnode4;
-   
-  const int kColorVZERO  = kGreen;
-  top = gAlice->GetGeometry()->GetNode("alice");
-
-  Float_t  height1Right, height2Right, height3Right, height4Right; 
-  Float_t  heightRight;
-  Float_t  theta;  
-  
-  Float_t  halfThickQua;
-  Float_t  zdet;
-  Float_t  r0Right, r4Right, rBoxRight;
-  Float_t  pi = TMath::Pi();
-
-  height1Right      =     2.6;  // height of cell 1, in cm
-  height2Right      =     4.6;  // height of cell 2, in cm
-  height3Right      =     7.6;  // height of cell 3, in cm
-  height4Right      =    12.7;  // height of cell 4, in cm
-    
-  theta             =    pi/4.0/2.0;    
-   
-  halfThickQua      =    fThickness1/2.0; 
-  
-  zdet              =    90.0 - 0.6 - fThickness/2.0;   
-  r0Right           =    4.20;         
-  heightRight       =    height1Right + height2Right + height3Right + height4Right;
-  r4Right           =    r0Right + heightRight + 0.3;
-  rBoxRight         =    38.0;
-  
-  Int_t     ndiv    =     1;  
-
-  Float_t   partube[3];
-
-  partube[0] =  r0Right - 0.2;
-  partube[1] =  r4Right + 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.0 mm) de maintien des cellules ...
-
-  Float_t  lidThickness = 0.30;
-  
-  partube[0] =   r0Right;
-  partube[1] =   rBoxRight;
-  partube[2] =   +lidThickness/2.0;
-  
-  TTUBE  *v0CA = new TTUBE("V0CA", "V0CA", "void",partube[0], partube[1], partube[2]);
-  
-  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();
-  v0Rnode8 = new TNode("V0CA", "V0CA",v0CA,0.0,0.0,-fThickness/2.0+partube[2],0);       
-  v0Rnode8->SetLineColor(kYellow);
-  fNodes->Add(v0Rnode8);
-  
-  partube[0] =   r0Right;
-  partube[1] =   r0Right + 0.3;
-  partube[2] =   +fThickness/2.0;
-  
-  TTUBE *v0IR = new TTUBE("V0IR","V0IR","void", partube[0], partube[1], partube[2]);
-  v0Rnode->cd();
-  v0Rnode9 = new TNode("V0IR", "V0IR",v0IR,0.0,0.0,0.0,0);
-  v0Rnode9->SetLineColor(kYellow);
-  fNodes->Add(v0Rnode9);
-
-  partube[0] =   rBoxRight - 0.3;
-  partube[1] =   rBoxRight; 
-  partube[2] =   +fThickness/2.0;
-
-  TTUBE  *v0ER = new TTUBE("V0ER","V0ER","void", partube[0], partube[1], partube[2]);
-  
-  v0Rnode->cd();
-  v0Rnode10 = new TNode("V0ER", "V0ER",v0ER,0.0,0.0,0.0,0);
-  v0Rnode10->SetLineColor(kYellow);
-  fNodes->Add(v0Rnode10);
-  
-  Float_t   partubs[5];
-  partubs[0]      =  r0Right;
-  partubs[1]      =  r4Right;
-  partubs[2]      =  fThickness/2.0;
-  partubs[3]      =  90.0-22.5;
-  partubs[4]      = 135.0-22.5;
-
-  TTUBS  *v0R0 = new TTUBS("V0R0", "V0R0", "void",partubs[0], partubs[1], partubs[2], 
-                                                  partubs[3], partubs[4]); 
-                                                 
-  v0R0->SetNumberOfDivisions(ndiv);                                              
-
-  Float_t   r1Right =  r0Right + 0.3 + height1Right;
-  Float_t   offset  = fThickness/2.0 - lidThickness - fThickness1/2.0; 
-  Float_t   offsetFibers = 1.0;
-    
-  partubs[0]     =  r0Right + 0.3;
-  partubs[1]     =  r1Right;
-  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   r2Right  =  r1Right + height2Right;       
-  
-  partubs[0]     =  r1Right;
-  partubs[1]     =  r2Right;
-
-  TTUBS *v0R2 = new TTUBS("V0R2", "V0R2", "void", partubs[0], partubs[1], partubs[2], 
-                                                  partubs[3], partubs[4]);
-
-  v0R2->SetNumberOfDivisions(ndiv);
-
-// Ring 3 :
-
-  Float_t   r3Right  =  r2Right + height3Right;     
-   
-  partubs[0]     =  r2Right;
-  partubs[1]     =  r3Right;
-  partubs[3]     =  90.0-22.5;
-  partubs[4]     = 112.5-22.5;
-  
-  TTUBS *v0R3 = new TTUBS("V0R3", "V0R3", "void", partubs[0], partubs[1], partubs[2], 
-                                                  partubs[3], partubs[4]);
-  v0R3->SetNumberOfDivisions(ndiv);
-  
-  partubs[3]     = 112.5-22.5;
-  partubs[4]     = 135.0-22.5;
-  
-  TTUBS *v0R4 = new TTUBS("V0R4", "V0R4", "void", partubs[0], partubs[1], partubs[2], 
-                                                  partubs[3], partubs[4]);
-  v0R4->SetNumberOfDivisions(ndiv);
-  
-// Ring 4 :  
-
-  partubs[0]     =  r3Right;
-  partubs[1]     =  r4Right;
-  partubs[3]     =  90.0-22.5;
-  partubs[4]     = 112.5-22.5;
-  
-  TTUBS *v0R5 = new TTUBS("V0R5", "V0R5", "void", partubs[0], partubs[1], partubs[2], 
-                                                  partubs[3], partubs[4]);
-  v0R5->SetNumberOfDivisions(ndiv);
-  
-  partubs[3]     = 112.5-22.5;
-  partubs[4]     = 135.0-22.5;
-  
-  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./4.;
-    
-  Int_t    ndetR = 1; 
-
-  char     nameNode[12];  
-  for (phi = 22.5; 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 + 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 + 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 + 2.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 =    3.3; 
-  Float_t   height2Left =    6.2;
-  Float_t   height3Left =    8.9; 
-  Float_t   height4Left =   20.9;     
-  Float_t   heightLeft  = height1Left + height2Left + height3Left + height4Left; 
-                                        
-  Float_t   r4Left      = r0Left  + heightLeft; 
-
-  partube[0] =  r0Left;
-  partube[1] =  r4Left;
-  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,339.0+fThickness1/2.0,0);
-  
-  v0Lnode->SetLineColor(kBlue);
-  fNodes->Add(v0Lnode);
-  
-  v0Lnode->SetVisibility(2);
-
-  partubs[0]      =  r0Left;
-  partubs[1]      =  r4Left;
-  partubs[2]      =  fThickness1/2.0;
-  partubs[3]      =  90.0-22.5;
-  partubs[4]      = 135.0-22.5;
-  
-  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);
-
-  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);
-  Int_t    ndetL   = 1;
-  for (phi = 22.5; 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++; 
-          
-    v0Lnode0->SetVisibility(2);    
-  }         
-}  
-    
 //_____________________________________________________________________________
 void AliVZEROv5::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,"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, 
@@ -803,8 +425,8 @@ void AliVZEROv5::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;
         
@@ -884,18 +506,12 @@ void AliVZEROv5::CreateMaterials()
 }
 
 //_____________________________________________________________________________
-void AliVZEROv5::DrawModule()
+void AliVZEROv5::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,"DrawModule");
 }
 
 //_____________________________________________________________________________
@@ -904,7 +520,7 @@ void AliVZEROv5::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 \n",IsVersion()));
    
 //   gMC->SetMaxStep(fMaxStepAlu);
 //   gMC->SetMaxStep(fMaxStepQua);
@@ -1065,20 +681,20 @@ void AliVZEROv5::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));
   }  
    
 }
@@ -1102,7 +718,6 @@ Int_t AliVZEROv5::GetCellId(Int_t *vol, Float_t *hits)
 //    cout << "X     = " << hits[0] << "    Y = " << hits[1] << endl;
    
    Float_t phi = Float_t(TMath::ATan2(Double_t(hits[1]),Double_t(hits[0])) ); 
-   Float_t kRaddeg = 180.0/TMath::Pi();
    phi = kRaddeg * phi;
     
    if (index < 7) index = index + 8;