Memory leak fixed
authorauras <antonio.uras@cern.ch>
Mon, 14 Apr 2014 16:24:11 +0000 (18:24 +0200)
committerauras <antonio.uras@cern.ch>
Mon, 14 Apr 2014 16:24:11 +0000 (18:24 +0200)
MFT/AliMFTAnalysisTools.cxx
MFT/AliMFTTrackerMU.cxx

index 66c0e9f..561e179 100644 (file)
@@ -225,8 +225,8 @@ Bool_t AliMFTAnalysisTools::CalculatePCA(TObjArray *muons, Double_t *pca, Double
   
   Double_t fXPointOfClosestApproach=0, fYPointOfClosestApproach=0, fZPointOfClosestApproach=0;
   
-  AliAODTrack *muon[nMuons];
-  AliMUONTrackParam *param[nMuons];
+  AliAODTrack *muon[AliMFTConstants::fNMaxMuonsForPCA]        = {0};
+  AliMUONTrackParam *param[AliMFTConstants::fNMaxMuonsForPCA] = {0};
 
   // Finding AliMUONTrackParam objects for each muon
   
@@ -249,7 +249,7 @@ Bool_t AliMFTAnalysisTools::CalculatePCA(TObjArray *muons, Double_t *pca, Double
 
   Double_t r[3]={0}, z[3]={startPoint, startPoint+step, startPoint+2*step};
   
-  TVector3 **points = new TVector3*[nMuons];
+  TVector3 **points = new TVector3*[AliMFTConstants::fNMaxMuonsForPCA];
   
   for (Int_t i=0; i<3; i++) {
     for (Int_t iMu=0; iMu<nMuons; iMu++) {
@@ -318,7 +318,8 @@ Bool_t AliMFTAnalysisTools::CalculatePCA(TObjArray *muons, Double_t *pca, Double
     else step *= 0.5;
   }
   
-  delete [] points;
+  for (Int_t iMuon=0; iMuon<AliMFTConstants::fNMaxMuonsForPCA; iMuon++) delete points[iMuon];
+  delete points;
 
   // Once z of minimum is found, we evaluate the x and y coordinates by averaging over the contributing tracks
   
index b1d2924..1c4c567 100644 (file)
@@ -336,7 +336,7 @@ Int_t AliMFTTrackerMU::Clusters2Tracks(AliESDEvent *event) {
       myESDTrack -> SetFirstTrackingPoint(newTrack->GetMFTCluster(0)->GetX(), newTrack->GetMFTCluster(0)->GetY(), newTrack->GetMFTCluster(0)->GetZ());
       myESDTrack -> SetXYAtVertex(newTrack->GetOffsetX(0., AliMFTConstants::fZEvalKinem), newTrack->GetOffsetY(0., AliMFTConstants::fZEvalKinem));
       myESDTrack -> SetRAtAbsorberEnd(newTrack->GetRAtAbsorberEnd());
-      myESDTrack -> SetCovariances(newTrack->GetTrackParamAtMFTCluster(0)->GetCovariances());    // waiting for commit from Peter...
+      myESDTrack -> SetCovariances(newTrack->GetTrackParamAtMFTCluster(0)->GetCovariances());
       myESDTrack -> SetChi2MatchTrigger(esdTrack->GetChi2MatchTrigger());
       myESDTrack -> SetMuonClusterMap(esdTrack->GetMuonClusterMap());
       myESDTrack -> SetHitsPatternInTrigCh(esdTrack->GetHitsPatternInTrigCh());