]>
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 | |
21 | // $ALICE_ROOT/PWG4/JetTasks/AliAnalysisTaskPhiCorrelations.cxx | |
22 | // | |
23 | // Authors: A. Adare and C. Loizides | |
24 | ||
25 | class AliEventPool : public TObject | |
26 | { | |
27 | public: | |
28 | AliEventPool(Int_t d) | |
29 | : fEvents(0), | |
30 | fNTracksInEvent(0), | |
31 | fEventIndex(0), | |
32 | fMixDepth(d), | |
33 | fMultMin(-999), | |
34 | fMultMax(+999), | |
35 | fZvtxMin(-999), | |
36 | fZvtxMax(+999), | |
37 | fWasUpdated(0), | |
38 | fMultBinIndex(0), | |
39 | fZvtxBinIndex(0), | |
40 | fDebug(0), | |
41 | fTargetTrackDepth(0), | |
42 | fFirstFilled(0), | |
43 | fNTimes(0) {;} | |
44 | ||
45 | AliEventPool(Int_t d, Double_t multMin, Double_t multMax, | |
46 | Double_t zvtxMin, Double_t zvtxMax) | |
47 | : fEvents(0), | |
48 | fNTracksInEvent(0), | |
49 | fEventIndex(0), | |
50 | fMixDepth(d), | |
51 | fMultMin(multMin), | |
52 | fMultMax(multMax), | |
53 | fZvtxMin(zvtxMin), | |
54 | fZvtxMax(zvtxMax), | |
55 | fWasUpdated(0), | |
56 | fMultBinIndex(0), | |
57 | fZvtxBinIndex(0), | |
58 | fDebug(0), | |
59 | fTargetTrackDepth(0), | |
60 | fFirstFilled(0), | |
61 | fNTimes(0) {;} | |
62 | ~AliEventPool() {;} | |
63 | ||
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 | Int_t GetCurrentNEvents() const { return fEvents.size(); } | |
68 | Int_t GlobalEventIndex(Int_t j) const; | |
69 | TObject *GetRandomTrack() const; | |
70 | TObjArray *GetRandomEvent() const; | |
71 | TObjArray *GetEvent(Int_t i) const; | |
72 | Int_t MultBinIndex() const { return fMultBinIndex; } | |
73 | Int_t NTracksInEvent(Int_t iEvent) const; | |
74 | Int_t NTracksInCurrentEvent() const { return fNTracksInEvent.back(); } | |
75 | void PrintInfo() const; | |
76 | Int_t NTracksInPool() const; | |
77 | Bool_t WasUpdated() const { return fWasUpdated; } | |
78 | Int_t ZvtxBinIndex() const { return fZvtxBinIndex; } | |
79 | void SetDebug(Bool_t b) { fDebug = b; } | |
80 | void SetTargetTrackDepth(Int_t d) { fTargetTrackDepth = d; } | |
81 | Int_t SetEventMultRange(Int_t multMin, Int_t multMax); | |
82 | Int_t SetEventMultRange(Double_t multMin, Double_t multMax); | |
83 | Int_t SetEventZvtxRange(Double_t zvtxMin, Double_t zvtxMax); | |
84 | void SetMultBinIndex(Int_t iM) { fMultBinIndex = iM; } | |
85 | void SetZvtxBinIndex(Int_t iZ) { fZvtxBinIndex = iZ; } | |
86 | Int_t UpdatePool(TObjArray *trk); | |
87 | ||
88 | protected: | |
89 | deque<TObjArray*> fEvents; //Holds TObjArrays of MyTracklets | |
90 | deque<int> fNTracksInEvent; //Tracks in event | |
91 | deque<int> fEventIndex; //Original event index | |
92 | Int_t fMixDepth; //Number of evts. to mix with | |
93 | Double_t fMultMin, fMultMax; //Track multiplicity bin range | |
94 | Double_t fZvtxMin, fZvtxMax; //Event z-vertex bin range | |
95 | Bool_t fWasUpdated; //Evt. succesfully passed selection? | |
96 | Int_t fMultBinIndex; //Multiplicity bin | |
97 | Int_t fZvtxBinIndex; //Zvertex bin | |
98 | Int_t fDebug; //If 1 then debug on | |
99 | Int_t fTargetTrackDepth; //Number of tracks, once full | |
100 | Bool_t fFirstFilled; //Init to false | |
101 | Int_t fNTimes; //Number of times init. condition reached | |
102 | ||
103 | ClassDef(AliEventPool,1) // Event pool class | |
104 | }; | |
105 | ||
106 | class AliEventPoolManager : public TObject | |
107 | { | |
108 | public: | |
109 | AliEventPoolManager() | |
110 | : fDebug(0), | |
111 | fNMultBins(0), | |
112 | fNZvtxBins(0), | |
113 | fEvPool(0), | |
114 | fTargetTrackDepth(0) {;} | |
115 | AliEventPoolManager(Int_t maxEvts, Int_t minNTracks, | |
116 | Int_t nMultBins, Double_t *multbins, | |
117 | Int_t nZvtxBins, Double_t *zvtxbins); | |
118 | ||
119 | ~AliEventPoolManager() {;} | |
120 | ||
121 | // First uses bin indices, second uses the variables themselves. | |
122 | AliEventPool *GetEventPool(Int_t iMult, Int_t iZvtx) const; | |
123 | AliEventPool *GetEventPool(Int_t centVal, Double_t zvtxVal) const; | |
124 | AliEventPool *GetEventPool(Double_t centVal, Double_t zvtxVal) const; | |
125 | ||
126 | Int_t InitEventPools(Int_t depth, | |
127 | Int_t nmultbins, Double_t *multbins, | |
128 | Int_t nzvtxbins, Double_t *zvtxbins); | |
129 | void SetTargetTrackDepth(Int_t d) { fTargetTrackDepth = d;} // Same as for G.E.P. class | |
130 | Int_t UpdatePools(TObjArray *trk); | |
131 | void SetDebug(Bool_t b) { fDebug = b; } | |
132 | ||
133 | protected: | |
134 | Int_t fDebug; // If 1 then debug on | |
135 | Int_t fNMultBins; // number mult bins | |
136 | Int_t fNZvtxBins; // number vertex bins | |
137 | std::vector<std::vector<AliEventPool*> > fEvPool; // pool in bins of [fMultBin][fZvtxBin] | |
138 | Int_t fTargetTrackDepth; // Required track size, same for all pools. | |
139 | ||
140 | ClassDef(AliEventPoolManager,1) | |
141 | }; | |
142 | #endif |