]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliInputEventHandler.h
Added protections to avoid crashes with Print() when ESDEvent is fetched from 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     AliInputEventHandler();
26     AliInputEventHandler(const char* name, const char* title);
27     virtual ~AliInputEventHandler();
28     virtual void         SetOutputFileName(const char* /*fname*/) {;}
29     virtual const char  *GetOutputFileName()                          {return 0;}
30     virtual Bool_t       Init(Option_t* /*opt*/)                      {return kTRUE;}
31     virtual Bool_t       Init(TTree* /*tree*/, Option_t* /*opt*/)     {return kTRUE;}
32     virtual Bool_t       BeginEvent(Long64_t /*entry*/)               {return kTRUE;}
33     virtual Bool_t       Notify() { return AliVEventHandler::Notify();}
34     virtual Bool_t       Notify(const char */*path*/)                 {return kTRUE;}
35     virtual Bool_t       FinishEvent()                                {return kTRUE;}        
36     virtual Bool_t       Terminate()                                  {return kTRUE;}
37     virtual Bool_t       TerminateIO()                                {return kTRUE;}
38     // Setters
39     virtual void         SetInputTree(TTree* tree)                    {fTree = tree;}
40     virtual void         SetEventSelection(AliVCuts* cuts)            {fEventCuts = cuts;}
41     //
42     void SetInactiveBranches(const char* branches) {fBranches   = branches;}
43     void SetActiveBranches  (const char* branches) {fBranchesOn = branches;}
44      // Getters
45     virtual AliVEvent   *GetEvent()        const                      {return 0;}
46     virtual AliRunTag   *GetRunTag()       const                      {return 0;}
47     virtual Option_t    *GetAnalysisType() const                      {return 0;}
48     virtual TTree       *GetTree( )        const                      {return fTree;}
49     virtual AliVCuts    *GetEventSelection() const                    {return fEventCuts;}
50     virtual Long64_t     GetReadEntry()    const;
51     virtual Bool_t       NewEvent()
52         {Bool_t ne = fNewEvent; fNewEvent = kFALSE; return ne;}
53     virtual Bool_t       IsEventSelected() 
54         {return fIsSelected;}
55  protected:
56     void SwitchOffBranches() const;
57     void SwitchOnBranches()  const;
58  private:
59     AliInputEventHandler(const AliInputEventHandler& handler);             
60     AliInputEventHandler& operator=(const AliInputEventHandler& handler);  
61  protected:
62     TTree          *fTree;         //! Pointer to the tree
63     TString         fBranches;     //  List of branches to be switched off (separated by space)
64     TString         fBranchesOn;   //  List of branches to be switched on  (separated by space)
65     Bool_t          fNewEvent;     //  New event flag 
66     AliVCuts*       fEventCuts;    //  Cuts on the event level
67     Bool_t          fIsSelected;   //  Selection result
68     ClassDef(AliInputEventHandler, 3);
69 };
70
71 #endif