Coverity
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 3 Feb 2012 09:38:24 +0000 (09:38 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 3 Feb 2012 09:38:24 +0000 (09:38 +0000)
PWGLF/STRANGENESS/AliAnalysisTaskCheckCascadePbPb.cxx
PWGLF/STRANGENESS/LambdaK0PbPb/AliAnalysisTaskLukeAOD.cxx
PWGLF/STRANGENESS/LambdaK0PbPb/AliAnalysisTaskLukeV0.cxx
PWGLF/STRANGENESS/LambdaK0PbPb/AliAnalysisTaskPerformanceStrange.cxx
RAW/AliMDC.cxx

index 7826a70..de1d9c2 100644 (file)
@@ -158,6 +158,9 @@ AliAnalysisTaskCheckCascadePbPb::AliAnalysisTaskCheckCascadePbPb()
     fCFContCascadePIDOmegaMinus(0),
     fCFContCascadePIDOmegaPlus(0),
     fCFContCascadeCuts(0),
+  fAlephParameters(),
+  fV0Sels(),
+  fCascSels(),
     
 //    fHnSpAngularCorrXiMinus(0), fHnSpAngularCorrXiPlus(0), 
 //    fHnSpAngularCorrOmegaMinus(0), fHnSpAngularCorrOmegaPlus(0),
@@ -247,6 +250,9 @@ AliAnalysisTaskCheckCascadePbPb::AliAnalysisTaskCheckCascadePbPb(const char *nam
     fCFContCascadePIDOmegaMinus(0),
     fCFContCascadePIDOmegaPlus(0),
     fCFContCascadeCuts(0),
+  fAlephParameters(),
+  fV0Sels(),
+  fCascSels(),
     
 //    fHnSpAngularCorrXiMinus(0), fHnSpAngularCorrXiPlus(0), 
 //    fHnSpAngularCorrOmegaMinus(0), fHnSpAngularCorrOmegaPlus(0),
index fb88134..f78b718 100644 (file)
@@ -69,6 +69,7 @@ AliAnalysisTaskLukeAOD::AliAnalysisTaskLukeAOD() // All data members should be i
 :AliAnalysisTaskSE(),
 fOutput(0),
 fPIDResponse(0),
+maskIsSelected(0),
 
 fHistPt(0), 
 fHistEta(0),
@@ -228,6 +229,7 @@ AliAnalysisTaskLukeAOD::AliAnalysisTaskLukeAOD(const char *name) // All data mem
 :AliAnalysisTaskSE(name),
 fOutput(0),
 fPIDResponse(0),
+maskIsSelected(0),
 
 fHistPt(0), 
 fHistEta(0),
index c44ed44..e1a385c 100644 (file)
@@ -96,6 +96,7 @@ AliAnalysisTaskLukeV0::AliAnalysisTaskLukeV0() // All data members should be ini
        fHistMLaPt(0), 
        fHistMLbPt(0), 
        fHistPtArm(0), 
+        fHistPtV0Z(0),
        fHistRZ(0), 
        fHistXZ(0), 
        fHistYZ(0) // The last in the above list should not have a comma after it
@@ -146,7 +147,8 @@ AliAnalysisTaskLukeV0::AliAnalysisTaskLukeV0(const char *name) // All data membe
        fHistMK0Pt(0), 
        fHistMLaPt(0), 
        fHistMLbPt(0), 
-       fHistPtArm(0), 
+       fHistPtArm(0),
+        fHistPtV0Z(0),
        fHistRZ(0), 
        fHistXZ(0), 
        fHistYZ(0) // The last in the above list should not have a comma after it
@@ -339,7 +341,7 @@ void AliAnalysisTaskLukeV0::UserExec(Option_t *)
                if (!mcEvent) 
                        { 
                                Printf("ERROR: Could not retrieve MC event"); 
-                               //return; 
+                               return; 
                        }
                else
                        {
@@ -373,7 +375,8 @@ void AliAnalysisTaskLukeV0::UserExec(Option_t *)
                        bool isprimaryMC = false;
                        
                        AliMCParticle *mcPart = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(iMCtrack));
-                       
+                       if (!mcPart) continue;
+
                        if(mcPart->PdgCode() == kLambda0)
                        {
                                lambdaMC = true;
@@ -394,7 +397,7 @@ void AliAnalysisTaskLukeV0::UserExec(Option_t *)
                        Int_t motherLabel = mcPart->GetMother();
                        AliMCParticle *mcMother = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(motherLabel));
                        double motherType = -1;
-                       if(motherLabel >= 0)
+                       if(motherLabel >= 0 && mcMother)
                        {motherType = mcMother->PdgCode();}
                        
                        // this block of code is used to include primary Sigma0 decays as primary lambda/antilambda
@@ -840,6 +843,7 @@ void AliAnalysisTaskLukeV0::UserExec(Option_t *)
                        if(realParticle == true)
                        {
                                AliMCParticle *mcPart2 = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(negParticleMotherLabel));
+                               if (mcPart2) {
 
                                if(mcPart2->PdgCode() != kLambda0)
                                        {mcLambdaCandidate = false;}
@@ -861,6 +865,7 @@ void AliAnalysisTaskLukeV0::UserExec(Option_t *)
                                        fHistMcV0MK0Pt->Fill(v0->Pt(),v0->GetEffMass(2,2));
                                }
                                }
+                       }
 
                        if(mcLambdaCandidate && lambdaCandidate)
                        {
index 841d972..43e28cc 100644 (file)
@@ -81,7 +81,9 @@ ClassImp(AliAnalysisTaskPerformanceStrange)
 
 //________________________________________________________________________
 AliAnalysisTaskPerformanceStrange::AliAnalysisTaskPerformanceStrange()
-: AliAnalysisTaskSE(), fAnalysisMC(0), fAnalysisType("infoType"),  fCollidingSystems(0), fUsePID("infoPID"), fUseCut("infoCut"),fDown(0),fUp(0), fESD(0), fListHist(0),fCentrSelector(0),fTracksCuts(0),fPIDResponse(0), 
+: AliAnalysisTaskSE(), 
+  fCuts(),
+  fAnalysisMC(0), fAnalysisType("infoType"),  fCollidingSystems(0), fUsePID("infoPID"), fUseCut("infoCut"),fDown(0),fUp(0), fESD(0), fListHist(0),fCentrSelector(0),fTracksCuts(0),fPIDResponse(0), 
 
   fHistMCPrimaryVertexX(0),
   fHistMCPrimaryVertexY(0),
@@ -368,7 +370,9 @@ AliAnalysisTaskPerformanceStrange::AliAnalysisTaskPerformanceStrange()
 
 //________________________________________________________________________
 AliAnalysisTaskPerformanceStrange::AliAnalysisTaskPerformanceStrange(const char *name)
-  : AliAnalysisTaskSE(name), fAnalysisMC(0), fAnalysisType("infoType"), fCollidingSystems(0), fUsePID("infoPID"), fUseCut("infocut"),fDown(0),fUp(0), fESD(0), fListHist(),fCentrSelector(0), fTracksCuts(0),fPIDResponse(0),
+  : AliAnalysisTaskSE(name),
+    fCuts(),
+    fAnalysisMC(0), fAnalysisType("infoType"), fCollidingSystems(0), fUsePID("infoPID"), fUseCut("infocut"),fDown(0),fUp(0), fESD(0), fListHist(),fCentrSelector(0), fTracksCuts(0),fPIDResponse(0),
 
     fHistMCPrimaryVertexX(0),
     fHistMCPrimaryVertexY(0),
@@ -1984,7 +1988,6 @@ void AliAnalysisTaskPerformanceStrange::UserExec(Option_t *)
   
     // Best Primary Vertex:  
     const AliESDVertex *myBestPrimaryVertex = ((AliESDEvent*)fESD)->GetPrimaryVertex();
-    myBestPrimaryVertex = ((AliESDEvent*)fESD)->GetPrimaryVertex();
     if (!myBestPrimaryVertex) return;
     if (!myBestPrimaryVertex->GetStatus()) return;
     fHistNumberEvents->Fill(3.5);
@@ -2054,6 +2057,7 @@ void AliAnalysisTaskPerformanceStrange::UserExec(Option_t *)
   //***********************
   // AliKF Primary Vertex
 
+  if (myPrimaryVertex) {
   AliKFVertex primaryVtxKF( *myPrimaryVertex );
   AliKFParticle::SetField(lMagneticField);
 
@@ -2176,9 +2180,11 @@ void AliAnalysisTaskPerformanceStrange::UserExec(Option_t *)
        negAPKF = new AliKFParticle( *(v0->GetParamP()) ,-2212);
 
       }
-
-      lLabelTrackPos = (UInt_t)TMath::Abs(myTrackPos->GetLabel());
-      lLabelTrackNeg = (UInt_t)TMath::Abs(myTrackNeg->GetLabel());
+      
+      if (myTrackPos)
+       lLabelTrackPos = (UInt_t)TMath::Abs(myTrackPos->GetLabel());
+      if (myTrackNeg)
+       lLabelTrackNeg = (UInt_t)TMath::Abs(myTrackNeg->GetLabel());
 
       // Daughters Pt and P:
       lPtPos = TMath::Sqrt(lMomPos[0]*lMomPos[0] + lMomPos[1]*lMomPos[1]);
@@ -2188,9 +2194,11 @@ void AliAnalysisTaskPerformanceStrange::UserExec(Option_t *)
       lPNeg = TMath::Sqrt(lMomNeg[0]*lMomNeg[0] + lMomNeg[1]*lMomNeg[1] + lMomNeg[2]*lMomNeg[2]);
 
       // Inner Wall parameter:
-      const AliExternalTrackParam *myInnerWallTrackPos = myTrackPos->GetInnerParam(); 
+      const AliExternalTrackParam *myInnerWallTrackPos = 0x0;
+      if (myTrackPos) myInnerWallTrackPos = myTrackPos->GetInnerParam(); 
       if(myInnerWallTrackPos) lMomInnerWallPos = myInnerWallTrackPos->GetP(); 
-      const AliExternalTrackParam *myInnerWallTrackNeg = myTrackNeg->GetInnerParam(); 
+      const AliExternalTrackParam *myInnerWallTrackNeg = 0x0;
+      if (myTrackNeg) myInnerWallTrackNeg = myTrackNeg->GetInnerParam(); 
       if(myInnerWallTrackNeg) lMomInnerWallNeg = myInnerWallTrackNeg->GetP(); 
              
       // DCA between daughter and Primary Vertex:
@@ -2546,8 +2554,10 @@ void AliAnalysisTaskPerformanceStrange::UserExec(Option_t *)
 
     if ((LambdaPID==1 && V0momentum <=1) || (V0momentum>1) ||  !(fUsePID.Contains("withPID"))){  
       if ((TMath::Abs(lRapK0s) < lCutRap) && lOnFlyStatus==0) {
-      fHistTPCsignalPt->Fill(V0momentum,myTrackPos->GetTPCsignal());
-      // fHistTPCsignalPt->Fill(V0momentum,myTrackNeg->GetTPCsignal());
+       if (myTrackPos)
+         fHistTPCsignalPt->Fill(V0momentum,myTrackPos->GetTPCsignal());
+       // if (myTrackNeg)
+       // fHistTPCsignalPt->Fill(V0momentum,myTrackNeg->GetTPCsignal());
       }
     }
 
@@ -2965,6 +2975,7 @@ void AliAnalysisTaskPerformanceStrange::UserExec(Option_t *)
   } // end V0 loop
 
   //  if (primaryVtxKF) delete primaryVtxKF;primaryVtxKF=NULL ;
+  } // Protection in case myPrimaryVertex is 0x0
 
 
   fHistV0Multiplicity->Fill(nv0s);
index 5bf1e0a..bf93061 100644 (file)
@@ -510,7 +510,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
   if (fRawDB) Close();
 
   if (Open(mode,NULL,maxFileSize,fs1,fs2) < 0) {
-    close(fd);
+    if (fd>-1) close(fd);
     return 1;
   }
   // Process input stream
@@ -548,7 +548,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
       Error("Run", "AliMDC was compiled without event builder support");
       delete fRawDB;
       fRawDB = NULL;
-      close(fd);
+      if (fd>-1) close(fd);
       return 1;
 #endif
 
@@ -568,7 +568,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
            Error("Run", "error reading base header");
            Close();
            delete[] event;
-           close(fd);
+           if (fd>-1) close(fd);
            return 1;
          }
        }
@@ -597,7 +597,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
          Close();
          delete[] event;
          delete hdr;
-         close(fd);
+         if (fd>-1) close(fd);
          return 1;
        }
       }
@@ -617,7 +617,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
        Close();
        delete[] event;
        delete hdr;
-       close(fd);
+       if (fd>-1) close(fd);
        return 1;
       }
     }
@@ -648,7 +648,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
          Close();
          if (inputFile) delete[] event;
          delete hdr;
-         close(fd);
+         if (fd>-1) close(fd);
          return 1;
        }
 
@@ -701,7 +701,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
 #endif
   } else {
     // Close input source
-    close(fd);
+    if (fd>-1) close(fd);
     delete [] event;
   }