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