Fix leaks in AliIsolationCut and AlianaOmegaToPi0Gamma
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Mar 2011 18:12:30 +0000 (18:12 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Mar 2011 18:12:30 +0000 (18:12 +0000)
Do Clear("C") and not Delete() of TClonesArrays with AOD branches
change //! to //-> in declaration in header of  temporal data member arrays arrays with clusters, tracks and AODs

PWG4/PartCorrBase/AliAnaPartCorrMaker.cxx
PWG4/PartCorrBase/AliCaloTrackReader.h
PWG4/PartCorrBase/AliIsolationCut.cxx
PWG4/PartCorrDep/AliAnaOmegaToPi0Gamma.cxx

index 1d0da84..670bca6 100755 (executable)
@@ -295,9 +295,8 @@ void AliAnaPartCorrMaker::ProcessEvent(const Int_t iEntry, const char * currentF
   TList * aodList = fReader->GetAODBranchList();
   Int_t nAODBranches = aodList->GetEntries();
   for(Int_t iaod = 0; iaod < nAODBranches; iaod++){
-         //aodList->At(iaod)->Clear();
          TClonesArray *tca = dynamic_cast<TClonesArray*> (aodList->At(iaod));
-         if(tca) tca->Delete();
+         if(tca) tca->Clear("C");
   }
   
   //Tell the reader to fill the data in the 3 detector lists
index 1c3b1be..59f4cef 100755 (executable)
@@ -330,11 +330,10 @@ public:
   Float_t          fEMCALPtMin;     // pT Threshold on emcal clusters
   Float_t          fPHOSPtMin;      // pT Threshold on phos clusters
 
-  TList          * fAODBranchList ; //! List with AOD branches created and needed in analysis  
-  //FIXME CHANGE NAMES, remove AOD, now they are VClusters, VTracks ...
-  TObjArray      * fCTSTracks ;     //! temporal array with tracks
-  TObjArray      * fEMCALClusters ; //! temporal array with EMCAL CaloClusters
-  TObjArray      * fPHOSClusters ;  //! temporal array with PHOS  CaloClusters
+  TList          * fAODBranchList ; //-> List with AOD branches created and needed in analysis  
+  TObjArray      * fCTSTracks ;     //-> temporal array with tracks
+  TObjArray      * fEMCALClusters ; //-> temporal array with EMCAL CaloClusters
+  TObjArray      * fPHOSClusters ;  //-> temporal array with PHOS  CaloClusters
   AliVCaloCells  * fEMCALCells ;    //! temporal array with EMCAL CaloCells
   AliVCaloCells  * fPHOSCells ;     //! temporal array with PHOS  CaloCells
 
@@ -371,23 +370,23 @@ public:
   TString          fDeltaAODFileName   ; // Delta AOD file name
   TString          fFiredTriggerClassName; // Name of trigger event type used to do the analysis
 
-  Bool_t           fAnaLED;             // Analyze LED data only.
+  Bool_t           fAnaLED;              // Analyze LED data only.
 
-  TString          fTaskName;           // Name of task that executes the analysis
+  TString          fTaskName;            // Name of task that executes the analysis
        
-  AliCalorimeterUtils * fCaloUtils ;    //  Pointer to CalorimeterUtils
+  AliCalorimeterUtils * fCaloUtils ;     //  Pointer to CalorimeterUtils
 
-  AliMixedEvent  * fMixedEvent  ;       //! mixed event object. This class is not the owner
-  Int_t            fNMixedEvent ;       // number of events in mixed event buffer
-  Double_t      ** fVertex      ;       //! vertex array 3 dim for each mixed event buffer
+  AliMixedEvent  * fMixedEvent  ;        //! mixed event object. This class is not the owner
+  Int_t            fNMixedEvent ;        // number of events in mixed event buffer
+  Double_t      ** fVertex      ;        //! vertex array 3 dim for each mixed event buffer
   
-  Bool_t           fWriteOutputDeltaAOD;// Write the created delta AOD objects into file  
-       Bool_t           fOldAOD;             // Old AODs, before revision 4.20
+  Bool_t           fWriteOutputDeltaAOD; // Write the created delta AOD objects into file  
+       Bool_t           fOldAOD;              // Old AODs, before revision 4.20
   
-  Int_t            fV0ADC[2]    ;       // Integrated V0 signal
-  Int_t            fV0Mul[2]    ;       // Integrated V0 Multiplicity
+  Int_t            fV0ADC[2]    ;        // Integrated V0 signal
+  Int_t            fV0Mul[2]    ;        // Integrated V0 Multiplicity
 
-  Bool_t           fCaloFilterPatch;    // CaloFilter patch
+  Bool_t           fCaloFilterPatch;     // CaloFilter patch
   TString          fEMCALClustersListName; //Alternative list of clusters produced elsewhere and not from InputEvent
   Float_t          fZvtxCut ;             // Cut on vertex position  
   Bool_t           fDoEventSelection;    // Select events depending on V0, pileup, vertex well reconstructed, at least 1 track ...
@@ -395,9 +394,9 @@ public:
   AliTriggerAnalysis* fTriggerAnalysis;  // Access to trigger selection algorithm for V0AND calculation
   
   //Centrality
-  TString          fCentralityClass;    // Name of selected centrality class     
-  Int_t            fCentralityOpt;      // Option for the returned value of the centrality, possible options 5, 10, 100
-  Int_t            fCentralityBin[2];   // Minimum and maximum value of the centrality for the analysis
+  TString          fCentralityClass;     // Name of selected centrality class     
+  Int_t            fCentralityOpt;       // Option for the returned value of the centrality, possible options 5, 10, 100
+  Int_t            fCentralityBin[2];    // Minimum and maximum value of the centrality for the analysis
   
   ClassDef(AliCaloTrackReader,27)
 } ;
index 75e225c..cb470a4 100755 (executable)
@@ -56,35 +56,7 @@ ClassImp(AliIsolationCut)
   InitParameters();
 
 }
-/*
-//____________________________________________________________________________
-AliIsolationCut::AliIsolationCut(const AliIsolationCut & g) : 
-  TObject(g),
-  fConeSize(g.fConeSize),
-  fPtThreshold(g.fPtThreshold),
-  fPtFraction(g.fPtFraction), 
-  fICMethod(g.fICMethod)
-{
-  // cpy ctor
-  
-}
-
-//_________________________________________________________________________
-AliIsolationCut & AliIsolationCut::operator = (const AliIsolationCut & source)
-{
-  // assignment operator
-  
-  if(&source == this) return *this;
-  
-  fConeSize = source.fConeSize ;
-  fPtThreshold = source.fPtThreshold ; 
-  fICMethod = source.fICMethod ;
-  fPtFraction = source.fPtFraction ;
 
-  return *this;
-  
-}
-*/
 //____________________________________________________________________________
 TString AliIsolationCut::GetICParametersList()
 {
@@ -115,12 +87,12 @@ void AliIsolationCut::InitParameters()
 {
   //Initialize the parameters of the analysis.
   
-  fConeSize    = 0.4 ; 
-  fPtThreshold = 1. ; 
+  fConeSize       = 0.4 ; 
+  fPtThreshold    = 1.  ; 
   fSumPtThreshold = 0.5 ; 
-  fPtFraction  = 0.1 ; 
-  fPartInCone  = kNeutralAndCharged;
-  fICMethod    = kPtThresIC; // 0 pt threshol method, 1 cone pt sum method
+  fPtFraction     = 0.1 ; 
+  fPartInCone     = kNeutralAndCharged;
+  fICMethod       = kPtThresIC; // 0 pt threshol method, 1 cone pt sum method
   
 }
 
@@ -170,7 +142,10 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * const plCTS,  TObjArray * co
         nfrac     = -1;
         coneptsum = -1;
         isolated  = kFALSE;
-        if(bFillAOD && reftracks) reftracks->Clear(); 
+        if(bFillAOD && reftracks) {
+          reftracks->Clear(); 
+          delete reftracks;
+        }
         return ;
       }
       //Check if there is any particle inside cone with pt larger than  fPtThreshold
@@ -245,8 +220,14 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * const plCTS,  TObjArray * co
         coneptsum = -1;
         isolated  = kFALSE;
         if(bFillAOD){
-          if(reftracks)  reftracks  ->Clear(); 
-          if(refclusters)refclusters->Clear(); 
+          if(reftracks){  
+            reftracks  ->Clear();
+            delete reftracks;
+          }
+          if(refclusters){
+            refclusters->Clear(); 
+            delete refclusters;
+          }
         }
         return ;
       }
index 5bcfd1f..e8b6ff4 100644 (file)
@@ -197,7 +197,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
   //\r
   Int_t nptbins   = GetHistoPtBins();\r
   Float_t ptmax   = GetHistoPtMax();\r
-  Float_t ptmin  = GetHistoPtMin();\r
+  Float_t ptmin   = GetHistoPtMin();\r
   \r
   Int_t nmassbins = GetHistoMassBins();\r
   Float_t massmin = GetHistoMassMin();\r
@@ -252,7 +252,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"RealToPi0Gamma_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s Real Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fRealOmega0[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fRealOmega0[index]->SetName(key) ;\r
             fRealOmega0[index]->SetTitle(title);\r
@@ -260,7 +259,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"MixAToPi0Gamma_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s MixA Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fMixAOmega0[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fMixAOmega0[index]->SetName(key) ;\r
             fMixAOmega0[index]->SetTitle(title);\r
@@ -268,7 +266,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"MixBToPi0Gamma_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s MixB Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fMixBOmega0[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fMixBOmega0[index]->SetName(key) ;\r
             fMixBOmega0[index]->SetTitle(title);\r
@@ -276,7 +273,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"MixCToPi0Gamma_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s MixC Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fMixCOmega0[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fMixCOmega0[index]->SetName(key) ;\r
             fMixCOmega0[index]->SetTitle(title);\r
@@ -284,7 +280,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"RealToPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s Real Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fRealOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fRealOmega1[index]->SetName(key) ;\r
             fRealOmega1[index]->SetTitle(title);\r
@@ -292,7 +287,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"MixAToPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s MixA Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fMixAOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fMixAOmega1[index]->SetName(key) ;\r
             fMixAOmega1[index]->SetTitle(title);\r
@@ -300,7 +294,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"MixBToPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s MixB Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fMixBOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fMixBOmega1[index]->SetName(key) ;\r
             fMixBOmega1[index]->SetTitle(title);\r
@@ -308,7 +301,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"MixCToPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s MixC Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fMixCOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fMixCOmega1[index]->SetName(key) ;\r
             fMixCOmega1[index]->SetTitle(title);\r
@@ -316,7 +308,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"RealToPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s Real Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fRealOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fRealOmega2[index]->SetName(key) ;\r
             fRealOmega2[index]->SetTitle(title);\r
@@ -324,7 +315,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"MixAToPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s MixA Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fMixAOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fMixAOmega2[index]->SetName(key) ;\r
             fMixAOmega2[index]->SetTitle(title);\r
@@ -332,7 +322,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"MixBToPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s MixB Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fMixBOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fMixBOmega2[index]->SetName(key) ;\r
             fMixBOmega2[index]->SetTitle(title);\r
@@ -340,7 +329,6 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
             \r
             snprintf(key,buffersize,"MixCToPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);\r
             snprintf(title,buffersize, "%s MixC Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,idist);\r
-            fhEtalon->Clone(key);\r
             fMixCOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;\r
             fMixCOmega2[index]->SetName(key) ;\r
             fMixCOmega2[index]->SetTitle(title);\r