]>
Commit | Line | Data |
---|---|---|
48a61f36 | 1 | #ifndef KiddiePoolClasses_h |
2 | #define KiddiePoolClasses_h | |
3 | ||
4 | #include <vector> | |
5 | #include <deque> | |
6 | #include <Rtypes.h> | |
7 | #include <Riostream.h> | |
8 | #include <TObject.h> | |
9 | #include <TFile.h> | |
10 | #include <TMath.h> | |
11 | #include <TSystem.h> | |
12 | ||
13 | class MiniTrack; | |
14 | ||
15 | // Low-memory event mixing classes: | |
16 | // - KiddiePoolManager: Maintain 2D vector (z,cent) of KiddiePools. | |
17 | // - KiddiePool: collections of sub-events in z and mult/cent bins. | |
18 | // - MiniTrack: super-lightweight track "struct" class. | |
19 | // | |
20 | // Stores a buffer of tracks that updates continuously. The track type | |
21 | // contained by the pools can be anything inheriting from | |
22 | // TObject. Pools are updated based on maintaining a minimum fixed | |
23 | // number of tracks. Multiplicity/centrality and z-vertex bins must be | |
24 | // passed in at initialization. For example of implementation, see | |
25 | // $ALICE_ROOT/PWG4/JetTasks/AliAnalysisTaskPhiCorrelations.cxx | |
26 | // | |
27 | // Authors: A. Adare and C. Loizides | |
28 | ||
29 | typedef std::vector< MiniTrack > MiniEvent; | |
30 | ||
31 | class MiniTrack | |
32 | { | |
33 | public: | |
34 | MiniTrack() : fPt(0), fEta(0), fPhi(0), fSign(0) {}; | |
35 | MiniTrack(Double_t pt, Double_t eta, Double_t phi, Int_t sign) : | |
36 | fPt(pt), fEta(eta), fPhi(phi), fSign(sign>=0?1:0) {}; | |
37 | ||
38 | Float_t Eta() const { return fEta; } | |
39 | Float_t Phi() const { return fPhi; } | |
40 | Float_t Pt() const { return fPt; } | |
41 | Int_t Sign() const { if (fSign) return 1; return -1; } | |
42 | ||
43 | protected: | |
44 | Float_t fPt; | |
45 | Float_t fEta; | |
46 | Float_t fPhi; | |
47 | Bool_t fSign; | |
48 | }; | |
49 | ||
50 | class KiddiePool : public TObject | |
51 | { | |
52 | public: | |
53 | KiddiePool(Int_t d) : | |
54 | fEvents(0), | |
55 | fNTracksInEvent(0), | |
56 | fEventIndex(0), | |
57 | fMixDepth(d), | |
58 | fMultMin(-999), | |
59 | fMultMax(+999), | |
60 | fZvtxMin(-999), | |
61 | fZvtxMax(+999), | |
62 | fWasUpdated(0), | |
63 | fMultBinIndex(0), | |
64 | fZvtxBinIndex(0), | |
65 | fDebug(0), | |
66 | fTargetTrackDepth(0), | |
67 | fFirstFilled(0), | |
68 | fNTimes(0) {;} | |
69 | ||
70 | KiddiePool(Int_t d, Double_t multMin, Double_t multMax, | |
71 | Double_t zvtxMin, Double_t zvtxMax) : | |
72 | fEvents(0), | |
73 | fNTracksInEvent(0), | |
74 | fEventIndex(0), | |
75 | fMixDepth(d), | |
76 | fMultMin(multMin), | |
77 | fMultMax(multMax), | |
78 | fZvtxMin(zvtxMin), | |
79 | fZvtxMax(zvtxMax), | |
80 | fWasUpdated(0), | |
81 | fMultBinIndex(0), | |
82 | fZvtxBinIndex(0), | |
83 | fDebug(0), | |
84 | fTargetTrackDepth(0), | |
85 | fFirstFilled(0), | |
86 | fNTimes(0) {;} | |
87 | ~KiddiePool(); | |
88 | ||
89 | Bool_t EventMatchesBin(Int_t mult, Double_t zvtx) const; | |
90 | Bool_t EventMatchesBin(Double_t mult, Double_t zvtx) const; | |
91 | Bool_t IsReady() const { return NTracksInPool() >= fTargetTrackDepth; } | |
92 | Bool_t IsFirstReady() const { return fFirstFilled; } | |
93 | Int_t GetNTimes() const { return fNTimes; } | |
94 | Int_t GetCurrentNEvents() const { return fEvents.size(); } | |
95 | Int_t GlobalEventIndex(Int_t j) const; | |
96 | MiniEvent* GetEvent(Int_t i) const; | |
97 | Int_t MultBinIndex() const { return fMultBinIndex; } | |
98 | Int_t NTracksInEvent(Int_t iEvent) const; | |
99 | Int_t NTracksInCurrentEvent() const { if (fNTracksInEvent.empty()) return 0; | |
100 | return fNTracksInEvent.back(); } | |
101 | void PrintInfo() const; | |
102 | Int_t NTracksInPool() const; | |
103 | Bool_t WasUpdated() const { return fWasUpdated; } | |
104 | Int_t ZvtxBinIndex() const { return fZvtxBinIndex; } | |
105 | void SetDebug(Bool_t b) { fDebug = b; } | |
106 | void SetTargetTrackDepth(Int_t d) { fTargetTrackDepth = d; } | |
107 | Int_t SetEventMultRange(Int_t multMin, Int_t multMax); | |
108 | Int_t SetEventMultRange(Double_t multMin, Double_t multMax); | |
109 | Int_t SetEventZvtxRange(Double_t zvtxMin, Double_t zvtxMax); | |
110 | void SetMultBinIndex(Int_t iM) { fMultBinIndex = iM; } | |
111 | void SetZvtxBinIndex(Int_t iZ) { fZvtxBinIndex = iZ; } | |
112 | Int_t UpdatePool(MiniEvent* miniEvt); | |
113 | ||
114 | protected: | |
115 | deque< MiniEvent* > fEvents; //Pool of events storing Minitracks | |
116 | deque<int> fNTracksInEvent; //Tracks in event | |
117 | deque<int> fEventIndex; //Original event index | |
118 | Int_t fMixDepth; //Number of evts. to mix with | |
119 | Double_t fMultMin, fMultMax; //Track multiplicity bin range | |
120 | Double_t fZvtxMin, fZvtxMax; //Event z-vertex bin range | |
121 | Bool_t fWasUpdated; //Evt. succesfully passed selection? | |
122 | Int_t fMultBinIndex; //Multiplicity bin | |
123 | Int_t fZvtxBinIndex; //Zvertex bin | |
124 | Int_t fDebug; //If 1 then debug on | |
125 | Int_t fTargetTrackDepth; //Number of tracks, once full | |
126 | Bool_t fFirstFilled; //Init to false | |
127 | Int_t fNTimes; //Number of times init. condition reached | |
128 | ||
129 | ClassDef(KiddiePool,1) // Event pool class | |
130 | }; | |
131 | ||
132 | class KiddiePoolManager : public TObject | |
133 | { | |
134 | public: | |
135 | KiddiePoolManager() : | |
136 | fDebug(0), | |
137 | fNMultBins(0), | |
138 | fNZvtxBins(0), | |
139 | fEvPool(0), | |
140 | fTargetTrackDepth(0) {;} | |
141 | KiddiePoolManager(Int_t maxEvts, Int_t minNTracks, | |
142 | Int_t nMultBins, Double_t *multbins, | |
143 | Int_t nZvtxBins, Double_t *zvtxbins); | |
144 | ||
145 | ~KiddiePoolManager(); | |
146 | ||
147 | // First uses bin indices, second uses the variables themselves. | |
148 | KiddiePool *GetEventPool(Int_t iMult, Int_t iZvtx) const; | |
149 | KiddiePool *GetEventPool(Int_t centVal, Double_t zvtxVal) const; | |
150 | KiddiePool *GetEventPool(Double_t centVal, Double_t zvtxVal) const; | |
151 | ||
152 | Int_t InitEventPools(Int_t depth, | |
153 | Int_t nmultbins, Double_t *multbins, | |
154 | Int_t nzvtxbins, Double_t *zvtxbins); | |
155 | void SetTargetTrackDepth(Int_t d) { fTargetTrackDepth = d;} | |
156 | Int_t UpdatePools(MiniEvent*); | |
157 | void SetDebug(Bool_t b) { fDebug = b; } | |
158 | ||
159 | protected: | |
160 | Int_t fDebug; // If 1 then debug on | |
161 | Int_t fNMultBins; // number mult bins | |
162 | Int_t fNZvtxBins; // number vertex bins | |
163 | vector< vector<KiddiePool*> > fEvPool; // pool in bins of [fMultBin][fZvtxBin] | |
164 | Int_t fTargetTrackDepth; // Required track size, same for all pools. | |
165 | ||
166 | ClassDef(KiddiePoolManager,1) | |
167 | }; | |
168 | #endif |