]>
Commit | Line | Data |
---|---|---|
2f9be372 | 1 | #include <TFile.h> |
2 | #include <TProfile.h> | |
3 | #include <TList.h> | |
4 | #include <TError.h> | |
5 | #include <TCanvas.h> | |
6 | #include <TPad.h> | |
7 | #include <TStyle.h> | |
8 | #include <TLegend.h> | |
9 | #include <TMath.h> | |
10 | #include <TLatex.h> | |
56199f2b | 11 | /** |
bd6f5206 | 12 | * @defgroup pwglf_forward_scripts_flow Flow scripts |
95c09e1c | 13 | * |
14 | * Various functions to do stuff on flow | |
15 | * | |
bd6f5206 | 16 | * @ingroup pwglf_forward_scripts |
56199f2b | 17 | * |
18 | */ | |
2f9be372 | 19 | // Data members |
20 | const char* pdfName = "Flow.pdf"; | |
21 | ||
56199f2b | 22 | |
23 | /** | |
24 | * @todo Document me | |
25 | * | |
26 | * @param name | |
27 | * | |
28 | * @return | |
29 | * | |
bd6f5206 | 30 | * @ingroup pwglf_forward_scripts_flow |
56199f2b | 31 | */ |
2f9be372 | 32 | TCanvas* SetupCanvas(TString name) |
33 | { | |
34 | TCanvas* c = new TCanvas("c","c",640,960); | |
35 | ||
36 | c->SetFillColor(0); | |
37 | c->SetBorderMode(0); | |
38 | c->SetBorderSize(0); | |
39 | c->cd(); | |
40 | ||
41 | if (name.Contains("Monitoring")) return c; | |
42 | ||
43 | TPad* p1 = new TPad("p1", "p1", 0, 0.5, 1.0, 1.0, 0, 0); | |
44 | p1->SetTopMargin(0.1); | |
45 | p1->SetBottomMargin(0.1); | |
46 | p1->SetRightMargin(0.05); | |
47 | p1->SetGridx(); | |
48 | p1->SetTicks(1, 1); | |
49 | p1->Draw(); | |
50 | p1->cd(); | |
51 | ||
52 | TProfile* p = new TProfile(name, "p", 48, -6, 6); | |
53 | p->GetYaxis()->SetRangeUser(0, 0.083); | |
54 | p->GetXaxis()->SetTitleFont(22); | |
55 | p->GetXaxis()->SetLabelFont(22); | |
56 | p->GetYaxis()->SetTitleFont(22); | |
57 | p->GetYaxis()->SetLabelFont(22); | |
58 | p->SetXTitle("#eta"); | |
59 | p->SetYTitle("v_{2}"); | |
60 | p->Draw(); | |
61 | ||
62 | TLatex* pt = new TLatex(.12, .87, "FMD Preliminary"); | |
63 | pt->SetNDC(); | |
64 | pt->SetTextFont(22); | |
65 | pt->SetTextSize(0.07); | |
66 | pt->SetTextColor(kRed+1); | |
67 | pt->SetTextAlign(13); | |
68 | pt->Draw(); | |
69 | ||
70 | c->cd(); | |
71 | ||
72 | TPad* p2 = new TPad("p2", "p2", 0, 0.25, 1.0, 0.5, 0, 0); | |
73 | p2->SetTopMargin(0.); | |
74 | p2->SetRightMargin(0.05); | |
75 | p2->SetBottomMargin(0.2); | |
76 | p2->SetGridx(); | |
77 | p2->SetGridy(); | |
78 | p2->SetTicks(1,1); | |
79 | p2->Draw(); | |
80 | p2->cd(); | |
81 | ||
82 | TProfile* pp = new TProfile(Form("%s_diff", name.Data()), "p", 48, -6, 6); | |
83 | pp->GetXaxis()->SetTitleFont(22); | |
84 | pp->GetXaxis()->SetLabelFont(22); | |
85 | pp->GetYaxis()->SetTitleFont(22); | |
86 | pp->GetYaxis()->SetLabelFont(22); | |
87 | pp->SetXTitle("#eta"); | |
88 | if ( name.Contains("MC")) { | |
89 | pp->SetYTitle("measured / truth"); | |
90 | pp->GetYaxis()->SetRangeUser(0.51, 1.15); | |
91 | } | |
92 | if (!name.Contains("MC")) { | |
93 | pp->SetYTitle("v_{2}{2} / v_{2}{4}"); | |
94 | pp->GetYaxis()->SetRangeUser(0.98, 1.17); | |
95 | } | |
96 | pp->GetXaxis()->SetTitleSize(2.*p->GetXaxis()->GetTitleSize()); | |
97 | pp->GetXaxis()->SetLabelSize(2.*p->GetXaxis()->GetLabelSize()); | |
98 | pp->GetYaxis()->SetTitleSize(2.*p->GetYaxis()->GetTitleSize()); | |
99 | pp->GetYaxis()->SetLabelSize(2.*p->GetYaxis()->GetLabelSize()); | |
100 | pp->GetYaxis()->SetTitleOffset(0.5); | |
101 | pp->Draw(); | |
102 | ||
103 | TF1* oneLine = new TF1("oneLine","1",-6,6); | |
104 | oneLine->SetLineWidth(0.5); | |
105 | oneLine->Draw("same"); | |
106 | ||
107 | if (!name.Contains("MC")) return c; | |
108 | ||
109 | c->cd(); | |
110 | ||
111 | TPad* p3 = new TPad("p3", "p3", 0, 0, 1.0, 0.25, 0, 0); | |
112 | p3->SetTopMargin(0.); | |
113 | p3->SetRightMargin(0.05); | |
114 | p3->SetBottomMargin(0.2); | |
115 | p3->SetGridx(); | |
116 | p3->SetGridy(); | |
117 | p3->SetTicks(1,1); | |
118 | p3->Draw(); | |
119 | p3->cd(); | |
120 | ||
121 | TProfile* ppp = new TProfile(Form("%s_trdiff", name.Data()), "p", 48, -6, 6); | |
122 | ppp->GetXaxis()->SetTitleFont(22); | |
123 | ppp->GetXaxis()->SetLabelFont(22); | |
124 | ppp->GetYaxis()->SetTitleFont(22); | |
125 | ppp->GetYaxis()->SetLabelFont(22); | |
126 | ppp->GetYaxis()->SetRangeUser(0.66, 1.19); | |
127 | ppp->SetXTitle("#eta"); | |
128 | ppp->SetYTitle("measured / track ref"); | |
129 | ppp->GetXaxis()->SetTitleSize(2.*p->GetXaxis()->GetTitleSize()); | |
130 | ppp->GetXaxis()->SetLabelSize(2.*p->GetXaxis()->GetLabelSize()); | |
131 | ppp->GetYaxis()->SetTitleSize(2.*p->GetYaxis()->GetTitleSize()); | |
132 | ppp->GetYaxis()->SetLabelSize(2.*p->GetYaxis()->GetLabelSize()); | |
133 | ppp->GetYaxis()->SetTitleOffset(0.5); | |
134 | ppp->Draw(); | |
135 | ||
136 | oneLine->Draw("same"); | |
137 | ||
138 | return c; | |
139 | } | |
140 | ||
56199f2b | 141 | /** |
142 | * @todo Document me | |
143 | * | |
144 | * @param f | |
145 | * | |
bd6f5206 | 146 | * @ingroup pwglf_forward_scripts_flow |
56199f2b | 147 | */ |
2f9be372 | 148 | void MakeFmdAndSpdPlots(TFile* f) |
149 | { | |
150 | TList* qList = static_cast<TList*>(f->Get("FlowResults/QCumulants")); | |
151 | TList* aList = static_cast<TList*>(qList->FindObject("FMD")); | |
152 | TList* fmdList = static_cast<TList*>(aList->FindObject("v2")); | |
153 | aList = static_cast<TList*>(qList->FindObject("SPD")); | |
154 | TList* spdList = static_cast<TList*>(aList->FindObject("v2")); | |
155 | ||
156 | TPad* pad = 0; | |
157 | ||
158 | Int_t y[11] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100 }; | |
159 | for (Int_t c = -2; c < 10; c++) { | |
160 | TProfile* fmd2DiffHist = 0; | |
161 | TProfile* spd2DiffHist = 0; | |
162 | TProfile* fmd4DiffHist = 0; | |
163 | TProfile* spd4DiffHist = 0; | |
164 | TH1D* fmdDiff = 0; | |
165 | TH1D* spdDiff = 0; | |
166 | TH1D* fmd = 0; | |
167 | TH1D* spd = 0; | |
168 | ||
169 | if (c == -2) { | |
170 | fmd2DiffHist = (TProfile*)fmdList->FindObject("hQ2Cumulant2DiffFlowFMD_mb"); | |
171 | spd2DiffHist = (TProfile*)spdList->FindObject("hQ2Cumulant2DiffFlowSPD_mb"); | |
172 | fmd4DiffHist = (TProfile*)fmdList->FindObject("hQ2Cumulant4DiffFlowFMD_mb"); | |
173 | spd4DiffHist = (TProfile*)spdList->FindObject("hQ2Cumulant4DiffFlowSPD_mb"); | |
174 | } | |
175 | else if (c == -1) { | |
176 | fmd2DiffHist = (TProfile*)fmdList->FindObject("hQ2Cumulant2DiffFlowFMD_0_40"); | |
177 | spd2DiffHist = (TProfile*)spdList->FindObject("hQ2Cumulant2DiffFlowSPD_0_40"); | |
178 | fmd4DiffHist = (TProfile*)fmdList->FindObject("hQ2Cumulant4DiffFlowFMD_0_40"); | |
179 | spd4DiffHist = (TProfile*)spdList->FindObject("hQ2Cumulant4DiffFlowSPD_0_40"); | |
180 | } | |
181 | else { | |
182 | fmd2DiffHist = (TProfile*)fmdList->FindObject(Form("hQ2Cumulant2DiffFlowFMD_%d_%d", y[c], y[c+1])); | |
183 | spd2DiffHist = (TProfile*)spdList->FindObject(Form("hQ2Cumulant2DiffFlowSPD_%d_%d", y[c], y[c+1])); | |
184 | fmd4DiffHist = (TProfile*)fmdList->FindObject(Form("hQ2Cumulant4DiffFlowFMD_%d_%d", y[c], y[c+1])); | |
185 | spd4DiffHist = (TProfile*)spdList->FindObject(Form("hQ2Cumulant4DiffFlowSPD_%d_%d", y[c], y[c+1])); | |
186 | } | |
187 | ||
188 | TString name = "v_{2}{2} and v_{2}{4} "; | |
189 | if (c == -2) name += "Minimum Bias"; | |
190 | else if (c == -1) name += "0-40% Centrality"; | |
191 | else { | |
192 | name += TString::Format("%d-%d", y[c], y[c+1]); | |
193 | name += "% Centrality"; | |
194 | } | |
195 | ||
196 | TCanvas* c1 = SetupCanvas(name); | |
197 | pad = (TPad*)c1->GetPrimitive("p1"); | |
198 | pad->cd(); | |
199 | ||
200 | TLatex* tit = new TLatex(0.10, 0.95, name); | |
201 | tit->SetNDC(); | |
202 | tit->SetTextFont(132); | |
203 | tit->SetTextSize(0.07); | |
204 | tit->Draw(); | |
205 | ||
206 | Int_t nEvs = (Int_t)fmd2DiffHist->GetBinContent(fmd2DiffHist->GetNbinsX()+1); | |
207 | TLatex* et = new TLatex(.93, .87, Form("%d events", nEvs)); | |
208 | et->SetNDC(); | |
209 | et->SetTextFont(132); | |
210 | et->SetTextAlign(33); | |
211 | et->Draw(); | |
212 | ||
213 | fmd2DiffHist->SetMarkerStyle(22); | |
214 | spd2DiffHist->SetMarkerStyle(23); | |
215 | fmd4DiffHist->SetMarkerStyle(22); | |
216 | spd4DiffHist->SetMarkerStyle(23); | |
217 | ||
218 | fmd2DiffHist->SetMarkerColor(kRed); | |
219 | spd2DiffHist->SetMarkerColor(kRed); | |
220 | fmd4DiffHist->SetMarkerColor(kBlue); | |
221 | spd4DiffHist->SetMarkerColor(kBlue); | |
222 | ||
223 | fmd2DiffHist->SetLineColor(kRed); | |
224 | spd2DiffHist->SetLineColor(kRed); | |
225 | fmd4DiffHist->SetLineColor(kBlue); | |
226 | spd4DiffHist->SetLineColor(kBlue); | |
227 | ||
228 | spd2DiffHist->Draw("same e1"); | |
229 | fmd2DiffHist->Draw("same e1"); | |
230 | spd4DiffHist->Draw("same e1"); | |
231 | fmd4DiffHist->Draw("same e1"); | |
232 | ||
233 | TLegend* l = new TLegend(.12,.40,.35,.80); | |
234 | // l->SetNColumns(2); | |
235 | l->SetFillColor(0); | |
236 | l->SetFillStyle(0); | |
237 | l->SetBorderSize(0); | |
238 | l->SetTextFont(132); | |
239 | l->AddEntry(fmd2DiffHist, "FMD v_{2}{2}", "lpe"); | |
240 | l->AddEntry(spd2DiffHist, "SPD v_{2}{2}", "lpe"); | |
241 | l->AddEntry(fmd4DiffHist, "FMD v_{2}{4}", "lpe"); | |
242 | l->AddEntry(spd4DiffHist, "SPD v_{2}{4}", "lpe"); | |
243 | l->Draw(); | |
244 | ||
245 | pad = (TPad*)c1->GetPrimitive("p2"); | |
246 | pad->cd(); | |
247 | ||
248 | fmdDiff = fmd2DiffHist->ProjectionX("fmdDiff", "e"); | |
249 | fmd = fmd4DiffHist->ProjectionX("fmd4Diff", "e"); | |
250 | fmdDiff->Divide(fmd); | |
251 | fmdDiff->SetLineColor(kBlue); | |
252 | fmdDiff->Draw("same e1"); | |
253 | ||
254 | spdDiff = spd2DiffHist->ProjectionX("spdDiff", "e"); | |
255 | spd = spd4DiffHist->ProjectionX("spd4Diff", "e"); | |
256 | spdDiff->Divide(spd); | |
257 | spdDiff->SetLineColor(kRed); | |
258 | spdDiff->Draw("same e1"); | |
259 | ||
260 | name.Prepend("Title:"); | |
261 | cout<<name<<endl; | |
262 | c1->Print(pdfName, name); | |
263 | ||
264 | delete fmd; | |
265 | delete spd; | |
266 | delete fmdDiff; | |
267 | delete spdDiff; | |
268 | delete c1; | |
269 | } // end of c | |
270 | } | |
271 | ||
56199f2b | 272 | /** |
273 | * @todo Document me | |
274 | * | |
275 | * @param f | |
276 | * | |
bd6f5206 | 277 | * @ingroup pwglf_forward_scripts_flow |
56199f2b | 278 | */ |
2f9be372 | 279 | void Make2ParticlePlots(TFile* f) |
280 | { | |
281 | TList* qList = static_cast<TList*>(f->Get("FlowResults/QCumulants")); | |
282 | TList* aList = static_cast<TList*>(qList->FindObject("MC")); | |
283 | TList* mcList = static_cast<TList*>(aList->FindObject("v2")); | |
284 | aList = static_cast<TList*>(qList->FindObject("FMDTR")); | |
285 | TList* fmdtrList = static_cast<TList*>(aList->FindObject("v2")); | |
286 | aList = static_cast<TList*>(qList->FindObject("SPDTR")); | |
287 | TList* spdtrList = static_cast<TList*>(aList->FindObject("v2")); | |
288 | aList = static_cast<TList*>(qList->FindObject("FMD")); | |
289 | TList* fmdList = static_cast<TList*>(aList->FindObject("v2")); | |
290 | aList = static_cast<TList*>(qList->FindObject("SPD")); | |
291 | TList* spdList = static_cast<TList*>(aList->FindObject("v2")); | |
292 | ||
293 | TProfile2D* mcProfile = (TProfile2D*)qList->FindObject("pMCTruth"); | |
294 | TPad* pad = 0; | |
295 | ||
296 | Int_t y[11] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100 }; | |
297 | for (Int_t c = -2; c < 10; c++) { | |
298 | TProfile* mcDiffHist = 0; | |
299 | TProfile* fmdtrDiffHist = 0; | |
300 | TProfile* spdtrDiffHist = 0; | |
301 | TProfile* fmdDiffHist = 0; | |
302 | TProfile* spdDiffHist = 0; | |
303 | TH1D* mcTruth = 0; | |
304 | TH1D* fmdDiff = 0; | |
305 | TH1D* spdDiff = 0; | |
306 | TH1D* fmdTrDiff = 0; | |
307 | TH1D* spdTrDiff = 0; | |
308 | ||
309 | if (c == -2) { | |
310 | mcDiffHist = (TProfile*)mcList->FindObject("hQ2Cumulant2DiffFlowMC_mb"); | |
311 | fmdtrDiffHist = (TProfile*)fmdtrList->FindObject("hQ2Cumulant2DiffFlowFMDTR_mb"); | |
312 | spdtrDiffHist = (TProfile*)spdtrList->FindObject("hQ2Cumulant2DiffFlowSPDTR_mb"); | |
313 | fmdDiffHist = (TProfile*)fmdList->FindObject("hQ2Cumulant2DiffFlowFMD_mb"); | |
314 | spdDiffHist = (TProfile*)spdList->FindObject("hQ2Cumulant2DiffFlowSPD_mb"); | |
315 | mcTruth = (TH1D*)mcProfile->ProjectionX("mcTruth", 1, 9, "E"); | |
316 | mcTruth->Scale(1./9.); | |
317 | } | |
318 | else if (c == -1) { | |
319 | mcDiffHist = (TProfile*)mcList->FindObject("hQ2Cumulant2DiffFlowMC_0_40"); | |
320 | fmdtrDiffHist = (TProfile*)fmdtrList->FindObject("hQ2Cumulant2DiffFlowFMDTR_0_40"); | |
321 | spdtrDiffHist = (TProfile*)spdtrList->FindObject("hQ2Cumulant2DiffFlowSPDTR_0_40"); | |
322 | fmdDiffHist = (TProfile*)fmdList->FindObject("hQ2Cumulant2DiffFlowFMD_0_40"); | |
323 | spdDiffHist = (TProfile*)spdList->FindObject("hQ2Cumulant2DiffFlowSPD_0_40"); | |
324 | mcTruth = (TH1D*)mcProfile->ProjectionX("mcTruth", 1, 5, "E"); | |
325 | mcTruth->Scale(1./5.); | |
326 | } | |
327 | else { | |
328 | mcDiffHist = (TProfile*)mcList->FindObject(Form("hQ2Cumulant2DiffFlowMC_%d_%d", y[c], y[c+1])); | |
329 | fmdtrDiffHist = (TProfile*)fmdtrList->FindObject(Form("hQ2Cumulant2DiffFlowFMDTR_%d_%d", y[c], y[c+1])); | |
330 | spdtrDiffHist = (TProfile*)spdtrList->FindObject(Form("hQ2Cumulant2DiffFlowSPDTR_%d_%d", y[c], y[c+1])); | |
331 | fmdDiffHist = (TProfile*)fmdList->FindObject(Form("hQ2Cumulant2DiffFlowFMD_%d_%d", y[c], y[c+1])); | |
332 | spdDiffHist = (TProfile*)spdList->FindObject(Form("hQ2Cumulant2DiffFlowSPD_%d_%d", y[c], y[c+1])); | |
333 | mcTruth = (TH1D*)mcProfile->ProjectionX("mcTruth", c+1, c+1, "E"); | |
334 | } | |
335 | ||
336 | TString name = "v_{2}{2} MC "; | |
337 | if (c == -2) name += "Minimum Bias"; | |
338 | else if (c == -1) name += "0-40% Centrality"; | |
339 | else { | |
340 | name += TString::Format("%d-%d", y[c], y[c+1]); | |
341 | name += "% Centrality"; | |
342 | } | |
343 | ||
344 | TCanvas* c1 = SetupCanvas(name); | |
345 | pad = (TPad*)c1->GetPrimitive("p1"); | |
346 | pad->cd(); | |
347 | ||
348 | TLatex* tit = new TLatex(0.10, 0.95, name); | |
349 | tit->SetNDC(); | |
350 | tit->SetTextFont(132); | |
351 | tit->SetTextSize(0.07); | |
352 | tit->Draw(); | |
353 | ||
354 | Int_t nEvs = (Int_t)fmdDiffHist->GetBinContent(fmdDiffHist->GetNbinsX()+1); | |
355 | TLatex* et = new TLatex(.93, .87, Form("%d events", nEvs)); | |
356 | et->SetNDC(); | |
357 | et->SetTextFont(132); | |
358 | et->SetTextAlign(33); | |
359 | et->Draw(); | |
360 | ||
361 | mcDiffHist->SetMarkerStyle(21); | |
362 | fmdDiffHist->SetLineColor(kBlue); | |
363 | spdDiffHist->SetLineColor(kRed); | |
364 | fmdtrDiffHist->SetLineColor(kGreen+1); | |
365 | spdtrDiffHist->SetLineColor(kCyan+1); | |
366 | mcTruth->SetFillColor(kGray); | |
367 | ||
368 | mcTruth->Draw("same e3"); | |
369 | mcDiffHist->Draw("same e1"); | |
370 | fmdDiffHist->Draw("same e1"); | |
371 | spdDiffHist->Draw("same e1"); | |
372 | fmdtrDiffHist->Draw("same e1"); | |
373 | spdtrDiffHist->Draw("same e1"); | |
374 | ||
375 | TLegend* l = new TLegend(.12,.40,.35,.80); | |
376 | l->SetFillColor(0); | |
377 | l->SetFillStyle(0); | |
378 | l->SetBorderSize(0); | |
379 | l->SetTextFont(132); | |
380 | l->AddEntry(fmdDiffHist, "FMD", "lpe"); | |
381 | l->AddEntry(spdDiffHist, "SPD", "lpe"); | |
382 | l->AddEntry(fmdtrDiffHist, "FMD TrackRefs", "lpe"); | |
383 | l->AddEntry(spdtrDiffHist, "SPD TrackRefs", "lpe"); | |
384 | l->AddEntry(mcDiffHist, "MC Truth", "lpe"); | |
385 | l->AddEntry(mcTruth, "cos(2(#varphi-#Psi_{rp}))", "f"); | |
386 | l->Draw(); | |
387 | ||
388 | pad = (TPad*)c1->GetPrimitive("p2"); | |
389 | pad->cd(); | |
390 | ||
391 | fmdDiff = fmdDiffHist->ProjectionX("fmdDiff", "e"); | |
392 | mcDiff1 = mcDiffHist->ProjectionX("mcDiff1", "e"); | |
393 | fmdDiff->Divide(mcDiff1); | |
394 | fmdDiff->SetLineColor(kBlue); | |
395 | fmdDiff->Draw("same e1"); | |
396 | ||
397 | spdDiff = spdDiffHist->ProjectionX("spdDiff", "e"); | |
398 | mcDiff2 = mcDiffHist->ProjectionX("mcDiff2", "e"); | |
399 | spdDiff->Divide(mcDiff2); | |
400 | spdDiff->SetLineColor(kRed); | |
401 | spdDiff->Draw("same e1"); | |
402 | ||
403 | pad = (TPad*)c1->GetPrimitive("p3"); | |
404 | pad->cd(); | |
405 | ||
406 | fmdTrDiff = fmdDiffHist->ProjectionX("fmdTrDiff", "e"); | |
407 | mcDiff3 = fmdtrDiffHist->ProjectionX("mcDiff3", "e"); | |
408 | fmdTrDiff->Divide(mcDiff3); | |
409 | fmdTrDiff->SetLineColor(kBlue); | |
410 | fmdTrDiff->Draw("same e1"); | |
411 | ||
412 | spdTrDiff = spdDiffHist->ProjectionX("spdTrDiff", "e"); | |
413 | mcDiff4 = spdtrDiffHist->ProjectionX("mcDiff4", "e"); | |
414 | spdTrDiff->Divide(mcDiff4); | |
415 | spdTrDiff->SetLineColor(kRed); | |
416 | spdTrDiff->Draw("same e1"); | |
417 | ||
418 | name.Prepend("Title:"); | |
419 | cout<<name<<endl; | |
420 | c1->Print(pdfName, name); | |
421 | ||
422 | delete mcDiff1; | |
423 | delete mcDiff2; | |
424 | delete mcDiff3; | |
425 | delete mcDiff4; | |
426 | delete fmdDiff; | |
427 | delete spdDiff; | |
428 | delete fmdTrDiff; | |
429 | delete spdTrDiff; | |
430 | delete c1; | |
431 | } // end of c | |
432 | } | |
433 | ||
56199f2b | 434 | /** |
435 | * @todo Document me | |
436 | * | |
437 | * @param f | |
438 | * | |
bd6f5206 | 439 | * @ingroup pwglf_forward_scripts_flow |
56199f2b | 440 | */ |
2f9be372 | 441 | void Make4ParticlePlots(TFile* f) |
442 | { | |
443 | TList* qList = static_cast<TList*>(f->Get("FlowResults/QCumulants")); | |
444 | TList* aList = static_cast<TList*>(qList->FindObject("MC")); | |
445 | TList* mcList = static_cast<TList*>(aList->FindObject("v2")); | |
446 | aList = static_cast<TList*>(qList->FindObject("FMDTR")); | |
447 | TList* fmdtrList = static_cast<TList*>(aList->FindObject("v2")); | |
448 | aList = static_cast<TList*>(qList->FindObject("SPDTR")); | |
449 | TList* spdtrList = static_cast<TList*>(aList->FindObject("v2")); | |
450 | aList = static_cast<TList*>(qList->FindObject("FMD")); | |
451 | TList* fmdList = static_cast<TList*>(aList->FindObject("v2")); | |
452 | aList = static_cast<TList*>(qList->FindObject("SPD")); | |
453 | TList* spdList = static_cast<TList*>(aList->FindObject("v2")); | |
454 | ||
455 | TProfile2D* mcProfile = (TProfile2D*)qList->FindObject("pMCTruth"); | |
456 | TPad* pad = 0; | |
457 | ||
458 | Int_t y[11] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100 }; | |
459 | for (Int_t c = -2; c < 10; c++) { | |
460 | TProfile* mcDiffHist = 0; | |
461 | TProfile* fmdtrDiffHist = 0; | |
462 | TProfile* spdtrDiffHist = 0; | |
463 | TProfile* fmdDiffHist = 0; | |
464 | TProfile* spdDiffHist = 0; | |
465 | TH1D* mcTruth = 0; | |
466 | TH1D* fmdDiff = 0; | |
467 | TH1D* spdDiff = 0; | |
468 | TH1D* fmdTrDiff = 0; | |
469 | TH1D* spdTrDiff = 0; | |
470 | TH1D* mcDiff1 = 0; | |
471 | TH1D* mcDiff2 = 0; | |
472 | TH1D* mcDiff3 = 0; | |
473 | TH1D* mcDiff4 = 0; | |
474 | ||
475 | if (c == -2) { | |
476 | mcDiffHist = (TProfile*)mcList->FindObject("hQ2Cumulant4DiffFlowMC_mb"); | |
477 | fmdtrDiffHist = (TProfile*)fmdtrList->FindObject("hQ2Cumulant4DiffFlowFMDTR_mb"); | |
478 | spdtrDiffHist = (TProfile*)spdtrList->FindObject("hQ2Cumulant4DiffFlowSPDTR_mb"); | |
479 | fmdDiffHist = (TProfile*)fmdList->FindObject("hQ2Cumulant4DiffFlowFMD_mb"); | |
480 | spdDiffHist = (TProfile*)spdList->FindObject("hQ2Cumulant4DiffFlowSPD_mb"); | |
481 | mcTruth = (TH1D*)mcProfile->ProjectionX("mcTruth", 1, 9, "E"); | |
482 | mcTruth->Scale(1./9.); | |
483 | } | |
484 | else if (c == -1) { | |
485 | mcDiffHist = (TProfile*)mcList->FindObject("hQ2Cumulant4DiffFlowMC_0_40"); | |
486 | fmdtrDiffHist = (TProfile*)fmdtrList->FindObject("hQ2Cumulant4DiffFlowFMDTR_0_40"); | |
487 | spdtrDiffHist = (TProfile*)spdtrList->FindObject("hQ2Cumulant4DiffFlowSPDTR_0_40"); | |
488 | fmdDiffHist = (TProfile*)fmdList->FindObject("hQ2Cumulant4DiffFlowFMD_0_40"); | |
489 | spdDiffHist = (TProfile*)spdList->FindObject("hQ2Cumulant4DiffFlowSPD_0_40"); | |
490 | mcTruth = (TH1D*)mcProfile->ProjectionX("mcTruth", 1, 5, "E"); | |
491 | mcTruth->Scale(1./5.); | |
492 | } | |
493 | else { | |
494 | mcDiffHist = (TProfile*)mcList->FindObject(Form("hQ2Cumulant4DiffFlowMC_%d_%d", y[c], y[c+1])); | |
495 | fmdtrDiffHist = (TProfile*)fmdtrList->FindObject(Form("hQ2Cumulant4DiffFlowFMDTR_%d_%d", y[c], y[c+1])); | |
496 | spdtrDiffHist = (TProfile*)spdtrList->FindObject(Form("hQ2Cumulant4DiffFlowSPDTR_%d_%d", y[c], y[c+1])); | |
497 | fmdDiffHist = (TProfile*)fmdList->FindObject(Form("hQ2Cumulant4DiffFlowFMD_%d_%d", y[c], y[c+1])); | |
498 | spdDiffHist = (TProfile*)spdList->FindObject(Form("hQ2Cumulant4DiffFlowSPD_%d_%d", y[c], y[c+1])); | |
499 | mcTruth = (TH1D*)mcProfile->ProjectionX("mcTruth", c+1, c+1, "E"); | |
500 | } | |
501 | ||
502 | TString name = "v_{2}{4} MC "; | |
503 | if (c == -2) name += "Minimum Bias"; | |
504 | else if (c == -1) name += "0-40% Centrality"; | |
505 | else { | |
506 | name += TString::Format("%d-%d", y[c], y[c+1]); | |
507 | name += "% Centrality"; | |
508 | } | |
509 | ||
510 | TCanvas* c1 = SetupCanvas(name); | |
511 | pad = (TPad*)c1->GetPrimitive("p1"); | |
512 | pad->cd(); | |
513 | ||
514 | TLatex* tit = new TLatex(0.10, 0.95, name); | |
515 | tit->SetNDC(); | |
516 | tit->SetTextFont(132); | |
517 | tit->SetTextSize(0.07); | |
518 | tit->Draw(); | |
519 | ||
520 | Int_t nEvs = (Int_t)fmdDiffHist->GetBinContent(fmdDiffHist->GetNbinsX()+1); | |
521 | TLatex* et = new TLatex(.93, .87, Form("%d events", nEvs)); | |
522 | et->SetNDC(); | |
523 | et->SetTextFont(132); | |
524 | et->SetTextAlign(33); | |
525 | et->Draw(); | |
526 | ||
527 | mcDiffHist->SetMarkerStyle(21); | |
528 | fmdDiffHist->SetLineColor(kBlue); | |
529 | spdDiffHist->SetLineColor(kRed); | |
530 | fmdtrDiffHist->SetLineColor(kGreen+1); | |
531 | spdtrDiffHist->SetLineColor(kCyan+1); | |
532 | mcTruth->SetFillColor(kGray); | |
533 | ||
534 | mcTruth->Draw("same e3"); | |
535 | mcDiffHist->Draw("same e1"); | |
536 | fmdDiffHist->Draw("same e1"); | |
537 | spdDiffHist->Draw("same e1"); | |
538 | fmdtrDiffHist->Draw("same e1"); | |
539 | spdtrDiffHist->Draw("same e1"); | |
540 | ||
541 | TLegend* l = new TLegend(.12,.40,.35,.80); | |
542 | // l->SetNColumns(2); | |
543 | l->SetFillColor(0); | |
544 | l->SetFillStyle(0); | |
545 | l->SetBorderSize(0); | |
546 | l->SetTextFont(132); | |
547 | l->AddEntry(fmdDiffHist, "FMD", "lpe"); | |
548 | l->AddEntry(spdDiffHist, "SPD", "lpe"); | |
549 | l->AddEntry(fmdtrDiffHist, "FMD TrackRefs", "lpe"); | |
550 | l->AddEntry(spdtrDiffHist, "SPD TrackRefs", "lpe"); | |
551 | l->AddEntry(mcDiffHist, "MC Truth", "lpe"); | |
552 | l->AddEntry(mcTruth, "cos(2(#varphi-#Psi_{rp}))", "f"); | |
553 | l->Draw(); | |
554 | ||
555 | pad = (TPad*)c1->GetPrimitive("p2"); | |
556 | pad->cd(); | |
557 | ||
558 | fmdDiff = fmdDiffHist->ProjectionX("fmdDiff", "e"); | |
559 | mcDiff1 = mcDiffHist->ProjectionX("mcDiff1", "e"); | |
560 | fmdDiff->Divide(mcDiff1); | |
561 | fmdDiff->SetLineColor(kBlue); | |
562 | fmdDiff->Draw("same e1"); | |
563 | ||
564 | spdDiff = spdDiffHist->ProjectionX("spdDiff", "e"); | |
565 | mcDiff2 = mcDiffHist->ProjectionX("mcDiff2", "e"); | |
566 | spdDiff->Divide(mcDiff2); | |
567 | spdDiff->SetLineColor(kRed); | |
568 | spdDiff->Draw("same e1"); | |
569 | ||
570 | pad = (TPad*)c1->GetPrimitive("p3"); | |
571 | pad->cd(); | |
572 | ||
573 | fmdTrDiff = fmdDiffHist->ProjectionX("fmdTrDiff", "e"); | |
574 | mcDiff3 = fmdtrDiffHist->ProjectionX("mcDiff3", "e"); | |
575 | fmdTrDiff->Divide(mcDiff3); | |
576 | fmdTrDiff->SetLineColor(kBlue); | |
577 | fmdTrDiff->Draw("same e1"); | |
578 | ||
579 | spdTrDiff = spdDiffHist->ProjectionX("spdTrDiff", "e"); | |
580 | mcDiff4 = spdtrDiffHist->ProjectionX("mcDiff4", "e"); | |
581 | spdTrDiff->Divide(mcDiff4); | |
582 | spdTrDiff->SetLineColor(kRed); | |
583 | spdTrDiff->Draw("same e1"); | |
584 | ||
585 | name.Prepend("Title:"); | |
586 | cout<<name<<endl; | |
587 | c1->Print(pdfName, name); | |
588 | ||
589 | delete mcDiff1; | |
590 | delete mcDiff2; | |
591 | delete mcDiff3; | |
592 | delete mcDiff4; | |
593 | delete fmdDiff; | |
594 | delete spdDiff; | |
595 | delete fmdTrDiff; | |
596 | delete spdTrDiff; | |
597 | delete c1; | |
598 | } // end of c | |
599 | } | |
600 | ||
56199f2b | 601 | /** |
602 | * @todo Document me | |
603 | * | |
604 | * @param f | |
605 | * | |
bd6f5206 | 606 | * @ingroup pwglf_forward_scripts_flow |
56199f2b | 607 | */ |
2f9be372 | 608 | void MakeMonitoringPlots(TFile* f) |
609 | { | |
610 | TList* qList = static_cast<TList*>(f->Get("FlowResults/QCumulants")); | |
611 | ||
612 | TH1D* cent = (TH1D*)qList->FindObject("Centralities"); | |
613 | TH2D* vert = (TH2D*)qList->FindObject("CoverageVsVertex"); | |
614 | ||
615 | TCanvas* c1 = SetupCanvas("Monitoring"); | |
616 | c1->Divide(1,2); | |
617 | c1->cd(1); | |
618 | cent->GetXaxis()->SetTitleFont(22); | |
619 | cent->GetXaxis()->SetLabelFont(22); | |
620 | cent->GetYaxis()->SetTitleFont(22); | |
621 | cent->GetYaxis()->SetLabelFont(22); | |
622 | cent->SetXTitle("Centrality %"); | |
623 | cent->SetYTitle("# of events"); | |
624 | cent->Draw(); | |
625 | c1->cd(2); | |
626 | vert->GetXaxis()->SetTitleFont(22); | |
627 | vert->GetXaxis()->SetLabelFont(22); | |
628 | vert->GetYaxis()->SetTitleFont(22); | |
629 | vert->GetYaxis()->SetLabelFont(22); | |
630 | vert->SetXTitle("#eta"); | |
631 | vert->SetYTitle("Vertex z coordinate [cm]"); | |
632 | vert->Draw("colz"); | |
633 | ||
634 | c1->Print(pdfName, "Title:Monitoring Plots"); | |
635 | } | |
636 | ||
637 | ||
56199f2b | 638 | /** |
639 | * Document me | |
640 | * | |
641 | * @param file | |
642 | * | |
bd6f5206 | 643 | * @ingroup pwglf_forward_scripts_flow |
56199f2b | 644 | */ |
2f9be372 | 645 | void DrawFlowPDF(char* file = "AnalysisResults.root") |
646 | { | |
647 | gStyle->SetOptStat(0); | |
648 | gStyle->SetOptTitle(0); | |
649 | ||
650 | TFile* f = TFile::Open(file, "READ"); | |
651 | TCanvas* c0 = SetupCanvas("empty"); | |
652 | c0->SetName("empty"); | |
653 | c0->Print(Form("%s[", pdfName)); | |
654 | MakeFmdAndSpdPlots(f); | |
655 | Make2ParticlePlots(f); | |
656 | Make4ParticlePlots(f); | |
657 | MakeMonitoringPlots(f); | |
658 | c0->Print(Form("%s]", pdfName)); | |
659 | } | |
56199f2b | 660 | // |
661 | // EOF | |
662 | // |