#include "AliAnalysisTaskME.h"
#include "AliAnalysisManager.h"
+#include "AliAnalysisDataSlot.h"
#include "AliAODEvent.h"
#include "AliVEvent.h"
#include "AliAODHandler.h"
#include "AliLog.h"
-ClassImp(AliAnalysisTaskME);
+ClassImp(AliAnalysisTaskME)
////////////////////////////////////////////////////////////////////////
//
// 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();
}
// 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);
}