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/PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations.cxx
23 // Authors: A. Adare and C. Loizides
27 class AliEventPool : public TObject
47 AliEventPool(Int_t d, Double_t multMin, Double_t multMax,
48 Double_t zvtxMin, Double_t zvtxMax)
66 Bool_t EventMatchesBin(Int_t mult, Double_t zvtx) const;
67 Bool_t EventMatchesBin(Double_t mult, Double_t zvtx) const;
68 Bool_t IsReady() const { return NTracksInPool() >= fTargetTrackDepth; }
69 Bool_t IsFirstReady() const { return fFirstFilled; }
70 Int_t GetNTimes() const { return fNTimes; }
71 Int_t GetCurrentNEvents() const { return fEvents.size(); }
72 Int_t GlobalEventIndex(Int_t j) const;
73 TObject *GetRandomTrack() const;
74 TObjArray *GetRandomEvent() const;
75 TObjArray *GetEvent(Int_t i) const;
76 Int_t MultBinIndex() const { return fMultBinIndex; }
77 Int_t NTracksInEvent(Int_t iEvent) const;
78 Int_t NTracksInCurrentEvent() const { return fNTracksInEvent.back(); }
79 void PrintInfo() const;
80 Int_t NTracksInPool() const;
81 Bool_t WasUpdated() const { return fWasUpdated; }
82 Int_t ZvtxBinIndex() const { return fZvtxBinIndex; }
83 void SetDebug(Bool_t b) { fDebug = b; }
84 void SetTargetTrackDepth(Int_t d) { fTargetTrackDepth = d; }
85 Int_t SetEventMultRange(Int_t multMin, Int_t multMax);
86 Int_t SetEventMultRange(Double_t multMin, Double_t multMax);
87 Int_t SetEventZvtxRange(Double_t zvtxMin, Double_t zvtxMax);
88 void SetMultBinIndex(Int_t iM) { fMultBinIndex = iM; }
89 void SetZvtxBinIndex(Int_t iZ) { fZvtxBinIndex = iZ; }
90 Int_t UpdatePool(TObjArray *trk);
93 deque<TObjArray*> fEvents; //Holds TObjArrays of MyTracklets
94 deque<int> fNTracksInEvent; //Tracks in event
95 deque<int> fEventIndex; //Original event index
96 Int_t fMixDepth; //Number of evts. to mix with
97 Double_t fMultMin, fMultMax; //Track multiplicity bin range
98 Double_t fZvtxMin, fZvtxMax; //Event z-vertex bin range
99 Bool_t fWasUpdated; //Evt. succesfully passed selection?
100 Int_t fMultBinIndex; //Multiplicity bin
101 Int_t fZvtxBinIndex; //Zvertex bin
102 Int_t fDebug; //If 1 then debug on
103 Int_t fTargetTrackDepth; //Number of tracks, once full
104 Bool_t fFirstFilled; //Init to false
105 Int_t fNTimes; //Number of times init. condition reached
107 ClassDef(AliEventPool,1) // Event pool class
110 class AliEventPoolManager : public TObject
113 AliEventPoolManager()
118 fTargetTrackDepth(0) {;}
119 AliEventPoolManager(Int_t maxEvts, Int_t minNTracks,
120 Int_t nMultBins, Double_t *multbins,
121 Int_t nZvtxBins, Double_t *zvtxbins);
123 ~AliEventPoolManager() {;}
125 // First uses bin indices, second uses the variables themselves.
126 AliEventPool *GetEventPool(Int_t iMult, Int_t iZvtx) const;
127 AliEventPool *GetEventPool(Int_t centVal, Double_t zvtxVal) const;
128 AliEventPool *GetEventPool(Double_t centVal, Double_t zvtxVal) const;
130 Int_t InitEventPools(Int_t depth,
131 Int_t nmultbins, Double_t *multbins,
132 Int_t nzvtxbins, Double_t *zvtxbins);
133 void SetTargetTrackDepth(Int_t d) { fTargetTrackDepth = d;} // Same as for G.E.P. class
134 Int_t UpdatePools(TObjArray *trk);
135 void SetDebug(Bool_t b) { fDebug = b; }
138 Int_t fDebug; // If 1 then debug on
139 Int_t fNMultBins; // number mult bins
140 Int_t fNZvtxBins; // number vertex bins
141 std::vector<std::vector<AliEventPool*> > fEvPool; // pool in bins of [fMultBin][fZvtxBin]
142 Int_t fTargetTrackDepth; // Required track size, same for all pools.
144 ClassDef(AliEventPoolManager,1)