]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/EventMixing/AliMixInputEventHandler.h
Port of new Event Mixing implementation
[u/mrichter/AliRoot.git] / ANALYSIS / EventMixing / AliMixInputEventHandler.h
1 //
2 // Class AliMixEventInputHandler
3 //
4 // Mixing input handler prepare N events before UserExec
5 // TODO example
6 // author:
7 //        Martin Vala (martin.vala@cern.ch)
8 //
9
10 #ifndef ALIMIXINPUTEVENTHANDLER_H
11 #define ALIMIXINPUTEVENTHANDLER_H
12
13 #include <TObjArray.h>
14 #include <TArrayI.h>
15
16 #include "AliMultiInputEventHandler.h"
17
18 class TChain;
19 class AliMixEventPool;
20 class AliMixInputHandlerInfo;
21 class AliInputEventHandler;
22 class AliMixInputEventHandler : public AliMultiInputEventHandler {
23
24 public:
25    AliMixInputEventHandler(const Int_t size = 1, const Int_t mixNum = 1);
26
27    // From the interface
28    virtual Bool_t  Init(Option_t *opt) { return AliMultiInputEventHandler::Init(opt); }
29    virtual Bool_t  Init(TTree *tree, Option_t *opt);
30    virtual Bool_t  Notify();
31    virtual Bool_t  Notify(const char *path);
32    virtual Bool_t  BeginEvent(Long64_t entry);
33    virtual Bool_t  GetEntry();
34    virtual Bool_t  FinishEvent();
35
36    // removing default impementation
37    virtual void            AddInputEventHandler(AliVEventHandler */*inHandler*/);
38
39    void                    SetInputHandlerForMixing(const AliInputEventHandler *const inHandler);
40    void                    SetEventPool(AliMixEventPool *const evPool) { fEventPool = evPool; }
41
42    AliInputEventHandler   *InputEventHandler(const Int_t index);
43    AliMixEventPool        *GetEventPool() const { return fEventPool; }
44    Int_t                   BufferSize() const { return fBufferSize; }
45    Int_t                   NumberMixedTimes() const { return fNumberMixed; }
46    Int_t                   MixNumber() const { return fMixNumber; }
47    Long64_t                EntryAll() const { return fEntryCounter; }
48    void                    UseDefaultProcess(Bool_t b = kTRUE) { fUseDefautProcess = b; }
49    void                    UsePreMixEvents(Bool_t b = kTRUE) { fUsePreMixEvents = b; }
50    void                    SetMixNumber(const Int_t mixNum);
51
52    void                    SetCurrentBinIndex(Int_t const index) { fCurrentBinIndex = index; }
53    void                    SetCurrentEntry(Long64_t const entry) { fCurrentEntry = entry ; }
54    void                    SetCurrentEntryMain(Long64_t const entry) { fCurrentEntryMain = entry ; }
55    void                    SetCurrentEntryMix(Long64_t const entry) { fCurrentEntryMix = entry ; }
56    void                    SetNumberMixed(Int_t const index) { fNumberMixed = index; }
57
58    Int_t                   CurrentBinIndex() const { return fCurrentBinIndex; }
59    Long64_t                CurrentEntry() const { return fCurrentEntry; }
60    Long64_t                CurrentEntryMain() const { return fCurrentEntryMain; }
61    Long64_t                CurrentEntryMix() const { return fCurrentEntryMix; }
62    Int_t                   NumberMixed() const { return fNumberMixed; }
63
64
65
66 protected:
67
68    TObjArray               fMixTrees;              // buffer of input handlers
69    TArrayI                 fTreeMap;               // tree map
70    AliMixInputHandlerInfo *fMixIntupHandlerInfoTmp;//! mix input handler info full chain
71    Long64_t                fEntryCounter;          // entry counter
72    AliMixEventPool        *fEventPool;             // event pool
73    Int_t                   fNumberMixed;           // number of mixed events with current event
74    Int_t                   fMixNumber;             // user's mix number request
75
76 private:
77
78    Bool_t                  fUseDefautProcess;      // use default process
79    Bool_t                  fUsePreMixEvents;       // use pre mixing events
80
81    // mixing info
82    Long64_t fCurrentEntry;       //! current entry number (adds 1 for every event processed on each worker)
83    Long64_t fCurrentEntryMain;   //! current entry in chain of processed files
84    Long64_t fCurrentEntryMix;    //! current mixed entry in chain of processed files
85    Int_t    fCurrentBinIndex;    //! current bin index
86
87    virtual Bool_t          MixStd();
88    virtual Bool_t          MixBuffer();
89    virtual Bool_t          MixEventsMoreTimesWithOneEvent();
90    virtual Bool_t          MixEventsMoreTimesWithBuffer();
91
92    void                    UserExecMixAllTasks(Long64_t entryCounter, Int_t idEntryList, Long64_t entryMainReal, Long64_t entryMixReal, Int_t numMixed);
93
94    AliMixInputEventHandler(const AliMixInputEventHandler& handler);
95    AliMixInputEventHandler &operator=(const AliMixInputEventHandler &handler);
96
97    ClassDef(AliMixInputEventHandler, 1)
98 };
99
100 #endif