Line data Source code
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 AliVCuts;
18 : class AliRunTag;
19 : class AliEventTag;
20 : class AliPIDResponse;
21 : class AliMCEvent;
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 : kNeedField = BIT(16)
30 : };
31 : AliInputEventHandler();
32 : AliInputEventHandler(const char* name, const char* title);
33 : virtual ~AliInputEventHandler();
34 : virtual void SetInputFileName(const char* fname);
35 2 : virtual const char *GetInputFileName() const {return fInputFileName;}
36 0 : virtual void SetOutputFileName(const char* /*fname*/) {;}
37 0 : virtual const char *GetOutputFileName() const {return 0;}
38 6 : virtual Bool_t Init(Option_t* opt) {if(fMixingHandler) fMixingHandler->Init(opt);return kTRUE;}
39 0 : virtual Bool_t Init(TTree* tree, Option_t* opt) {if(fMixingHandler) fMixingHandler->Init(tree,opt);return kTRUE;}
40 0 : virtual Bool_t GetEntry() {if(fMixingHandler) fMixingHandler->GetEntry(); return kTRUE;}
41 0 : virtual Bool_t BeginEvent(Long64_t entry) {if(fMixingHandler) fMixingHandler->BeginEvent(entry);return kTRUE;}
42 20 : virtual Bool_t NeedField() const {return TObject::TestBit(kNeedField);}
43 : //
44 0 : virtual Bool_t Notify() { return AliVEventHandler::Notify();}
45 0 : virtual Bool_t Notify(const char *path) {if(fMixingHandler) fMixingHandler->Notify(path);return kTRUE;}
46 0 : virtual Bool_t FinishEvent() {if(fMixingHandler) fMixingHandler->FinishEvent();return kTRUE;}
47 6 : virtual Bool_t Terminate() {if(fMixingHandler) fMixingHandler->Terminate();return kTRUE;}
48 6 : virtual Bool_t TerminateIO() {if(fMixingHandler) fMixingHandler->TerminateIO();return kTRUE;}
49 : // Setters
50 4 : virtual void SetInputTree(TTree* tree) {fTree = tree;}
51 0 : virtual void SetEventSelection(AliVCuts* cuts) {if (fEventCuts) Changed(); fEventCuts = cuts;}
52 0 : virtual void SetUserCallSelectionMask(Bool_t flag=kTRUE) {TObject::SetBit(kUserCallSelectionMask,flag);}
53 0 : virtual void SetCheckStatistics(Bool_t flag=kTRUE) {Changed(); TObject::SetBit(kCheckStatistics,flag);}
54 0 : virtual void SetNeedField(Bool_t flag=kTRUE) {TObject::SetBit(kNeedField,flag);}
55 : //
56 0 : void SetInactiveBranches(const char* branches) {Changed(); fBranches = branches;}
57 0 : void SetActiveBranches (const char* branches) {Changed(); fBranchesOn = branches;}
58 : // Getters
59 0 : virtual AliVEvent *GetEvent() const {return 0;}
60 0 : virtual const AliEventTag *GetEventTag() const {return 0;}
61 0 : virtual AliRunTag *GetRunTag() const {return 0;}
62 : // Get the statistics object (currently TH2). Option can be BIN0.
63 : virtual TObject *GetStatistics(Option_t *option="") const;
64 0 : virtual Option_t *GetAnalysisType() const {return 0;}
65 36 : virtual TTree *GetTree( ) const {return fTree;}
66 56 : virtual AliVCuts *GetEventSelection() const {return fEventCuts;}
67 : virtual Long64_t GetReadEntry() const;
68 0 : virtual Bool_t IsCheckStatistics() const {return TObject::TestBit(kCheckStatistics);}
69 0 : virtual Bool_t IsUserCallSelectionMask() const {return TObject::TestBit(kUserCallSelectionMask);}
70 : virtual Bool_t NewEvent()
71 0 : {Bool_t ne = fNewEvent; fNewEvent = kFALSE; return ne;}
72 : virtual UInt_t IsEventSelected()
73 16 : {return fIsSelectedResult;}
74 0 : virtual AliMCEvent* MCEvent() const {return 0;}
75 0 : TList *GetUserInfo() const {return fUserInfo;}
76 : // Mixing
77 0 : void SetMixingHandler(AliInputEventHandler* mixing) {Changed(); fMixingHandler = mixing;}
78 0 : AliInputEventHandler* MixingHandler() {return fMixingHandler;}
79 : // Parent Handler
80 0 : void SetParentHandler(AliInputEventHandler* parent) {Changed(); fParentHandler = parent;}
81 0 : AliInputEventHandler* ParentHandler() {return fParentHandler;}
82 :
83 : //PID response
84 0 : virtual AliPIDResponse* GetPIDResponse() {return 0x0;}
85 0 : virtual void CreatePIDResponse(Bool_t /*isMC*/=kFALSE) {;}
86 :
87 : protected:
88 : void SwitchOffBranches() const;
89 : void SwitchOnBranches() const;
90 : private:
91 : AliInputEventHandler(const AliInputEventHandler& handler);
92 : AliInputEventHandler& operator=(const AliInputEventHandler& handler);
93 : protected:
94 : TTree *fTree; //! Pointer to the tree
95 : TString fBranches; // List of branches to be switched off (separated by space)
96 : TString fBranchesOn; // List of branches to be switched on (separated by space)
97 : TString fInputFileName; // Name of the input file
98 : Bool_t fNewEvent; // New event flag
99 : AliVCuts* fEventCuts; // Cuts on the event level
100 : UInt_t fIsSelectedResult; // Selection result
101 : AliInputEventHandler* fMixingHandler; // Optionla plugin for mixing
102 : AliInputEventHandler* fParentHandler; // optional pointer to parent handlers (used in AliMultiInputEventHandler)
103 : TList *fUserInfo; //! transient user info for current tree
104 176 : ClassDef(AliInputEventHandler, 7);
105 : };
106 :
107 : #endif
|