X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ANALYSIS%2FAliAnalysisTaskME.cxx;h=6900da35b982c8d917a05f235d978173b20ef6cb;hb=d8831c4227fb65ff7e91767ab6f6af3a2b510e24;hp=c922604e2af121de49be696b0b85f6249b7ab4ea;hpb=cd17c2ba62a42d11fd198b43bfb9ecb92023737c;p=u%2Fmrichter%2FAliRoot.git diff --git a/ANALYSIS/AliAnalysisTaskME.cxx b/ANALYSIS/AliAnalysisTaskME.cxx index c922604e2af..6900da35b98 100644 --- a/ANALYSIS/AliAnalysisTaskME.cxx +++ b/ANALYSIS/AliAnalysisTaskME.cxx @@ -24,6 +24,7 @@ #include "AliAnalysisTaskME.h" #include "AliAnalysisManager.h" +#include "AliAnalysisDataSlot.h" #include "AliAODEvent.h" #include "AliVEvent.h" #include "AliAODHandler.h" @@ -42,7 +43,8 @@ AliAnalysisTaskME::AliAnalysisTaskME(): fFreshBufferOnly(kFALSE), fInputHandler(0x0), fOutputAOD(0x0), - fTreeA(0x0) + fTreeA(0x0), + fOfflineTriggerMask(0) { // Default constructor } @@ -54,7 +56,8 @@ AliAnalysisTaskME::AliAnalysisTaskME(const char* name): fFreshBufferOnly(kFALSE), fInputHandler(0x0), fOutputAOD(0x0), - fTreeA(0x0) + fTreeA(0x0), + fOfflineTriggerMask(0) { // Default constructor DefineInput (0, TChain::Class()); @@ -68,27 +71,32 @@ AliAnalysisTaskME::AliAnalysisTaskME(const AliAnalysisTaskME& obj): fFreshBufferOnly(kFALSE), fInputHandler(0x0), fOutputAOD(0x0), - fTreeA(0x0) + fTreeA(0x0), + fOfflineTriggerMask(0) { // Copy constructor fDebug = obj.fDebug; fEntry = obj.fEntry; fInputHandler = obj.fInputHandler; fOutputAOD = obj.fOutputAOD; - fTreeA = obj.fTreeA; + fTreeA = obj.fTreeA; + fOfflineTriggerMask = obj.fOfflineTriggerMask; } AliAnalysisTaskME& AliAnalysisTaskME::operator=(const AliAnalysisTaskME& other) { // Assignment - AliAnalysisTask::operator=(other); - fDebug = other.fDebug; - fEntry = other.fEntry; - fFreshBufferOnly = other.fFreshBufferOnly; - fInputHandler = other.fInputHandler; - fOutputAOD = other.fOutputAOD; - fTreeA = other.fTreeA; + if (this != &other) { + AliAnalysisTask::operator=(other); + fDebug = other.fDebug; + fEntry = other.fEntry; + fFreshBufferOnly = other.fFreshBufferOnly; + fInputHandler = other.fInputHandler; + fOutputAOD = other.fOutputAOD; + fTreeA = other.fTreeA; + fOfflineTriggerMask = other.fOfflineTriggerMask; + } return *this; } @@ -146,13 +154,31 @@ void AliAnalysisTaskME::Exec(Option_t* option) AliAODHandler* outputHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); +// +// Was event selected ? If no event selection mechanism, the event SHOULD be selected (AG) + UInt_t isSelected = AliVEvent::kAny; + 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(); + return; + } // 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); } @@ -169,13 +195,13 @@ const char* AliAnalysisTaskME::CurrentFileName() else return ""; } -void AliAnalysisTaskME::AddAODBranch(const char* cname, void* addobj) +void AliAnalysisTaskME::AddAODBranch(const char* cname, void* addobj, const char *fname) { // Add a new branch to the aod tree AliAODHandler* handler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); if (handler) { - handler->AddBranch(cname, addobj); + handler->AddBranch(cname, addobj, fname); } }