]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALClusterizer.cxx
avoid warnings with modern compilers due to unused variables or wrong comparison...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALClusterizer.cxx
index 36590a9f4efb76a2de8f7f59e4d0ff975d397618..bd3ae91b6c3fa868e6111ada53bd1d6ce8c09e1f 100644 (file)
@@ -25,8 +25,7 @@
 //////////////////////////////////////////////////////////////////////////////
 
 // --- ROOT system ---
-#include "TClonesArray.h"
-#include "TTree.h"
+#include <TTree.h>
 #include <TFile.h> 
 class TFolder;
 #include <TMath.h> 
@@ -73,7 +72,7 @@ AliEMCALClusterizer::AliEMCALClusterizer():
   fTimeMin(-1.),fTimeMax(1.),fTimeCut(1.),
   fDefaultInit(kFALSE),fToUnfold(kFALSE),
   fNumberOfECAClusters(0), fECAClusteringThreshold(0.),
-  fECALocMaxCut(0.),fECAW0(0.),fMinECut(0.),
+  fECALocMaxCut(0.),fECAW0(0.),fMinECut(0.),fRejectBelowThreshold(0),
   fClusterUnfolding(NULL)
 {
   // ctor
@@ -95,7 +94,7 @@ AliEMCALClusterizer::AliEMCALClusterizer(AliEMCALGeometry* geometry):
   fTimeMin(-1.),fTimeMax(1.),fTimeCut(1.),
   fDefaultInit(kFALSE),fToUnfold(kFALSE),
   fNumberOfECAClusters(0), fECAClusteringThreshold(0.),
-  fECALocMaxCut(0.),fECAW0(0.),fMinECut(0.),
+  fECALocMaxCut(0.),fECAW0(0.),fMinECut(0.),fRejectBelowThreshold(0),
   fClusterUnfolding(NULL)
 {
   // Ctor with the indication of the file where header Tree and digits Tree are stored.
@@ -134,7 +133,7 @@ AliEMCALClusterizer::AliEMCALClusterizer(AliEMCALGeometry *geometry,
   fTimeMin(-1.),fTimeMax(1.),fTimeCut(1.),
   fDefaultInit(kFALSE),fToUnfold(kFALSE),
   fNumberOfECAClusters(0), fECAClusteringThreshold(0.),
-  fECALocMaxCut(0.),fECAW0(0.),fMinECut(0.),
+  fECALocMaxCut(0.),fECAW0(0.),fMinECut(0.),fRejectBelowThreshold(0),
   fClusterUnfolding(NULL)
 {
   // ctor, geometry and calibration are initialized elsewhere.
@@ -176,6 +175,7 @@ void AliEMCALClusterizer::DeleteRecPoints()
       AliDebug(2, "Deleting fRecPoints.");
       fRecPoints->Delete();
       delete fRecPoints;
+      fRecPoints = 0;
     }
 }
 
@@ -188,6 +188,7 @@ void AliEMCALClusterizer::DeleteDigits()
       AliDebug(2, "Deleting fDigitsArr.");
       fDigitsArr->Clear("C");
       delete fDigitsArr;
+      fDigitsArr = 0;
     }
 }
 
@@ -247,22 +248,18 @@ void AliEMCALClusterizer::Calibrate(Float_t & amp, Float_t & time, const Int_t a
       return ;
     }
   }
-  //Check if time is too large or too small, indication of a noisy channel, remove in this case
-  if(time > fTimeMax || time < fTimeMin) {
-    amp  = 0 ;
-    time = 0 ;
-    return ;
-  }
     
-  if (fIsInputCalibrated||!fCalibData)
+  if (fIsInputCalibrated || !fCalibData)
   {
     AliDebug(10, Form("Input already calibrated!"));
     return ;
   }
          
+  Int_t bc = 0; // Get somehow the bunch crossing number
+
   fADCchannelECA  = fCalibData->GetADCchannel (iSupMod,ieta,iphi);
   fADCpedestalECA = fCalibData->GetADCpedestal(iSupMod,ieta,iphi);
-  fTimeECA        = fCalibData->GetTimeChannel(iSupMod,ieta,iphi);
+  fTimeECA        = fCalibData->GetTimeChannel(iSupMod,ieta,iphi, bc);
   
   time -= fTimeECA ;
   amp   = amp * fADCchannelECA - fADCpedestalECA ;  
@@ -374,15 +371,21 @@ void AliEMCALClusterizer::InitParameters(const AliEMCALRecParam* recParam)
   fECAClusteringThreshold = recParam->GetClusteringThreshold();
   fECAW0                  = recParam->GetW0();
   fMinECut                = recParam->GetMinECut();    
+  fRejectBelowThreshold   = recParam->GetRejectBelowThreshold();
   fToUnfold               = recParam->GetUnfold();
   fECALocMaxCut           = recParam->GetLocMaxCut();
   fTimeCut                = recParam->GetTimeCut();
   fTimeMin                = recParam->GetTimeMin();
   fTimeMax                = recParam->GetTimeMax();
-    
+  
+  //For NxN
+  SetNRowDiff(recParam->GetNRowDiff());
+  SetNColDiff(recParam->GetNColDiff());
+  
   AliDebug(1,Form("Reconstruction parameters: fECAClusteringThreshold=%.3f GeV, fECAW=%.3f, fMinECut=%.3f GeV, "
-                  "fToUnfold=%d, fECALocMaxCut=%.3f GeV, fTimeCut=%e s,fTimeMin=%e s,fTimeMax=%e s",
-                  fECAClusteringThreshold,fECAW0,fMinECut,fToUnfold,fECALocMaxCut,fTimeCut, fTimeMin, fTimeMax));
+                  "fToUnfold=%d, fECALocMaxCut=%.3f GeV, fTimeCut=%e s,fTimeMin=%e s,fTimeMax=%e s,fRejectBelowThreshold=%d",
+                  fECAClusteringThreshold,fECAW0,fMinECut,fToUnfold,fECALocMaxCut,fTimeCut, fTimeMin, fTimeMax, 
+                 fRejectBelowThreshold));
 
   if (fToUnfold) {
     Int_t i=0;
@@ -509,12 +512,15 @@ void AliEMCALClusterizer::SetInput(TTree *digitsTree)
   // Read the digits from the input tree
 
   TBranch *branch = digitsTree->GetBranch("EMCAL");
-  if (!branch) { 
+  if (!branch)
+  {
     AliError("can't get the branch with the EMCAL digits !");
     return;
   }
-  if (!fDigitsArr)
-    fDigitsArr = new TClonesArray("AliEMCALDigit",100);
+  
+  if (!fDigitsArr) fDigitsArr = new TClonesArray("AliEMCALDigit",100);
+  else             fDigitsArr->Clear("C"); // avoid leak
+    
   branch->SetAddress(&fDigitsArr);
   branch->GetEntry(0);
 }