]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
From Kenneth: Coverity fixes
authorslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Feb 2011 18:56:34 +0000 (18:56 +0000)
committerslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Feb 2011 18:56:34 +0000 (18:56 +0000)
PWG4/GammaConv/AliAnalysisTaskGammaConversion.cxx
PWG4/GammaConv/AliGammaConversionHistograms.cxx
PWG4/GammaConv/AliV0Reader.cxx
PWG4/GammaConv/AliV0Reader.h

index beae0784b44e11fc2a1ee81f610f5960b2718c09..74bc6c11efc5a6f1fedc7b3cc1a7950c07a33984 100644 (file)
@@ -418,9 +418,9 @@ void AliAnalysisTaskGammaConversion::UserExec(Option_t */*option*/)
     AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
   }
 
-  if(fV0Reader == NULL){
+  //  if(fV0Reader == NULL){ // coverty does not permit this test
     // Write warning here cuts and so on are default if this ever happens
-  }
+  //  }
 
   if (fMCEvent ) {
     // To avoid crashes due to unzip errors. Sometimes the trees are not there.
@@ -3650,8 +3650,10 @@ void AliAnalysisTaskGammaConversion::RecalculateV0ForGamma(){
       }
                        
       AliKFParticle twoGammaCandidate(*twoGammaDecayCandidateDaughter0,*twoGammaDecayCandidateDaughter1);
-      fHistograms->FillHistogram("ESD_RecalculateGG_InvMass",twoGammaCandidate.GetMass());             
-      fHistograms->FillHistogram("ESD_RecalculateGG_InvMass_vs_Pt",twoGammaCandidate.GetMass(),twoGammaCandidate.GetPt());             
+      if(fHistograms != NULL){
+       fHistograms->FillHistogram("ESD_RecalculateGG_InvMass",twoGammaCandidate.GetMass());            
+       fHistograms->FillHistogram("ESD_RecalculateGG_InvMass_vs_Pt",twoGammaCandidate.GetMass(),twoGammaCandidate.GetPt());            
+      }
    }
  }
 }
@@ -4543,8 +4545,9 @@ Int_t AliAnalysisTaskGammaConversion::GetProcessType(const AliMCEvent * mcEvt) {
   // Determine if the event was generated with pythia or phojet and return the process type
 
   // Check if mcEvt is fine
-  if (!mcEvt) {
+  if (!mcEvt) { // coverty does not allow this, the check is done elsewhere
     AliFatal("NULL mc event");
+    return -1;
   } 
 
   // Determine if it was a pythia or phojet header, and return the correct process type
@@ -4553,6 +4556,7 @@ Int_t AliAnalysisTaskGammaConversion::GetProcessType(const AliMCEvent * mcEvt) {
   AliGenEventHeader * htmp = mcEvt->GenEventHeader();
   if(!htmp) {
     AliFatal("Cannot Get MC Header!!");
+    return -1;
   }
   if( TString(htmp->IsA()->GetName()) == "AliGenPythiaEventHeader") {
     headPy =  (AliGenPythiaEventHeader*) htmp;
index 27578768c852d2acd99723e183d69537d6b5ce89..f0affd1c18f15928c6b886ca9151d903a9c7090d 100644 (file)
@@ -291,9 +291,7 @@ void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){
          fMappingContainer->SetOwner(kTRUE);
          fMappingContainer->SetName("Mapping histograms");
        }
-       if(fMappingContainer != NULL){
-         fMappingContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-       }
+       fMappingContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
       }
       else if(histogramString.Contains("Background")){// means it should be put in the background folder
        if(fBackgroundContainer == NULL){
@@ -301,9 +299,7 @@ void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){
          fBackgroundContainer->SetOwner(kTRUE);
          fBackgroundContainer->SetName("Background histograms");
        }
-       if(fBackgroundContainer != NULL){
-         fBackgroundContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-       }
+       fBackgroundContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
       }
       else if(histogramString.Contains("Debug")){// means it should be put in the debug folder
        if(fDebugContainer == NULL){
@@ -311,9 +307,7 @@ void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){
          fDebugContainer->SetOwner(kTRUE);
          fDebugContainer->SetName("Debug histograms");
        }
-       if(fDebugContainer != NULL){
-         fDebugContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-       }
+       fDebugContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
       }
       else if(histogramString.Contains("Resolution")){// means it should be put in the resolution folder
        if(fResolutionContainer == NULL){
@@ -321,9 +315,7 @@ void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){
          fResolutionContainer->SetOwner(kTRUE);
          fResolutionContainer->SetName("Resolution histograms");
        }
-       if(fResolutionContainer != NULL){
-         fResolutionContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-       }
+       fResolutionContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
       }
       else if(histogramString.Contains("TrueConv")){// means it should be put in the true conv folder
        if(fMatchContainer == NULL){
@@ -331,9 +323,7 @@ void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){
          fMatchContainer->SetOwner(kTRUE);
          fMatchContainer->SetName("True conversion histograms");
        }
-       if(fMatchContainer != NULL){
-         fMatchContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-       }
+       fMatchContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
       }
       else if(histogramString.Contains("ESD")){// means it should be put in the ESD folder
        if(fESDContainer == NULL){
@@ -341,9 +331,7 @@ void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){
          fESDContainer->SetOwner(kTRUE);
          fESDContainer->SetName("ESD histograms");
        }
-       if(fESDContainer != NULL){
-         fESDContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-       }
+       fESDContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
       }
       else if(histogramString.Contains("MC")){// means it should be put in the MC folder
        if(fMCContainer == NULL){
@@ -351,9 +339,7 @@ void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){
          fMCContainer->SetOwner(kTRUE);
          fMCContainer->SetName("MC histograms");
        }
-       if(fMCContainer != NULL){
-         fMCContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-       }
+       fMCContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
       }
       else if(histogramString.Contains("Table")){// means it should be put in the Table Folder
        if(fTableContainer == NULL){
@@ -361,9 +347,7 @@ void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){
           fTableContainer->SetOwner(kTRUE);
           fTableContainer->SetName("Tables");
        }
-       if(fTableContainer != NULL){
-          fTableContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-       }
+       fTableContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
       }                        
       else{
        if(fOtherContainer == NULL){
@@ -371,12 +355,11 @@ void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){
          fOtherContainer->SetOwner(kTRUE);
          fOtherContainer->SetName("Other histograms");
        }
-       if(fOtherContainer != NULL){
-         fOtherContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-       }
+       fOtherContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
       }
       histogramName = NULL;
     } // end while
+
     if(fMappingContainer != NULL){
       fOutputContainer->Add(fMappingContainer);
     }
index b01a5070b62e5d5223fa25be34290f66cd544f95..f080cc535c5b0e97513782de2517e82bb4ac19db 100644 (file)
@@ -1116,12 +1116,8 @@ Bool_t AliV0Reader::UpdateV0Information(){
   if(fMotherCandidateLorentzVector != NULL){
     delete fMotherCandidateLorentzVector;
   }
-  if(fUseKFParticle){
-    fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
-  }
-  else if(fUseESDTrack){
-    fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
-  }
+
+  fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
        
   if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
     fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.); 
@@ -1289,11 +1285,12 @@ Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut
     //fESDEvent->GetTrack(fCurrentV0->GetPindex());
   //-AM for switchtracks==true the above is a bug
 
-  negTrack->GetTPCpid(negProbArray);
-  posTrack->GetTPCpid(posProbArray);
-       
-  //  if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19)
   if(negProbArray && posProbArray){
+
+    negTrack->GetTPCpid(negProbArray);
+    posTrack->GetTPCpid(posProbArray);
+    
+    //  if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19)
     if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){
       iResult=kTRUE;
     }
@@ -1318,18 +1315,18 @@ void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){
   AliESDtrack* negTrack  = GetNegativeESDTrack();
   AliESDtrack* posTrack  = GetPositiveESDTrack();
 
-
-  negTrack->GetTPCpid(negProbArray);
-  posTrack->GetTPCpid(posProbArray);
-       
-  //  if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
   if(negProbArray && posProbArray){
+    negTrack->GetTPCpid(negProbArray);
+    posTrack->GetTPCpid(posProbArray);
+    
+    //  if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
     negPIDProb = negProbArray[GetSpeciesIndex(-1)];
     posPIDProb = posProbArray[GetSpeciesIndex(1)];
   }
   delete [] posProbArray;
   delete [] negProbArray;
 }
+
 void AliV0Reader::GetPIDProbabilityMuonPion(Double_t &negPIDProb,Double_t & posPIDProb){
   // see header file for documentation
 
@@ -1344,11 +1341,12 @@ void AliV0Reader::GetPIDProbabilityMuonPion(Double_t &negPIDProb,Double_t & posP
   AliESDtrack* negTrack  = GetNegativeESDTrack();
   AliESDtrack* posTrack  = GetPositiveESDTrack();
 
-  negTrack->GetTPCpid(negProbArray);
-  posTrack->GetTPCpid(posProbArray);
-       
-  //  if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
   if(negProbArray && posProbArray){
+    negTrack->GetTPCpid(negProbArray);
+    posTrack->GetTPCpid(posProbArray);
+    
+    //  if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
+
     negPIDProb = negProbArray[1]+negProbArray[2];
     posPIDProb = posProbArray[1]+posProbArray[2];
   }
index 1b9b916c8dc7bbff10d7eed0e2540e9399f83535..ded3c1d57988bbbae1ae3b2ccf2cdaa2a111685b 100644 (file)
@@ -195,7 +195,7 @@ class AliV0Reader : public TObject {
   /*
    *Get the PID of the MC mother particle
    */
-  Int_t GetMotherMCParticlePDGCode() const{if(fMotherMCParticle != NULL){ cout<<"MCParticle exists"<<endl;} return fMotherMCParticle->GetPdgCode();}
+  Int_t GetMotherMCParticlePDGCode() const{return fMotherMCParticle->GetPdgCode();}
        
   /*
    *Get the MC stack