]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliAnalysisTaskME.cxx
Doxygen documentation fixes
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskME.cxx
index 2670db7c69f4f59ce2313f40193a0f661bf7efde..ea16666a9156ef8b523b6b91cd0b80365bb9d895 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "AliAnalysisTaskME.h"
 #include "AliAnalysisManager.h"
+#include "AliAnalysisDataSlot.h"
 #include "AliAODEvent.h"
 #include "AliVEvent.h"
 #include "AliAODHandler.h"
@@ -31,7 +32,7 @@
 #include "AliLog.h"
 
 
-ClassImp(AliAnalysisTaskME);
+ClassImp(AliAnalysisTaskME)
 
 ////////////////////////////////////////////////////////////////////////
 
@@ -154,12 +155,13 @@ void AliAnalysisTaskME::Exec(Option_t* option)
 //
 // Was event selected ? If no event selection mechanism, the event SHOULD be selected (AG)
     UInt_t isSelected = AliVEvent::kAny;
-    if( fInputHandler && fInputHandler->GetEventSelection()) {
+    if(fInputHandler && fInputHandler->GetEventSelection()) {
       // Get the actual offline trigger mask for the event and AND it with the
       // requested mask. If no mask requested select by default the event.
       if (fOfflineTriggerMask)
        isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
     }
+    
     if (!isSelected) { 
        if (fDebug > 1) AliInfo("Event rejected \n");
        fInputHandler->EventSkipped();
@@ -167,12 +169,14 @@ void AliAnalysisTaskME::Exec(Option_t* option)
     }
 // Call the user analysis    
     
-    if (fInputHandler->IsBufferReady()) {
+    if (fInputHandler && fInputHandler->IsBufferReady()) {
        if ((fFreshBufferOnly && fInputHandler->IsFreshBuffer()) || !fFreshBufferOnly)
        {
            if (outputHandler) outputHandler->SetFillAOD(kTRUE);
            UserExec(option);
-           PostData(0, fTreeA);
+           // Added protection in case the derived task is not an AOD producer.
+           AliAnalysisDataSlot *out0 = GetOutputSlot(0);
+           if (out0 && out0->IsConnected()) PostData(0, fTreeA);
        } else {
            if (outputHandler) outputHandler->SetFillAOD(kFALSE);
        }