]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSEvalRecPoint.cxx
Compilation warnings fixed
[u/mrichter/AliRoot.git] / PHOS / AliPHOSEvalRecPoint.cxx
index 5a2a840da2adc98667d0cd20de4ac1eff8a2b2e7..aab901076c60f88c7f6fa020d2a273dd8946ce5c 100644 (file)
@@ -1,12 +1,38 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//*-- Author: Boris Polichtchouk, IHEP
+//////////////////////////////////////////////////////////////////////////////
+// Reconstructed point operations for the Clusterization class for IHEP reconstruction.
+// Performs clusterization (collects neighbouring active cells)
+// It differs from AliPHOSClusterizerv1 in neighbour definition only
+
 // ---- ROOT system ---
-#include "TDirectory.h"
-#include "TBranch.h"
-#include "TTree.h"
-#include "TROOT.h"
-#include "TFolder.h"
+#include <TMath.h>
+#include <TDirectory.h>
+#include <TBranch.h>
+#include <TTree.h>
+#include <TROOT.h>
+#include <TFolder.h>
 
 // --- AliRoot header files ---
+#include "AliLog.h"
 #include "AliConfig.h"
+#include "AliPHOSDigit.h" 
 #include "AliPHOSClusterizer.h"
 #include "AliPHOSEvalRecPoint.h"
 #include "AliRun.h"
 #include "AliPHOSRecCpvManager.h"
 #include "AliPHOSRecEmcManager.h"
 #include "AliPHOSDigitizer.h"
+#include "AliPHOSGeometry.h" 
 
 // --- Standard library ---
 
 
 ClassImp(AliPHOSEvalRecPoint)
 
-  AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(): fEventFolderName(AliConfig::fgkDefaultEventFolderName)
+AliPHOSEvalRecPoint::AliPHOSEvalRecPoint() :
+  fIsEmc(kFALSE),
+  fIsCpv(kTRUE),
+  fParent(-333),
+  fChi2Dof(-111),
+  fEventFolderName(AliConfig::GetDefaultEventFolderName())
 {
-  fParent=-333;
-  fChi2Dof=-111;
-  fIsCpv = kTRUE;
-  fIsEmc = kFALSE;
+  // default ctor
 }
 
-AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent) 
-  : fEventFolderName(AliConfig::fgkDefaultEventFolderName)
+AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent) : 
+  fIsEmc(kFALSE),
+  fIsCpv(kFALSE),
+  fParent(-333),
+  fChi2Dof(-111),
+  fEventFolderName("")
 {
-
+  // ctor
   fParent=-333;
   fChi2Dof=-111;
 
 //    fParent=parent;
   TObjArray* wPool = (TObjArray*)GetWorkingPool();
   if(!wPool) {
-    Error("AliPHOSEvalRecPoint", "Couldn't find working pool. Exit.") ; 
-    exit(1);
+    Fatal("ctor", "Couldn't find working pool") ; 
   }
 
   fParent = wPool->IndexOf((TObject*)parent);
@@ -59,12 +91,14 @@ AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent
   
 }
 
-AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Int_t i, Bool_t cpv) : fEventFolderName(AliConfig::fgkDefaultEventFolderName)
+AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Int_t i, Bool_t cpv) : 
+  fIsEmc(kFALSE),
+  fIsCpv(kFALSE),
+  fParent(-333),
+  fChi2Dof(-111),
+  fEventFolderName(AliConfig::GetDefaultEventFolderName())
 {
-
-  fChi2Dof=-111;
-  fParent=-333;
-
+  // ctor
   AliPHOSEmcRecPoint* rp=0;
 
   AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
@@ -80,13 +114,13 @@ AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Int_t i, Bool_t cpv) : fEventFolderName
     fIsCpv = kFALSE;
   }
 
-  Int_t* Digits = rp->GetDigitsList();
-  Float_t* Energies = rp->GetEnergiesList();
+  Int_t* digits = rp->GetDigitsList();
+  Float_t* energies = rp->GetEnergiesList();
   Int_t nDigits = rp->GetMultiplicity();
   
   for(Int_t iDigit=0; iDigit<nDigits; iDigit++) {
-    AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] );
-    Float_t eDigit = Energies[iDigit];
+    AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] );
+    Float_t eDigit = energies[iDigit];
     this->AddDigit(*digit,eDigit);
   }
 
@@ -101,12 +135,12 @@ AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Int_t i, Bool_t cpv) : fEventFolderName
 
 AliPHOSClusterizer* AliPHOSEvalRecPoint::GetClusterizer()
 {
+  // returns clusterizer task
   TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice");
   TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP");
   AliPHOSClusterizer* clu = (AliPHOSClusterizer*)wPoolF->FindObject("PHOS:clu-v1");
   if(!clu) { 
-    Error("GetClusterizer", "Couldn't find Clusterizer. Exit.") ; 
-    exit(1); 
+    Fatal("GetClusterizer", "Couldn't find Clusterizer") ; 
   }
 
   return clu;
@@ -114,12 +148,13 @@ AliPHOSClusterizer* AliPHOSEvalRecPoint::GetClusterizer()
 
 Bool_t AliPHOSEvalRecPoint::TooClose(AliPHOSRecPoint* pt) const 
 {
-  TVector3 her_pos;
-  TVector3 my_pos;
-  pt->GetLocalPosition(her_pos);
-  this->GetLocalPosition(my_pos);
-  Float_t dx = her_pos.X() - my_pos.X();
-  Float_t dz = her_pos.Z() - my_pos.Z();
+  // check if a rec.point pt is too close to this one
+  TVector3 herPos;
+  TVector3 myPos;
+  pt->GetLocalPosition(herPos);
+  this->GetLocalPosition(myPos);
+  Float_t dx = herPos.X() - myPos.X();
+  Float_t dz = herPos.Z() - myPos.Z();
   Float_t dr = TMath::Sqrt(dx*dx + dz*dz);
 
   if(dr<GetReconstructionManager()->MergeGammasMinDistanceCut())
@@ -131,17 +166,19 @@ Bool_t AliPHOSEvalRecPoint::TooClose(AliPHOSRecPoint* pt) const
 
 Bool_t AliPHOSEvalRecPoint::NeedToSplit() const 
 {
+  // rec.point needs to be split
   return kFALSE;
 }
 
 void AliPHOSEvalRecPoint::DeleteParent()
 {
+  // delete parent
   fParent=-333;
 }
 
 void AliPHOSEvalRecPoint::UpdateWorkingPool()
 {
-
+  // update pool of rec.points
   Int_t i; //loop variable
   
   for(i=0; i<this->InWorkingPool(); i++) {
@@ -150,7 +187,7 @@ void AliPHOSEvalRecPoint::UpdateWorkingPool()
      Int_t nChild = parent->HasChild(children);
      for(Int_t iChild=0; iChild<nChild; iChild++)
        {
-        ((AliPHOSEvalRecPoint*)children.At(iChild))->DeleteParent();
+        ((AliPHOSEvalRecPoint*)children.At(iChild))->DeleteParent();
        }
 
      if(nChild) {
@@ -177,6 +214,7 @@ void AliPHOSEvalRecPoint::UpdateWorkingPool()
 
 Int_t AliPHOSEvalRecPoint::HasChild(TObjArray& children)
 {
+  // returns the number of children
   for(Int_t iChild=0; iChild<InWorkingPool(); iChild++)
     {
       AliPHOSEvalRecPoint* child = (AliPHOSEvalRecPoint*)GetFromWorkingPool(iChild);
@@ -190,24 +228,25 @@ Int_t AliPHOSEvalRecPoint::HasChild(TObjArray& children)
 
 void AliPHOSEvalRecPoint::Init()
 {
-
+  // initialization
   AliPHOSClusterizer* clusterizer = GetClusterizer();
   if(!clusterizer) {
-    Error("Init", "Cannot get clusterizer. Exit.") ;
-    exit(1);
+    Fatal("Init", "Cannot get clusterizer") ;
   }
 
   TClonesArray* digits = AliPHOSLoader::GetPHOSLoader(fEventFolderName)->Digits();
-  Float_t LogWeight=0;  
+  Float_t logWeight=0;  
 
   if(this->IsEmc()) {
-    LogWeight = clusterizer->GetEmcLogWeight();
+    logWeight = clusterizer->GetEmcLogWeight();
   }
   else {
-    LogWeight = clusterizer->GetCpvLogWeight();
+    logWeight = clusterizer->GetCpvLogWeight();
   }
   
-  EvalLocalPosition(LogWeight,digits); // evaluate initial position
+  TVector3 vtx(0.,0.,0.) ;
+  TVector3 inc(0.,0.,0.) ;
+  EvalLocalPosition(logWeight,vtx,digits,inc); // evaluate initial position
 }
 
 
@@ -249,19 +288,19 @@ void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2)
   GetLocalPosition(lpos);
   Float_t xx = lpos.Z();
   Float_t yy = lpos.X();
-  Float_t E = GetEnergy();
+  Float_t e = GetEnergy();
 
-  Info("InitTwoGam", "(x,z,E)[old] = (%f, %f, %f)", yy, xx, E) ;
+  AliInfo(Form("(x,z,e)[old] = (%f, %f, %f)", yy, xx, e)) ;
 
-//    xx = XY(xx/E);
-//    yy = XY(yy/E);
+//    xx = XY(xx/e);
+//    yy = XY(yy/e);
 
 
   Float_t eDigit ;
   AliPHOSDigit * digit ;
   Int_t nDigits = GetMultiplicity();  
-  Int_t * Digits = GetDigitsList();
-  Float_t * Energies = GetEnergiesList();
+  Int_t * digits = GetDigitsList();
+  Float_t * energies = GetEnergiesList();
 
   Float_t ix ;
   Float_t iy ;
@@ -274,16 +313,16 @@ void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2)
   Float_t cos2fi = 1.;
 
   AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
-  const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance() ;
 
   Int_t iDigit; //loop variable
 
   for(iDigit = 0 ; iDigit < nDigits ; iDigit ++)
     {
-      digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); 
-      eDigit = Energies[iDigit];
-      fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
-      fGeom->RelPosInModule(relid, iy, ix);
+      digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); 
+      eDigit = energies[iDigit];
+      phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+      phosgeom->RelPosInModule(relid, iy, ix);
     
       Float_t dx =  ix - xx;
       Float_t dy =  iy - yy;
@@ -303,10 +342,10 @@ void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2)
   Float_t eu3 = 0;
   for(iDigit = 0 ; iDigit < nDigits ; iDigit ++)
     {
-      digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); 
-      eDigit = Energies[iDigit];
-      fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
-      fGeom->RelPosInModule(relid, iy, ix);
+      digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); 
+      eDigit = energies[iDigit];
+      phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+      phosgeom->RelPosInModule(relid, iy, ix);
     
       Float_t dx =  ix - xx;
       Float_t dy =  iy - yy;
@@ -314,16 +353,16 @@ void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2)
       eu3 += eDigit*du*du*du;
     }
   
-  Float_t c = E*eu3*eu3/(euu*euu*euu)/2.;
+  Float_t c = e*eu3*eu3/(euu*euu*euu)/2.;
   Float_t sign = 1.;
   if(eu3<0) sign = -1.;
   Float_t r = 1.+ c + sign*TMath::Sqrt(2.*c + c*c);
   Float_t u = 0;
   if(TMath::Abs(r-1.)>0.1) u = eu3/euu*(r+1.)/(r-1.);
-  if(TMath::Abs(r-1.)<0.1) u = TMath::Sqrt(sqr/E/r)*(1.+r);
+  if(TMath::Abs(r-1.)<0.1) u = TMath::Sqrt(sqr/e/r)*(1.+r);
   
-  Float_t e2c = E/(1.+r);
-  Float_t e1c = E-e2c;
+  Float_t e2c = e/(1.+r);
+  Float_t e1c = e-e2c;
   Float_t u1 = -u/(1.+r);
   Float_t u2 = u+u1;
   
@@ -361,7 +400,7 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2)
   Float_t chmin = GetReconstructionManager()->TwoGamChisqMin();
   Float_t emin = GetReconstructionManager()->TwoGamEmin();
   Float_t stpmin = GetReconstructionManager()->TwoGamStepMin();
-  Int_t Niter = GetReconstructionManager()->TwoGamNumOfIterations(); // Number of iterations.
+  Int_t nIter = GetReconstructionManager()->TwoGamNumOfIterations(); // Number of iterations.
 
   Float_t chisq = 100.; //Initial chisquare.
 
@@ -391,22 +430,22 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2)
   Float_t y2c = gamma2[1];
   Float_t x2c = gamma2[2];
 
-  Float_t E = GetEnergy();
+  Float_t e = GetEnergy();
 
   Float_t eDigit ;
   AliPHOSDigit * digit ;
   Int_t nDigits = GetMultiplicity();  
-  Int_t * Digits = GetDigitsList();
-  Float_t * Energies = GetEnergiesList();
+  Int_t * digits = GetDigitsList();
+  Float_t * energies = GetEnergiesList();
 
   Float_t ix ;
   Float_t iy ;
   Int_t relid[4] ; 
 
   AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
-  const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance() ;
 
-  for(Int_t Iter=0; Iter<Niter; Iter++)
+  for(Int_t iter=0; iter<nIter; iter++)
     {
       Float_t chisqc = 0.;
       Float_t grx1c = 0.;
@@ -417,45 +456,43 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2)
 
       for(Int_t iDigit = 0 ; iDigit < nDigits ; iDigit ++)
        {
-         digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); 
-         eDigit = Energies[iDigit];
-         fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
-         fGeom->RelPosInModule(relid, iy, ix);
+         digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); 
+         eDigit = energies[iDigit];
+         phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+         phosgeom->RelPosInModule(relid, iy, ix);
          
          Float_t a1,gx1,gy1;
          Float_t a2,gx2,gy2;
          
          Float_t dx1 =  x1c - ix;
          Float_t dy1 =  y1c - iy;
-//       Info("TwoGam", "Mult %d dx1 %f dy1 %f", nDigits, dx1, dy1) ;
-//       AG(e1c,dx1,dy1,a1,gx1,gy1);
+
          GetReconstructionManager()->AG(e1c,dx1,dy1,a1,gx1,gy1);
 
          Float_t dx2 =  x2c - ix;
          Float_t dy2 =  y2c - iy;
-//       Info("TwoGam", "      dx2 %f dy2 %f", dx2, dy2) ;
-//       AG(e2c,dx2,dy2,a2,gx2,gy2);
+
          GetReconstructionManager()->AG(e2c,dx2,dy2,a2,gx2,gy2);
       
-         Float_t A = a1+a2;
-//       Float_t D = Const*A*(1. - A/E);
+         Float_t a = a1+a2;
+//       Float_t D = Const*a*(1. - a/e);
 //       if(D<0) D=0;
 
 //  //           D = 9.; // ????
          
-//       Float_t da = A - eDigit;
+//       Float_t da = a - eDigit;
 //       chisqc += da*da/D;
 //       Float_t dd = da/D;
-//       dd = dd*(2.-dd*Const*(1.-2.*A/E));
+//       dd = dd*(2.-dd*Const*(1.-2.*a/e));
 
          Float_t dd;
-         chisqc += GetReconstructionManager()->TwoGamChi2(A,eDigit,E,dd);
+         chisqc += GetReconstructionManager()->TwoGamChi2(a,eDigit,e,dd);
          
          grx1c += gx1*dd;
          gry1c += gy1*dd;
          grx2c += gx2*dd;
          gry2c += gy2*dd;
-         grec += (a1/e1c - a2/e2c)*E*dd;
+         grec += (a1/e1c - a2/e2c)*e*dd;
 
        }
 
@@ -492,14 +529,14 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2)
     loop20: ;
       Float_t step = st*gr;
 
-      Info("TwoGam", "Iteration %d dof %d chisq/dof %f chstop/dof %f step %d stpmin %d",
-          Iter, dof, ch/dof, chstop/dof, step, stpmin) ;
+      AliInfo(Form("Iteration %d dof %d chisq/dof %f chstop/dof %f step %f stpmin %f",
+          iter, dof, ch/dof, chstop/dof, step, stpmin)) ;
 
       
       if(step<stpmin) 
        goto loop101;
 
-      Float_t de = st*gre*E;
+      Float_t de = st*gre*e;
       e1c = ee1 - de;
       e2c = ee2 + de;
       
@@ -531,19 +568,19 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2)
   gamma2[1] = yy2;
   gamma2[2] = xx2;
 
-  Float_t x1_new = yy1;
-  Float_t z1_new = xx1;
-  Float_t e1_new = ee1;
-  Float_t x2_new = yy2;
-  Float_t z2_new = xx2;
-  Float_t e2_new = ee2;
+  Float_t x1New = yy1;
+  Float_t z1New = xx1;
+  Float_t e1New = ee1;
+  Float_t x2New = yy2;
+  Float_t z2New = xx2;
+  Float_t e2New = ee2;
 
   TString message ; 
-  message  = "     (x,z,E)[1 fit] = (%f, %f, %f)\n" ;  
-  message  = "     (x,z,E)[2 fit] = (%f, %f, %f)\n" ;  
-  Info("TwoGam", message.Data(), 
-       x1_new, z1_new, e1_new, 
-       x2_new, z2_new, e2_new) ;
+  message  = "     (x,z,e)[1 fit] = (%f, %f, %f)\n" ;  
+  message  = "     (x,z,e)[2 fit] = (%f, %f, %f)\n" ;  
+  AliInfo(Form(message.Data(), 
+       x1New, z1New, e1New, 
+       x2New, z2New, e2New)) ;
 
   fChi2Dof = chisq;
 
@@ -556,27 +593,27 @@ void AliPHOSEvalRecPoint::UnfoldTwoMergedPoints(Float_t* gamma1, Float_t* gamma2
   // Use TwoGam() to estimate the positions and energies of merged points.
  
   
-  Int_t Nmax = 2;
+  Int_t nMax = 2;
   Float_t* gamma;
 
-  Int_t* Digits = GetDigitsList();
+  Int_t* digits = GetDigitsList();
   Int_t nDigits = GetMultiplicity();
-  Float_t* Energies = GetEnergiesList();
+  Float_t* energies = GetEnergiesList();
   Float_t* eFit = new Float_t[nDigits];
 
   AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
-  const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance() ;
 
   for(Int_t iDigit=0; iDigit<nDigits; iDigit++)
     {
-      AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); 
+      AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); 
       Int_t relid[4] ;
-      fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+      phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
       Float_t x,z;     
-      fGeom->RelPosInModule(relid, x, z);
+      phosgeom->RelPosInModule(relid, x, z);
 
       Float_t gain = 0.;
-      for(Int_t iMax=0; iMax<Nmax; iMax++)
+      for(Int_t iMax=0; iMax<nMax; iMax++)
        {
          if(iMax==0)
            gamma = gamma1;
@@ -589,16 +626,16 @@ void AliPHOSEvalRecPoint::UnfoldTwoMergedPoints(Float_t* gamma1, Float_t* gamma2
 
          Float_t dx = xMax - x;
          Float_t dz = zMax - z;
-         Float_t Amp,gx,gy;
-         GetReconstructionManager()->AG(eMax,dz,dx,Amp,gx,gy); 
-         gain += Amp;
+         Float_t amp,gx,gy;
+         GetReconstructionManager()->AG(eMax,dz,dx,amp,gx,gy); 
+         gain += amp;
        }
  
       eFit[iDigit] = gain;
     }
 
 
-  for( Int_t iMax=0; iMax<Nmax; iMax++)
+  for( Int_t iMax=0; iMax<nMax; iMax++)
     {      
       if(iMax==0)
        gamma = gamma1;
@@ -615,24 +652,25 @@ void AliPHOSEvalRecPoint::UnfoldTwoMergedPoints(Float_t* gamma1, Float_t* gamma2
 
       for( Int_t iDigit = 0 ; iDigit < nDigits ; iDigit ++)
        {
-         AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] ); 
-         Float_t eDigit = Energies[iDigit];
+         AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); 
+         Float_t eDigit = energies[iDigit];
          Int_t relid[4] ;
-         fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+         phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
          Float_t ix,iz;
-         fGeom->RelPosInModule(relid, ix, iz);
+         phosgeom->RelPosInModule(relid, ix, iz);
          
          Float_t dx = xMax - ix;
          Float_t dz = zMax - iz;
-         Float_t single_shower_gain,gxMax,gyMax;
-         GetReconstructionManager()->AG(eMax,dz,dx,single_shower_gain,gxMax,gyMax);
-         Float_t total_gain = eFit[iDigit];
-         Float_t ratio = single_shower_gain/total_gain; 
+         Float_t singleShowerGain,gxMax,gyMax;
+         GetReconstructionManager()->AG(eMax,dz,dx,singleShowerGain,gxMax,gyMax);
+         Float_t totalGain = eFit[iDigit];
+         Float_t ratio = singleShowerGain/totalGain; 
          eDigit = eDigit*ratio;
          newRP->AddDigit(*digit,eDigit);
        }
-      Info("UnfoldTwoMergedPoints", "======= Split: daughter rec point %d =================", iMax) ;
-      newRP->Print("");
+      AliInfo(Form("======= Split: daughter rec point %d =================", 
+                  iMax)) ;
+      newRP->Print();
 
     }
 
@@ -652,10 +690,10 @@ void AliPHOSEvalRecPoint::EvaluatePosition()
   if(nDigits<2)
     return;
 
-  Int_t Niter = GetReconstructionManager()->OneGamNumOfIterations(); // number of iterations
-  Float_t St0 = GetReconstructionManager()->OneGamInitialStep(); // initial step
-//    const Float_t Stpmin = 0.005;
-  Float_t Stpmin = GetReconstructionManager()->OneGamStepMin();
+  Int_t nIter = GetReconstructionManager()->OneGamNumOfIterations(); // number of iterations
+  Float_t st0 = GetReconstructionManager()->OneGamInitialStep(); // initial step
+//    const Float_t stpMin = 0.005;
+  Float_t stpMin = GetReconstructionManager()->OneGamStepMin();
   Float_t chmin =  GetReconstructionManager()->OneGamChisqMin();
  
   TVector3 locpos;
@@ -665,11 +703,11 @@ void AliPHOSEvalRecPoint::EvaluatePosition()
   Float_t ix, iy;
 
   GetLocalPosition(locpos);
-  Float_t E = GetEnergy();
+  Float_t e = GetEnergy();
   Float_t xc = locpos.Z();
   Float_t yc = locpos.X();
   Float_t dx,dy,gx,gy,grxc,gryc;
-  Float_t st = St0;
+  Float_t st = st0;
   Float_t chisq = 1.e+20;
   Float_t gr = 1.;
   Float_t grx = 0.;
@@ -682,9 +720,9 @@ void AliPHOSEvalRecPoint::EvaluatePosition()
   Float_t chisqc;
 
   AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
-  const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance() ;
 
-  for(Int_t Iter=0; Iter<Niter; Iter++)
+  for(Int_t iter=0; iter<nIter; iter++)
     {
  
       chisqc = 0.;
@@ -693,12 +731,12 @@ void AliPHOSEvalRecPoint::EvaluatePosition()
       for(Int_t iDigit = 0 ; iDigit < nDigits ; iDigit ++)
        {
 
-         Float_t* Energies = GetEnergiesList();
-         Int_t* Digits = GetDigitsList();
-         digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] );
-         eDigit = Energies[iDigit];
-         fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
-         fGeom->RelPosInModule(relid, iy, ix);
+         Float_t* energies = GetEnergiesList();
+         Int_t* digits = GetDigitsList();
+         digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] );
+         eDigit = energies[iDigit];
+         phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+         phosgeom->RelPosInModule(relid, iy, ix);
       
          dx =  xc - ix;
          dy =  yc - iy;
@@ -706,11 +744,12 @@ void AliPHOSEvalRecPoint::EvaluatePosition()
          if(!dx) dx=dy;
          if(!dy) dy=dx;
                  
-         Float_t A;
-         GetReconstructionManager()->AG(E,dx,dy,A,gx,gy);
+         Float_t a;
+         GetReconstructionManager()->AG(e,dx,dy,a,gx,gy);
          Float_t dd;
-         Info("EvaluatePosition", "  (ix iy  xc yc  dx dy)   %f %f %f %f %f %f", ix, iy, xc, yc, dx, dy) ;
-         Float_t chi2dg = GetReconstructionManager()->OneGamChi2(A,eDigit,E,dd);
+         AliInfo(Form("  (ix iy  xc yc  dx dy)   %f %f %f %f %f %f", 
+                      ix, iy, xc, yc, dx, dy)) ;
+         Float_t chi2dg = GetReconstructionManager()->OneGamChi2(a,eDigit,e,dd);
 
          // Exclude digit with too large chisquare.
          if(chi2dg > 10) {  continue; }
@@ -724,7 +763,7 @@ void AliPHOSEvalRecPoint::EvaluatePosition()
       Float_t grc = TMath::Sqrt(grxc*grxc + gryc*gryc);
       if(grc<1.e-10) grc=1.e-10;
       Float_t sc = 1. + chisqc/chisq;
-       Info("EvaluatePosition", " chisq: %f", chisq) ;
+       AliInfo(Form(" chisq: %f", chisq)) ;
       st = st/sc;
       if(chisqc>chisq)
        goto loop20;
@@ -743,11 +782,11 @@ void AliPHOSEvalRecPoint::EvaluatePosition()
     loop20: ;
       Float_t step = st*gr;
 
-      Info("EvaluatePosition", " Iteration %d dof %d chisq/dof %f chstop/dof %f step %d Stpmin %d",
-          Iter, dof, chisq/dof, chisq/dof, chstop/dof, step, Stpmin) ;
+      AliInfo(Form(" Iteration %d dof %d chisq/dof %f chstop/dof %f step %f stpMin %f",
+          iter, dof, chisq/dof, chstop/dof, step, stpMin)) ;
        
 
-      if(step<Stpmin)
+      if(step<stpMin)
        goto loop101;
 
       if(step>1.)
@@ -765,7 +804,7 @@ void AliPHOSEvalRecPoint::EvaluatePosition()
 //      }
 
   Float_t gamma1[3];
-  gamma1[0] = E;
+  gamma1[0] = e;
   gamma1[1] = y1;
   gamma1[2] = x1;
 
@@ -773,7 +812,7 @@ void AliPHOSEvalRecPoint::EvaluatePosition()
   //SetLocalPosition(newpos);
   
   fLocPos=newpos;
-  fAmp=E;
+  fAmp=e;
 
 //    TVector3 pos;
 //    RP->GetLocalPosition(pos);
@@ -790,10 +829,10 @@ Bool_t AliPHOSEvalRecPoint::KillWeakPoint()
   // Remove this point from further procession
   // if it's energy is too small.
   
-  Float_t Thr0 = GetReconstructionManager()->KillGamMinEnergy();
+  Float_t thr0 = GetReconstructionManager()->KillGamMinEnergy();
   
-  if(GetEnergy()<Thr0) {
-    Info("KillWeakPoint", "+++++++ Killing this rec point ++++++++++") ;
+  if(GetEnergy()<thr0) {
+    AliInfo(Form("+++++++ Killing this rec point ++++++++++")) ;
     RemoveFromWorkingPool(this);
     return kTRUE;
   }
@@ -821,7 +860,7 @@ void AliPHOSEvalRecPoint::SplitMergedShowers()
 
 void AliPHOSEvalRecPoint::MergeClosePoint() 
 {
-
+  // merge rec.points if they are too close
   AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
 //    AliPHOSDigitizer* digitizer = fLoader->Digitizer();
 //    Float_t fPedestal = digitizer->GetPedestal();  // YVK 30.09.2001
@@ -837,10 +876,10 @@ void AliPHOSEvalRecPoint::MergeClosePoint()
            {
              if(TooClose(rp))
                {
-                 Info("MergeClosePoint", "+++++++ Merging point 1: ++++++") ;
-                 this->Print("");
-                 Info("MergeClosePoint", "+++++++ and point 2: ++++++++++") ;
-                 ((AliPHOSEvalRecPoint*)rp)->Print("");
+                 AliInfo(Form("+++++++ Merging point 1: ++++++")) ;
+                 this->Print();
+                 AliInfo(Form("+++++++ and point 2: ++++++++++")) ;
+                 ((AliPHOSEvalRecPoint*)rp)->Print();
 
                  //merge two rec. points
                  TVector3 lpos1;
@@ -848,28 +887,28 @@ void AliPHOSEvalRecPoint::MergeClosePoint()
                  this->GetLocalPosition(lpos1);
                  rp->GetLocalPosition(lpos2);
 
-                 Int_t* Digits = rp->GetDigitsList();
+                 Int_t* digits = rp->GetDigitsList();
                  Float_t dE = rp->GetEnergy()/(rp->GetEnergy()+this->GetEnergy());
-                 Float_t new_x = lpos1.X()*dE + lpos2.X()*(1.-dE); 
-                 Float_t new_z = lpos1.Z()*dE + lpos2.Z()*(1.-dE);
-                 Float_t new_E = rp->GetEnergy()+this->GetEnergy();
-                 Float_t* Energies = ((AliPHOSEmcRecPoint*)rp)->GetEnergiesList();
+                 Float_t newX = lpos1.X()*dE + lpos2.X()*(1.-dE); 
+                 Float_t newZ = lpos1.Z()*dE + lpos2.Z()*(1.-dE);
+                 Float_t newE = rp->GetEnergy()+this->GetEnergy();
+                 Float_t* energies = ((AliPHOSEmcRecPoint*)rp)->GetEnergiesList();
 
                  for(Int_t iDigit=0; iDigit<rp->GetDigitsMultiplicity(); iDigit++)
                    {
-                     AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At(Digits[iDigit]);
-                     Float_t eDigit = Energies[iDigit];
+                     AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At(digits[iDigit]);
+                     Float_t eDigit = energies[iDigit];
                      this->AddDigit(*digit,eDigit);
                    }
 
-                 TVector3 newpos(new_x,0,new_z);
+                 TVector3 newpos(newX,0,newZ);
                  fLocPos = newpos;
-                 fAmp = new_E;
+                 fAmp = newE;
                  RemoveFromWorkingPool(rp);
                  delete rp;
                  
-                 Info("MergeClosePoint", "++++++ Resulting point: ++++++++") ;
-                 this->Print("");
+                 AliInfo(Form("++++++ Resulting point: ++++++++")) ;
+                 this->Print();
 
                  break;
                } 
@@ -889,38 +928,36 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima()
 
   AliPHOSDigit * maxAt[1000];
   Float_t maxAtEnergy[1000];  
-  Float_t LocMaxCut, LogWeight;
+  Float_t locMaxCut, logWeight;
   Int_t relid[4] ; 
   Float_t xMax;
   Float_t zMax;
 
-//    AliPHOSClusterizer* clusterizer = fLoader->Clusterizer("PHOSclu-v1");  
   AliPHOSClusterizer* clusterizer = GetClusterizer();
   if(!clusterizer) {
-    Error("UnfoldLocalMaxima", "Cannot get clusterizer. Exit.") ;
-    exit(1);
+    AliFatal(Form("Cannot get clusterizer")) ;
   }
 
   if(this->IsEmc()) {
-    LocMaxCut = clusterizer->GetEmcLocalMaxCut();
-    LogWeight = clusterizer->GetEmcLogWeight();
+    locMaxCut = clusterizer->GetEmcLocalMaxCut();
+    logWeight = clusterizer->GetEmcLogWeight();
   }
   else {
-    LocMaxCut = clusterizer->GetCpvLocalMaxCut();
-    LogWeight = clusterizer->GetCpvLogWeight();
+    locMaxCut = clusterizer->GetCpvLocalMaxCut();
+    logWeight = clusterizer->GetCpvLogWeight();
   }
 
   AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
-  const AliPHOSGeometry* fGeom = fLoader->PHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSGeometry::GetInstance() ;
   TClonesArray* digits = fLoader->Digits();
 
   // if number of local maxima less then 2 - nothing to unfold
-  Int_t Nmax = GetNumberOfLocalMax(maxAt,maxAtEnergy,LocMaxCut,digits); 
-  if(Nmax<2) return Nmax;
+  Int_t nMax = GetNumberOfLocalMax(maxAt,maxAtEnergy,locMaxCut,digits); 
+  if(nMax<2) return nMax;
 
-  Int_t* Digits = GetDigitsList();
+  Int_t* digitsList = GetDigitsList();
   Int_t nDigits = GetMultiplicity();
-  Float_t* Energies = GetEnergiesList();
+  Float_t* energies = GetEnergiesList();
   Float_t* eFit = new Float_t[nDigits];
 
   Int_t iDigit; //loop variable
@@ -933,76 +970,80 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima()
   for(iDigit=0; iDigit<nDigits; iDigit++)
     {
       
-      AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] );
-      fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+      AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digitsList[iDigit] );
+      phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
       Float_t x,z;
-      fGeom->RelPosInModule(relid, x, z);
+      phosgeom->RelPosInModule(relid, x, z);
 
-      for(Int_t iMax=0; iMax<Nmax; iMax++)
+      for(Int_t iMax=0; iMax<nMax; iMax++)
        {
          AliPHOSDigit* digitMax = maxAt[iMax];
          Float_t eMax = maxAtEnergy[iMax]; 
-         fGeom->AbsToRelNumbering(digitMax->GetId(), relid) ;
-         fGeom->RelPosInModule(relid, xMax, zMax);
+         phosgeom->AbsToRelNumbering(digitMax->GetId(), relid) ;
+         phosgeom->RelPosInModule(relid, xMax, zMax);
          Float_t dx = xMax - x;
          Float_t dz = zMax - z;
-         Float_t Amp,gx,gy;
-         GetReconstructionManager()->AG(eMax,dz,dx,Amp,gx,gy); 
-//        Amp = Amp + 0.5;
-         eFit[iDigit] += Amp;
+         Float_t amp,gx,gy;
+         GetReconstructionManager()->AG(eMax,dz,dx,amp,gx,gy); 
+//        amp = amp + 0.5;
+         eFit[iDigit] += amp;
        }
     }
 
 
-  for(Int_t iMax=0; iMax<Nmax; iMax++) 
+  for(Int_t iMax=0; iMax<nMax; iMax++) 
     {
       AliPHOSDigit* digitMax = maxAt[iMax];
-      fGeom->AbsToRelNumbering(digitMax->GetId(), relid) ;
-      fGeom->RelPosInModule(relid, xMax, zMax);
+      phosgeom->AbsToRelNumbering(digitMax->GetId(), relid) ;
+      phosgeom->RelPosInModule(relid, xMax, zMax);
       Float_t eMax = maxAtEnergy[iMax];
 
       AliPHOSEvalRecPoint* newRP = new AliPHOSEvalRecPoint(IsCPV(),this);    
       newRP->AddDigit(*digitMax,maxAtEnergy[iMax]);
 
       //Neighbous ( matrix 3x3 around the local maximum)
-      for(Int_t iDigit=0; iDigit<nDigits; iDigit++)
+      for(iDigit=0; iDigit<nDigits; iDigit++)
        {     
-         AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( Digits[iDigit] );
-         Float_t eDigit = Energies[iDigit];
-         fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+         AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digitsList[iDigit] );
+         Float_t eDigit = energies[iDigit];
+         phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
          Float_t ix,iz;
-         fGeom->RelPosInModule(relid, ix, iz);
+         phosgeom->RelPosInModule(relid, ix, iz);
 
          if(AreNeighbours(digitMax,digit))
            {
              Float_t dx = xMax - ix;
              Float_t dz = zMax - iz;
-             Float_t single_shower_gain,gxMax,gyMax;
-             GetReconstructionManager()->AG(eMax,dz,dx,single_shower_gain,gxMax,gyMax);
-             Float_t total_gain = eFit[iDigit];
-             Float_t ratio = single_shower_gain/total_gain; 
-             Info("UnfoldLocalMaxima", " ratio -> %f", ratio) ;
+             Float_t singleShowerGain,gxMax,gyMax;
+             GetReconstructionManager()->AG(eMax,dz,dx,singleShowerGain,gxMax,gyMax);
+             Float_t totalGain = eFit[iDigit];
+             Float_t ratio = singleShowerGain/totalGain; 
+             AliInfo(Form(" ratio -> %f", ratio)) ;
              eDigit = eDigit*ratio;
              newRP->AddDigit(*digit,eDigit);
            }
        }
 
-      newRP->EvalLocalPosition(LogWeight,digits);
-      Info("UnfoldLocalMaxima", "======= Unfold: daughter rec point %d =================", iMax) ;
-      newRP->Print("");
+      TVector3 vtx(0.,0.,0.) ;
+      TVector3 inc(0.,0.,0.) ;
+      newRP->EvalLocalPosition(logWeight,vtx,digits,inc);
+      AliInfo(Form("======= Unfold: daughter rec point %d =================", 
+                  iMax)) ;
+      newRP->Print();
     }
 
 //    RemoveFromWorkingPool(this);
 
   delete[] eFit;
 
-  return Nmax;
+  return nMax;
 
 }
 
-void AliPHOSEvalRecPoint::PrintPoint(Option_t* opt)
+void AliPHOSEvalRecPoint::PrintPoint()
 {
-  AliPHOSCpvRecPoint::Print(opt);
+  // print rec.point to stdout
+  AliPHOSCpvRecPoint::Print();
 
   TVector3 lpos;
   GetLocalPosition(lpos);
@@ -1010,19 +1051,18 @@ void AliPHOSEvalRecPoint::PrintPoint(Option_t* opt)
   TString message ; 
   message  = "       Chi2/dof = %f" ;
   message += "       Local (x,z) = (%f, %f) in module %d" ; 
-  Info("Print", message.Data(), Chi2Dof(), lpos.X(), lpos.Z(), GetPHOSMod()) ;
+  AliInfo(Form(message.Data(), Chi2Dof(), lpos.X(), lpos.Z(), GetPHOSMod())) ;
 
 }
 
 AliPHOSRecManager* AliPHOSEvalRecPoint::GetReconstructionManager() const
 {
-
+  // returns reconstruction manager
   TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice");
   TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP");
   AliPHOSRecManager* recMng = (AliPHOSRecManager*)wPoolF->FindObject("AliPHOSRecManager");
   if(!recMng) { 
-    Error("GetReconstructionManager", "Couldn't find Reconstruction Manager. Exit.") ; 
-    exit(1); 
+    AliFatal(Form("Couldn't find Reconstruction Manager")) ;  
   }
 
   return recMng;
@@ -1031,6 +1071,7 @@ AliPHOSRecManager* AliPHOSEvalRecPoint::GetReconstructionManager() const
 
 AliPHOSRecPoint* AliPHOSEvalRecPoint::Parent()
 {
+  // returns a parent
   if(fParent<0) return NULL;
   else
     return (AliPHOSRecPoint*)GetFromWorkingPool(fParent);
@@ -1039,18 +1080,18 @@ AliPHOSRecPoint* AliPHOSEvalRecPoint::Parent()
 
 Float_t AliPHOSEvalRecPoint::Chi2Dof() const 
 {
+  // returns a chi^2 per degree of freedom
   return fChi2Dof;
 }
 
 const TObject* AliPHOSEvalRecPoint::GetWorkingPool()
 {
-
+  // returns a pool of rec.points
   TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice");
   TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP");
   TObject* wPool = wPoolF->FindObject("SmartPoints");
   if(!wPool) { 
-    Error("GetWorkingPool", "Couldn't find Working Pool. Exit.") ; 
-    exit(1); 
+    AliFatal(Form("Couldn't find Working Pool")) ;  
   }
 
   return wPool;
@@ -1058,46 +1099,32 @@ const TObject* AliPHOSEvalRecPoint::GetWorkingPool()
 
 void AliPHOSEvalRecPoint::AddToWorkingPool(TObject* obj)
 {
+  // add a rec.point to a pool
   ((TObjArray*)GetWorkingPool())->Add(obj);
 }
 
 TObject* AliPHOSEvalRecPoint::GetFromWorkingPool(Int_t i)
 {
+  // return a rec.point from a pool at an index i
 //    return fWorkingPool->At(i);
   return ((TObjArray*)GetWorkingPool())->At(i);
 }
 
 Int_t AliPHOSEvalRecPoint::InWorkingPool()
 {
+  // return the number of rec.points in a pool
   return ((TObjArray*)GetWorkingPool())->GetEntries();
 }
 
 void AliPHOSEvalRecPoint::RemoveFromWorkingPool(TObject* obj)
 {
+  // remove a rec.point from a pool
   ((TObjArray*)GetWorkingPool())->Remove(obj);
   ((TObjArray*)GetWorkingPool())->Compress();
 }
 
 void AliPHOSEvalRecPoint::PrintWorkingPool()
 {
-  ((TObjArray*)GetWorkingPool())->Print("");
+  // print pool of rec.points to stdout
+  ((TObjArray*)GetWorkingPool())->Print();
 }
-
-void AliPHOSEvalRecPoint::SetEventFolderName(const char* evfname)
-{//Sets event folder name
-  fEventFolderName = evfname;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-