coverity fixes
authorslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Mar 2011 09:16:34 +0000 (09:16 +0000)
committerslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Mar 2011 09:16:34 +0000 (09:16 +0000)
PWG4/GammaConv/AliAnalysisTaskGammaConvDalitz.cxx
PWG4/GammaConv/AliAnalysisTaskGammaConversion.cxx

index 0da720a..fe45799 100644 (file)
@@ -312,7 +312,7 @@ void AliAnalysisTaskGammaConvDalitz::UserExec(Option_t */*option*/)
    fBGEventHandler = fV0Reader->GetBGHandler();
    fESDpid = fV0Reader->GetESDpid();
    fESDEvent = fV0Reader->GetESDEvent();
-   if(fDoMC)
+   if(fDoMC && MCEvent())
    {
        fStack= MCEvent()->Stack();
         fGCMCEvent=MCEvent();
index 02a75f0..d9c079a 100644 (file)
@@ -2657,17 +2657,20 @@ void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
 
 ///__________________________________________________________________________________
 void AliAnalysisTaskGammaConversion::AddToAODBranch(TClonesArray * branch, AliKFParticle * kfParticle, Double_t mass, Int_t daughter1, Int_t daughter2) {
-  
-  new((*branch)[branch->GetEntriesFast()])  AliAODConversionParticle(kfParticle, daughter1, daughter2);
-  AliAODConversionParticle * aodParticle = dynamic_cast<AliAODConversionParticle*>(branch->Last());
-  if(aodParticle) {
-    aodParticle->SetChi2(kfParticle->Chi2());
-    aodParticle->SetIMass(mass);
+  //Fill AOD with particles
+  if(branch) {
+    new((*branch)[branch->GetEntriesFast()])  AliAODConversionParticle(kfParticle, daughter1, daughter2);
+    AliAODConversionParticle * aodParticle = dynamic_cast<AliAODConversionParticle*>(branch->Last());
+    if(aodParticle) {
+      aodParticle->SetChi2(kfParticle->Chi2());
+      aodParticle->SetIMass(mass);
+    }
   }
 }
 
 ///__________________________________________________________________________________
 void AliAnalysisTaskGammaConversion::AddPionToAOD(AliKFParticle * kfParticle, Double_t mass, Int_t daughter1, Int_t daughter2) {
+  //Add pions to AOD
   AddToAODBranch(fAODPi0, kfParticle, mass, daughter1, daughter2);
   TagDaughter(daughter1);
   TagDaughter(daughter2);
@@ -2677,6 +2680,7 @@ void AliAnalysisTaskGammaConversion::AddPionToAOD(AliKFParticle * kfParticle, Do
 
 ///__________________________________________________________________________________
 void AliAnalysisTaskGammaConversion::TagDaughter(Int_t gammaIndex) {
+  //Set conversion tag on pion daughters
   AliAODConversionParticle * daughter = dynamic_cast<AliAODConversionParticle*>(fAODGamma->At(gammaIndex));
   if(daughter) {
     daughter->SetTag(kTRUE);
@@ -2688,14 +2692,14 @@ void AliAnalysisTaskGammaConversion::TagDaughter(Int_t gammaIndex) {
 ///___________________________________________________________________________________
 void AliAnalysisTaskGammaConversion::FillAODWithConversionGammas(){
   // Fill AOD with reconstructed Gamma
-       
   for(Int_t gammaIndex=0;gammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();gammaIndex++){
     AliKFParticle * gammakf = dynamic_cast<AliKFParticle*>(fKFReconstructedGammasTClone->At(gammaIndex));
-    AddToAODBranch(fAODGamma, gammakf, gammakf->GetMass(), fElectronv1[gammaIndex], fElectronv2[gammaIndex]);
+    if(gammakf) {
+      AddToAODBranch(fAODGamma, gammakf, gammakf->GetMass(), fElectronv1[gammaIndex], fElectronv2[gammaIndex]);
+    }
   }
 }
 
-
 /*
   void AliAnalysisTaskGammaConversion::ProcessConvPHOSGammasForNeutralMesonAnalysis(){