]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Consider physics selection when building the buffer.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 1 Nov 2010 14:28:43 +0000 (14:28 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 1 Nov 2010 14:28:43 +0000 (14:28 +0000)
ANALYSIS/AliAnalysisTaskME.cxx
ANALYSIS/AliAnalysisTaskME.h
ANALYSIS/AliMultiEventInputHandler.cxx
ANALYSIS/AliMultiEventInputHandler.h

index 02738031e6f0729f0cfc9331f79683a3935c348d..2670db7c69f4f59ce2313f40193a0f661bf7efde 100644 (file)
@@ -31,7 +31,7 @@
 #include "AliLog.h"
 
 
-ClassImp(AliAnalysisTaskME)
+ClassImp(AliAnalysisTaskME);
 
 ////////////////////////////////////////////////////////////////////////
 
@@ -42,7 +42,8 @@ AliAnalysisTaskME::AliAnalysisTaskME():
     fFreshBufferOnly(kFALSE),
     fInputHandler(0x0),
     fOutputAOD(0x0),
-    fTreeA(0x0)
+    fTreeA(0x0),
+    fOfflineTriggerMask(0)
 {
   // Default constructor
 }
@@ -54,7 +55,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,14 +70,16 @@ 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;
 }
 
 
@@ -89,6 +93,7 @@ AliAnalysisTaskME& AliAnalysisTaskME::operator=(const AliAnalysisTaskME& other)
     fInputHandler    = other.fInputHandler;
     fOutputAOD       = other.fOutputAOD;
     fTreeA           = other.fTreeA;    
+    fOfflineTriggerMask = other.fOfflineTriggerMask;
     return *this;
 }
 
@@ -146,7 +151,22 @@ 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 ((fFreshBufferOnly && fInputHandler->IsFreshBuffer()) || !fFreshBufferOnly)
        {
index 0928f1b73018b65a4b46d850cf261f293de5d578..08fb4f02868951e7d06a072c6aaeb7c09cc253ef 100644 (file)
@@ -7,7 +7,7 @@
 /* $Id$ */
 
 #include "AliAnalysisTask.h"
-class AliVEvent;
+#include "AliVEvent.h"
 class AliAODEvent;
 class AliInputEventHandler;
 class TTree;
@@ -35,6 +35,7 @@ class AliAnalysisTaskME : public AliAnalysisTask
     virtual void UserExec(Option_t* /*option*/) {;}
     // Helpers for adding branches to the AOD
     virtual void   AddAODBranch(const char* cname, void* addobj, const char *fname="");
+    virtual void   SelectCollisionCandidates(UInt_t offlineTriggerMask = AliVEvent::kMB) {fOfflineTriggerMask = offlineTriggerMask;}
     // Getters
     virtual Int_t          DebugLevel()              {return fDebug;     }
     virtual AliVEvent*     GetEvent(Int_t iev);
@@ -50,6 +51,9 @@ class AliAnalysisTaskME : public AliAnalysisTask
     AliMultiEventInputHandler* fInputHandler;    //! Input Handler
     AliAODEvent*               fOutputAOD;       //! AOD out 
     TTree*                     fTreeA;           //  AOD output Tree
+    // Event Selection
+    UInt_t fOfflineTriggerMask;   //  Task processes collision candidates only
+
     ClassDef(AliAnalysisTaskME, 1); // Analysis task for standard jet analysis
 };
  
index 4ff7c8aca6065a9b2237e349cea0f87ea8e34422..a3ddb794738186ad3f4f01e039187c2fa6fb39ad 100644 (file)
@@ -26,6 +26,7 @@
 #include "AliAODEvent.h"
 #include "AliESDEvent.h"
 #include "AliVEventPool.h"
+#include "AliVCuts.h"
 #include "AliLog.h"
 #include <TObjArray.h>
 #include <TTree.h>
@@ -45,7 +46,8 @@ AliMultiEventInputHandler::AliMultiEventInputHandler() :
     fCurrentEvt(0),
     fInit(0),
     fEventPool(0),
-    fEventBuffer(0)
+    fEventBuffer(0),
+    fEventSkipped(0)
 {
   // Default constructor
 }
@@ -61,7 +63,8 @@ AliMultiEventInputHandler::AliMultiEventInputHandler(Int_t size, Int_t format) :
     fCurrentEvt(0),
     fInit(0),
     fEventPool(0),
-    fEventBuffer(0)
+    fEventBuffer(0),
+    fEventSkipped(0)
 {
   // constructor
 }
@@ -77,7 +80,8 @@ AliMultiEventInputHandler::AliMultiEventInputHandler(const char* name, const cha
     fCurrentEvt(0),
     fInit(0),
     fEventPool(0),
-    fEventBuffer(0)
+    fEventBuffer(0),
+    fEventSkipped(0)
 {
     // Constructor
 
@@ -144,6 +148,16 @@ Bool_t AliMultiEventInputHandler::BeginEvent(Long64_t /*entry*/)
        fCurrentBin = fEventPool->BinNumber();
        fNBuffered = 0;
     }
+  //
+  // Event selection
+  // 
+    if (fFormat == 0) {
+      fIsSelectedResult = 0;
+      if (fEventCuts && !IsUserCallSelectionMask())
+       fIsSelectedResult = 
+         fEventCuts->GetSelectionMask((AliESDEvent*)fEventBuffer[fIndex]); 
+    }
+    
     return kTRUE;
 }
 
@@ -151,9 +165,9 @@ Bool_t AliMultiEventInputHandler::FinishEvent()
 {
     // 
     // Connect the next event in the buffer to the tree
-    fIndex++;
-    
+    if (!fEventSkipped) fIndex++;
     fIndex %= fBufferSize;
+
     AliInfo(Form("Connecting buffer entry %5d", fIndex));
     fEventBuffer[fIndex]->Clear();
     fCurrentEvt++;
index baaaee6078789f2a8f7176d301b5d49ceecf0264..50add9ef86e71e49d1f5f947ff08a80826778519 100644 (file)
@@ -33,6 +33,7 @@ class AliMultiEventInputHandler : public AliInputEventHandler {
     virtual AliVEvent       *GetEvent(Int_t iev) const;
     AliVEvent               *GetLatestEvent()    const {return fEventBuffer[fIndex];}
     Int_t                    GetFormat() { return fFormat ;} 
+    void                     EventSkipped() {fEventSkipped = kTRUE;}
     // From the interface
     virtual Bool_t Init(Option_t* /*opt*/)    {return kTRUE;}
     virtual Bool_t Init(TTree* tree, Option_t* /*opt*/);
@@ -53,6 +54,7 @@ class AliMultiEventInputHandler : public AliInputEventHandler {
     Bool_t         fInit;         // Current event
     AliVEventPool* fEventPool;    // Pointer to the pool
     AliVEvent**    fEventBuffer;  //! The event buffer
+    Bool_t         fEventSkipped; // User requires event to be skip
     ClassDef(AliMultiEventInputHandler, 1);
 };