]>
Commit | Line | Data |
---|---|---|
b425275c | 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> | |
c65f16c8 | 14 | #include <TEntryList.h> |
b425275c | 15 | #include <TArrayI.h> |
16 | ||
62e756a5 | 17 | #include <AliVEvent.h> |
18 | ||
b425275c | 19 | #include "AliMultiInputEventHandler.h" |
20 | ||
21 | class TChain; | |
c65f16c8 | 22 | class TChainElement; |
b425275c | 23 | class AliMixEventPool; |
24 | class AliMixInputHandlerInfo; | |
25 | class AliInputEventHandler; | |
26 | class AliMixInputEventHandler : public AliMultiInputEventHandler { | |
27 | ||
28 | public: | |
29 | AliMixInputEventHandler(const Int_t size = 1, const Int_t mixNum = 1); | |
e3582ebd | 30 | virtual ~AliMixInputEventHandler(); |
b425275c | 31 | // From the interface |
32 | virtual Bool_t Init(Option_t *opt) { return AliMultiInputEventHandler::Init(opt); } | |
33 | virtual Bool_t Init(TTree *tree, Option_t *opt); | |
34 | virtual Bool_t Notify(); | |
35 | virtual Bool_t Notify(const char *path); | |
36 | virtual Bool_t BeginEvent(Long64_t entry); | |
37 | virtual Bool_t GetEntry(); | |
38 | virtual Bool_t FinishEvent(); | |
39 | ||
40 | // removing default impementation | |
41 | virtual void AddInputEventHandler(AliVEventHandler */*inHandler*/); | |
42 | ||
43 | void SetInputHandlerForMixing(const AliInputEventHandler *const inHandler); | |
44 | void SetEventPool(AliMixEventPool *const evPool) { fEventPool = evPool; } | |
45 | ||
b425275c | 46 | AliMixEventPool *GetEventPool() const { return fEventPool; } |
47 | Int_t BufferSize() const { return fBufferSize; } | |
48 | Int_t NumberMixedTimes() const { return fNumberMixed; } | |
49 | Int_t MixNumber() const { return fMixNumber; } | |
50 | Long64_t EntryAll() const { return fEntryCounter; } | |
51 | void UseDefaultProcess(Bool_t b = kTRUE) { fUseDefautProcess = b; } | |
917b33da | 52 | void DoMixExtra(Bool_t b = kTRUE) { fDoMixExtra = b; } |
53 | void DoMixIfNotEnoughEvents(Bool_t b = kTRUE) { fDoMixIfNotEnoughEvents = b; } | |
b425275c | 54 | void SetMixNumber(const Int_t mixNum); |
55 | ||
56 | void SetCurrentBinIndex(Int_t const index) { fCurrentBinIndex = index; } | |
57 | void SetCurrentEntry(Long64_t const entry) { fCurrentEntry = entry ; } | |
58 | void SetCurrentEntryMain(Long64_t const entry) { fCurrentEntryMain = entry ; } | |
59 | void SetCurrentEntryMix(Long64_t const entry) { fCurrentEntryMix = entry ; } | |
60 | void SetNumberMixed(Int_t const index) { fNumberMixed = index; } | |
61 | ||
62 | Int_t CurrentBinIndex() const { return fCurrentBinIndex; } | |
63 | Long64_t CurrentEntry() const { return fCurrentEntry; } | |
64 | Long64_t CurrentEntryMain() const { return fCurrentEntryMain; } | |
65 | Long64_t CurrentEntryMix() const { return fCurrentEntryMix; } | |
66 | Int_t NumberMixed() const { return fNumberMixed; } | |
67 | ||
62e756a5 | 68 | void SelectCollisionCandidates(UInt_t offlineTriggerMask = AliVEvent::kMB) {fOfflineTriggerMask = offlineTriggerMask;} |
69 | Bool_t IsEventCurrentSelected(); | |
917b33da | 70 | Bool_t IsMixingIfNotEnoughEvents() { return fDoMixIfNotEnoughEvents;} |
71 | ||
c65f16c8 | 72 | void DoMixEventGetEntryAuto(Bool_t doAuto=kTRUE) { fDoMixEventGetEntryAuto = doAuto; } |
73 | ||
74 | Bool_t GetEntryMainEvent(); | |
75 | Bool_t GetEntryMixedEvent(Int_t idHandler=0); | |
b425275c | 76 | protected: |
77 | ||
78 | TObjArray fMixTrees; // buffer of input handlers | |
79 | TArrayI fTreeMap; // tree map | |
80 | AliMixInputHandlerInfo *fMixIntupHandlerInfoTmp;//! mix input handler info full chain | |
81 | Long64_t fEntryCounter; // entry counter | |
82 | AliMixEventPool *fEventPool; // event pool | |
83 | Int_t fNumberMixed; // number of mixed events with current event | |
84 | Int_t fMixNumber; // user's mix number request | |
85 | ||
86 | private: | |
87 | ||
88 | Bool_t fUseDefautProcess; // use default process | |
917b33da | 89 | Bool_t fDoMixExtra; // mix extra events to get enough combinations |
c65f16c8 | 90 | Bool_t fDoMixIfNotEnoughEvents;// mix events if they don't have enough events to mix |
91 | Bool_t fDoMixEventGetEntryAuto;// flag for preparing mixed events automatically (default on) | |
b425275c | 92 | |
93 | // mixing info | |
94 | Long64_t fCurrentEntry; //! current entry number (adds 1 for every event processed on each worker) | |
95 | Long64_t fCurrentEntryMain; //! current entry in chain of processed files | |
96 | Long64_t fCurrentEntryMix; //! current mixed entry in chain of processed files | |
97 | Int_t fCurrentBinIndex; //! current bin index | |
e580d8f4 | 98 | ULong64_t fOfflineTriggerMask; // Task processes collision candidates only |
62e756a5 | 99 | |
c65f16c8 | 100 | TEntryList fCurrentMixEntry; //! array of mix entries currently used (user should touch) |
101 | Long64_t fCurrentEntryMainTree; //! current entry in current tree (main event) | |
102 | ||
b425275c | 103 | virtual Bool_t MixStd(); |
104 | virtual Bool_t MixBuffer(); | |
105 | virtual Bool_t MixEventsMoreTimesWithOneEvent(); | |
106 | virtual Bool_t MixEventsMoreTimesWithBuffer(); | |
107 | ||
108 | void UserExecMixAllTasks(Long64_t entryCounter, Int_t idEntryList, Long64_t entryMainReal, Long64_t entryMixReal, Int_t numMixed); | |
109 | ||
35e08f92 | 110 | AliMixInputEventHandler(const AliMixInputEventHandler &handler); |
b425275c | 111 | AliMixInputEventHandler &operator=(const AliMixInputEventHandler &handler); |
112 | ||
c65f16c8 | 113 | ClassDef(AliMixInputEventHandler, 5) |
b425275c | 114 | }; |
115 | ||
116 | #endif |