]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fix mem leak - Marcel
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Feb 2013 19:50:11 +0000 (19:50 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Feb 2013 19:50:11 +0000 (19:50 +0000)
EMCAL/AliEMCALRecoUtils.cxx
EMCAL/AliEMCALReconstructor.cxx
EMCAL/AliEMCALTracker.cxx

index 0df249a3c35846693ee2f4c0d32c4275d6af24db..c82d08a3f78c376628c6cf2ca8919c7fd87d0dcc 100644 (file)
@@ -1786,9 +1786,9 @@ void AliEMCALRecoUtils::FindMatches(AliVEvent *event,
     Bool_t desc1 = (mask1 >> 3) & 0x1;
     Bool_t desc2 = (mask2 >> 3) & 0x1;
     if (desc1==0 || desc2==0) { 
-      AliError(Form("TPC not in DAQ/RECO: %u (%u)/%u (%u)", 
-      mask1, esdevent->GetESDRun()->GetDetectorsInReco(),
-      mask2, esdevent->GetESDRun()->GetDetectorsInDAQ()));
+//       AliError(Form("TPC not in DAQ/RECO: %u (%u)/%u (%u)", 
+//       mask1, esdevent->GetESDRun()->GetDetectorsInReco(),
+//       mask2, esdevent->GetESDRun()->GetDetectorsInDAQ()));
       fITSTrackSA=kTRUE;
     }
   }
@@ -1866,6 +1866,7 @@ void AliEMCALRecoUtils::FindMatches(AliVEvent *event,
     if(!ExtrapolateTrackToEMCalSurface(&emcalParam, 430., fMass, fStepSurface, eta, phi)) 
       {
   if(aodevent && trackParam) delete trackParam;
+  if(fITSTrackSA && trackParam) delete trackParam;
   continue;
       }
 
@@ -1877,6 +1878,7 @@ void AliEMCALRecoUtils::FindMatches(AliVEvent *event,
     if(TMath::Abs(eta)>0.75 || (phi) < 70*TMath::DegToRad() || (phi) > 190*TMath::DegToRad())
       {
   if(aodevent && trackParam) delete trackParam;
+  if(fITSTrackSA && trackParam) delete trackParam;
   continue;
       }
 
@@ -1902,6 +1904,7 @@ void AliEMCALRecoUtils::FindMatches(AliVEvent *event,
       matched++;
     }
     if(aodevent && trackParam) delete trackParam;
+    if(fITSTrackSA && trackParam) delete trackParam;
   }//track loop
 
   if(clusterArray)
@@ -1939,9 +1942,16 @@ Int_t AliEMCALRecoUtils::FindMatchedClusterInEvent(const AliESDtrack *track,
   if(!trackParam) return index;
   AliExternalTrackParam emcalParam(*trackParam);
   Float_t eta, phi;
-  if(!ExtrapolateTrackToEMCalSurface(&emcalParam, 430., fMass, fStepSurface, eta, phi)) return index;
-  if(TMath::Abs(eta)>0.75 || (phi) < 70*TMath::DegToRad() || (phi) > 190*TMath::DegToRad()) return index;
 
+  if(!ExtrapolateTrackToEMCalSurface(&emcalParam, 430., fMass, fStepSurface, eta, phi))        {
+       if(fITSTrackSA) delete trackParam;
+       return index;
+  }
+  if(TMath::Abs(eta)>0.75 || (phi) < 70*TMath::DegToRad() || (phi) > 190*TMath::DegToRad()){
+       if(fITSTrackSA) delete trackParam;
+       return index;
+  }
+  
   TObjArray *clusterArr = new TObjArray(event->GetNumberOfCaloClusters());
 
   for(Int_t icl=0; icl<event->GetNumberOfCaloClusters(); icl++)
@@ -1954,7 +1964,8 @@ Int_t AliEMCALRecoUtils::FindMatchedClusterInEvent(const AliESDtrack *track,
   index = FindMatchedClusterInClusterArr(&emcalParam, &emcalParam, clusterArr, dEta, dPhi);  
   clusterArr->Clear();
   delete clusterArr;
-  
+  if(fITSTrackSA) delete trackParam;
+
   return index;
 }
 
index 5a50202295933c40080e69602839b95ed9e7a1c9..55eb4a40a211157f4bdb79fb6fa5b0ac42f9274a 100644 (file)
@@ -729,6 +729,7 @@ Bool_t AliEMCALReconstructor::CalculateResidual(AliESDtrack *track, AliESDCaloCl
   // Otherwise use the TPCInner point
 
   dEta = -999, dPhi = -999;
+  Bool_t ITSTrackSA = 0;
 
   AliExternalTrackParam *trkParam = 0;
   
@@ -737,13 +738,19 @@ Bool_t AliEMCALReconstructor::CalculateResidual(AliESDtrack *track, AliESDCaloCl
     trkParam = const_cast<AliExternalTrackParam*>(friendTrack->GetTPCOut());
   else if(track->GetInnerParam())
     trkParam = const_cast<AliExternalTrackParam*>(track->GetInnerParam());
-  else
+  else{
     trkParam = new AliExternalTrackParam(*track); //If there is ITSSa track 
+    ITSTrackSA = 1;    
+  }
   if(!trkParam) return kFALSE;
   
   AliExternalTrackParam trkParamTmp (*trkParam);
-  if(!AliEMCALRecoUtils::ExtrapolateTrackToCluster(&trkParamTmp, cluster, track->GetMass(kTRUE), GetRecParam()->GetExtrapolateStep(), dEta, dPhi)) return kFALSE;
+  if(!AliEMCALRecoUtils::ExtrapolateTrackToCluster(&trkParamTmp, cluster, track->GetMass(kTRUE), GetRecParam()->GetExtrapolateStep(), dEta, dPhi)){
+       if(ITSTrackSA) delete trkParam;
+       return kFALSE;
+  }
 
+  if(ITSTrackSA) delete trkParam;
   return kTRUE;
 }
 
index 015ce473332d5940b91bb0a2cf3d4028b67839d0..6229a45d15cbdbb1b9d93d52a670469eece98b41 100644 (file)
@@ -265,9 +265,9 @@ Int_t AliEMCALTracker::LoadTracks(AliESDEvent *esd)
   Bool_t desc1 = (mask1 >> 3) & 0x1;
   Bool_t desc2 = (mask2 >> 3) & 0x1;
   if (desc1==0 || desc2==0) {
-    AliError(Form("TPC not in DAQ/RECO: %u (%u)/%u (%u)",
-                  mask1, esd->GetESDRun()->GetDetectorsInReco(),
-                  mask2, esd->GetESDRun()->GetDetectorsInDAQ()));
+//     AliError(Form("TPC not in DAQ/RECO: %u (%u)/%u (%u)",
+//                   mask1, esd->GetESDRun()->GetDetectorsInReco(),
+//                   mask2, esd->GetESDRun()->GetDetectorsInDAQ()));
     fITSTrackSA = kTRUE;
   }
   
@@ -406,9 +406,15 @@ Int_t AliEMCALTracker::FindMatchedCluster(AliESDtrack *track)
   
   AliExternalTrackParam trkParamTmp(*trkParam);
   Float_t eta, phi;
-  if(!AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&trkParamTmp, 430., track->GetMass(kTRUE), fStep, eta, phi))  return index;
+  if(!AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&trkParamTmp, 430., track->GetMass(kTRUE), fStep, eta, phi))  {
+       if(fITSTrackSA) delete trkParam;
+       return index;
+  }
   track->SetTrackPhiEtaOnEMCal(phi,eta);
-  if(TMath::Abs(eta)>0.75 || (phi) < 70*TMath::DegToRad() || (phi) > 190*TMath::DegToRad()) return index;
+  if(TMath::Abs(eta)>0.75 || (phi) < 70*TMath::DegToRad() || (phi) > 190*TMath::DegToRad()){
+        if(fITSTrackSA) delete trkParam;
+       return index;
+  }
 
   //Perform extrapolation
   Double_t trkPos[3];
@@ -433,6 +439,8 @@ Int_t AliEMCALTracker::FindMatchedCluster(AliESDtrack *track)
           index=ic;
         }
       }
+
+  if(fITSTrackSA) delete trkParam;
   return index;
 }