]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALClusterizer.cxx
cosmetics
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALClusterizer.cxx
index 27a7f27b58e141509b3f958354221e3b1ce04a02..fd263106c032c71c51160184c5d4d0dce40df635 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> 
@@ -161,6 +160,10 @@ AliEMCALClusterizer::~AliEMCALClusterizer()
 
   // make sure we delete the rec points array
   DeleteRecPoints();
+
+  //Delete digits array
+  DeleteDigits();
+
 }
 
 //____________________________________________________________________________
@@ -176,12 +179,32 @@ void AliEMCALClusterizer::DeleteRecPoints()
     }
 }
 
+//____________________________________________________________________________
+void AliEMCALClusterizer::DeleteDigits()
+{
+  // free the digits array
+  if (fDigitsArr) 
+    {
+      AliDebug(2, "Deleting fDigitsArr.");
+      fDigitsArr->Clear("C");
+      delete fDigitsArr;
+      fDigitsArr = 0;
+    }
+}
+
 //____________________________________________________________________________
 void AliEMCALClusterizer::Calibrate(Float_t & amp, Float_t & time, const Int_t absId) 
 {
   // Convert digitized amplitude into energy, calibrate time
   // Calibration parameters are taken from OCDB : OCDB/EMCAL/Calib/Data
 
+  //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 ;
+  }  
+  
   //Return energy with default parameters if calibration is not available
   if (!fCalibData && !fCaloPed) {
     if (fIsInputCalibrated == kTRUE)
@@ -232,22 +255,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 ;  
@@ -364,7 +383,11 @@ void AliEMCALClusterizer::InitParameters(const AliEMCALRecParam* recParam)
   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));