]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Coverity fix, 8443
authorarossi <arossi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Sep 2013 09:21:23 +0000 (09:21 +0000)
committerarossi <arossi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Sep 2013 09:21:23 +0000 (09:21 +0000)
PWGHF/correlationHF/AliAnalysisTaskDStarCorrelations.cxx
PWGHF/correlationHF/AliAnalysisTaskSED0Correlations.cxx

index 075fbe11eade74db4b48e52d7298c2335c1693e7..37a755b51b81e7847e312dc9844ab39d8f8ae856 100644 (file)
@@ -482,7 +482,7 @@ void AliAnalysisTaskDStarCorrelations::UserExec(Option_t *){
          deltainvMDStar = -998;\r
          AliAODRecoCascadeHF* dstarD0pi;\r
          AliAODRecoDecayHF2Prong* theD0particle;\r
-         AliAODMCParticle* DStarMC;\r
+         AliAODMCParticle* DStarMC=0x0;\r
       Short_t daughtercharge = -2;\r
          Int_t trackiddaugh0 = -1; // track id if it is reconstruction - label if it is montecarlo info\r
          Int_t trackiddaugh1 = -1;\r
@@ -868,19 +868,22 @@ void AliAnalysisTaskDStarCorrelations::UserExec(Option_t *){
                                // ================ FILL CORRELATION HISTOGRAMS ===============================\r
                                \r
                 // monte carlo case (mc tagged D*)\r
-                               if((fmontecarlo && isDStarMCtag) || (fmontecarlo && !fReco)){ // check correlations of MC tagged DStars in MonteCarlo\r
-                    \r
-                                       Bool_t* PartSource = fCuts2->IsMCpartFromHF(label,fmcArray); // check source of associated particle (hadron/kaon/K0)\r
-                    \r
-                    MCarraytofill[5] = 0;\r
-                                       if(PartSource[0]) MCarraytofill[5] = 1;\r
-                    if(PartSource[1]) MCarraytofill[5] = 2;\r
-                    if(PartSource[2]&&PartSource[0]) MCarraytofill[5] = 3;\r
+             if((fmontecarlo && isDStarMCtag) || (fmontecarlo && !fReco)){ // check correlations of MC tagged DStars in MonteCarlo\r
+                \r
+               Bool_t* PartSource = fCuts2->IsMCpartFromHF(label,fmcArray); // check source of associated particle (hadron/kaon/K0)\r
+                             \r
+               MCarraytofill[5] = 0;\r
+               if(PartSource[0]) MCarraytofill[5] = 1;\r
+               if(PartSource[1]) MCarraytofill[5] = 2;\r
+               if(PartSource[2]&&PartSource[0]) MCarraytofill[5] = 3;\r
                     if(PartSource[2]&&PartSource[1]) MCarraytofill[5] = 4;\r
                     if(PartSource[3]) MCarraytofill[5] = 5;\r
                     if(!isDfromB) MCarraytofill[6] = 0;\r
                     if(isDfromB) MCarraytofill[6] = 1;\r
-                                       if(!fReco && TMath::Abs(etaHad)>0.8) continue; // makes sure you study the correlation on MC  truth only if particles are in acceptance\r
+                   if(!fReco && TMath::Abs(etaHad)>0.8) {\r
+                     delete [] PartSource;\r
+                     continue; // makes sure you study the correlation on MC  truth only if particles are in acceptance\r
+                   }\r
                     ((THnSparseF*)fOutputMC->FindObject("MCDStarCorrelationsDStarHadron"))->Fill(MCarraytofill);\r
                     \r
                     delete[] PartSource;\r
@@ -1459,7 +1462,11 @@ void AliAnalysisTaskDStarCorrelations::EnlargeDZeroMassWindow(){
     \r
   AliInfo("Enlarging the D0 mass windows from cut object\n"); \r
   Int_t nvars = fCuts->GetNVars();\r
-    \r
+\r
+  if(nvars<1){\r
+    AliWarning("EnlargeDZeroMassWindow: 0 variables in cut object... check!");\r
+    return;\r
+  }\r
   Float_t** rdcutsvalmine=new Float_t*[nvars];\r
   for(Int_t iv=0;iv<nvars;iv++){\r
     rdcutsvalmine[iv]=new Float_t[fNofPtBins];\r
index dfacaabeb1aba96f747cb875a7a91ba3dd01186c..21bf0989994be08b96c96f134b101e35522d886a 100644 (file)
@@ -2305,9 +2305,12 @@ Bool_t AliAnalysisTaskSED0Correlations::IsSoftPion_MCKine(AliAODMCParticle* d, A
   Int_t labelD0 = d->GetLabel();
 
   Int_t mother = track->GetMother();
-  if(!mother) return isSoftPi; //safety check
+  if(mother<0) return isSoftPi; //safety check
 
   AliAODMCParticle* mcMoth = dynamic_cast<AliAODMCParticle*>(arrayMC->At(mother)); //it's the mother of the track!
+  if(!mcMoth){
+    return isSoftPi;
+  }
   if(TMath::Abs(mcMoth->GetPdgCode())==413 && mcMoth->GetNDaughters()==2) { //mother is D* with 2 daughs
     Int_t labdau1 = mcMoth->GetDaughter(0);
     Int_t labdau2 = mcMoth->GetDaughter(1);