Modified the tender and added method AliTender::SetCheckEventSelection(Bool_t flag) to use this feature automatically. The tender MUST be added first in the train.
{
// Nothing for the moment, but we may need ESD event replication here.
if (fDebug > 1) Printf("AliTender::CreateOutputObjects()\n");
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) AliFatal("No tender without an analysis manager");
+ fESDhandler = dynamic_cast<AliESDInputHandler *>(mgr->GetInputEventHandler());
+ if (fESDhandler && TObject::TestBit(kCheckEventSelection)) {
+ fESDhandler->SetUserCallSelectionMask(kTRUE);
+ Info("UserCreateOutputObjects","The TENDER will check the event selection. Make sure you add the tender as FIRST wagon!");
+ }
}
//______________________________________________________________________________
Printf("AliTender::Exec() %s ==> processing event %lld\n", fESDhandler->GetTree()->GetCurrentFile()->GetName(),entry);
}
fESD = fESDhandler->GetEvent();
+ if (TObject::TestBit(kCheckEventSelection)) fESDhandler->CheckSelectionMask();
// Call the user analysis
// Unlock CDB
class AliTender : public AliAnalysisTaskSE {
+public:
+enum ETenderFlags {
+ kCheckEventSelection = BIT(18) // up to 18 used by AliAnalysisTask
+};
+
private:
Int_t fRun; //! Current run
Bool_t fRunChanged; //! Flag for run change.
AliESDInputHandler *GetESDhandler() const {return fESDhandler;}
AliESDEvent *GetEvent() const {return fESD;}
TObjArray *GetSupplies() const {return fSupplies;}
+ void SetCheckEventSelection(Bool_t flag=kTRUE) {TObject::SetBit(kCheckEventSelection,flag);}
Bool_t RunChanged() const {return fRunChanged;}
// Configuration
void SetDefaultCDBStorage(const char *dbString="local://$ALICE_ROOT/OCDB");
-AliAnalysisTask *AddTaskTender(){
+AliAnalysisTask *AddTaskTender(Bool_t checkEvtSelection=kFALSE){
//get the current analysis manager
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
//========= Add tender to the ANALYSIS manager and set default storage =====
AliTender *tender=new AliTender("AnalysisTender");
+ tender->SetCheckEventSelection(checkEvtSelection);
tender->SetDefaultCDBStorage("raw://");
mgr->AddTask(tender);
+ if (checkEvtSelection) {
+ if (mgr->GetTasks()->First() != (TObject*)tender) {
+ ::Error("When setting the tender to check the event selection, it has to be the first wagon ! Aborting.");
+ return NULL;
+ }
+ }
//========= Attach TPC supply ======
AliTPCTenderSupply *tpcSupply=new AliTPCTenderSupply("TPCtender");
// Constructor
}
+//______________________________________________________________________________
Bool_t AliESDInputHandler::Init(TTree* tree, Option_t* opt)
{
//
return kTRUE;
}
+//______________________________________________________________________________
Bool_t AliESDInputHandler::BeginEvent(Long64_t entry)
{
// Copy from old to new format if necessary
+ static Bool_t called = kFALSE;
+ if (!called && fEventCuts && IsUserCallSelectionMask())
+ AliInfo(Form("The ESD input handler expects that the first task calls AliESDInputHandler::CheckSelectionMask() %s", fEventCuts->ClassName()));
AliESD* old = ((AliESDEvent*) fEvent)->GetAliESDOld();
if (old) {
((AliESDEvent*)fEvent)->CopyFromOldESD();
//
// Event selection
//
- if (fEventCuts)
- fIsSelectedResult = fEventCuts->GetSelectionMask((AliESDEvent*)fEvent);
+ fIsSelectedResult = 0;
+ if (fEventCuts && !IsUserCallSelectionMask())
+ fIsSelectedResult = fEventCuts->GetSelectionMask((AliESDEvent*)fEvent);
//
// Friends
((AliESDEvent*)fEvent)->SetESDfriend(fFriend);
+ called = kTRUE;
return kTRUE;
}
+//______________________________________________________________________________
+void AliESDInputHandler::CheckSelectionMask()
+{
+// This method can be called by a task only if IsUserCallSelectionMask is true.
+ if (!fEventCuts || !IsUserCallSelectionMask()) return;
+ fEventCuts->GetSelectionMask((AliESDEvent*)fEvent);
+}
+
+//______________________________________________________________________________
Bool_t AliESDInputHandler::FinishEvent()
{
// Finish the event
return kTRUE;
}
+//______________________________________________________________________________
Bool_t AliESDInputHandler::Notify(const char* path)
{
// Notify a directory change
SwitchOffBranches();
SwitchOnBranches();
fFriend = (AliESDfriend*)(fEvent->FindListObject("AliESDfriend"));
-
-
//
if (fUseHLT) {
// Get HLTesdTree from current file
}
}
-
-
-
if (!fUseTags) return (kTRUE);
Bool_t zip = kFALSE;
return kTRUE;
}
-
-
+//______________________________________________________________________________
Option_t *AliESDInputHandler::GetDataType() const
{
// Returns handled data type.
return gESDDataType;
}
+//______________________________________________________________________________
Int_t AliESDInputHandler::GetNEventAcceptedInFile()
{
// Get number of events in file accepted by the tag cuts
return iAcc;
}
+
+//______________________________________________________________________________
Int_t AliESDInputHandler::GetNEventRejectedInFile()
{
// Get number of events in file rejected by the tag cuts
return iRej;
}
+
+//______________________________________________________________________________
Bool_t AliESDInputHandler::GetCutSummaryForChain(Int_t *aTotal, Int_t *aAccepted, Int_t *aRejected)
{
// Get number of events in the full chain
return kTRUE;
}
+//______________________________________________________________________________
Int_t AliESDInputHandler::GetNFilesEmpty()
{
// Count number of files in which all events were de-selected
virtual Bool_t Notify() { return AliVEventHandler::Notify(); };
virtual Bool_t Notify(const char* path);
virtual Bool_t FinishEvent();
+ void CheckSelectionMask();
AliESDEvent *GetEvent() const {return fEvent;}
Option_t *GetAnalysisType() const {return fAnalysisType;}
Option_t *GetDataType() const;
class AliInputEventHandler : public AliVEventHandler {
public:
+ enum EInputHandlerFlags {
+ kUserCallSelectionMask = BIT(14) // Watch out for defining base class bits
+ };
AliInputEventHandler();
AliInputEventHandler(const char* name, const char* title);
virtual ~AliInputEventHandler();
// Setters
virtual void SetInputTree(TTree* tree) {fTree = tree;}
virtual void SetEventSelection(AliVCuts* cuts) {fEventCuts = cuts;}
+ virtual void SetUserCallSelectionMask(Bool_t flag=kTRUE) {TObject::SetBit(kUserCallSelectionMask,flag);}
//
void SetInactiveBranches(const char* branches) {fBranches = branches;}
void SetActiveBranches (const char* branches) {fBranchesOn = branches;}
virtual TTree *GetTree( ) const {return fTree;}
virtual AliVCuts *GetEventSelection() const {return fEventCuts;}
virtual Long64_t GetReadEntry() const;
+ virtual Bool_t IsUserCallSelectionMask() const {return TObject::TestBit(kUserCallSelectionMask);}
virtual Bool_t NewEvent()
{Bool_t ne = fNewEvent; fNewEvent = kFALSE; return ne;}
virtual UInt_t IsEventSelected()