]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSEmcRecPoint.cxx
Fix compiler problems
[u/mrichter/AliRoot.git] / PHOS / AliPHOSEmcRecPoint.cxx
index 0868f9601812eea5988d6484d9770ff8d4777e82..5dcb9051b14af0ce681fdb5af83e3c161215b2a5 100644 (file)
 
 /* $Id$ */
 
+/* History of cvs commits:
+ *
+ * $Log$
+ */
+
 //_________________________________________________________________________
 //  RecPoint implementation for PHOS-EMC 
 //  An EmcRecPoint is a cluster of digits   
@@ -31,6 +36,7 @@
 // --- Standard library ---
 
 // --- AliRoot header files ---
+#include "AliLog.h"
 #include "AliPHOSLoader.h"
 #include "AliGenerator.h"
 #include "AliPHOSGeometry.h"
@@ -146,7 +152,7 @@ Bool_t AliPHOSEmcRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * d
   
   Bool_t aren = kFALSE ;
   
-  AliPHOSGeometry * phosgeom =  AliPHOSLoader::GetPHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance() ;
 
   Int_t relid1[4] ; 
   phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ; 
@@ -167,8 +173,8 @@ Bool_t AliPHOSEmcRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * d
 Int_t AliPHOSEmcRecPoint::Compare(const TObject * obj) const
 {
   // Compares two RecPoints according to their position in the PHOS modules
-
-  Float_t delta = 1 ; //Width of "Sorting row". If you changibg this 
+  
+  const Float_t delta = 1 ; //Width of "Sorting row". If you changibg this 
                       //value (what is senseless) change as vell delta in
                       //AliPHOSTrackSegmentMakerv* and other RecPoints...
   Int_t rv ; 
@@ -206,7 +212,7 @@ Int_t AliPHOSEmcRecPoint::Compare(const TObject * obj) const
   return rv ; 
 }
 //______________________________________________________________________________
-void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t, Int_t) const
+void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t, Int_t) /*const*/
 {
   
   // Execute action corresponding to one event
@@ -216,7 +222,7 @@ void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t, Int_t) const
   //  and switched off when the mouse button is released.
   
   
-  AliPHOSGeometry * phosgeom =  AliPHOSLoader::GetPHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance();
   
   static TGraph *  digitgraph = 0 ;
   
@@ -230,13 +236,13 @@ void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t, Int_t) const
   AliRunLoader* rn = AliRunLoader::GetRunLoader(AliConfig::GetDefaultEventFolderName());
   if (rn == 0x0) 
     {
-      Error("ExecuteEvent","Can not find Run Loader in Default Event Folder");
+      AliError(Form("Cannot find Run Loader in Default Event Folder"));
       return;
     }
   AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(rn->GetLoader("PHOSLoader"));
   if (gime == 0x0) 
     {
-      Error("ExecuteEvent","Can not find PHOS Loader from Run Loader");
+      AliError(Form("Cannot find PHOS Loader from Run Loader"));
       return;
     }
   
@@ -342,7 +348,7 @@ void  AliPHOSEmcRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits
 
   AliPHOSDigit * digit ;
  
-  AliPHOSGeometry * phosgeom =  AliPHOSLoader::GetPHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance();
 
  // Calculates the center of gravity in the local PHOS-module coordinates 
   
@@ -401,7 +407,7 @@ void AliPHOSEmcRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * digits
 
   AliPHOSDigit * digit ;
 
-  AliPHOSGeometry * phosgeom =  AliPHOSLoader::GetPHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance();
 
   Int_t iDigit;
 
@@ -451,7 +457,7 @@ void  AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits)
 
   AliPHOSDigit * digit ;
 
-  AliPHOSGeometry * phosgeom =  AliPHOSLoader::GetPHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance();
 
   Int_t iDigit;
 
@@ -523,7 +529,7 @@ void  AliPHOSEmcRecPoint::EvalMoments(Float_t logWeight,TClonesArray * digits)
 
   AliPHOSDigit * digit ;
 
-  AliPHOSGeometry * phosgeom =  AliPHOSLoader::GetPHOSGeometry();
+  AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
 
   Int_t iDigit;
 
@@ -636,7 +642,6 @@ void  AliPHOSEmcRecPoint::EvalMoments(Float_t logWeight,TClonesArray * digits)
 void AliPHOSEmcRecPoint::EvalAll(Float_t logWeight, TClonesArray * digits )
 {
   // Evaluates all shower parameters
-
   EvalLocalPosition(logWeight, digits) ;
   EvalElipsAxis(logWeight, digits) ;
   EvalMoments(logWeight, digits) ;
@@ -658,7 +663,7 @@ void AliPHOSEmcRecPoint::EvalLocalPosition(Float_t logWeight, TClonesArray * dig
   
   AliPHOSDigit * digit ;
 
-  AliPHOSGeometry * phosgeom =  AliPHOSLoader::GetPHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance() ;
 
   Int_t iDigit;
 
@@ -675,7 +680,6 @@ void AliPHOSEmcRecPoint::EvalLocalPosition(Float_t logWeight, TClonesArray * dig
     wtot += w ;
 
   }
-
   x /= wtot ;
   z /= wtot ;
 
@@ -684,8 +688,12 @@ void AliPHOSEmcRecPoint::EvalLocalPosition(Float_t logWeight, TClonesArray * dig
   Float_t parb = 6.52 ; 
 
   Float_t xo,yo,zo ; //Coordinates of the origin
-  gAlice->Generator()->GetOrigin(xo,yo,zo) ;
-
+  //We should check all 3 possibilities to avoid seg.v.
+  if(gAlice && gAlice->GetMCApp() && gAlice->Generator())
+    gAlice->Generator()->GetOrigin(xo,yo,zo) ;
+  else{
+    xo=yo=zo=0.;
+  }
   Float_t phi = phosgeom->GetPHOSAngle(relid[0]) ;
 
   //Transform to the local ref.frame
@@ -763,6 +771,9 @@ Int_t  AliPHOSEmcRecPoint::GetNumberOfLocalMax( AliPHOSDigit **  maxAt, Float_t
       digit = maxAt[iDigit] ;
           
       for(iDigitN = 0; iDigitN < fMulDigit; iDigitN++) {       
+       if(iDigit == iDigitN)
+         continue ;
+       
        digitN = (AliPHOSDigit *) digits->At(fDigitsList[iDigitN]) ; 
        
        if ( AreNeighbours(digit, digitN) ) {
@@ -850,17 +861,17 @@ void AliPHOSEmcRecPoint::Print(Option_t *) const
   TString message ; 
   message  = "AliPHOSEmcRecPoint:\n" ;
   message +=  " digits # = " ; 
-  Info("Print", message.Data()) ; 
+  AliInfo(Form(message.Data())) ; 
 
   Int_t iDigit;
   for(iDigit=0; iDigit<fMulDigit; iDigit++)
     printf(" %d ", fDigitsList[iDigit] ) ;  
   
-  Info("Print", " Energies = ") ;
+  printf(" Energies = ") ;
   for(iDigit=0; iDigit<fMulDigit; iDigit++) 
     printf(" %f ", fEnergyList[iDigit] ) ;
   printf("\n") ; 
-   Info("Print", " Primaries  ") ;
+   printf(" Primaries  ") ;
   for(iDigit = 0;iDigit < fMulTrack; iDigit++)
     printf(" %d ", fTracksList[iDigit]) ;
   printf("\n") ;       
@@ -869,7 +880,7 @@ void AliPHOSEmcRecPoint::Print(Option_t *) const
   message += "       Number of primaries %d" ; 
   message += "       Stored at position %d" ; 
  
-  Info("Print", message.Data(), fMulDigit, fAmp, fMulTrack,GetIndexInList() ) ;  
+  printf(message.Data(), fMulDigit, fAmp, fMulTrack,GetIndexInList() ) ;  
 }