coverity fixes
authorslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 11 May 2011 10:05:59 +0000 (10:05 +0000)
committerslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 11 May 2011 10:05:59 +0000 (10:05 +0000)
PWG4/GammaConv/AliAnalysisTaskGCPartToPWG4Part.cxx
PWG4/GammaConv/AliAnalysisTaskGammaConvDalitz.cxx
PWG4/GammaConv/ConvCorrelations/AliAnalysisTaskGammaJet.cxx

index 02c536b..9f3c6a8 100644 (file)
@@ -309,9 +309,11 @@ Bool_t AliAnalysisTaskGCPartToPWG4Part::BothTracksPresent(const AliAODConversion
   AliAODTrack * track2 = NULL;
   for(Int_t i = 0; i < tracks->GetEntriesFast(); i++) {
     AliAODTrack * track = dynamic_cast<AliAODTrack*>(tracks->At(i));
-    if(track->GetID() == photon->GetLabel1()) track1 = track;
-    else if (track->GetID() == photon->GetLabel2()) track2 = track;
-    if(track1 && track2) break;
+    if(track) {
+      if(track->GetID() == photon->GetLabel1()) track1 = track;
+      else if (track->GetID() == photon->GetLabel2()) track2 = track;
+      if(track1 && track2) break;
+    }
   }
   
   if(track1 && track2) {
index b8964b1..69651a3 100644 (file)
@@ -257,7 +257,7 @@ void AliAnalysisTaskGammaConvDalitz::UserExec(Option_t */*option*/)
     // yes: MC parameters
     // no:  data parameters
         if (!AliV0Reader::GetESDpid()){
-            if (fMCEvent ) {
+         if (MCEvent() ) {
                 AliV0Reader::InitESDpid();
             } else {
                 AliV0Reader::InitESDpid(1);
index 00becc0..50bc28d 100644 (file)
@@ -331,9 +331,11 @@ Bool_t AliAnalysisTaskGammaJet::EventIsSynced(const TClonesArray * const tracks,
       AliAODTrack * track2 = NULL;
       for(Int_t i = 0; i < tracks->GetEntriesFast(); i++) {
        AliAODTrack * track = dynamic_cast<AliAODTrack*>(tracks->At(i));
-       if(track->GetID() == photon->GetLabel1()) track1 = track;
-       else if (track->GetID() == photon->GetLabel2()) track2 = track;
-       if(track1 && track2) break;
+       if(track) {
+         if(track->GetID() == photon->GetLabel1()) track1 = track;
+         else if (track->GetID() == photon->GetLabel2()) track2 = track;
+         if(track1 && track2) break;
+       }
       }
       
       if(track1 && track2) {
@@ -387,9 +389,11 @@ Bool_t AliAnalysisTaskGammaJet::BothTracksPresent(const AliAODConversionParticle
   AliAODTrack * track2 = NULL;
   for(Int_t i = 0; i < tracks->GetEntriesFast(); i++) {
     AliAODTrack * track = dynamic_cast<AliAODTrack*>(tracks->At(i));
-    if(track->GetID() == photon->GetLabel1()) track1 = track;
-    else if (track->GetID() == photon->GetLabel2()) track2 = track;
-    if(track1 && track2) break;
+    if(track) {
+      if(track->GetID() == photon->GetLabel1()) track1 = track;
+      else if (track->GetID() == photon->GetLabel2()) track2 = track;
+      if(track1 && track2) break;
+    }
   }
   
   if(track1 && track2) {