]>
Commit | Line | Data |
---|---|---|
a67d6cee | 1 | const Int_t numberOfCentralityBins = 8; |
2 | TString centralityArray[numberOfCentralityBins] = {"0-10","10-20","20-30","30-40","40-50","50-60","60-70","70-80"}; | |
3 | ||
4 | void drawBalanceFunctionPsiSummarySummary(const char* lhcPeriod = "LHC11h", | |
e4391c02 | 5 | Int_t gTrainID = 290, |
a67d6cee | 6 | Double_t psiMin = -0.5, |
e4391c02 | 7 | Double_t psiMax = 3.5, |
8 | TString eventClass = "Centrality"){ | |
a67d6cee | 9 | TFile *fPar[3]; |
10 | TGraphErrors *gPar[3][18]; | |
11 | ||
9a62bd04 | 12 | Int_t iCentrality[3] = {1,2,3}; |
e4391c02 | 13 | Double_t fCentralityMin[3] = {0.,20.,40.}; |
14 | Double_t fCentralityMax[3] = {10.,30.,50.}; | |
a67d6cee | 15 | |
e4391c02 | 16 | |
a67d6cee | 17 | for(Int_t iCent = 0 ; iCent < 3; iCent++){ |
18 | ||
19 | // open file | |
e4391c02 | 20 | if(eventClass == "Centrality"){ |
21 | fPar[iCent] = TFile::Open(Form("PbPb/%s/Train%d/figs/balanceFunctionFit_Cent%.1fTo%.1f_FitParameters.root",lhcPeriod,gTrainID,fCentralityMin[iCent],fCentralityMax[iCent]),"READ"); | |
22 | } | |
23 | else if(eventClass == "Multiplicity"){ | |
24 | fPar[iCent] = TFile::Open(Form("PbPb/%s/Train%d/figs/balanceFunctionFit_Mult%.1fTo%.1f_FitParameters.root",lhcPeriod,gTrainID,fCentralityMin[iCent],fCentralityMax[iCent]),"RED"); | |
25 | } | |
26 | else{ | |
27 | fPar[iCent] = TFile::Open(Form("PbPb/%s/Train%d/figs/balanceFunctionFit_Cent%d_FitParameters.root",lhcPeriod,gTrainID,iCentrality[iCent]),"READ"); | |
28 | } | |
29 | ||
a67d6cee | 30 | if(!fPar[iCent]){ |
31 | cerr<<"FILE "<<Form("PbPb/%s/Train%d/figs/correlationFunctionFit_Cent%d_FitParameters.root",lhcPeriod,gTrainID,iCentrality[iCent])<<" not found!"<<endl; | |
32 | return; | |
33 | } | |
34 | ||
35 | // open graph | |
36 | for(Int_t iPar = 0 ; iPar < 18; iPar++){ | |
37 | gPar[iCent][iPar] = (TGraphErrors*)fPar[iCent]->Get(Form("gPar%d",iPar)); | |
38 | if(!gPar[iCent][iPar]){ | |
e4391c02 | 39 | cerr<<"Graph for parameter "<<iPar<<" in centrality "<< iCent << " not found!"<<endl; |
40 | fPar[iCent]->ls(); | |
a67d6cee | 41 | return; |
42 | } | |
43 | } | |
44 | } | |
45 | ||
46 | ||
47 | TCanvas *cSummary[18]; | |
48 | for(Int_t iPar = 0 ; iPar < 18; iPar++){ | |
49 | ||
50 | cSummary[iPar] = new TCanvas(Form("cSummary%d",iPar),Form("Summary %d",iPar)); | |
51 | ||
52 | // compare centralities | |
53 | cSummary[iPar]->cd(); | |
54 | gPar[0][iPar]->SetMarkerColor(1); | |
55 | gPar[0][iPar]->SetLineColor(1); | |
56 | gPar[0][iPar]->Draw("AP"); | |
57 | gPar[1][iPar]->SetMarkerColor(2); | |
58 | gPar[1][iPar]->SetLineColor(2); | |
59 | gPar[1][iPar]->Draw("P"); | |
60 | gPar[2][iPar]->SetMarkerColor(4); | |
61 | gPar[2][iPar]->SetLineColor(4); | |
62 | gPar[2][iPar]->Draw("P"); | |
63 | ||
64 | ||
65 | TLegend *legend2 = new TLegend(0.2,0.6,0.85,0.88,"","brNDC"); | |
66 | setupLegend(legend2,0.065); | |
67 | for(Int_t iCent = 0 ; iCent < 3; iCent++){ | |
68 | legend2->AddEntry(gPar[iCent][iPar],Form("%s \%",centralityArray[iCentrality[iCent]-1].Data()),"lp"); | |
69 | } | |
70 | legend2->Draw(); | |
71 | ||
72 | cSummary[iPar]->SaveAs(Form("PbPb/%s/Train%d/figs/balanceFunctionFit_FitParameter%d_Summary.eps",lhcPeriod,gTrainID,iPar)); | |
73 | } | |
74 | ||
75 | ||
76 | } | |
77 | ||
78 | ||
79 | void drawBalanceFunctionPsiSummary(const char* lhcPeriod = "LHC11h", | |
e4391c02 | 80 | Int_t gTrainID = 290, |
81 | Int_t gCentrality = 9, | |
82 | Double_t psiMin = 0, | |
83 | Double_t psiMax = 10, | |
84 | TString eventClass = "Centrality") { | |
a67d6cee | 85 | // Macro that draws the fit results for the |
86 | // correlation functions from the balance function analysis | |
87 | // Author: m.weber@cern.ch | |
88 | ||
89 | gROOT->LoadMacro("~/SetPlotStyle.C"); | |
90 | SetPlotStyle(); | |
91 | gStyle->SetPalette(1,0); | |
92 | ||
93 | //Load the PWG2ebye library | |
94 | gSystem->Load("libANALYSIS.so"); | |
95 | gSystem->Load("libANALYSISalice.so"); | |
96 | gSystem->Load("libEventMixing.so"); | |
97 | gSystem->Load("libCORRFW.so"); | |
98 | gSystem->Load("libPWGTools.so"); | |
99 | gSystem->Load("libPWGCFebye.so"); | |
100 | ||
101 | // pt bins | |
102 | // this could also be retrieved directly from AliBalancePsi | |
103 | //const Int_t kNPtBins = 16; | |
104 | //Double_t ptBins[kNPtBins+1] = {0.2,0.6,1.0,1.5,2.0,2.5,3.0,3.5,4.0,5.0,6.0,7.0,8.0,10.,12.,15.,20.}; | |
e4391c02 | 105 | const Int_t kNPtBins = 5; |
106 | Double_t ptBins[kNPtBins+1] = {0.2,1.0,2.0,3.0,4.0,8.0}; | |
107 | //const Int_t kNPtBins = 4; | |
108 | //Double_t ptBins[kNPtBins+1] = {1.0,2.0,3.0,4.0,8.0}; | |
a67d6cee | 109 | //const Int_t kNPtBins = 1; |
110 | //Double_t ptBins[kNPtBins+1] = {0.2,2.0}; | |
111 | ||
112 | Double_t pt[kNPtBins*kNPtBins]; | |
113 | Double_t ptE[kNPtBins*kNPtBins]; | |
114 | for(Int_t i = 0; i < kNPtBins; i++){ | |
115 | for(Int_t j = 0; j < kNPtBins; j++){ | |
116 | pt[i*kNPtBins+j] = 10*i + (ptBins[j]+ptBins[j+1])/2.; | |
117 | ptE[i*kNPtBins+j] = 0.2; | |
118 | } | |
119 | } | |
120 | ||
121 | ||
122 | // Canvases | |
123 | TCanvas *cQA[kNPtBins][kNPtBins]; | |
124 | for(Int_t i = 0; i < kNPtBins; i++){ | |
125 | for(Int_t j = 0; j <= i; j++){ | |
126 | cQA[i][j] = new TCanvas(Form("cQA%d%d",i,j),Form("Fitting QA for bin %d %d",i,j),1200,900); | |
127 | cQA[i][j]->Divide(3,3); | |
128 | } | |
129 | } | |
130 | ||
131 | ||
132 | // Loop over pt bins | |
133 | Double_t ptTriggerMin = 0.0; | |
134 | Double_t ptTriggerMax = 0.; | |
135 | Double_t ptAssociatedMin = 0.0; | |
136 | Double_t ptAssociatedMax = 0.0; | |
137 | TString inFileName = ""; | |
138 | ||
139 | //Fit Parameters | |
140 | Double_t p[18][kNPtBins*kNPtBins]; | |
141 | Double_t pE[18][kNPtBins*kNPtBins]; | |
142 | ||
143 | for(Int_t iPar = 0; iPar < 18; iPar++){ | |
144 | for(Int_t i = 0; i < kNPtBins; i++){ | |
145 | for(Int_t j = 0; j < kNPtBins; j++){ | |
146 | p[iPar][i*kNPtBins+j] = -1.; | |
147 | pE[iPar][i*kNPtBins+j] = 0.; | |
148 | } | |
149 | } | |
150 | } | |
151 | ||
152 | TFile *inFile = NULL; | |
153 | TH2D *hTMPData = NULL; | |
154 | TH2D *hTMPRes = NULL; | |
155 | TH2D *hTMPFit = NULL; | |
156 | TF2 *fFit = NULL; | |
157 | ||
158 | ||
159 | for(Int_t i = 0; i < kNPtBins; i++){ | |
160 | for(Int_t j = 0; j <= i; j++){ | |
161 | ||
162 | cout<<" PROCESSING PT BIN "<<i<<" "<<j<<endl; | |
163 | ||
164 | ptTriggerMin = ptBins[i]; | |
165 | ptTriggerMax = ptBins[i+1]; | |
166 | ptAssociatedMin = ptBins[j]; | |
167 | ptAssociatedMax = ptBins[j+1]; | |
168 | ||
169 | ||
170 | //Latex | |
171 | TString centralityLatex = "Centrality: "; | |
172 | centralityLatex += centralityArray[gCentrality-1]; | |
173 | centralityLatex += "%"; | |
174 | ||
175 | TString psiLatex; | |
176 | if((psiMin == -0.5)&&(psiMax == 0.5)) | |
177 | psiLatex = " -7.5^{o} < #varphi - #Psi_{2} < 7.5^{o}"; | |
178 | else if((psiMin == 0.5)&&(psiMax == 1.5)) | |
179 | psiLatex = " 37.5^{o} < #varphi - #Psi_{2} < 52.5^{o}"; | |
180 | else if((psiMin == 1.5)&&(psiMax == 2.5)) | |
181 | psiLatex = " 82.5^{o} < #varphi - #Psi_{2} < 97.5^{o}"; | |
182 | else | |
183 | psiLatex = " 0^{o} < #varphi - #Psi_{2} < 180^{o}"; | |
184 | ||
185 | TString pttLatex = Form("%.1f",ptTriggerMin); | |
186 | pttLatex += " < p_{T,trig} < "; pttLatex += Form("%.1f",ptTriggerMax); | |
187 | pttLatex += " GeV/c"; | |
188 | ||
189 | TString ptaLatex = Form("%.1f",ptAssociatedMin); | |
190 | ptaLatex += " < p_{T,assoc} < "; ptaLatex += Form("%.1f",ptAssociatedMax); | |
191 | ptaLatex += " GeV/c"; | |
192 | ||
193 | TLatex *latexInfo1 = new TLatex(); | |
194 | latexInfo1->SetNDC(); | |
195 | latexInfo1->SetTextSize(0.045); | |
196 | latexInfo1->SetTextColor(1); | |
197 | ||
198 | // Open input file | |
9a62bd04 | 199 | inFileName = Form("PbPb/%s/Train%d/Fits/balanceFunctionFit2D",lhcPeriod,gTrainID); |
e4391c02 | 200 | if(eventClass == "Centrality"){ |
201 | inFileName += Form(".Centrality%.1fTo%.1f",psiMin,psiMax); | |
202 | inFileName += ".PsiAll.PttFrom"; | |
203 | } | |
204 | else if(eventClass == "Multiplicity"){ | |
205 | inFileName += Form(".Multiplicity%.0fTo%.0f",psiMin,psiMax); | |
206 | inFileName += ".PsiAll.PttFrom"; | |
207 | } | |
208 | else{ // "EventPlane" (default) | |
209 | inFileName += ".Centrality"; | |
210 | inFileName += gCentrality; inFileName += ".Psi"; | |
211 | if((psiMin == -0.5)&&(psiMax == 0.5)) inFileName += "InPlane.Ptt"; | |
212 | else if((psiMin == 0.5)&&(psiMax == 1.5)) inFileName += "Intermediate.Ptt"; | |
213 | else if((psiMin == 1.5)&&(psiMax == 2.5)) inFileName += "OutOfPlane.Ptt"; | |
214 | else if((psiMin == 2.5)&&(psiMax == 3.5)) inFileName += "Rest.PttFrom"; | |
215 | else inFileName += "All.PttFrom"; | |
216 | } | |
a67d6cee | 217 | inFileName += Form("%.1f",ptTriggerMin); inFileName += "To"; |
218 | inFileName += Form("%.1f",ptTriggerMax); inFileName += "PtaFrom"; | |
219 | inFileName += Form("%.1f",ptAssociatedMin); inFileName += "To"; | |
220 | inFileName += Form("%.1f",ptAssociatedMax); | |
9a62bd04 | 221 | inFileName += "_2pMethod.root"; |
a67d6cee | 222 | inFile = TFile::Open(inFileName.Data(),"read"); |
223 | inFile->ls(); | |
224 | hTMPData = (TH2D*)inFile->Get(Form("gHistBalanceFunctionSubtracted")); | |
225 | hTMPRes = (TH2D*)inFile->Get("gHistResidual"); | |
226 | hTMPFit = (TH2D*)inFile->Get(Form("gHistBalanceFunctionSubtractedFit")); | |
227 | ||
228 | cQA[i][j]->cd(1); | |
229 | hTMPData->DrawCopy("surf1fb"); | |
230 | latexInfo1->DrawLatex(0.2,0.95,"Data"); | |
231 | ||
232 | latexInfo1->DrawLatex(0.44,0.88,centralityLatex.Data()); | |
233 | //latexInfo1->DrawLatex(0.44,0.82,psiLatex.Data()); | |
234 | latexInfo1->DrawLatex(0.44,0.82,pttLatex.Data()); | |
235 | latexInfo1->DrawLatex(0.44,0.76,ptaLatex.Data()); | |
236 | ||
237 | cQA[i][j]->cd(2); | |
238 | hTMPFit->DrawCopy("surf1fb"); | |
239 | latexInfo1->DrawLatex(0.2,0.95,"Fit"); | |
240 | ||
241 | cQA[i][j]->cd(3); | |
242 | hTMPRes->DrawCopy("surf1fb"); | |
243 | latexInfo1->DrawLatex(0.2,0.95,"Residual"); | |
244 | ||
245 | cQA[i][j]->cd(4); | |
246 | hTMPData->ProjectionX()->DrawCopy(""); | |
247 | latexInfo1->DrawLatex(0.2,0.95,"Data"); | |
248 | ||
249 | cQA[i][j]->cd(5); | |
250 | hTMPFit->ProjectionX()->DrawCopy(""); | |
251 | latexInfo1->DrawLatex(0.2,0.95,"Fit"); | |
252 | ||
253 | cQA[i][j]->cd(6); | |
254 | hTMPRes->ProjectionX()->DrawCopy(""); | |
255 | latexInfo1->DrawLatex(0.2,0.95,"Residual"); | |
256 | ||
257 | cQA[i][j]->cd(7); | |
258 | hTMPData->ProjectionY()->DrawCopy(""); | |
259 | latexInfo1->DrawLatex(0.2,0.95,"Data"); | |
260 | ||
261 | cQA[i][j]->cd(8); | |
262 | hTMPFit->ProjectionY()->DrawCopy(""); | |
263 | latexInfo1->DrawLatex(0.2,0.95,"Fit"); | |
264 | ||
265 | cQA[i][j]->cd(9); | |
266 | hTMPRes->ProjectionY()->DrawCopy(""); | |
267 | latexInfo1->DrawLatex(0.2,0.95,"Residual"); | |
268 | ||
269 | ||
270 | cQA[i][j]->SaveAs(Form(Form("PbPb/%s/Train%d/figs/balanceFunctionFit_PttFrom%.1fTo%.1fPtaFrom%.1fTo%.1f.eps",lhcPeriod,gTrainID,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax))); | |
271 | cQA[i][j]->SaveAs(Form(Form("PbPb/%s/Train%d/figs/balanceFunctionFit_PttFrom%.1fTo%.1fPtaFrom%.1fTo%.1f.pdf",lhcPeriod,gTrainID,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax))); | |
272 | ||
273 | // fit parameters | |
274 | fFit = (TF2*)inFile->Get("gFitFunction"); | |
275 | for(Int_t iPar = 0; iPar < 18; iPar++){ | |
276 | p[iPar][i*kNPtBins+j] = fFit->GetParameter(iPar); | |
277 | pE[iPar][i*kNPtBins+j] = fFit->GetParError(iPar); | |
278 | cout<<iPar<<") Parameter "<<fFit->GetParName(iPar)<<" : "<<p[iPar][i*kNPtBins+j]<<" +- "<<pE[iPar][i*kNPtBins+j]<<endl; | |
279 | } | |
280 | ||
281 | inFile->Close(); | |
282 | } | |
283 | } | |
284 | ||
285 | TGraphErrors *gPar[18]; | |
286 | for(Int_t iPar = 0; iPar < 18; iPar++){ | |
287 | gPar[iPar] = new TGraphErrors(kNPtBins*kNPtBins,pt,p[iPar],ptE,pE[iPar]); | |
288 | gPar[iPar]->SetName(Form("gPar%d",iPar)); | |
289 | gPar[iPar]->SetTitle(fFit->GetParName(iPar)); | |
290 | gPar[iPar]->GetXaxis()->SetTitle("p_{T}"); | |
291 | gPar[iPar]->GetYaxis()->SetTitle(fFit->GetParName(iPar)); | |
292 | gPar[iPar]->SetMinimum(0.01); | |
293 | gPar[iPar]->SetMaximum(2); | |
294 | gPar[iPar]->SetMarkerStyle(20); | |
295 | gPar[iPar]->SetMarkerColor(2); | |
296 | gPar[iPar]->SetLineColor(2); | |
297 | } | |
298 | ||
299 | TLatex *latexInfo2 = new TLatex(); | |
300 | latexInfo2->SetNDC(); | |
301 | latexInfo2->SetTextSize(0.045); | |
302 | latexInfo2->SetTextColor(1); | |
303 | ||
304 | TCanvas *cPar = new TCanvas("cPar","parameters",1200,900); | |
305 | cPar->Divide(3,3); | |
306 | ||
307 | cPar->cd(1); | |
308 | gPar[1]->Draw("AP"); | |
309 | ||
310 | cPar->cd(2); | |
311 | gPar[2]->Draw("AP"); | |
312 | ||
313 | cPar->cd(3); | |
314 | gPar[3]->Draw("AP"); | |
315 | ||
316 | cPar->cd(4); | |
317 | gPar[8]->Draw("AP"); | |
318 | ||
319 | cPar->cd(5); | |
320 | gPar[9]->Draw("AP"); | |
321 | ||
322 | cPar->cd(6); | |
323 | gPar[17]->Draw("AP"); | |
324 | ||
325 | cPar->cd(7); | |
326 | gPar[12]->Draw("AP"); | |
327 | ||
328 | cPar->cd(8); | |
329 | gPar[14]->Draw("AP"); | |
330 | ||
331 | cPar->cd(9); | |
332 | gPar[15]->Draw("AP"); | |
333 | ||
334 | cPar->SaveAs(Form("PbPb/%s/Train%d/figs/balanceFunctionFit_Cent%d_FitParameters.eps",lhcPeriod,gTrainID,gCentrality)); | |
335 | cPar->SaveAs(Form("PbPb/%s/Train%d/figs/balanceFunctionFit_Cent%d_FitParameters.pdf",lhcPeriod,gTrainID,gCentrality)); | |
336 | ||
e4391c02 | 337 | TFile *fOut = NULL; |
338 | if(eventClass == "Centrality"){ | |
339 | fOut = TFile::Open(Form("PbPb/%s/Train%d/figs/balanceFunctionFit_Cent%.1fTo%.1f_FitParameters.root",lhcPeriod,gTrainID,psiMin,psiMax),"RECREATE"); | |
340 | } | |
341 | else if(eventClass == "Multiplicity"){ | |
342 | fOut = TFile::Open(Form("PbPb/%s/Train%d/figs/balanceFunctionFit_Mult%.1fTo%.1f_FitParameters.root",lhcPeriod,gTrainID,psiMin,psiMax),"RECREATE"); | |
343 | } | |
344 | else{ | |
345 | fOut = TFile::Open(Form("PbPb/%s/Train%d/figs/balanceFunctionFit_Cent%d_FitParameters.root",lhcPeriod,gTrainID,gCentrality),"RECREATE") | |
346 | } | |
347 | ||
a67d6cee | 348 | for(Int_t iPar = 0; iPar < 18; iPar++){ |
349 | gPar[iPar]->Write(); | |
350 | } | |
351 | ||
352 | // delete canvases | |
353 | for(Int_t i = 0; i < kNPtBins; i++){ | |
354 | for(Int_t j = 0; j <= i; j++){ | |
355 | //delete cQA[i][j]; | |
356 | } | |
357 | } | |
358 | ||
359 | } | |
360 | ||
361 |