covertity fix 24465,..66
authorfbock <Friederike.Bock@cern.ch>
Mon, 12 Jan 2015 16:02:33 +0000 (17:02 +0100)
committerfbock <Friederike.Bock@cern.ch>
Mon, 12 Jan 2015 16:02:33 +0000 (17:02 +0100)
PWGGA/GammaConv/AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero.cxx

index 83a5ed3..9db8ecd 100644 (file)
@@ -1694,12 +1694,14 @@ void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessPionCandidates(){
                                labelp=TMath::Abs(posPionCandidate->GetLabel());
                                fNegativeMCParticle = fMCStack->Particle(labeln);
                                fPositiveMCParticle = fMCStack->Particle(labelp);
+                               // check whether MC particles exist, else abort
+                               if (fNegativeMCParticle == NULL || fPositiveMCParticle == NULL) return;
+
                                motherlabeln = fNegativeMCParticle->GetMother(0);
                                motherlabelp = fPositiveMCParticle->GetMother(0);
-                               if( fPositiveMCParticle && fNegativeMCParticle) {
-                                       virtualPhoton->SetMCLabelPositive(labelp);
-                                       virtualPhoton->SetMCLabelNegative(labeln);
-                               }                               
+                               virtualPhoton->SetMCLabelPositive(labelp);
+                               virtualPhoton->SetMCLabelNegative(labeln);
+                       
                        }
                        
                        AliAODConversionPhoton *vParticle = new AliAODConversionPhoton(virtualPhoton); //To apply mass 2 pion mass cut