Coverity fixes
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Sep 2011 17:25:51 +0000 (17:25 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Sep 2011 17:25:51 +0000 (17:25 +0000)
Robert Grajcarek <grajcarek@physi.uni-heidelberg.de>

ANALYSIS/AliEPSelectionTask.cxx

index 2764442..722ded8 100644 (file)
@@ -308,7 +308,8 @@ void AliEPSelectionTask::UserExec(Option_t */*option*/)
   }
   
     else if (fAnalysisInput.CompareTo("AOD")==0){
-    AliAODEvent *aod =  dynamic_cast<AliAODEvent*> (InputEvent());
+    AliVEvent* event = InputEvent();
+    AliAODEvent* aod = dynamic_cast<AliAODEvent*>(event);
 
     if (!(fRunNumber == aod->GetRunNumber())) {
       fRunNumber = aod->GetRunNumber();
@@ -322,10 +323,10 @@ void AliEPSelectionTask::UserExec(Option_t */*option*/)
   
     if (aod){
       esdEP = aod->GetHeader()->GetEventplaneP();
-      if(esdEP) {esdEP->Reset();} // reset eventplane if not NULL       
+      esdEP->Reset(); 
      
-    Int_t maxID = 0;
-    TObjArray* tracklist = GetAODTracksAndMaxID(aod,maxID);
+      Int_t maxID = 0;
+      TObjArray* tracklist = GetAODTracksAndMaxID(aod,maxID);
        
     if (fSaveTrackContribution) {
       esdEP->GetQContributionXArray()->Set(maxID+1);
@@ -592,7 +593,7 @@ Double_t AliEPSelectionTask::GetWeight(TObject* track1)
 {
   Double_t ptweight=1;
   AliVTrack* track = dynamic_cast<AliVTrack*>(track1);
-  if (fUsePtWeight) {      
+  if (fUsePtWeight && track) {      
     if (track->Pt()<2) ptweight=track->Pt();
     else ptweight=2;
   }