**************************************************************************/
// After-burner for the EMCAL cluster unfolding algorithm
//
-// Input: TObjArray *clusArray -- array of AliAODCaloClusters;
-// AliAODCaloCells *cellsEMCAL -- EMCAL cells.
+// Input: TObjArray *clusArray -- array of AliVClusters;
+// AliVCaloCells *cellsEMCAL -- EMCAL cells.
//
// Output is appended to clusArray, the original (unfolded or not) clusters
// are deleted or moved to another position in clusArray.
// TObjArray *clusArray = new TObjArray(100);
//
//
-// AliAODEvent *event = (AliAODEvent*) InputEvent();
-// AliAODCaloCells *cellsEMCAL = event->GetEMCALCells();
+// AliVEvent *event = InputEvent();
+// AliVCaloCells *cellsEMCAL = event->GetEMCALCells();
//
// for (Int_t i = 0; i < event->GetNumberOfCaloClusters(); i++)
// {
-// AliAODCaloCluster *clus = event->GetCaloCluster(i);
+// AliVCluster *clus = event->GetCaloCluster(i);
//
// clusArray->Add(clus->Clone()); // NOTE _CLONE_ in this line
// }
#include <AliEMCALGeometry.h>
#include <AliEMCALUnfolding.h>
#include <AliAODCaloCluster.h>
-#include <AliAODCaloCells.h>
+#include <AliVCaloCells.h>
#include <AliEMCALRecPoint.h>
#include <AliEMCALDigit.h>
fGeom(NULL),
fLogWeight(4.5), // correct?
fECALocMaxCut(0.03), // value suggested by Adam
+ fMinECut(0.01),
fRecPoints(NULL),
fDigitsArr(NULL),
fClusterUnfolding(NULL)
}
//------------------------------------------------------------------------
-AliEMCALAfterBurnerUF::AliEMCALAfterBurnerUF(Float_t logWeight, Float_t ECALocMaxCut):
+AliEMCALAfterBurnerUF::AliEMCALAfterBurnerUF(Float_t logWeight, Float_t ecaLocMaxCut, Float_t minECut):
fGeom(NULL),
fLogWeight(logWeight),
- fECALocMaxCut(ECALocMaxCut),
+ fECALocMaxCut(ecaLocMaxCut),
+ fMinECut(minECut),
fRecPoints(NULL),
fDigitsArr(NULL),
fClusterUnfolding(NULL)
// for this to work, the OCDB geometry must be imported instead
if (!gGeoManager)
- TGeoManager::Import("geometry.root");
+ Warning("AliEMCALAfterBurnerUF::Init","GeoManager not found, please import the geometry.root file or pass to the geometry the misalignment matrices");
+// TGeoManager::Import("geometry.root");
// required for global cluster position recalculation
if (!gGeoManager)
- Fatal("AliEMCALAfterBurnerUF::Init", "failed to import geometry.root");
+ Info("AliEMCALAfterBurnerUF::Init", "gGeoManager was not set, be careful");
// initialize geometry, if not yet initialized
if (!AliEMCALGeometry::GetInstance()) {
- Warning("AliEMCALAfterBurnerUF::Init", "AliEMCALGeometry is not yet initialized. Initializing with EMCAL_COMPLETE");
- AliEMCALGeometry::GetInstance("EMCAL_COMPLETE");
+ Warning("AliEMCALAfterBurnerUF::Init", "AliEMCALGeometry is not yet initialized. Initializing with EMCAL_COMPLETEV1");
+ AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
}
// AliEMCALRecPoint is using exactly this call
fClusterUnfolding = new AliEMCALUnfolding(fGeom);
fClusterUnfolding->SetECALocalMaxCut(fECALocMaxCut);
-
+ fClusterUnfolding->SetThreshold(fMinECut);
+
// clusters --> recPoints, cells --> digits and back ;)
fRecPoints = new TObjArray(100);
fDigitsArr = new TClonesArray("AliEMCALDigit",1152);
//------------------------------------------------------------------------
AliEMCALAfterBurnerUF::~AliEMCALAfterBurnerUF()
{
+ //
+ // destructor
+ //
+
if (fClusterUnfolding) delete fClusterUnfolding;
- if (fRecPoints) delete fRecPoints;
- if (fDigitsArr) delete fDigitsArr;
+ if (fRecPoints) {
+ fRecPoints->Delete();
+ delete fRecPoints;
+ }
+ if (fDigitsArr) {
+ fDigitsArr->Clear("C");
+ delete fDigitsArr;
+ }
}
+//------------------------------------------------------------------------
+void AliEMCALAfterBurnerUF::Clear()
+{
+ //Clean the arrays
+
+ if (fRecPoints) fRecPoints->Delete(); // do not Clear(), it leaks, why?
+ if (fDigitsArr) fDigitsArr->Clear("C");
+
+}
//------------------------------------------------------------------------
void AliEMCALAfterBurnerUF::RecPoints2Clusters(TObjArray *clusArray)
{
{
AliEMCALRecPoint *recPoint = (AliEMCALRecPoint*) fRecPoints->At(i);
- Int_t ncells = recPoint->GetMultiplicity();
- Int_t ncells_true = 0;
+ const Int_t ncells = recPoint->GetMultiplicity();
+ Int_t ncellsTrue = 0;
// cells and their amplitude fractions
UShort_t absIds[ncells]; // NOTE: unfolding must not give recPoints with no cells!
for (Int_t c = 0; c < ncells; c++) {
AliEMCALDigit *digit = (AliEMCALDigit*) fDigitsArr->At(recPoint->GetDigitsList()[c]);
- absIds[ncells_true] = digit->GetId();
- ratios[ncells_true] = recPoint->GetEnergiesList()[c]/digit->GetAmplitude();
+ absIds[ncellsTrue] = digit->GetId();
+ ratios[ncellsTrue] = recPoint->GetEnergiesList()[c]/digit->GetAmplitude();
- if (ratios[ncells_true] > 0.001) ncells_true++;
+ if (ratios[ncellsTrue] > 0.001) ncellsTrue++;
}
- if (ncells_true < 1) {
+ if (ncellsTrue < 1) {
Warning("AliEMCALAfterBurnerUF::RecPoints2Clusters", "skipping cluster with no cells");
continue;
}
// create a new cluster
AliAODCaloCluster *clus = new AliAODCaloCluster();
- clus->SetType(AliAODCaloCluster::kEMCALClusterv1);
+ clus->SetType(AliVCluster::kEMCALClusterv1);
clus->SetE(recPoint->GetEnergy());
clus->SetPosition(g);
- clus->SetNCells(ncells_true);
+ clus->SetNCells(ncellsTrue);
clus->SetCellsAbsId(absIds);
clus->SetCellsAmplitudeFraction(ratios);
// TODO: time not stored
}
//------------------------------------------------------------------------
-void AliEMCALAfterBurnerUF::UnfoldClusters(TObjArray *clusArray, AliAODCaloCells *cellsEMCAL)
+void AliEMCALAfterBurnerUF::UnfoldClusters(TObjArray *clusArray, AliVCaloCells *cellsEMCAL)
{
// Unfolds clusters.
//
*/
for (Int_t i = 0; i < nclus; i++)
{
- AliAODCaloCluster *clus = (AliAODCaloCluster*) clusArray->At(i);
+ AliVCluster *clus = (AliVCluster*) clusArray->At(i);
if (!clus->IsEMCAL()) continue;
// new recPoint
AliEMCALRecPoint *recPoint = new AliEMCALRecPoint("");
- recPoint->SetClusterType(AliAODCaloCluster::kEMCALClusterv1);
+ recPoint->SetClusterType(AliVCluster::kEMCALClusterv1);
fRecPoints->Add(recPoint);
// fill digits
RecPoints2Clusters(clusArray);
// clean up
- fRecPoints->Delete();
- fDigitsArr->Delete();
+ fRecPoints->Delete(); // do not Clear(), it leaks, why?
+ fDigitsArr->Clear("C");
clusArray->Compress();