Coverity fixes (Philippe)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Feb 2011 19:57:10 +0000 (19:57 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Feb 2011 19:57:10 +0000 (19:57 +0000)
PWG3/muondep/AliAnalysisTaskESDMCLabelAddition.cxx
PWG3/muondep/AliAnalysisTaskMuonFakes.cxx
PWG3/muondep/AliAnalysisTaskMuonResolution.cxx

index 30ff4d2..edf5ff4 100644 (file)
@@ -94,6 +94,10 @@ void AliAnalysisTaskESDMCLabelAddition::AddMCLabel()
 {
   // Load ESD event
   AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
+  if (!esd) {
+    AliError("Cannot get input event");
+    return;
+  }      
   
   // Load MC event 
   AliMCEventHandler *mcH = 0;
index f8d9794..4fa4439 100644 (file)
@@ -286,6 +286,10 @@ void AliAnalysisTaskMuonFakes::UserExec(Option_t *)
   
   // Load ESD event
   AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
+  if (!esd) {
+    AliError("Cannot get input event");
+    return;
+  }      
   
   // Load MC event 
   AliMCEventHandler *mcH = 0;
@@ -669,6 +673,10 @@ Int_t AliAnalysisTaskMuonFakes::RemoveConnectedFakes(AliMUONVTrackStore &fakeTra
       
       // find the corresponding ESD MUON track
       AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
+      if (!esd) {
+       AliError("Cannot get input event");
+       return nFreeMissingTracks;
+      }      
       TIter next3(static_cast<TClonesArray*>(esd->FindListObject("MuonTracks")));
       AliESDMuonTrack* esdTrack = 0x0;
       while ((esdTrack = static_cast<AliESDMuonTrack*>(next3())) && esdTrack->GetUniqueID() != connectedFake->GetUniqueID()) {}
index 4c5e83a..bce332a 100644 (file)
@@ -412,6 +412,11 @@ void AliAnalysisTaskMuonResolution::UserExec(Option_t *)
       AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>(track.GetTrackParamAtCluster()->UncheckedAt(iCluster));
       AliMUONTrackParam* previousTrackParam = static_cast<AliMUONTrackParam*>(track.GetTrackParamAtCluster()->Before(trackParam));
       AliMUONTrackParam* nextTrackParam = static_cast<AliMUONTrackParam*>(track.GetTrackParamAtCluster()->After(trackParam));
+      if (!previousTrackParam && !nextTrackParam) {
+       AliError(Form("unable to find a cluster neither before nor after the one at position %d !?!", iCluster));
+       track.RecursiveDump();
+       break;
+      }
       
       // save current trackParam and remove it from the track
       AliMUONTrackParam currentTrackParam(*trackParam);