]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSEvalRecPoint.cxx
Adding histos
[u/mrichter/AliRoot.git] / PHOS / AliPHOSEvalRecPoint.cxx
index 59311ddc03c44f6edcfc60c47caa851452afeb94..fae088df97d587821b542dd1b719f6c6977dca80 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-/* $Id:  */
 
-/* $Log:
- */
+/* $Id$ */
+
 //*-- Author: Boris Polichtchouk, IHEP
 //////////////////////////////////////////////////////////////////////////////
 // Reconstructed point operations for the Clusterization class for IHEP reconstruction.
 // 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"
 
 ClassImp(AliPHOSEvalRecPoint)
 
-  AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(): fEventFolderName(AliConfig::fgkDefaultEventFolderName)
+AliPHOSEvalRecPoint::AliPHOSEvalRecPoint() :
+  fIsEmc(kFALSE),
+  fIsCpv(kTRUE),
+  fParent(-333),
+  fChi2Dof(-111),
+  fEventFolderName(AliConfig::GetDefaultEventFolderName())
 {
   // default ctor
-  fParent=-333;
-  fChi2Dof=-111;
-  fIsCpv = kTRUE;
-  fIsEmc = kFALSE;
 }
 
-AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent) : AliPHOSCpvRecPoint()
+AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent) : 
+  fIsEmc(kFALSE),
+  fIsCpv(kFALSE),
+  fParent(-333),
+  fChi2Dof(-111),
+  fEventFolderName("")
 {
   // ctor
   fParent=-333;
@@ -67,7 +74,9 @@ AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent
     Fatal("ctor", "Couldn't find working pool") ; 
   }
 
-  fParent = wPool->IndexOf((TObject*)parent);
+  if(wPool)
+    fParent = wPool->IndexOf((TObject*)parent);
+
   fChi2Dof = parent->Chi2Dof();
 
   if(cpv) {
@@ -84,12 +93,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())
 {
   // ctor
-  fChi2Dof=-111;
-  fParent=-333;
-
   AliPHOSEmcRecPoint* rp=0;
 
   AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
@@ -222,7 +233,7 @@ void AliPHOSEvalRecPoint::Init()
   // initialization
   AliPHOSClusterizer* clusterizer = GetClusterizer();
   if(!clusterizer) {
-    Fatal("Init", "Cannot get clusterizer") ;
+    AliFatal("Cannot get clusterizer") ;
   }
 
   TClonesArray* digits = AliPHOSLoader::GetPHOSLoader(fEventFolderName)->Digits();
@@ -235,7 +246,9 @@ void AliPHOSEvalRecPoint::Init()
     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
 }
 
 
@@ -279,7 +292,7 @@ void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2)
   Float_t yy = lpos.X();
   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);
@@ -302,7 +315,7 @@ 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
 
@@ -310,8 +323,8 @@ void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2)
     {
       digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); 
       eDigit = energies[iDigit];
-      fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
-      fGeom->RelPosInModule(relid, iy, ix);
+      phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+      phosgeom->RelPosInModule(relid, iy, ix);
     
       Float_t dx =  ix - xx;
       Float_t dy =  iy - yy;
@@ -333,8 +346,8 @@ void AliPHOSEvalRecPoint::InitTwoGam(Float_t* gamma1, Float_t* gamma2)
     {
       digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); 
       eDigit = energies[iDigit];
-      fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
-      fGeom->RelPosInModule(relid, iy, ix);
+      phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+      phosgeom->RelPosInModule(relid, iy, ix);
     
       Float_t dx =  ix - xx;
       Float_t dy =  iy - yy;
@@ -432,7 +445,7 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2)
   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++)
     {
@@ -447,22 +460,20 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2)
        {
          digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] ); 
          eDigit = energies[iDigit];
-         fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
-         fGeom->RelPosInModule(relid, iy, ix);
+         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;
@@ -520,8 +531,8 @@ 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) 
@@ -569,9 +580,9 @@ void AliPHOSEvalRecPoint::TwoGam(Float_t* gamma1, Float_t* gamma2)
   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(), 
+  AliInfo(Form(message.Data(), 
        x1New, z1New, e1New, 
-       x2New, z2New, e2New) ;
+       x2New, z2New, e2New)) ;
 
   fChi2Dof = chisq;
 
@@ -593,15 +604,15 @@ void AliPHOSEvalRecPoint::UnfoldTwoMergedPoints(Float_t* gamma1, Float_t* gamma2
   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] ); 
       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++)
@@ -646,9 +657,9 @@ void AliPHOSEvalRecPoint::UnfoldTwoMergedPoints(Float_t* gamma1, Float_t* gamma2
          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;
@@ -659,7 +670,8 @@ void AliPHOSEvalRecPoint::UnfoldTwoMergedPoints(Float_t* gamma1, Float_t* gamma2
          eDigit = eDigit*ratio;
          newRP->AddDigit(*digit,eDigit);
        }
-      Info("UnfoldTwoMergedPoints", "======= Split: daughter rec point %d =================", iMax) ;
+      AliInfo(Form("======= Split: daughter rec point %d =================", 
+                  iMax)) ;
       newRP->Print();
 
     }
@@ -710,7 +722,7 @@ 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++)
     {
@@ -725,8 +737,8 @@ void AliPHOSEvalRecPoint::EvaluatePosition()
          Int_t* digits = GetDigitsList();
          digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] );
          eDigit = energies[iDigit];
-         fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
-         fGeom->RelPosInModule(relid, iy, ix);
+         phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+         phosgeom->RelPosInModule(relid, iy, ix);
       
          dx =  xc - ix;
          dy =  yc - iy;
@@ -737,7 +749,8 @@ void AliPHOSEvalRecPoint::EvaluatePosition()
          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) ;
+         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.
@@ -752,7 +765,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;
@@ -771,8 +784,8 @@ 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)
@@ -821,7 +834,7 @@ Bool_t AliPHOSEvalRecPoint::KillWeakPoint()
   Float_t thr0 = GetReconstructionManager()->KillGamMinEnergy();
   
   if(GetEnergy()<thr0) {
-    Info("KillWeakPoint", "+++++++ Killing this rec point ++++++++++") ;
+    AliInfo(Form("+++++++ Killing this rec point ++++++++++")) ;
     RemoveFromWorkingPool(this);
     return kTRUE;
   }
@@ -865,9 +878,9 @@ void AliPHOSEvalRecPoint::MergeClosePoint()
            {
              if(TooClose(rp))
                {
-                 Info("MergeClosePoint", "+++++++ Merging point 1: ++++++") ;
+                 AliInfo(Form("+++++++ Merging point 1: ++++++")) ;
                  this->Print();
-                 Info("MergeClosePoint", "+++++++ and point 2: ++++++++++") ;
+                 AliInfo(Form("+++++++ and point 2: ++++++++++")) ;
                  ((AliPHOSEvalRecPoint*)rp)->Print();
 
                  //merge two rec. points
@@ -896,7 +909,7 @@ void AliPHOSEvalRecPoint::MergeClosePoint()
                  RemoveFromWorkingPool(rp);
                  delete rp;
                  
-                 Info("MergeClosePoint", "++++++ Resulting point: ++++++++") ;
+                 AliInfo(Form("++++++ Resulting point: ++++++++")) ;
                  this->Print();
 
                  break;
@@ -924,7 +937,7 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima()
 
   AliPHOSClusterizer* clusterizer = GetClusterizer();
   if(!clusterizer) {
-    Fatal("UnfoldLocalMaxima", "Cannot get clusterizer") ;
+    AliFatal(Form("Cannot get clusterizer")) ;
   }
 
   if(this->IsEmc()) {
@@ -937,7 +950,7 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima()
   }
 
   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
@@ -960,16 +973,16 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima()
     {
       
       AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digitsList[iDigit] );
-      fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+      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++)
        {
          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;
@@ -983,21 +996,21 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima()
   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( digitsList[iDigit] );
          Float_t eDigit = energies[iDigit];
-         fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+         phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
          Float_t ix,iz;
-         fGeom->RelPosInModule(relid, ix, iz);
+         phosgeom->RelPosInModule(relid, ix, iz);
 
          if(AreNeighbours(digitMax,digit))
            {
@@ -1007,14 +1020,17 @@ Int_t AliPHOSEvalRecPoint::UnfoldLocalMaxima()
              GetReconstructionManager()->AG(eMax,dz,dx,singleShowerGain,gxMax,gyMax);
              Float_t totalGain = eFit[iDigit];
              Float_t ratio = singleShowerGain/totalGain; 
-             Info("UnfoldLocalMaxima", " ratio -> %f", ratio) ;
+             AliInfo(Form(" ratio -> %f", ratio)) ;
              eDigit = eDigit*ratio;
              newRP->AddDigit(*digit,eDigit);
            }
        }
 
-      newRP->EvalLocalPosition(logWeight,digits);
-      Info("UnfoldLocalMaxima", "======= Unfold: daughter rec point %d =================", iMax) ;
+      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();
     }
 
@@ -1037,7 +1053,7 @@ void AliPHOSEvalRecPoint::PrintPoint()
   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())) ;
 
 }
 
@@ -1048,7 +1064,7 @@ AliPHOSRecManager* AliPHOSEvalRecPoint::GetReconstructionManager() const
   TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP");
   AliPHOSRecManager* recMng = (AliPHOSRecManager*)wPoolF->FindObject("AliPHOSRecManager");
   if(!recMng) { 
-    Fatal("GetReconstructionManager", "Couldn't find Reconstruction Manager") ;  
+    AliFatal(Form("Couldn't find Reconstruction Manager")) ;  
   }
 
   return recMng;
@@ -1077,7 +1093,7 @@ const TObject* AliPHOSEvalRecPoint::GetWorkingPool()
   TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP");
   TObject* wPool = wPoolF->FindObject("SmartPoints");
   if(!wPool) { 
-    Fatal("GetWorkingPool", "Couldn't find Working Pool") ;  
+    AliFatal(Form("Couldn't find Working Pool")) ;  
   }
 
   return wPool;