]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliInputEventHandler.h
Added method AliInputEventHandler::GetStatistics(Option_t *option) to retrieve the...
[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
21
22 class AliInputEventHandler : public AliVEventHandler {
23
24  public:
25  enum EInputHandlerFlags {
26     kUserCallSelectionMask = BIT(14) // Watch out for defining base class bits
27  };
28     AliInputEventHandler();
29     AliInputEventHandler(const char* name, const char* title);
30     virtual ~AliInputEventHandler();
31     virtual void         SetOutputFileName(const char* /*fname*/) {;}
32     virtual const char  *GetOutputFileName()                          {return 0;}
33     virtual Bool_t       Init(Option_t* opt) {if(fMixingHandler) fMixingHandler->Init(opt);return kTRUE;}
34     virtual Bool_t       Init(TTree* tree, Option_t* opt) {if(fMixingHandler) fMixingHandler->Init(tree,opt);return kTRUE;}
35     virtual Bool_t       GetEntry() {if(fMixingHandler) fMixingHandler->GetEntry(); return kTRUE;}
36     virtual Bool_t       BeginEvent(Long64_t entry) {if(fMixingHandler) fMixingHandler->BeginEvent(entry);return kTRUE;}
37
38     virtual Bool_t       Notify()      { return AliVEventHandler::Notify();}
39     virtual Bool_t       Notify(const char *path) {if(fMixingHandler) fMixingHandler->Notify(path);return kTRUE;}
40     virtual Bool_t       FinishEvent() {if(fMixingHandler) fMixingHandler->FinishEvent();return kTRUE;}        
41     virtual Bool_t       Terminate()   {if(fMixingHandler) fMixingHandler->Terminate();return kTRUE;}
42     virtual Bool_t       TerminateIO() {if(fMixingHandler) fMixingHandler->TerminateIO();return kTRUE;}
43
44     // Setters
45     virtual void         SetInputTree(TTree* tree)                    {fTree = tree;}
46     virtual void         SetEventSelection(AliVCuts* cuts)            {fEventCuts = cuts;}
47     virtual void         SetUserCallSelectionMask(Bool_t flag=kTRUE)  {TObject::SetBit(kUserCallSelectionMask,flag);}
48     //
49     void SetInactiveBranches(const char* branches) {fBranches   = branches;}
50     void SetActiveBranches  (const char* branches) {fBranchesOn = branches;}
51      // Getters
52     virtual AliVEvent   *GetEvent()        const                      {return 0;}
53     virtual AliRunTag   *GetRunTag()       const                      {return 0;}
54     // Get the statistics object (currently TH2). Option can be BIN0.
55     virtual TObject     *GetStatistics(Option_t *option="") const;
56     virtual Option_t    *GetAnalysisType() const                      {return 0;}
57     virtual TTree       *GetTree( )        const                      {return fTree;}
58     virtual AliVCuts    *GetEventSelection() const                    {return fEventCuts;}
59     virtual Long64_t     GetReadEntry()    const;
60     virtual Bool_t       IsUserCallSelectionMask() const              {return TObject::TestBit(kUserCallSelectionMask);}
61     virtual Bool_t       NewEvent()
62         {Bool_t ne = fNewEvent; fNewEvent = kFALSE; return ne;}
63     virtual UInt_t       IsEventSelected() 
64         {return fIsSelectedResult;}
65     // Mixing
66     void SetMixingHandler(AliInputEventHandler* mixing) 
67     {fMixingHandler = mixing;}
68     AliInputEventHandler* MixingHandler()
69     {return fMixingHandler;}
70
71  protected:
72     void SwitchOffBranches() const;
73     void SwitchOnBranches()  const;
74  private:
75     AliInputEventHandler(const AliInputEventHandler& handler);             
76     AliInputEventHandler& operator=(const AliInputEventHandler& handler);  
77  protected:
78     TTree          *fTree;         //! Pointer to the tree
79     TString         fBranches;     //  List of branches to be switched off (separated by space)
80     TString         fBranchesOn;   //  List of branches to be switched on  (separated by space)
81     Bool_t          fNewEvent;     //  New event flag 
82     AliVCuts*       fEventCuts;    //  Cuts on the event level
83     UInt_t          fIsSelectedResult; //  Selection result
84     AliInputEventHandler* fMixingHandler; // Optionla plugin for mixing 
85     ClassDef(AliInputEventHandler, 5);
86 };
87
88 #endif