]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fix memory leaks in output container for each analysis, delete when not used anymore...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 27 Mar 2010 15:18:32 +0000 (15:18 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 27 Mar 2010 15:18:32 +0000 (15:18 +0000)
PWG4/PartCorrBase/AliAnaPartCorrMaker.cxx
PWG4/PartCorrBase/AliCaloPID.cxx
PWG4/PartCorrBase/AliCaloPID.h
PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx
PWG4/PartCorrDep/AliAnaPhoton.cxx

index 4693cb16aeabf998df1c4d2b0d650f2b943a2f2f..f200a6e790c3bbf15544c1d4f163ddef534d29bc 100755 (executable)
@@ -154,6 +154,7 @@ TList *AliAnaPartCorrMaker::GetOutputContainer()
     if(fMakeHisto){// Analysis with histograms as output on
       //Fill container with appropriate histograms                     
       TList * templist =  ana -> GetCreateOutputObjects(); 
+         templist->SetOwner(kFALSE); //Owner is fOutputContainer.
       for(Int_t i = 0; i < templist->GetEntries(); i++){
 
        //Add only  to the histogram name the name of the task
@@ -164,6 +165,7 @@ TList *AliAnaPartCorrMaker::GetOutputContainer()
        //Add histogram to general container
        fOutputContainer->Add(templist->At(i)) ;
       }
+               delete templist;
     }// Analysis with histograms as output on
   }//Loop on analysis defined
   
index d53053c627bffe02b6d3e14579a1eedf41d0b2a3..6b0805f879e29c8358fc4ad563c68e8a477811d4 100755 (executable)
@@ -42,7 +42,7 @@
 // --- ROOT system ---
 #include <TMath.h>
 #include <TString.h>
-#include <TFormula.h>
+//#include <TFormula.h>
 
 //---- ANALYSIS system ----
 #include "AliCaloPID.h"
@@ -59,8 +59,8 @@ fEMCALElectronWeight(0.),  fEMCALChargeWeight(0.),
 fEMCALNeutralWeight(0.),
 fPHOSPhotonWeight(0.), fPHOSPi0Weight(0.),  
 fPHOSElectronWeight(0.), fPHOSChargeWeight(0.) , 
-fPHOSNeutralWeight(0.), fPHOSWeightFormula(0), 
-fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0),
+fPHOSNeutralWeight(0.), //fPHOSWeightFormula(0), 
+//fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0),
 fDispCut(0.),fTOFCut(0.), fDebug(-1), 
 fRecalculateBayesian(kFALSE), fParticleFlux(kLow), fEMCALPIDUtils(new AliEMCALPIDUtils)
 {
@@ -77,8 +77,8 @@ fEMCALElectronWeight(0.),  fEMCALChargeWeight(0.),
 fEMCALNeutralWeight(0.),
 fPHOSPhotonWeight(0.), fPHOSPi0Weight(0.),  
 fPHOSElectronWeight(0.), fPHOSChargeWeight(0.) , 
-fPHOSNeutralWeight(0.), fPHOSWeightFormula(0), 
-fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0),
+fPHOSNeutralWeight(0.), //fPHOSWeightFormula(0), 
+//fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0),
 fDispCut(0.),fTOFCut(0.), fDebug(-1), 
 fRecalculateBayesian(kTRUE), fParticleFlux(flux), fEMCALPIDUtils(new AliEMCALPIDUtils)
 {
@@ -95,8 +95,8 @@ fEMCALElectronWeight(0.),  fEMCALChargeWeight(0.),
 fEMCALNeutralWeight(0.),
 fPHOSPhotonWeight(0.), fPHOSPi0Weight(0.),  
 fPHOSElectronWeight(0.), fPHOSChargeWeight(0.) , 
-fPHOSNeutralWeight(0.), fPHOSWeightFormula(0), 
-fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0),
+fPHOSNeutralWeight(0.), //fPHOSWeightFormula(0), 
+//fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0),
 fDispCut(0.),fTOFCut(0.), fDebug(-1), 
 fRecalculateBayesian(kTRUE), fParticleFlux(-1), fEMCALPIDUtils( (AliEMCALPIDUtils*) emcalpid)
 {
@@ -118,9 +118,9 @@ fPHOSPi0Weight(pid.fPHOSPi0Weight),
 fPHOSElectronWeight(pid.fPHOSElectronWeight), 
 fPHOSChargeWeight(pid.fPHOSChargeWeight),
 fPHOSNeutralWeight(pid.fPHOSNeutralWeight),
-fPHOSWeightFormula(pid.fPHOSWeightFormula), 
-fPHOSPhotonWeightFormula(new TFormula(*pid.fPHOSPhotonWeightFormula)), 
-fPHOSPi0WeightFormula   (new TFormula(*pid.fPHOSPi0WeightFormula)), 
+//fPHOSWeightFormula(pid.fPHOSWeightFormula), 
+//fPHOSPhotonWeightFormula(new TFormula(*pid.fPHOSPhotonWeightFormula)), 
+//fPHOSPi0WeightFormula   (new TFormula(*pid.fPHOSPi0WeightFormula)), 
 fDispCut(pid.fDispCut),fTOFCut(pid.fTOFCut),
 fDebug(pid.fDebug), fRecalculateBayesian(pid.fRecalculateBayesian),
 fParticleFlux(pid.fParticleFlux), 
@@ -170,8 +170,8 @@ fEMCALPIDUtils(new AliEMCALPIDUtils(*pid.fEMCALPIDUtils))
 AliCaloPID::~AliCaloPID() {
   //Dtor
   
-  if(fPHOSPhotonWeightFormula) delete fPHOSPhotonWeightFormula ;
-  if(fPHOSPi0WeightFormula)    delete fPHOSPi0WeightFormula ;
+//  if(fPHOSPhotonWeightFormula) delete fPHOSPhotonWeightFormula ;
+//  if(fPHOSPi0WeightFormula)    delete fPHOSPi0WeightFormula ;
   if(fEMCALPIDUtils)           delete fEMCALPIDUtils ;
 }
 
@@ -194,13 +194,13 @@ void AliCaloPID::InitParameters()
   fPHOSNeutralWeight   = 0.5 ;
   
   //Formula to set the PID weight threshold for photon or pi0
-  fPHOSWeightFormula = kTRUE;
-  if(fPHOSPhotonWeightFormula) delete fPHOSPhotonWeightFormula;
-  if(fPHOSPi0WeightFormula)    delete fPHOSPi0WeightFormula;
-  fPHOSPhotonWeightFormula = 
-    new TFormula("photonWeight","0.98*(x<40)+ 0.68*(x>=100)+(x>=40 && x<100)*(0.98+x*(6e-3)-x*x*(2e-04)+x*x*x*(1.1e-06))");
-  fPHOSPi0WeightFormula = 
-    new TFormula("pi0Weight","0.98*(x<65)+ 0.915*(x>=100)+(x>=65 && x-x*(1.95e-3)-x*x*(4.31e-05)+x*x*x*(3.61e-07))");
+  //fPHOSWeightFormula = kTRUE;
+  //if(fPHOSPhotonWeightFormula) delete fPHOSPhotonWeightFormula;
+  //if(fPHOSPi0WeightFormula)    delete fPHOSPi0WeightFormula;
+  //fPHOSPhotonWeightFormula = 
+    //new TFormula("photonWeight","0.98*(x<40)+ 0.68*(x>=100)+(x>=40 && x<100)*(0.98+x*(6e-3)-x*x*(2e-04)+x*x*x*(1.1e-06))");
+  //fPHOSPi0WeightFormula = 
+    //new TFormula("pi0Weight","0.98*(x<65)+ 0.915*(x>=100)+(x>=65 && x-x*(1.95e-3)-x*x*(4.31e-05)+x*x*x*(3.61e-07))");
   
   fDispCut  = 1.5;
   fTOFCut   = 5.e-9;
@@ -234,10 +234,10 @@ Int_t AliCaloPID::GetPdg(const TString calo, const Double_t * pid, const Float_t
   Float_t wNe  =  fPHOSNeutralWeight ;
   
   
-  if(calo == "PHOS" && fPHOSWeightFormula){
-    wPh  = fPHOSPhotonWeightFormula->Eval(energy) ;
-    wPi0 = fPHOSPi0WeightFormula->Eval(energy);
-  }
+//  if(calo == "PHOS" && fPHOSWeightFormula){
+//    wPh  = fPHOSPhotonWeightFormula->Eval(energy) ;
+//    wPi0 = fPHOSPi0WeightFormula->Eval(energy);
+//  }
   
   if(calo == "EMCAL"){
     
@@ -371,12 +371,12 @@ TString  AliCaloPID::GetPIDParametersList()  {
   sprintf(onePar,"fPHOSNeutralWeight =%2.2f (PHOS bayesian weight for neutral hadrons)\n",fPHOSNeutralWeight) ;
   parList+=onePar ;
   
-  if(fPHOSWeightFormula){
-       sprintf(onePar,"PHOS Photon Weight Formula: %s\n",(fPHOSPhotonWeightFormula->GetExpFormula("p")).Data()) ;
-    parList+=onePar;
-       sprintf(onePar,"PHOS Pi0    Weight Formula: %s\n",(fPHOSPi0WeightFormula->GetExpFormula("p")).Data()) ;
-       parList+=onePar;          
-  }
+//  if(fPHOSWeightFormula){
+//     sprintf(onePar,"PHOS Photon Weight Formula: %s\n",(fPHOSPhotonWeightFormula->GetExpFormula("p")).Data()) ;
+//    parList+=onePar;
+//     sprintf(onePar,"PHOS Pi0    Weight Formula: %s\n",(fPHOSPi0WeightFormula->GetExpFormula("p")).Data()) ;
+//     parList+=onePar;          
+//  }
   
   return parList; 
   
@@ -399,11 +399,11 @@ void AliCaloPID::Print(const Option_t * opt) const
         fEMCALPhotonWeight,  fEMCALPi0Weight, 
         fEMCALElectronWeight,  fEMCALChargeWeight,  fEMCALNeutralWeight) ; 
   
-  printf("PHOS Parametrized weight on?  =     %d\n",  fPHOSWeightFormula) ; 
-  if(fPHOSWeightFormula){
-    printf("Photon weight formula = %s\n", (fPHOSPhotonWeightFormula->GetExpFormula("p")).Data());
-    printf("Pi0    weight formula = %s\n", (fPHOSPhotonWeightFormula->GetExpFormula("p")).Data());
-  }
+//  printf("PHOS Parametrized weight on?  =     %d\n",  fPHOSWeightFormula) ; 
+//  if(fPHOSWeightFormula){
+//    printf("Photon weight formula = %s\n", (fPHOSPhotonWeightFormula->GetExpFormula("p")).Data());
+//    printf("Pi0    weight formula = %s\n", (fPHOSPhotonWeightFormula->GetExpFormula("p")).Data());
+//  }
   
   printf("TOF cut        = %e\n",fTOFCut);
   printf("Dispersion cut = %2.2f\n",fDispCut);
index ca4eb45a77c34551cc9a768e0f27a0a22cf14b84..465cc938338f5ed89e2a2cae8aed627675d24abc 100755 (executable)
@@ -31,7 +31,7 @@
 #include <TObject.h> 
 class TString ;
 class TLorentzVector ;
-class TFormula ;
+//class TFormula ;
 class TTask;
 
 //--- AliRoot system ---
@@ -92,10 +92,10 @@ public:
   Float_t  GetPHOSChargeWeight() const   {  return fPHOSChargeWeight  ; }
   Float_t  GetPHOSNeutralWeight() const   {  return fPHOSNeutralWeight  ; }
   
-  Bool_t  IsPHOSPIDWeightFormulaOn() const   {  return fPHOSWeightFormula  ; } 
-  TFormula * GetPHOSPhotonWeightFormula() const     {  return fPHOSPhotonWeightFormula  ; } 
-  TFormula * GetPHOSPi0WeightFormula() const    {  return fPHOSPi0WeightFormula  ; }
-  
+//  Bool_t  IsPHOSPIDWeightFormulaOn() const   {  return fPHOSWeightFormula  ; } 
+//  TFormula * GetPHOSPhotonWeightFormula() const     {  return fPHOSPhotonWeightFormula  ; } 
+//  TFormula * GetPHOSPi0WeightFormula() const    {  return fPHOSPi0WeightFormula  ; }
+//  
   //Weight setters
   void SetEMCALPhotonWeight(Float_t  w){  fEMCALPhotonWeight = w ; }
   void SetEMCALPi0Weight(Float_t  w){  fEMCALPi0Weight = w ; }
@@ -108,9 +108,9 @@ public:
   void SetPHOSChargeWeight(Float_t  w){  fPHOSChargeWeight = w ; }
   void SetPHOSNeutralWeight(Float_t  w){  fPHOSNeutralWeight = w ; }
   
-  void UsePHOSPIDWeightFormula(Bool_t par)  { fPHOSWeightFormula  = par; } 
-  void SetPHOSPhotonWeightFormula(TFormula * const photon)    {  fPHOSPhotonWeightFormula  = photon; } 
-  void SetPHOSPi0WeightFormula(TFormula * const pi0)   {  fPHOSPi0WeightFormula  = pi0; }
+//  void UsePHOSPIDWeightFormula(Bool_t par)  { fPHOSWeightFormula  = par; } 
+//  void SetPHOSPhotonWeightFormula(TFormula * const photon)    {  fPHOSPhotonWeightFormula  = photon; } 
+//  void SetPHOSPi0WeightFormula(TFormula * const pi0)   {  fPHOSPi0WeightFormula  = pi0; }
   
   //PID bits setters and getters
   void SetDispersionCut(Float_t dcut ) {fDispCut = dcut; }
@@ -141,9 +141,9 @@ public:
   Float_t      fPHOSChargeWeight; //Bayesian PID weight for charged hadrons in PHOS 
   Float_t      fPHOSNeutralWeight; //Bayesian PID weight for neutral hadrons in PHOS 
   
-  Bool_t  fPHOSWeightFormula ; //Use parametrized weight threshold, function of energy
-  TFormula * fPHOSPhotonWeightFormula ; //Formula for photon weight
-  TFormula * fPHOSPi0WeightFormula ; //Formula for pi0 weight
+//  Bool_t  fPHOSWeightFormula ; //Use parametrized weight threshold, function of energy
+//  TFormula * fPHOSPhotonWeightFormula ; //Formula for photon weight
+//  TFormula * fPHOSPi0WeightFormula ; //Formula for pi0 weight
   
   Float_t fDispCut;    //Cut on dispersion, used in PID evaluation
   Float_t fTOFCut;     //Cut on TOF, used in PID evaluation
index 58644ba970ef3b823e6be1d5c302b0d86c3ea9af..62d4ee41ff81bd5b09bd46d92061b9822e077410 100755 (executable)
@@ -562,7 +562,6 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
       if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Particle %d, In Track Refs  entries %d\n", iaod, reftracks->GetEntriesFast());
       if(reftracks->GetEntriesFast() > 0) MakeChargedCorrelation(particle, reftracks,kTRUE);
     }
-    
     //Make correlation with neutral pions
     if(GetOutputAODBranch() && GetOutputAODBranch()->GetEntriesFast() > 0){
       if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Particle %d, In Cluster Refs entries %d\n",iaod, GetOutputAODBranch()->GetEntriesFast());      
@@ -597,10 +596,9 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
    Double_t eta  = -100. ;
    Double_t p[3];
   
-    TObjArray * reftracks    =0x0;
-   if(!bFillHisto) 
-     reftracks    = new TObjArray;
-  
+   TObjArray * reftracks    =0x0;
+   Int_t nrefs = 0;
+       
    //Track loop, select tracks with good pt, phi and fill AODs or histograms
    for(Int_t ipr = 0;ipr < pl->GetEntries() ; ipr ++ ){
      AliAODTrack * track = (AliAODTrack *) (pl->At(ipr)) ;
@@ -673,6 +671,8 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
 
      }
      else{
+          nrefs++;
+          if(nrefs==1)reftracks    = new TObjArray;
        reftracks->Add(track);
      }//aod particle loop
    }// track loop
index 71dd01d27759532498de2cdac0fabc765f6038f6..7262147457c0191d1c09f98a30947e7c2ff0c492 100755 (executable)
@@ -165,7 +165,6 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
   // store them in outputContainer
   TList * outputContainer = new TList() ; 
   outputContainer->SetName("PhotonHistos") ; 
-  outputContainer->SetOwner(kFALSE);
        
   Int_t nptbins  = GetHistoPtBins();
   Int_t nphibins = GetHistoPhiBins();