Try to correct leak on AliEMCALTracker::LoadClustes
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 22 Apr 2010 17:47:20 +0000 (17:47 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 22 Apr 2010 17:47:20 +0000 (17:47 +0000)
EMCAL/AliEMCALTracker.cxx

index 3518383..8fd5bdd 100644 (file)
@@ -263,6 +263,9 @@ Int_t AliEMCALTracker::LoadClusters(TTree *cTree)
        
        Clear("CLUSTERS");
 
+       cTree->SetBranchStatus("*",0); //disable all branches
+       cTree->SetBranchStatus("EMCALECARP",1); //Enable only the branch we need
+
        TBranch *branch = cTree->GetBranch("EMCALECARP");
        if (!branch) {
                AliError("Can't get the branch with the EMCAL clusters");
@@ -272,9 +275,11 @@ Int_t AliEMCALTracker::LoadClusters(TTree *cTree)
        TClonesArray *clusters = new TClonesArray("AliEMCALRecPoint", 1000);
        branch->SetAddress(&clusters);
        
-       cTree->GetEvent(0);
+       //cTree->GetEvent(0);
+       branch->GetEntry(0);
        Int_t nClusters = (Int_t)clusters->GetEntries();
-       fClusters = new TObjArray(0);
+       if(fClusters) fClusters->Delete();
+       else fClusters = new TObjArray(0);
        for (Int_t i = 0; i < nClusters; i++) {
                AliEMCALRecPoint *cluster = (AliEMCALRecPoint*)clusters->At(i);
                if (!cluster) continue;