]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - VZERO/AliVZEROv2.cxx
Added protection (E. Fragiacomo)
[u/mrichter/AliRoot.git] / VZERO / AliVZEROv2.cxx
index 68d6e75d0c8a78024f4c612d748e22ca2f013ac2..d7be156b5bd10a6b9e27ce7be69f1d39add1a2ed 100755 (executable)
@@ -51,6 +51,7 @@
 #include "AliRun.h"
 #include "AliMC.h"
 #include "AliConst.h"
+#include "AliLog.h"
 #include "AliMagF.h"
 #include "AliVZEROLoader.h"
 #include "AliVZEROdigit.h"
@@ -72,13 +73,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");
   
 }
 
@@ -88,13 +83,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;
 
@@ -339,7 +328,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 :
 
@@ -354,9 +343,7 @@ 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));    
            
 }
             
@@ -366,13 +353,7 @@ 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");
+  AliDebug(2,"VZERO BuildGeometry");
 
   TNode *top; 
 
@@ -780,13 +761,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, 
@@ -946,19 +921,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");
 
 }
 
@@ -968,7 +936,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);
@@ -994,7 +962,6 @@ void AliVZEROv2::StepManager()
      
      Float_t        theta;
      Float_t        phi;
-     Float_t        kRaddeg = 180.0/TMath::Pi();
      Float_t        ringNumber;
 
      Int_t          ipart;
@@ -1010,23 +977,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;
@@ -1052,7 +1031,7 @@ void AliVZEROv2::StepManager()
 ////////////////////////////////////////////////////////////////////////////         
      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); 
+     //PH     AliDebug(2,Form("RingNumber, copy, phi1  = %f %d %f \n", ringNumber,vol[1],angle1)); 
 ////////////////////////////////////////////////////////////////////////////   
                 
      
@@ -1128,20 +1107,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);
+    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));
   }  
    
 }