1 #ifndef AliEventPoolManager_h
2 #define AliEventPoolManager_h
14 // Generic event mixing classes
16 // Stores a buffer of tracks that updates continuously. The track type
17 // contained by the pools can be anything inheriting from
18 // TObject. Pools are updated based on maintaining a minimum fixed
19 // number of tracks. Multiplicity/centrality and z-vertex bins must be
20 // passed in at initialization. For example of implementation, see
21 // $ALICE_ROOT/PWG4/Correlations/AliAnalysisTaskPhiCorrelations.cxx
23 // Authors: A. Adare and C. Loizides
25 class AliEventPool : public TObject
45 AliEventPool(Int_t d, Double_t multMin, Double_t multMax,
46 Double_t zvtxMin, Double_t zvtxMax)
64 Bool_t EventMatchesBin(Int_t mult, Double_t zvtx) const;
65 Bool_t EventMatchesBin(Double_t mult, Double_t zvtx) const;
66 Bool_t IsReady() const { return NTracksInPool() >= fTargetTrackDepth; }
67 Bool_t IsFirstReady() const { return fFirstFilled; }
68 Int_t GetNTimes() const { return fNTimes; }
69 Int_t GetCurrentNEvents() const { return fEvents.size(); }
70 Int_t GlobalEventIndex(Int_t j) const;
71 TObject *GetRandomTrack() const;
72 TObjArray *GetRandomEvent() const;
73 TObjArray *GetEvent(Int_t i) const;
74 Int_t MultBinIndex() const { return fMultBinIndex; }
75 Int_t NTracksInEvent(Int_t iEvent) const;
76 Int_t NTracksInCurrentEvent() const { return fNTracksInEvent.back(); }
77 void PrintInfo() const;
78 Int_t NTracksInPool() const;
79 Bool_t WasUpdated() const { return fWasUpdated; }
80 Int_t ZvtxBinIndex() const { return fZvtxBinIndex; }
81 void SetDebug(Bool_t b) { fDebug = b; }
82 void SetTargetTrackDepth(Int_t d) { fTargetTrackDepth = d; }
83 Int_t SetEventMultRange(Int_t multMin, Int_t multMax);
84 Int_t SetEventMultRange(Double_t multMin, Double_t multMax);
85 Int_t SetEventZvtxRange(Double_t zvtxMin, Double_t zvtxMax);
86 void SetMultBinIndex(Int_t iM) { fMultBinIndex = iM; }
87 void SetZvtxBinIndex(Int_t iZ) { fZvtxBinIndex = iZ; }
88 Int_t UpdatePool(TObjArray *trk);
91 deque<TObjArray*> fEvents; //Holds TObjArrays of MyTracklets
92 deque<int> fNTracksInEvent; //Tracks in event
93 deque<int> fEventIndex; //Original event index
94 Int_t fMixDepth; //Number of evts. to mix with
95 Double_t fMultMin, fMultMax; //Track multiplicity bin range
96 Double_t fZvtxMin, fZvtxMax; //Event z-vertex bin range
97 Bool_t fWasUpdated; //Evt. succesfully passed selection?
98 Int_t fMultBinIndex; //Multiplicity bin
99 Int_t fZvtxBinIndex; //Zvertex bin
100 Int_t fDebug; //If 1 then debug on
101 Int_t fTargetTrackDepth; //Number of tracks, once full
102 Bool_t fFirstFilled; //Init to false
103 Int_t fNTimes; //Number of times init. condition reached
105 ClassDef(AliEventPool,1) // Event pool class
108 class AliEventPoolManager : public TObject
111 AliEventPoolManager()
116 fTargetTrackDepth(0) {;}
117 AliEventPoolManager(Int_t maxEvts, Int_t minNTracks,
118 Int_t nMultBins, Double_t *multbins,
119 Int_t nZvtxBins, Double_t *zvtxbins);
121 ~AliEventPoolManager() {;}
123 // First uses bin indices, second uses the variables themselves.
124 AliEventPool *GetEventPool(Int_t iMult, Int_t iZvtx) const;
125 AliEventPool *GetEventPool(Int_t centVal, Double_t zvtxVal) const;
126 AliEventPool *GetEventPool(Double_t centVal, Double_t zvtxVal) const;
128 Int_t InitEventPools(Int_t depth,
129 Int_t nmultbins, Double_t *multbins,
130 Int_t nzvtxbins, Double_t *zvtxbins);
131 void SetTargetTrackDepth(Int_t d) { fTargetTrackDepth = d;} // Same as for G.E.P. class
132 Int_t UpdatePools(TObjArray *trk);
133 void SetDebug(Bool_t b) { fDebug = b; }
136 Int_t fDebug; // If 1 then debug on
137 Int_t fNMultBins; // number mult bins
138 Int_t fNZvtxBins; // number vertex bins
139 std::vector<std::vector<AliEventPool*> > fEvPool; // pool in bins of [fMultBin][fZvtxBin]
140 Int_t fTargetTrackDepth; // Required track size, same for all pools.
142 ClassDef(AliEventPoolManager,1)