]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fix for memory leak after using selections
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 27 Nov 2008 13:47:08 +0000 (13:47 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 27 Nov 2008 13:47:08 +0000 (13:47 +0000)
PWG2/FLOW/AliFlowCommonHist.cxx
PWG2/FLOW/AliFlowEventSimpleMaker.cxx

index 6937258111f17c134a927d7345898adad1560a01..4cffc5b4183e4a9a97a6f39e47e88abb9117a688 100644 (file)
@@ -287,7 +287,7 @@ Bool_t AliFlowCommonHist::FillControlHistograms(AliFlowEventSimple* anEvent)
   //weight by the Multiplicity
   Double_t dQX = 0.;
   Double_t dQY = 0.;
-  if (iNumberOfTracks!=0) {
+  if (vQ.GetMult()!=0) {
     dQX = vQ.X()/vQ.GetMult();
     dQY = vQ.Y()/vQ.GetMult();
   }
index c75b268a4129c2815b58ce2f1a63e7ef2439fc21..984102ebdfa464ab84f9fa73d7f738ff2f6b0929 100644 (file)
@@ -184,7 +184,7 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* anInput)
   pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
   pEvent->SetNumberOfTracks(iGoodTracks);
   cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  //cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
   return pEvent;
   
 }
@@ -260,7 +260,7 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput)
   pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
   pEvent->SetNumberOfTracks(iGoodTracks);
   cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  //cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
   return pEvent;
 
 }
@@ -309,8 +309,9 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput, Ali
 
     //check if any bits are set
     TBits bFlowBits = pTrack->GetFlowBits();
-    if (bFlowBits.CountBits() != 0) {
-      //cout<<"The number of bits set = "<<bFlowBits.CountBits()<<endl;
+    if (bFlowBits.CountBits() ==0) {
+      delete pTrack; } //track will not be used anymore
+    else {
       pEvent->TrackCollection()->Add(pTrack) ; 
       iGoodTracks++;
 
@@ -326,7 +327,7 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput, Ali
   pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
   pEvent-> SetNumberOfTracks(iGoodTracks);
   cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  //cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
   return pEvent;
 
 }
@@ -377,7 +378,7 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
   pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
   pEvent->SetNumberOfTracks(iGoodTracks);
   cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  //cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
   return pEvent;
 
 
@@ -420,7 +421,9 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, Al
 
     //check if any bits are set
     TBits bFlowBits = pTrack->GetFlowBits();
-    if (bFlowBits.CountBits() !=0) {
+    if (bFlowBits.CountBits() ==0) {
+      delete pTrack; } //track will not be used anymore
+    else {
       pEvent->TrackCollection()->Add(pTrack) ;  
       iGoodTracks++;
 
@@ -430,13 +433,14 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, Al
        { iSelParticlesDiff++; }
       
     }
+    
     itrkN++; 
   }
   
   pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
   pEvent->SetNumberOfTracks(iGoodTracks);
   cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  //cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
   return pEvent;
 
 
@@ -486,7 +490,7 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
   pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
   pEvent->SetNumberOfTracks(iGoodTracks);
   cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  //cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
   return pEvent;
   
 }
@@ -527,7 +531,9 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput,  A
 
     //check if any bits are set
     TBits bFlowBits = pTrack->GetFlowBits();
-    if (bFlowBits.CountBits() !=0) {
+    if (bFlowBits.CountBits() ==0) {
+      delete pTrack; } //track will not be used anymore
+    else {
       pEvent->TrackCollection()->Add(pTrack) ; 
       iGoodTracks++;
 
@@ -537,14 +543,14 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput,  A
        { iSelParticlesDiff++; }
             
     }
-      
+       
     itrkN++; 
   }
   
   pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
   pEvent->SetNumberOfTracks(iGoodTracks);
   cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  //cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
   return pEvent;
   
 }
@@ -622,7 +628,7 @@ AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, A
   pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
   pEvent->SetNumberOfTracks(iGoodTracks);
   cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  //cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
   return pEvent;
 
 
@@ -703,7 +709,9 @@ AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, A
       
     //check if any bits are set
     TBits bFlowBits = pTrack->GetFlowBits();
-    if (bFlowBits.CountBits() !=0) {
+    if (bFlowBits.CountBits() ==0) {
+      delete pTrack; } //track will not be used anymore
+    else {
       pEvent->TrackCollection()->Add(pTrack) ; 
       iGoodTracks++;  
     
@@ -713,13 +721,14 @@ AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, A
        { iSelParticlesDiff++; }
             
     }
+    
     itrkN++; 
   }
   
   pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
   pEvent->SetNumberOfTracks(iGoodTracks);
   cout<<" iGoodTracks = "<<iGoodTracks<<endl;
-  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  //cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
   return pEvent;
 
 }