]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliInputEventHandler.h
adding separate primary vertex and V0 finder components (Timur)
[u/mrichter/AliRoot.git] / STEER / AliInputEventHandler.h
1 #ifndef ALIINPUTEVENTHANDLER_H
2 #define ALIINPUTEVENTHANDLER_H
3 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //-------------------------------------------------------------------------
9 //     Input Handler realisation of the AliVEventHandler interface
10 //     Author: Andreas Morsch, CERN
11 //-------------------------------------------------------------------------
12
13 #include "AliVEventHandler.h"
14 #include <TTree.h>
15
16
17 class AliVEvent;
18 class AliVCuts;
19 class AliRunTag;
20 class AliEventTag;
21
22
23 class AliInputEventHandler : public AliVEventHandler {
24
25  public:
26  enum EInputHandlerFlags {
27     kUserCallSelectionMask = BIT(14) // Watch out for defining base class bits
28  };
29     AliInputEventHandler();
30     AliInputEventHandler(const char* name, const char* title);
31     virtual ~AliInputEventHandler();
32     virtual void         SetOutputFileName(const char* /*fname*/) {;}
33     virtual const char  *GetOutputFileName()                          {return 0;}
34     virtual Bool_t       Init(Option_t* opt) {if(fMixingHandler) fMixingHandler->Init(opt);return kTRUE;}
35     virtual Bool_t       Init(TTree* tree, Option_t* opt) {if(fMixingHandler) fMixingHandler->Init(tree,opt);return kTRUE;}
36     virtual Bool_t       GetEntry() {if(fMixingHandler) fMixingHandler->GetEntry(); return kTRUE;}
37     virtual Bool_t       BeginEvent(Long64_t entry) {if(fMixingHandler) fMixingHandler->BeginEvent(entry);return kTRUE;}
38
39     virtual Bool_t       Notify()      { return AliVEventHandler::Notify();}
40     virtual Bool_t       Notify(const char *path) {if(fMixingHandler) fMixingHandler->Notify(path);return kTRUE;}
41     virtual Bool_t       FinishEvent() {if(fMixingHandler) fMixingHandler->FinishEvent();return kTRUE;}        
42     virtual Bool_t       Terminate()   {if(fMixingHandler) fMixingHandler->Terminate();return kTRUE;}
43     virtual Bool_t       TerminateIO() {if(fMixingHandler) fMixingHandler->TerminateIO();return kTRUE;}
44
45     // Setters
46     virtual void         SetInputTree(TTree* tree)                    {fTree = tree;}
47     virtual void         SetEventSelection(AliVCuts* cuts)            {fEventCuts = cuts;}
48     virtual void         SetUserCallSelectionMask(Bool_t flag=kTRUE)  {TObject::SetBit(kUserCallSelectionMask,flag);}
49     //
50     void SetInactiveBranches(const char* branches) {fBranches   = branches;}
51     void SetActiveBranches  (const char* branches) {fBranchesOn = branches;}
52      // Getters
53     virtual AliVEvent   *GetEvent()        const                      {return 0;}
54     virtual const AliEventTag   *GetEventTag() const                  {return 0;}
55     virtual AliRunTag   *GetRunTag()       const                      {return 0;}
56     // Get the statistics object (currently TH2). Option can be BIN0.
57     virtual TObject     *GetStatistics(Option_t *option="") const;
58     virtual Option_t    *GetAnalysisType() const                      {return 0;}
59     virtual TTree       *GetTree( )        const                      {return fTree;}
60     virtual AliVCuts    *GetEventSelection() const                    {return fEventCuts;}
61     virtual Long64_t     GetReadEntry()    const;
62     virtual Bool_t       IsUserCallSelectionMask() const              {return TObject::TestBit(kUserCallSelectionMask);}
63     virtual Bool_t       NewEvent()
64         {Bool_t ne = fNewEvent; fNewEvent = kFALSE; return ne;}
65     virtual UInt_t       IsEventSelected() 
66         {return fIsSelectedResult;}
67     // Mixing
68     void SetMixingHandler(AliInputEventHandler* mixing) 
69     {fMixingHandler = mixing;}
70     AliInputEventHandler* MixingHandler()
71     {return fMixingHandler;}
72
73  protected:
74     void SwitchOffBranches() const;
75     void SwitchOnBranches()  const;
76  private:
77     AliInputEventHandler(const AliInputEventHandler& handler);             
78     AliInputEventHandler& operator=(const AliInputEventHandler& handler);  
79  protected:
80     TTree          *fTree;         //! Pointer to the tree
81     TString         fBranches;     //  List of branches to be switched off (separated by space)
82     TString         fBranchesOn;   //  List of branches to be switched on  (separated by space)
83     Bool_t          fNewEvent;     //  New event flag 
84     AliVCuts*       fEventCuts;    //  Cuts on the event level
85     UInt_t          fIsSelectedResult; //  Selection result
86     AliInputEventHandler* fMixingHandler; // Optionla plugin for mixing 
87     ClassDef(AliInputEventHandler, 5);
88 };
89
90 #endif