]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliMultiEventInputHandler.cxx
preserve bit 8 for TPC only tracks
[u/mrichter/AliRoot.git] / ANALYSIS / AliMultiEventInputHandler.cxx
index 4ff7c8aca6065a9b2237e349cea0f87ea8e34422..7a2fb658840971686facd63a4cfb4958027dcf99 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
 
@@ -121,7 +125,7 @@ Bool_t AliMultiEventInputHandler::Init(TTree* tree, Option_t* /*opt*/)
 Bool_t AliMultiEventInputHandler::Notify(const char */*path*/)
 {
     // Connect to new tree
+
     TList* connectedList = (TList*) (fTree->GetUserInfo()->FindObject("AODObjectsConnectedToTree"));   
     if (connectedList && !fInit) {
        fEventBuffer[0]->ReadFromTree(fTree, "reconnect");
@@ -140,10 +144,21 @@ Bool_t AliMultiEventInputHandler::BeginEvent(Long64_t /*entry*/)
     // Actions before analysis of each event 
     //
     // Reset the number of events buffered for this bin to 0
+    
     if (fCurrentBin != (fEventPool->BinNumber())) {
        fCurrentBin = fEventPool->BinNumber();
        fNBuffered = 0;
     }
+  //
+  // Event selection
+  // 
+    if (fFormat == 0) {
+      fIsSelectedResult = 0;
+      if (fEventCuts && !IsUserCallSelectionMask())
+       fIsSelectedResult = 
+         fEventCuts->GetSelectionMask((AliESDEvent*)fEventBuffer[fIndex]); 
+    }
+    
     return kTRUE;
 }
 
@@ -151,8 +166,7 @@ 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();
@@ -164,7 +178,7 @@ Bool_t AliMultiEventInputHandler::FinishEvent()
 
     fNBuffered++;
     if (fNBuffered > fBufferSize) fNBuffered = fBufferSize;
-
+    
     Int_t nmax = fTree->GetEntries();
     if (fTree->GetEntryList()) {
        nmax = (fTree->GetEntryList()->GetN());