]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG4/PartCorrBase/AliAnaPartCorrMaker.cxx
Correct memory leaks.
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliAnaPartCorrMaker.cxx
index b073ce5a15023454c787f2824a9a3392f1ae0f2a..57913712b2e53e51f871b6754004e9edf368378d 100755 (executable)
@@ -30,6 +30,7 @@
 #include "TList.h"
 #include "TH1.h"
 //#include "Riostream.h"
+//#include <TObjectTable.h>
 
 //---- AliRoot system ---- 
 #include "AliAnaPartCorrBaseClass.h" 
@@ -227,30 +228,39 @@ void AliAnaPartCorrMaker::ProcessEvent(const Int_t iEntry, const char * currentF
     abort();
   }
        
-       if(fAnaDebug >= 0 ){ 
+  if(fAnaDebug >= 0 ){ 
                printf("***  Event %d   ***  \n",iEntry);
-               if(fAnaDebug > 1 ) 
-                 printf("AliAnaPartCorrMaker::Current File Name : %s\n", currentFileName);
+         if(fAnaDebug > 1 ) {
+                 printf("AliAnaPartCorrMaker::ProcessEvent() - Current File Name : %s\n", currentFileName);
+                 //printf("fAODBranchList %p, entries %d\n",fAODBranchList,fAODBranchList->GetEntries());
+         }
   }
-  //Each event needs an empty branch   
-  for(Int_t iaod = 0; iaod < fAODBranchList->GetEntries(); iaod++)
-    fAODBranchList->At(iaod)->Clear();
-  
+  //Each event needs an empty branch
+  Int_t nAODBranches = fAODBranchList->GetEntries();
+  for(Int_t iaod = 0; iaod < nAODBranches; iaod++){
+         //fAODBranchList->At(iaod)->Clear();
+         TClonesArray *tca = dynamic_cast<TClonesArray*> (fAODBranchList->At(iaod));
+         if(tca) tca->Delete();
+  }
+
   //Tell the reader to fill the data in the 3 detector lists
   Bool_t ok = fReader->FillInputEvent(iEntry, currentFileName);
   if(!ok){
-         printf("*** Skip event *** %d \n",iEntry);
+         if(fAnaDebug >= 1 )printf("*** Skip event *** %d \n",iEntry);
          return ;
   }
-  
+       
+  //printf(">>>>>>>>>> BEFORE >>>>>>>>>>>\n");
+  //gObjectTable->Print();
   //Loop on analysis algorithms
   if(fAnaDebug > 0 ) printf("*** Begin analysis *** \n");
   Int_t nana = fAnalysisContainer->GetEntries() ;
   for(Int_t iana = 0; iana <  nana; iana++){
     AliAnaPartCorrBaseClass * ana =  ((AliAnaPartCorrBaseClass *) fAnalysisContainer->At(iana)) ; 
-    ana->ConnectInputOutputAODBranches(); //Sets branches for each analysis
+    
+       ana->ConnectInputOutputAODBranches(); //Sets branches for each analysis
     //Make analysis, create aods in aod branch or AODCaloClusters
-    if(fMakeAOD) ana->MakeAnalysisFillAOD()  ;
+    if(fMakeAOD)   ana->MakeAnalysisFillAOD()  ;
     //Make further analysis with aod branch and fill histograms
     if(fMakeHisto) ana->MakeAnalysisFillHistograms()  ;
     
@@ -258,6 +268,9 @@ void AliAnaPartCorrMaker::ProcessEvent(const Int_t iEntry, const char * currentF
   
   fReader->ResetLists();
   
+  //printf(">>>>>>>>>> AFTER >>>>>>>>>>>\n");
+  //gObjectTable->Print();
+       
   if(fAnaDebug > 0 ) printf("*** End analysis *** \n");
   
 }