Fix for coverity defects
authorfprino <prino@to.infn.it>
Mon, 17 Feb 2014 13:08:08 +0000 (14:08 +0100)
committerfprino <prino@to.infn.it>
Mon, 17 Feb 2014 13:36:26 +0000 (14:36 +0100)
PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelor.cxx
PWGHF/vertexingHF/AliCFVertexingHFLctoV0bachelor.cxx

index 692881f..a7af9ad 100644 (file)
@@ -1822,11 +1822,10 @@ void AliAnalysisTaskSELc2V0bachelor::FillTheTree(AliAODRecoCascadeHF *part, AliR
   fCandidateVariables[80]=bachelor->Charge();
   fCandidateVariables[81]=isMCparticleInFiducialAcceptance;
   if (fUseMCInfo) {
+    fCandidateVariables[82]=0;
     if (bachelor->GetLabel()!=-1) {
       AliAODMCParticle *partBachelor = dynamic_cast<AliAODMCParticle*>(mcArray->At(TMath::Abs(bachelor->GetLabel())));
-      fCandidateVariables[82]=partBachelor->GetPdgCode();
-    } else {
-      fCandidateVariables[82]=0;
+      if(partBachelor) fCandidateVariables[82]=partBachelor->GetPdgCode();
     }
   } else {
     fCandidateVariables[82]=-1;
@@ -2431,13 +2430,12 @@ Int_t AliAnalysisTaskSELc2V0bachelor::MatchToMClabelC(AliAODRecoCascadeHF *candi
   Int_t ndg2 = partLc->GetDaughter(1)-partLc->GetDaughter(0)+1;
   if (ndg2==2) return -1;
 
-  Char_t stringaCheck[100];
-  sprintf(stringaCheck,">>>>>>>> %d -> ",partLc->GetPdgCode());
+  TString stringaCheck = Form(">>>>>>>> %d -> ",partLc->GetPdgCode());
   for(Int_t ii=0; ii<ndg2; ii++) {
     AliAODMCParticle* partDau=(AliAODMCParticle*)(mcArray->At(partLc->GetDaughter(0)+ii));
-    sprintf(stringaCheck," %s %d",stringaCheck,partDau->GetPdgCode());
+    stringaCheck.Append(Form("  %d",partDau->GetPdgCode()));
   }
-  printf("%s \n",stringaCheck);
+  printf("%s \n",stringaCheck.Data());
 
   return indexMotherBach;
 
index fc877cc..c7c63b0 100644 (file)
@@ -914,7 +914,7 @@ Bool_t AliCFVertexingHFLctoV0bachelor::FillVectorFromMCarray(AliAODMCParticle *m
   AliAODMCParticle *mcPartV0DaughterNeg = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[2]));
   AliAODMCParticle *mcPartDaughterV0 = 0x0;
 
-  if(!mcPartV0DaughterPos && !mcPartV0DaughterNeg) return bGenValues;
+  if(!mcPartV0DaughterPos || !mcPartV0DaughterNeg) return bGenValues;
 
   if (TMath::Abs(mcPartDaughterK0->GetPdgCode())==311) {
     Int_t daughterK0 = mcPartDaughterK0->GetDaughter(0);