]>
Commit | Line | Data |
---|---|---|
2a910c25 | 1 | #ifndef AliEventPoolManager_h |
2 | #define AliEventPoolManager_h | |
3 | ||
4 | #include <vector> | |
5 | #include <deque> | |
6 | #include <Rtypes.h> | |
7 | #include <Riostream.h> | |
8 | #include <TObjArray.h> | |
9 | #include <TFile.h> | |
10 | #include <TMath.h> | |
11 | #include <TRandom.h> | |
12 | #include <TSystem.h> | |
13 | ||
14 | // Generic event mixing classes | |
15 | // | |
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 | |
15695e03 | 21 | // $ALICE_ROOT/PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations.cxx |
2a910c25 | 22 | // |
23 | // Authors: A. Adare and C. Loizides | |
24 | ||
c82bb898 | 25 | using std::deque; |
26 | ||
2a910c25 | 27 | class AliEventPool : public TObject |
28 | { | |
29 | public: | |
30 | AliEventPool(Int_t d) | |
31 | : fEvents(0), | |
32 | fNTracksInEvent(0), | |
33 | fEventIndex(0), | |
34 | fMixDepth(d), | |
35 | fMultMin(-999), | |
36 | fMultMax(+999), | |
37 | fZvtxMin(-999), | |
38 | fZvtxMax(+999), | |
39 | fWasUpdated(0), | |
40 | fMultBinIndex(0), | |
41 | fZvtxBinIndex(0), | |
42 | fDebug(0), | |
43 | fTargetTrackDepth(0), | |
44 | fFirstFilled(0), | |
45 | fNTimes(0) {;} | |
46 | ||
47 | AliEventPool(Int_t d, Double_t multMin, Double_t multMax, | |
48 | Double_t zvtxMin, Double_t zvtxMax) | |
49 | : fEvents(0), | |
50 | fNTracksInEvent(0), | |
51 | fEventIndex(0), | |
52 | fMixDepth(d), | |
53 | fMultMin(multMin), | |
54 | fMultMax(multMax), | |
55 | fZvtxMin(zvtxMin), | |
56 | fZvtxMax(zvtxMax), | |
57 | fWasUpdated(0), | |
58 | fMultBinIndex(0), | |
59 | fZvtxBinIndex(0), | |
60 | fDebug(0), | |
61 | fTargetTrackDepth(0), | |
62 | fFirstFilled(0), | |
63 | fNTimes(0) {;} | |
64 | ~AliEventPool() {;} | |
65 | ||
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; } | |
fa67180e | 69 | Bool_t IsFirstReady() const { return fFirstFilled; } |
70 | Int_t GetNTimes() const { return fNTimes; } | |
2a910c25 | 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); | |
91 | ||
92 | protected: | |
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 | |
106 | ||
107 | ClassDef(AliEventPool,1) // Event pool class | |
108 | }; | |
109 | ||
110 | class AliEventPoolManager : public TObject | |
111 | { | |
112 | public: | |
113 | AliEventPoolManager() | |
114 | : fDebug(0), | |
115 | fNMultBins(0), | |
116 | fNZvtxBins(0), | |
117 | fEvPool(0), | |
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); | |
122 | ||
123 | ~AliEventPoolManager() {;} | |
124 | ||
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; | |
129 | ||
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; } | |
136 | ||
137 | protected: | |
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. | |
143 | ||
144 | ClassDef(AliEventPoolManager,1) | |
145 | }; | |
146 | #endif |