]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/EventMixing/AliMixInputEventHandler.h
fixed bug that could ignore libSTEER if libSTEERbase was loaded in LoadModule (JFGO...
[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 <AliVEvent.h>
17
18 #include "AliMultiInputEventHandler.h"
19
20 class TChain;
21 class AliMixEventPool;
22 class AliMixInputHandlerInfo;
23 class AliInputEventHandler;
24 class AliMixInputEventHandler : public AliMultiInputEventHandler {
25
26 public:
27    AliMixInputEventHandler(const Int_t size = 1, const Int_t mixNum = 1);
28
29    // From the interface
30    virtual Bool_t  Init(Option_t *opt) { return AliMultiInputEventHandler::Init(opt); }
31    virtual Bool_t  Init(TTree *tree, Option_t *opt);
32    virtual Bool_t  Notify();
33    virtual Bool_t  Notify(const char *path);
34    virtual Bool_t  BeginEvent(Long64_t entry);
35    virtual Bool_t  GetEntry();
36    virtual Bool_t  FinishEvent();
37
38    // removing default impementation
39    virtual void            AddInputEventHandler(AliVEventHandler */*inHandler*/);
40
41    void                    SetInputHandlerForMixing(const AliInputEventHandler *const inHandler);
42    void                    SetEventPool(AliMixEventPool *const evPool) { fEventPool = evPool; }
43
44    AliMixEventPool        *GetEventPool() const { return fEventPool; }
45    Int_t                   BufferSize() const { return fBufferSize; }
46    Int_t                   NumberMixedTimes() const { return fNumberMixed; }
47    Int_t                   MixNumber() const { return fMixNumber; }
48    Long64_t                EntryAll() const { return fEntryCounter; }
49    void                    UseDefaultProcess(Bool_t b = kTRUE) { fUseDefautProcess = b; }
50    void                    DoMixExtra(Bool_t b = kTRUE) { fDoMixExtra = b; }
51    void                    DoMixIfNotEnoughEvents(Bool_t b = kTRUE) { fDoMixIfNotEnoughEvents = b; }
52    void                    SetMixNumber(const Int_t mixNum);
53
54    void                    SetCurrentBinIndex(Int_t const index) { fCurrentBinIndex = index; }
55    void                    SetCurrentEntry(Long64_t const entry) { fCurrentEntry = entry ; }
56    void                    SetCurrentEntryMain(Long64_t const entry) { fCurrentEntryMain = entry ; }
57    void                    SetCurrentEntryMix(Long64_t const entry) { fCurrentEntryMix = entry ; }
58    void                    SetNumberMixed(Int_t const index) { fNumberMixed = index; }
59
60    Int_t                   CurrentBinIndex() const { return fCurrentBinIndex; }
61    Long64_t                CurrentEntry() const { return fCurrentEntry; }
62    Long64_t                CurrentEntryMain() const { return fCurrentEntryMain; }
63    Long64_t                CurrentEntryMix() const { return fCurrentEntryMix; }
64    Int_t                   NumberMixed() const { return fNumberMixed; }
65
66    void                    SelectCollisionCandidates(UInt_t offlineTriggerMask = AliVEvent::kMB) {fOfflineTriggerMask = offlineTriggerMask;}
67    Bool_t                  IsEventCurrentSelected();
68    Bool_t                  IsMixingIfNotEnoughEvents() { return fDoMixIfNotEnoughEvents;}
69
70 protected:
71
72    TObjArray               fMixTrees;              // buffer of input handlers
73    TArrayI                 fTreeMap;               // tree map
74    AliMixInputHandlerInfo *fMixIntupHandlerInfoTmp;//! mix input handler info full chain
75    Long64_t                fEntryCounter;          // entry counter
76    AliMixEventPool        *fEventPool;             // event pool
77    Int_t                   fNumberMixed;           // number of mixed events with current event
78    Int_t                   fMixNumber;             // user's mix number request
79
80 private:
81
82    Bool_t                  fUseDefautProcess;      // use default process
83    Bool_t                  fDoMixExtra;            // mix extra events to get enough combinations
84    Bool_t                  fDoMixIfNotEnoughEvents;// mix events if they dont have enough events to mix
85
86    // mixing info
87    Long64_t fCurrentEntry;       //! current entry number (adds 1 for every event processed on each worker)
88    Long64_t fCurrentEntryMain;   //! current entry in chain of processed files
89    Long64_t fCurrentEntryMix;    //! current mixed entry in chain of processed files
90    Int_t    fCurrentBinIndex;    //! current bin index
91
92    UInt_t fOfflineTriggerMask;   //  Task processes collision candidates only
93
94    virtual Bool_t          MixStd();
95    virtual Bool_t          MixBuffer();
96    virtual Bool_t          MixEventsMoreTimesWithOneEvent();
97    virtual Bool_t          MixEventsMoreTimesWithBuffer();
98
99    void                    UserExecMixAllTasks(Long64_t entryCounter, Int_t idEntryList, Long64_t entryMainReal, Long64_t entryMixReal, Int_t numMixed);
100
101    AliMixInputEventHandler(const AliMixInputEventHandler &handler);
102    AliMixInputEventHandler &operator=(const AliMixInputEventHandler &handler);
103
104    ClassDef(AliMixInputEventHandler, 3)
105 };
106
107 #endif