]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fix memory leak and funny multiplicity
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Apr 2009 18:40:20 +0000 (18:40 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Apr 2009 18:40:20 +0000 (18:40 +0000)
PWG2/FLOW/AliFlowCommon/AliFlowEventSimpleMakerOnTheFly.cxx

index 876eb163d826b0c553760436c7522263afc4dbb2..61dba5c517447018babc22fa83e886512f8c2cb3 100644 (file)
@@ -86,9 +86,8 @@ AliFlowEventSimple* AliFlowEventSimpleMakerOnTheFly::CreateEventOnTheFly()
   fPtSpectra = new TF1("fPtSpectra","[0]*x*TMath::Exp(-x*x)",dPtMin,dPtMax);  
   fPtSpectra->SetParName(0,"Multiplicity of RPs");  
   // sampling the multiplicity:
-  fMultiplicityOfRP = fMyTRandom3->Gaus(fMultiplicityOfRP,fMultiplicitySpreadOfRP);
-  fPtSpectra->SetParameter(0,fMultiplicityOfRP);
-  
+  Int_t fNewMultiplicityOfRP = fMyTRandom3->Gaus(fMultiplicityOfRP,fMultiplicitySpreadOfRP);
+  fPtSpectra->SetParameter(0,fNewMultiplicityOfRP);
   
   
   // phi:
@@ -114,7 +113,7 @@ AliFlowEventSimple* AliFlowEventSimpleMakerOnTheFly::CreateEventOnTheFly()
   Int_t iGoodTracks = 0;
   Int_t iSelParticlesRP = 0;
   Int_t iSelParticlesPOI = 0;
-  for(Int_t i=0;i<fMultiplicityOfRP;i++) {
+  for(Int_t i=0;i<fNewMultiplicityOfRP;i++) {
     AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
     pTrack->SetPt(fPtSpectra->GetRandom());
     pTrack->SetEta(fMyTRandom3->Uniform(dEtaMin,dEtaMax));
@@ -140,7 +139,9 @@ AliFlowEventSimple* AliFlowEventSimpleMakerOnTheFly::CreateEventOnTheFly()
   cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;  
   cout << "# " << ++fCount << " events processed" << endl;
 
- return pEvent;  
+  delete fPhiDistribution;
+  delete fPtSpectra;
+  return pEvent;  
  
 } // end of CreateEventOnTheFly()