]>
Commit | Line | Data |
---|---|---|
58f5fae2 | 1 | // |
2 | // Class used to handle the input from AODs and put it into histograms | |
3 | // the Forward Flow tasks can run on. | |
4 | // It can also add flow to AliAODMCParticles. | |
5 | // | |
6 | #include <iostream> | |
7 | #include "AliForwardFlowUtil.h" | |
8 | #include "AliAODCentralMult.h" | |
9 | #include "AliAODMCParticle.h" | |
10 | #include "AliAODMCHeader.h" | |
11 | #include "AliLog.h" | |
12 | #include "AliAODForwardMult.h" | |
13 | #include "AliAODEvent.h" | |
14 | ||
15 | ClassImp(AliForwardFlowUtil) | |
16 | ||
17 | //_____________________________________________________________________ | |
18 | AliForwardFlowUtil::AliForwardFlowUtil() : | |
19 | fList(0), | |
ffca499d | 20 | fZvertex(0) |
21 | { | |
58f5fae2 | 22 | // |
23 | // Default Constructor | |
24 | // | |
ffca499d | 25 | } |
58f5fae2 | 26 | //_____________________________________________________________________ |
27 | AliForwardFlowUtil::AliForwardFlowUtil(TList* outputList) : | |
28 | fList(0), | |
29 | fZvertex(0) | |
30 | { | |
31 | // | |
32 | // Constructor | |
33 | // | |
34 | // Parameters: | |
35 | // TList: list containing histograms for flow analysis | |
36 | // | |
37 | fList = outputList; | |
38 | } | |
39 | //_____________________________________________________________________ | |
40 | Bool_t AliForwardFlowUtil::AODCheck(const AliAODForwardMult* aodfm) const | |
41 | { | |
42 | // | |
43 | // Function to check that and AOD event meets the cuts | |
44 | // | |
45 | // Parameters: | |
46 | // AliAODForwardMult: forward mult object with trigger and vertex info | |
47 | // | |
9453b19e | 48 | return aodfm->CheckEvent(AliAODForwardMult::kInel, -fZvertex, fZvertex, |
49 | 0, 0); | |
58f5fae2 | 50 | } |
51 | //_____________________________________________________________________ | |
52 | Bool_t AliForwardFlowUtil::LoopAODFMD(const AliAODEvent* aodevent) const | |
53 | { | |
54 | // | |
55 | // Loop over AliAODFowardMult object and fill histograms provided | |
56 | // by flow task. | |
57 | // | |
58 | AliAODForwardMult* aodfmult = static_cast<AliAODForwardMult*>(aodevent->FindListObject("Forward")); | |
59 | if (!aodfmult) return kFALSE; | |
60 | if (!AODCheck(aodfmult)) return kFALSE; | |
61 | ||
62 | TH2D hdNdetadphi = aodfmult->GetHistogram(); | |
63 | TH1D* dNdphi = (TH1D*)fList->FindObject("hdNdphiSE"); | |
64 | TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSE"); | |
65 | dNdphi->Reset(); | |
66 | dNdetadphi->Reset(); | |
67 | ||
68 | Double_t mult = 0; | |
69 | Double_t eta = 0; | |
70 | Double_t phi = 0; | |
71 | Double_t weight = 0; | |
72 | for (Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) { | |
73 | eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin); | |
74 | for (Int_t phiBin = 1; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) { | |
75 | phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin); | |
76 | weight = hdNdetadphi.GetBinContent(etaBin, phiBin); | |
77 | dNdetadphi->Fill(eta, phi, weight); | |
78 | if (eta < 4.) dNdphi->Fill(phi, weight); | |
79 | mult += weight; | |
80 | } | |
81 | } | |
82 | dNdphi->SetBinContent(0, mult); | |
83 | // if (aodfmult->HasCentrality()) dNdphi->SetBinContent(dNdphi->GetNbinsX()+1, aodfmult->GetCentrality()); | |
84 | // else dNdphi->SetBinContent(dNdphi->GetNbinsX()+1, -1); | |
85 | ||
86 | dNdphi->SetBinContent(dNdphi->GetNbinsX()+1, GetCentFromMC(aodevent)); | |
87 | return kTRUE; | |
88 | } | |
89 | //_____________________________________________________________________ | |
90 | Bool_t AliForwardFlowUtil::LoopAODSPD(const AliAODEvent* aodevent) const | |
91 | { | |
92 | // | |
93 | // Loop over AliAODCentralMult object and fill histograms | |
94 | // provided by flow task | |
95 | // | |
96 | AliAODCentralMult* aodcmult = static_cast<AliAODCentralMult*>(aodevent->FindListObject("CentralClusters")); | |
97 | if (!aodcmult) return kFALSE; | |
98 | ||
99 | TH2D hdNdetadphi = aodcmult->GetHistogram(); | |
100 | TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSESPD"); | |
101 | dNdetadphi->Reset(); | |
102 | ||
103 | Double_t eta = 0; | |
104 | Double_t phi = 0; | |
105 | Double_t weight = 0; | |
106 | for (Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) { | |
107 | eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin); | |
108 | for (Int_t phiBin = 1; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) { | |
109 | phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin); | |
110 | weight = hdNdetadphi.GetBinContent(etaBin, phiBin); | |
111 | dNdetadphi->Fill(eta, phi, weight); | |
112 | } | |
113 | } | |
114 | return kTRUE; | |
115 | } | |
116 | //_____________________________________________________________________ | |
117 | Bool_t AliForwardFlowUtil::LoopAODtrrefHits(const AliAODEvent* aodevent) const | |
118 | { | |
119 | // | |
120 | // Loop over AliAODForwardMult object, get MC track ref information | |
121 | // and fill flow histograms | |
122 | // | |
123 | ||
124 | AliAODForwardMult* aodfmult = static_cast<AliAODForwardMult*>(aodevent->FindListObject("ForwardMC")); | |
125 | if (!aodfmult) return kFALSE; | |
126 | // if (!AODCheck(aodfmult)) return kFALSE; | |
127 | ||
128 | TH2D hdNdetadphi = aodfmult->GetHistogram(); | |
129 | TH1D* dNdphi = (TH1D*)fList->FindObject("hdNdphiSETrRef"); | |
130 | TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSETrRef"); | |
131 | dNdphi->Reset(); | |
132 | dNdetadphi->Reset(); | |
133 | ||
134 | Double_t mult = 0; | |
135 | Double_t eta = 0; | |
136 | Double_t phi = 0; | |
137 | Double_t weight = 0; | |
138 | for(Int_t etaBin = 1; etaBin<=hdNdetadphi.GetNbinsX(); etaBin++) { | |
139 | eta = hdNdetadphi.GetXaxis()->GetBinCenter(etaBin); | |
140 | for(Int_t phiBin = 1; phiBin<=hdNdetadphi.GetNbinsY(); phiBin++) { | |
141 | phi = hdNdetadphi.GetYaxis()->GetBinCenter(phiBin); | |
142 | weight = hdNdetadphi.GetBinContent(etaBin, phiBin); | |
143 | dNdetadphi->Fill(eta, phi, weight); | |
144 | dNdphi->Fill(phi, weight); | |
145 | mult += weight; | |
146 | } | |
147 | } | |
148 | dNdphi->SetBinContent(0, mult); | |
149 | ||
150 | return kTRUE; | |
151 | } | |
152 | //_____________________________________________________________________ | |
153 | Bool_t AliForwardFlowUtil::LoopAODmc(const AliAODEvent* aodevent, | |
154 | TString addFlow = "", | |
155 | Int_t type = 0, | |
156 | Int_t order = 2) const | |
157 | { | |
158 | // | |
159 | // Loop over AliAODParticle branch and fill flow histograms | |
160 | // | |
161 | ||
162 | //retreive MC particles from event | |
163 | TClonesArray* mcArray = (TClonesArray*)aodevent->FindListObject(AliAODMCParticle::StdBranchName()); | |
164 | if(!mcArray){ | |
165 | AliWarning("No MC array found in AOD. Try making it again."); | |
166 | return kFALSE; | |
167 | } | |
168 | ||
169 | Double_t rp = 0; | |
170 | if (addFlow.Length() > 1) { | |
171 | AliAODMCHeader* header = (AliAODMCHeader*)aodevent->FindListObject(AliAODMCHeader::StdBranchName()); | |
172 | rp = header->GetReactionPlaneAngle(); | |
173 | } | |
174 | ||
175 | TH2D* dNdetadphi = (TH2D*)fList->FindObject("hdNdetadphiSEMC"); | |
176 | TH1D* dNdphi = (TH1D*)fList->FindObject("hdNdphiSEMC"); | |
177 | dNdphi->Reset(); | |
178 | dNdetadphi->Reset(); | |
179 | ||
180 | Int_t ntracks = mcArray->GetEntriesFast(); | |
181 | ||
182 | // Track loop: chek how many particles will be accepted | |
183 | Double_t mult = 0; | |
184 | Double_t weight = 0; | |
185 | for (Int_t it = 0; it < ntracks; it++) { | |
186 | weight = 0; | |
187 | AliAODMCParticle* particle = (AliAODMCParticle*)mcArray->At(it); | |
188 | if (!particle) { | |
189 | AliError(Form("Could not receive track %d", it)); | |
190 | continue; | |
191 | } | |
192 | if (!particle->IsPhysicalPrimary()) continue; | |
193 | if (particle->Charge() == 0) continue; | |
194 | if (particle->Eta() > -3.4 && particle->Eta() < 5) { | |
195 | // Add flow if it is in the argument | |
196 | if (addFlow.Length() > 1) { | |
197 | if (addFlow.Contains("pt")) | |
198 | weight += AddptFlow(particle->Pt(), type); | |
199 | if (addFlow.Contains("pid")) | |
200 | weight += AddpidFlow(particle->PdgCode(), type); | |
201 | if (addFlow.Contains("eta")) | |
202 | weight += AddetaFlow(particle->Eta(), type); | |
203 | if (addFlow.Contains("flat")) | |
204 | weight = 0.1*type; | |
205 | weight *= 2.*TMath::Cos((Double_t)order*(particle->Phi()-rp)); | |
206 | } | |
207 | weight += 1; | |
208 | ||
209 | dNdphi->Fill(particle->Phi(), weight); | |
210 | dNdetadphi->Fill(particle->Eta(), particle->Phi(), weight); | |
211 | mult += weight; | |
212 | } | |
213 | } | |
214 | ||
215 | dNdphi->SetBinContent(0, mult); | |
216 | ||
217 | return kTRUE; | |
218 | } | |
219 | //_____________________________________________________________________ | |
220 | Double_t AliForwardFlowUtil::AddptFlow(Double_t Pt = 0, Int_t type = 0) const | |
221 | { | |
222 | // | |
223 | // Add pt dependent flow factor | |
224 | // | |
225 | Double_t weight = 0; | |
226 | ||
227 | if (type == 1) weight = 0.125*Pt; | |
228 | ||
229 | if (type == 2) { | |
230 | weight = 0.2*(Pt/2.0); | |
231 | if (Pt > 2.0) weight = 0.2; | |
232 | } | |
233 | ||
234 | if (type == 3) { | |
235 | weight = 0.05*(Pt/2.0); | |
236 | if (Pt < 2.0) weight = 0.05; | |
237 | } | |
238 | ||
239 | if (type == 4) { | |
240 | weight = 0.2*(Pt/1.0); | |
241 | if (Pt > 1.0) weight = 0.2; | |
242 | } | |
243 | ||
244 | if (type == 5) { | |
245 | weight = 0.05*(Pt/1.0); | |
246 | if (Pt < 1.0) weight = 0.05; | |
247 | } | |
248 | ||
249 | if (type == 6) { | |
250 | weight = 0.2*(Pt/3.0); | |
251 | if (Pt > 3.0) weight = 0.2; | |
252 | } | |
253 | ||
254 | return weight; | |
255 | } | |
256 | //_____________________________________________________________________ | |
257 | Double_t AliForwardFlowUtil::AddpidFlow(Int_t ID = 0, Int_t type = 0) const | |
258 | { | |
259 | // | |
260 | // Add pid dependent flow factor | |
261 | // | |
262 | Double_t weight = 0; | |
263 | ||
264 | if (type == 1) { | |
265 | weight = 0.07; | |
266 | if (TMath::Abs(ID) == 211) // pion flow | |
267 | weight = 0.1; | |
268 | if (TMath::Abs(ID) == 2212) // proton flow | |
269 | weight = 0.05; | |
270 | } | |
271 | ||
272 | if (type == 2) { | |
273 | weight = 0.06; | |
274 | if (TMath::Abs(ID) == 211) // pion flow | |
275 | weight = 0.1; | |
276 | if (TMath::Abs(ID) == 2212) // proton flow | |
277 | weight = 0.08; | |
278 | } | |
279 | ||
280 | if (type == 3) { | |
281 | weight = 0.05; | |
282 | if (TMath::Abs(ID) == 211) // pion flow | |
283 | weight = 0.1; | |
284 | if (TMath::Abs(ID) == 2212) // proton flow | |
285 | weight = 0.07; | |
286 | } | |
287 | ||
288 | if (type == 4) { | |
289 | weight = 0.07; | |
290 | if (TMath::Abs(ID) == 211) // pion flow | |
291 | weight = 0.1; | |
292 | if (TMath::Abs(ID) == 2212) // proton flow | |
293 | weight = 0.085; | |
294 | } | |
295 | ||
296 | return weight; | |
297 | } | |
298 | //_____________________________________________________________________ | |
299 | Double_t AliForwardFlowUtil::AddetaFlow(Double_t eta = 0, Int_t type = 0) const | |
300 | { | |
301 | // | |
302 | // Add eta dependent flow factor | |
303 | // | |
304 | Double_t weight = 0; | |
305 | ||
306 | if (type == 1) weight = 0.03 + 0.07 * (1 - TMath::Abs(eta) / 6.); | |
307 | ||
308 | if (type == 2) weight = 0.07 * (1 - TMath::Abs(eta) / 6.); | |
309 | ||
310 | if (type == 3) weight = 0.07 * (1 - TMath::Abs(eta) / 8.); | |
311 | ||
312 | if (type == 4) weight = 0.07 * (1 - TMath::Abs(eta) / 10.); | |
313 | ||
314 | if (type == 5) weight = 0.07 * (1 - TMath::Abs(eta) / 12.); | |
315 | ||
316 | if (type == 6) weight = 0.07 * (1 - TMath::Abs(eta) / 14.); | |
317 | ||
318 | if (type == 7) weight = 0.07 * (1 - TMath::Abs(eta) / 16.); | |
319 | ||
320 | return weight; | |
321 | } | |
322 | //_____________________________________________________________________ | |
323 | Double_t AliForwardFlowUtil::GetCentFromMC(const AliAODEvent* aodevent) const | |
324 | { | |
325 | // | |
326 | // Get centrality from MC impact parameter. | |
327 | // Values taken from: https://twiki.cern.ch/twiki/bin/viewauth/ALICE/CentStudies | |
328 | // | |
329 | Double_t cent = -1.; | |
330 | Double_t b = -1.; | |
331 | AliAODMCHeader* header = (AliAODMCHeader*)aodevent->FindListObject(AliAODMCHeader::StdBranchName()); | |
332 | if (!header) return cent; | |
333 | b = header->GetImpactParameter(); | |
334 | ||
335 | if ( 0.00 <= b && b < 3.50) | |
336 | cent = 2.5; | |
337 | if ( 3.50 <= b && b < 4.95) | |
338 | cent = 7.5; | |
339 | if ( 4.95 <= b && b < 6.98) | |
340 | cent = 15.; | |
341 | if ( 6.98 <= b && b < 8.55) | |
342 | cent = 25.; | |
343 | if ( 8.55 <= b && b < 9.88) | |
344 | cent = 35.; | |
345 | if ( 9.88 <= b && b < 11.04) | |
346 | cent = 45.; | |
347 | if (11.04 <= b && b < 12.09) | |
348 | cent = 55.; | |
349 | if (12.09 <= b && b < 13.06) | |
350 | cent = 65.; | |
351 | if (13.06 <= b && b < 13.97) | |
352 | cent = 75.; | |
353 | if (13.97 <= b && b < 19.61) | |
354 | cent = 90.; | |
355 | ||
356 | return cent; | |
357 | } | |
358 | //_____________________________________________________________________ | |
359 | // | |
360 | // | |
361 | // EOF | |
362 |