]>
Commit | Line | Data |
---|---|---|
9dcf9913 | 1 | // add comment |
2 | ||
3 | // Set how many output analysis files in total you want to access: | |
c109b8c7 | 4 | const Int_t nFiles = 1; |
9dcf9913 | 5 | |
6 | // Set how many of those output analysis files you want to represent with a mesh (usually used to represent results of simulations): | |
c109b8c7 | 7 | const Int_t nSim = 0; |
9dcf9913 | 8 | |
9 | // Set paths of all output analysis files (first the ones to be represented with mesh (simulations), then the ones to be represented with markers (real data)) | |
c109b8c7 | 10 | TString files[nFiles] = {"data"}; |
9dcf9913 | 11 | |
12 | // Set analysis types for all output analysis files (can be "ESD","AOD","MC",""): | |
c109b8c7 | 13 | TString type[nFiles] = {"ESD"}; |
9dcf9913 | 14 | |
15 | // Set mesh color: | |
c109b8c7 | 16 | Int_t meshColor[nSim] = {}; |
9dcf9913 | 17 | |
18 | // Set marker styles: | |
19 | Int_t markerStyle[nFiles-nSim] = {kStar}; | |
20 | ||
c109b8c7 | 21 | // Set marker colors: |
22 | Int_t markerColor[nFiles-nSim] = {kBlack}; | |
23 | ||
9dcf9913 | 24 | // Set legend entries: |
c109b8c7 | 25 | TString legendEntry[nFiles] = {"pp example run"}; |
9dcf9913 | 26 | |
c109b8c7 | 27 | // Set if you whish to plot cumulants versus <reference multiplicity> (by default they are plotted versus # of RPs): |
28 | Bool_t plotCumulantsVsReferenceMultiplicity = kTRUE; | |
29 | ||
9dcf9913 | 30 | // Set flow values whose theoretical contribution to cumulants will be shown on the plots with the straight coloured lines: |
31 | Bool_t showTheoreticalLines = kFALSE; | |
32 | const Int_t nFlowValues = 2; | |
33 | Double_t v[nFlowValues] = {0.1,0.05}; | |
34 | Int_t lineColor[nFlowValues] = {kRed,kBlue}; | |
35 | ||
36 | // If the statistical error of 6th and 8th order cumulant is huge you may prefer not to show them: | |
c109b8c7 | 37 | Bool_t plotOnly2ndAnd4thOrderCumulant = kTRUE; |
9dcf9913 | 38 | |
39 | // For comparison sake show also GFC results with dotted line: | |
40 | Bool_t showAlsoGFCResults = kFALSE; | |
41 | Int_t gfcLineStyle = 3; | |
42 | ||
43 | // Set method names which calculate cumulants vs multiplicity: | |
44 | const Int_t nMethods = 2; | |
45 | TString method[nMethods] = {"QC","GFC"}; | |
46 | ||
47 | TFile *commonOutputFiles[nFiles] = {NULL}; // common output files "AnalysisResults.root" | |
48 | TList *lists[nFiles][nMethods] = {{NULL}}; // lists cobj<method> holding objects with results for each method | |
49 | TH1D *cumulantsVsM[nFiles][nMethods][4] = {{{NULL}}}; // histograms with results for cumulants vs multiplicity (4 stands for 4 cumulant orders) | |
50 | TLine *lines[nFlowValues][4] = {{NULL}}; // lines denoting theoretical flow contribution to cumulants | |
c109b8c7 | 51 | TProfile *refMultVsNoOfRPs = NULL; // <reference multipicity> versus # of RPs |
9dcf9913 | 52 | |
53 | // Ranges for plots: | |
54 | Double_t xMin[4]={0.}; | |
55 | Double_t xMax[4]={0.}; | |
56 | Double_t yMin[4]={0.}; | |
57 | Double_t yMax[4]={0.}; | |
58 | ||
59 | enum libModes {mLocal,mLocalSource}; | |
60 | ||
61 | void plotCumulants(Int_t analysisMode=mLocal) | |
62 | { | |
63 | // analysisMode: if analysisMode = mLocal -> analyze data on your computer using aliroot | |
64 | // if analysisMode = mLocalSource -> analyze data on your computer using root + source files | |
65 | ||
66 | // Load needed libraries: | |
67 | LoadLibrariesPC(analysisMode); | |
68 | ||
69 | // Access all common output files: | |
70 | TString commonOutputFileName = "AnalysisResults.root"; | |
71 | AccessCommonOutputFiles(commonOutputFileName); | |
72 | ||
73 | // Get from common output files the lists holding histograms for each method: | |
74 | GetLists(); | |
75 | ||
76 | // Get histograms with results for cumulants vs multiplicity: | |
77 | GetHistograms(); | |
78 | ||
79 | // Determine ranges for plots: | |
80 | DetermineMinMax(); | |
81 | ||
82 | // Make lines which indicate theoretical contributions of flow to cumulants: | |
83 | Lines(); | |
84 | ||
85 | // Print number of events and average multiplicities for each common output file: | |
86 | Print(); | |
87 | ||
88 | // Make plots: | |
89 | Plot(); | |
90 | ||
91 | // Global settings which will affect all plots: | |
92 | GlobalSettings(); | |
93 | ||
94 | } // end of void plotCumulants(Int_t analysisMode=mLocal) | |
95 | ||
96 | // ===================================================================================== | |
97 | ||
98 | void Plot() | |
99 | { | |
100 | // Make all plots. | |
101 | ||
102 | TCanvas *c = NULL; | |
103 | Int_t coMax = 0; | |
104 | if(!plotOnly2ndAnd4thOrderCumulant) | |
105 | { | |
106 | c = new TCanvas("c","cumulants"); | |
107 | c->Divide(2,2); | |
108 | coMax = 4; | |
109 | } else | |
110 | { | |
111 | c = new TCanvas("c","cumulants",1200,500); | |
112 | c->Divide(2,1); | |
113 | coMax = 2; | |
114 | } | |
115 | ||
116 | TLegend *legend = new TLegend(0.1,0.7,0.33,0.9); | |
117 | legend->SetFillStyle(0); | |
118 | ||
119 | TString qcFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"}; | |
120 | ||
121 | for(Int_t co=0;co<coMax;co++) // cumulant order | |
122 | { | |
123 | c->cd(co+1); | |
124 | StyleHist(qcFlag[co].Data(),co)->Draw(); | |
125 | // simulations: | |
126 | for(Int_t s=0;s<nSim;s++) | |
127 | { | |
128 | TGraph *errorMesh = GetErrorMesh(cumulantsVsM[s][0][co]); | |
129 | if(errorMesh) | |
130 | { | |
131 | errorMesh->SetFillColor(meshColor[s]); | |
132 | errorMesh->Draw("lfsame"); | |
133 | } | |
134 | if(co==0){legend->AddEntry(errorMesh,legendEntry[s].Data(),"f");} | |
135 | } // end of if(Int_t s=0;s<nSim;s++) | |
136 | // data: | |
137 | for(Int_t f=nSim;f<nFiles;f++) | |
138 | { | |
139 | // Theoretical lines: | |
140 | if(showTheoreticalLines) | |
141 | { | |
142 | if(f==nSim) // plot them only once | |
143 | { | |
144 | for(Int_t fv=0;fv<nFlowValues;fv++) | |
145 | { | |
146 | lines[fv][co]->Draw("same"); | |
147 | if(co==0){legend->AddEntry(lines[fv][co],Form("v_{2} = %g",v[fv]),"l");} | |
148 | } | |
149 | } | |
150 | } | |
151 | // QC results: | |
152 | if(cumulantsVsM[f][0][co]) | |
153 | { | |
154 | cumulantsVsM[f][0][co]->Draw("e1same"); | |
c109b8c7 | 155 | cumulantsVsM[f][0][co]->SetMarkerStyle(markerStyle[f-nSim]); |
156 | cumulantsVsM[f][0][co]->SetMarkerColor(markerColor[f-nSim]); | |
9dcf9913 | 157 | if(co==0) |
158 | { | |
159 | if(showAlsoGFCResults) | |
160 | { | |
161 | legend->AddEntry(cumulantsVsM[f][0][co],Form("%s (QC)",legendEntry[f].Data()),"p"); | |
162 | } else | |
163 | { | |
164 | legend->AddEntry(cumulantsVsM[f][0][co],legendEntry[f].Data(),"p"); | |
165 | } | |
166 | } | |
167 | } | |
168 | // GFC results: | |
169 | if(showAlsoGFCResults && cumulantsVsM[f][1][co]) | |
170 | { | |
171 | cumulantsVsM[f][1][co]->Draw("lsame"); | |
172 | cumulantsVsM[f][1][co]->SetLineStyle(gfcLineStyle); | |
173 | if(co==0){legend->AddEntry(cumulantsVsM[f][1][co],Form("%s (GFC)",legendEntry[f].Data()),"l");} | |
174 | } | |
175 | } | |
176 | // Draw legend: | |
177 | if(co==0){legend->Draw("same");} | |
178 | } // end of for(Int_t co=0;co<4;co++) // cumulant order | |
c109b8c7 | 179 | |
180 | // Plot also <reference multiplicity> vs # of RPs: | |
181 | if(plotCumulantsVsReferenceMultiplicity) | |
182 | { | |
183 | if(refMultVsNoOfRPs) | |
184 | { | |
185 | TCanvas *cRefMultVsNoOfRPs = new TCanvas("cRefMultVsNoOfRPs","#LTreference multiplicity#GT vs # of RPs"); | |
186 | refMultVsNoOfRPs->SetTitle(""); | |
187 | refMultVsNoOfRPs->GetXaxis()->SetRangeUser(0,refMultVsNoOfRPs->FindLastBinAbove()); | |
188 | refMultVsNoOfRPs->Draw(); | |
189 | } else | |
190 | { | |
191 | cout<<endl; | |
192 | cout<<"WARNING: refMultVsNoOfRPs is NULL in Plot() !!!!"<<endl; | |
193 | cout<<endl; | |
194 | } | |
195 | } | |
196 | ||
9dcf9913 | 197 | } // end of void Plot() |
198 | ||
199 | // ===================================================================================== | |
200 | ||
201 | void Lines() | |
202 | { | |
203 | // Make lines denoting theoretical contribution of flow to cumulants. | |
204 | ||
205 | for(Int_t co=0;co<4;co++) | |
206 | { | |
207 | xMin[co] = 0.; | |
208 | //xMax[co] = 59.5; | |
209 | } | |
210 | ||
211 | for(Int_t fv=0;fv<nFlowValues;fv++) | |
212 | { | |
213 | lines[fv][0] = new TLine(xMin[0],pow(v[fv],2),xMax[0]+0.5,pow(v[fv],2)); | |
214 | lines[fv][0]->SetLineColor(lineColor[fv]); | |
215 | lines[fv][1] = new TLine(xMin[1],-pow(v[fv],4),xMax[1]+0.5,-pow(v[fv],4)); | |
216 | lines[fv][1]->SetLineColor(lineColor[fv]); | |
217 | lines[fv][2] = new TLine(xMin[2],4.*pow(v[fv],6),xMax[2]+0.5,4.*pow(v[fv],6)); | |
218 | lines[fv][2]->SetLineColor(lineColor[fv]); | |
219 | lines[fv][3] = new TLine(xMin[3],-33.*pow(v[fv],8),xMax[3]+0.5,-33.*pow(v[fv],8)); | |
220 | lines[fv][3]->SetLineColor(lineColor[fv]); | |
221 | } | |
222 | ||
223 | } // end of void Lines() | |
224 | ||
225 | // ===================================================================================== | |
226 | ||
227 | void Print() | |
228 | { | |
229 | // Print number of events and average multiplicities for each common output file. | |
230 | ||
231 | cout<<endl; | |
232 | cout<<"Accessed files:"<<endl; | |
233 | cout<<endl; | |
234 | for(Int_t f=0;f<nFiles;f++) | |
235 | { | |
236 | cout<<commonOutputFiles[f]->GetName()<<endl; | |
237 | for(Int_t m=0;m<nMethods;m++) | |
238 | { | |
239 | AliFlowCommonHist *commonHist = dynamic_cast<AliFlowCommonHist*> (lists[f][m]->FindObject(Form("AliFlowCommonHist%s",method[m].Data()))); | |
240 | Double_t nEvts = -1.; | |
241 | Double_t AvM = -1.; | |
242 | if(commonHist && commonHist->GetHistMultRP()) | |
243 | { | |
244 | nEvts = commonHist->GetHistMultRP()->GetEntries(); | |
245 | AvM = commonHist->GetHistMultRP()->GetMean(); | |
246 | } | |
247 | if(!(strcmp(method[m].Data(),"QC"))) | |
248 | { | |
249 | cout<<Form("%s:",method[m].Data())<<" <M> = "<<AvM<<", N = "<<nEvts<<endl; | |
250 | } | |
251 | if(!(strcmp(method[m].Data(),"GFC")) && showAlsoGFCResults) | |
252 | { | |
253 | cout<<Form("%s:",method[m].Data())<<" <M> = "<<AvM<<", N = "<<nEvts<<endl; | |
254 | } | |
255 | } | |
256 | cout<<endl; | |
257 | } // end of for(Int_t f=0;f<nFiles;f++) | |
258 | ||
259 | } // end of void Print() | |
260 | ||
261 | // ===================================================================================== | |
262 | ||
263 | void DetermineMinMax() | |
264 | { | |
265 | // Determine ranges for plots. | |
266 | ||
267 | for(Int_t co=0;co<4;co++) | |
268 | { | |
269 | xMin[co] = 0.; yMin[co] = 44.; | |
270 | xMax[co] = -440000.; yMax[co] = -44.; | |
271 | } | |
272 | ||
273 | Double_t tfc[nFlowValues][4] = {{0.}}; // theoretical flow contribution | |
274 | for(Int_t fv=0;fv<nFlowValues;fv++) | |
275 | { | |
276 | tfc[fv][0] = pow(v[fv],2); | |
277 | tfc[fv][1] = -pow(v[fv],4); | |
278 | tfc[fv][2] = 4.*pow(v[fv],6); | |
279 | tfc[fv][3] = -33.*pow(v[fv],8); | |
280 | } | |
281 | ||
282 | for(Int_t f=0;f<nFiles;f++) | |
283 | { | |
284 | for(Int_t m=0;m<nMethods;m++) | |
285 | { | |
286 | for(Int_t co=0;co<4;co++) | |
287 | { | |
288 | if(cumulantsVsM[f][m][co]) | |
289 | { | |
290 | for(Int_t b=1;b<=cumulantsVsM[f][m][co]->GetXaxis()->GetNbins();b++) | |
291 | { | |
292 | Double_t result = cumulantsVsM[f][m][co]->GetBinContent(b); | |
293 | Double_t error = cumulantsVsM[f][m][co]->GetBinError(b); | |
294 | if(TMath::Abs(result)>1.e-44 && TMath::Abs(error)>1.e-44) | |
295 | { | |
296 | // y-axis: | |
297 | if(yMin[co] > result-error){yMin[co] = result-error;} // min value | |
298 | if(yMax[co] < result+error) {yMax[co] = result+error;} // max value | |
299 | // x-axis: | |
300 | xMax[co] = b; | |
301 | } | |
302 | } // end of for(Int_t b=1;b<=cumulantsVsM[f][m][co]->GetXaxis()->GetNbins();b++) | |
303 | // theoretical contributions: | |
304 | for(Int_t fv=0;fv<nFlowValues;fv++) | |
305 | { | |
306 | //if(yMin[co] > tfc[fv][0]) {yMin[co] = tfc[fv][0];} // min value | |
307 | //if(yMax[co] < tfc[fv][0]) {yMax[co] = tfc[fv][0];} // max value | |
308 | } // end of for(Int_t fv=0;fv<nFlowValues;fv++) | |
309 | } // end of if(cumulantsVsM[f][m][co]) | |
310 | } // end of for(Int_t co=0;co<4;co++) | |
311 | } // end of for(Int_t m=0;m<nMethods;m++) | |
312 | } // end of for(Int_t f=0;f<nFiles;f++) | |
313 | ||
314 | } // end of void DetermineMinMax() | |
315 | ||
316 | // ===================================================================================== | |
317 | ||
318 | void GetHistograms() | |
319 | { | |
320 | // Get histograms with results for cumulants vs multiplicity. | |
c109b8c7 | 321 | |
322 | if(plotCumulantsVsReferenceMultiplicity) {GetProfileForRefMultVsNoOfRPs();} | |
9dcf9913 | 323 | |
324 | TString qcFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"}; | |
325 | TString gfcFlag[4] = {"GFC{2}","GFC{4}","GFC{6}","GFC{8}"}; | |
326 | for(Int_t f=0;f<nFiles;f++) | |
327 | { | |
328 | for(Int_t m=0;m<nMethods;m++) | |
329 | { | |
330 | TList *temp = NULL; | |
331 | if(!(strcmp(method[m].Data(),"QC"))) | |
332 | { | |
333 | temp = dynamic_cast<TList*> (lists[f][m]->FindObject("Integrated Flow")); | |
334 | if(temp) {temp = dynamic_cast<TList*> (temp->FindObject("Results"));} | |
335 | if(temp) | |
336 | { | |
337 | for(Int_t co=0;co<4;co++) | |
338 | { | |
339 | cumulantsVsM[f][m][co] = dynamic_cast<TH1D*> (temp->FindObject(Form("fIntFlowQcumulantsVsM, %s",qcFlag[co].Data()))); | |
c109b8c7 | 340 | if(plotCumulantsVsReferenceMultiplicity) |
341 | { | |
342 | Map(cumulantsVsM[f][m][co]); | |
343 | } | |
9dcf9913 | 344 | } |
345 | } | |
346 | } // end of if(!(strcmp(method[m].Data(),"QC"))) | |
347 | else if(!(strcmp(method[m].Data(),"GFC"))) | |
348 | { | |
349 | temp = dynamic_cast<TList*> (lists[f][m]->FindObject("Reference Flow")); | |
350 | if(temp) {temp = dynamic_cast<TList*> (temp->FindObject("Results"));} | |
351 | if(temp) | |
352 | { | |
353 | for(Int_t co=0;co<4;co++) | |
354 | { | |
355 | cumulantsVsM[f][m][co] = dynamic_cast<TH1D*> (temp->FindObject(Form("fReferenceFlowCumulantsVsM, %s",gfcFlag[co].Data()))); | |
c109b8c7 | 356 | if(plotCumulantsVsReferenceMultiplicity) |
357 | { | |
358 | Map(cumulantsVsM[f][m][co]); | |
359 | } | |
9dcf9913 | 360 | } |
361 | } | |
362 | } // end of else if(!(strcmp(method[m].Data(),"QC"))) | |
363 | } // end of for(Int_t m=0;m<nMethods;m++) | |
364 | } // end of for(Int_t f=0;f<nFiles;f++) | |
365 | ||
366 | } // end of void GetHistograms() | |
367 | ||
368 | // ===================================================================================== | |
369 | ||
c109b8c7 | 370 | void GetProfileForRefMultVsNoOfRPs() |
371 | { | |
372 | // Get profile holding <reference multiplicity> versus # of RPs. | |
373 | ||
374 | AliFlowCommonHist *commonHist = dynamic_cast<AliFlowCommonHist*> (lists[0][0]->FindObject("AliFlowCommonHistQC")); | |
375 | if(commonHist && commonHist->GetRefMultVsNoOfRPs()) | |
376 | { | |
377 | refMultVsNoOfRPs = commonHist->GetRefMultVsNoOfRPs(); | |
378 | } else | |
379 | { | |
380 | cout<<endl; | |
381 | cout<<"WARNING: commonHist && commonHist->GetRefMultVsNoOfRPs() is NULL in method"<<endl; | |
382 | cout<<" GetProfileForRefMultVsNoOfRPs() !!!! But was searching only in the file"<<endl; | |
383 | cout<<" "<<commonOutputFiles[0]->GetName()<<", though."<<endl; | |
384 | cout<<" Do you have this file available?"<<endl; | |
385 | cout<<endl; | |
386 | } | |
387 | ||
388 | } // end of void GetProfileForRefMultVsNoOfRPs() | |
389 | ||
390 | // ===================================================================================== | |
391 | ||
392 | void Map(TH1D *hist) | |
393 | { | |
394 | // Map cumulant versus # of RPs into cumulants versus <reference multiplicity>. | |
395 | ||
396 | TH1D *temp = NULL; | |
397 | if(hist) | |
398 | { | |
399 | temp = (TH1D*) hist->Clone(); | |
400 | temp->Reset(); | |
401 | Int_t nBins = hist->GetNbinsX(); | |
402 | for(Int_t b=1;b<=nBins;b++) | |
403 | { | |
404 | temp->SetBinContent((Int_t)refMultVsNoOfRPs->GetBinContent(b),hist->GetBinContent(b)); | |
405 | temp->SetBinError((Int_t)refMultVsNoOfRPs->GetBinContent(b),hist->GetBinError(b)); | |
406 | } | |
407 | } | |
408 | ||
409 | hist = temp; | |
410 | ||
411 | return; | |
412 | ||
413 | } // end of Map() | |
414 | ||
415 | // ===================================================================================== | |
416 | ||
9dcf9913 | 417 | TGraphErrors* GetGraphErrors(Int_t bin, Int_t nFiles, TH1D** qc) |
418 | { | |
419 | TGraphErrors *ge = new TGraphErrors(nFiles); | |
420 | for(Int_t f=0;f<nFiles;f++) | |
421 | { | |
422 | ge->SetPoint(f,f+0.5,qc[f]->GetBinContent(bin+1)); | |
423 | ge->SetPointError(f,0,qc[f]->GetBinError(bin+1)); | |
424 | } | |
425 | ||
426 | return ge; | |
427 | ||
428 | } // end of TGraphErrors* GetGraphErrors(Int_t bin, Int_t nFiles, TH1D** qc) | |
429 | ||
430 | // ===================================================================================== | |
431 | ||
432 | TH1D* StyleHist(TString yAxisTitle, Int_t co) | |
433 | { | |
434 | // Style histogram. | |
435 | ||
436 | TH1D *styleHist = new TH1D("","",10000,0,10000); // to be improved (hardwired 10000) | |
437 | // x-axis: | |
438 | styleHist->GetXaxis()->SetRangeUser(xMin[co],xMax[co]); | |
439 | // y-axis: | |
440 | styleHist->GetYaxis()->SetRangeUser(yMin[co],yMax[co]); | |
441 | ||
c109b8c7 | 442 | if(plotCumulantsVsReferenceMultiplicity) |
443 | { | |
444 | styleHist->GetXaxis()->SetTitle("#LTreference multiplicity#GT"); | |
445 | } else | |
446 | { | |
447 | styleHist->GetXaxis()->SetTitle("# of RPs"); | |
448 | } | |
449 | ||
9dcf9913 | 450 | styleHist->GetYaxis()->SetTitle(yAxisTitle.Data()); |
451 | ||
452 | return styleHist; | |
453 | ||
454 | } // end of TH1D* StyleHist(TString yAxisTitle, Int_t co) | |
455 | ||
456 | // =========================================================================================== | |
457 | ||
458 | TGraph* GetErrorMesh(TH1D *hist) | |
459 | { | |
460 | // Error mesh. | |
461 | ||
462 | TGraph* errorMesh = NULL; | |
463 | if(hist) | |
464 | { | |
465 | Int_t nBins = hist->GetNbinsX(); | |
466 | Double_t binWidth = hist->GetBinWidth(1); // assuming that all bins have the same width | |
467 | // Counting the non-empty bins: | |
468 | Int_t nNonEmptyBins=0; | |
469 | for(Int_t i=1;i<nBins+1;i++) | |
470 | { | |
471 | if(!(hist)->GetBinError(i)==0.0)) | |
472 | { | |
473 | nNonEmptyBins++; | |
474 | } | |
475 | } | |
476 | errorMesh = new TGraph(2*nNonEmptyBins+1); | |
477 | Double_t value=0.,error=0.; | |
478 | Int_t count=1; | |
479 | Double_t xFirst=0.,yUpFirst=0.; // needed to close up the mesh | |
480 | for(Int_t i=1;i<nBins+1;i++) | |
481 | { | |
482 | // Setting up the upper limit of the mesh: | |
483 | value = hist->GetBinContent(i); | |
484 | error = hist->GetBinError(i); | |
485 | if(!(error==0.0)) | |
486 | { | |
487 | errorMesh->SetPoint(count++,(i-0.5)*binWidth,value+error); | |
488 | if(xFirst==0.) | |
489 | { | |
490 | xFirst=(i-0.5)*binWidth; | |
491 | yUpFirst=value+error; | |
492 | } | |
493 | } | |
494 | } | |
495 | for(Int_t i=nBins+1;i<2*nBins+1;i++) | |
496 | { | |
497 | // Setting up the lower limit of the mesh: | |
498 | value = hist->GetBinContent(2*nBins+1-i); | |
499 | error = hist->GetBinError(2*nBins+1-i); | |
500 | if(!(error==0.0)) | |
501 | { | |
502 | errorMesh->SetPoint(count++,(2*nBins-i+0.5)*binWidth,value-error); | |
503 | } | |
504 | } | |
505 | // Closing the mesh area: | |
506 | errorMesh->SetPoint(2*nNonEmptyBins+1,xFirst,yUpFirst); | |
507 | } // end if(hist) | |
508 | ||
509 | errorMesh->SetFillStyle(1001); | |
510 | ||
511 | return errorMesh; | |
512 | ||
513 | } // end of TGraph* GetErrorMesh(TH1D *hist) | |
514 | ||
515 | // =========================================================================================== | |
516 | ||
517 | void GlobalSettings() | |
518 | { | |
519 | // Settings which will affect all plots. | |
520 | ||
521 | gROOT->SetStyle("Plain"); // default color is white instead of gray | |
522 | gStyle->SetOptStat(0); // remove stat. box from all histos | |
523 | ||
524 | } // end of void GlobalSettings() | |
525 | ||
526 | // =========================================================================================== | |
527 | ||
528 | void GetLists() | |
529 | { | |
530 | // Get from common output files the lists holding histograms for each method. | |
531 | ||
532 | TString fileName[nFiles][nMethods]; | |
533 | TDirectoryFile *dirFile[nFiles][nMethods] = {{NULL}}; | |
534 | TString listName[nFiles][nMethods]; | |
535 | for(Int_t f=0;f<nFiles;f++) | |
536 | { | |
537 | for(Int_t i=0;i<nMethods;i++) | |
538 | { | |
539 | // Form a file name for each method: | |
540 | fileName[f][i]+="output"; | |
541 | fileName[f][i]+=method[i].Data(); | |
542 | fileName[f][i]+="analysis"; | |
543 | fileName[f][i]+=type[f].Data(); | |
544 | // Access this file: | |
545 | if(commonOutputFiles[f]){dirFile[f][i] = (TDirectoryFile*)commonOutputFiles[f]->FindObjectAny(fileName[f][i].Data());} | |
546 | // Form a list name for each method: | |
547 | listName[f][i]+="cobj"; | |
548 | listName[f][i]+=method[i].Data(); | |
549 | // Access this lists: | |
550 | if(dirFile[f][i]) | |
551 | { | |
552 | dirFile[f][i]->GetObject(listName[f][i].Data(),lists[f][i]); | |
553 | } else | |
554 | { | |
555 | cout<<"WARNING: Couldn't find a file "<<fileName[f][i].Data()<<".root in "<<commonOutputFiles[f]->GetName()<<" !!!!"<<endl;exit(0); | |
556 | } | |
557 | } // end of for(Int_t i=0;i<nMethods;i++) | |
558 | } // end of for(Int_t f=0;f<nFiles;f++) | |
559 | ||
560 | } // end of void GetLists() | |
561 | ||
562 | // =========================================================================================== | |
563 | ||
564 | void AccessCommonOutputFiles(TString commonOutputFileName) | |
565 | { | |
566 | // Access all output files. | |
567 | for(Int_t f=0;f<nFiles;f++) | |
568 | { | |
569 | if(!(gSystem->AccessPathName(Form("%s/%s/%s",gSystem->pwd(),files[f].Data(),commonOutputFileName.Data()),kFileExists))) | |
570 | { | |
571 | commonOutputFiles[f] = TFile::Open(Form("%s/%s/%s",gSystem->pwd(),files[f].Data(),commonOutputFileName.Data()),"READ"); | |
572 | } else | |
573 | { | |
574 | cout<<endl; | |
575 | cout<<"WARNING: Couldn't find the file "<<Form("%s/%s/%s",gSystem->pwd(),files[f].Data(),commonOutputFileName.Data())<<" !!!!"<<endl; | |
576 | cout<<endl; | |
577 | exit(0); | |
578 | } | |
579 | } // end of for(Int_t f=0;f<nFiles;f++) | |
580 | ||
581 | } // void AccessCommonOutputFiles(TString commonOutputFileName); | |
582 | ||
583 | // =========================================================================================== | |
584 | ||
585 | void LoadLibrariesPC(const libModes analysisMode) { | |
586 | ||
587 | //-------------------------------------- | |
588 | // Load the needed libraries most of them already loaded by aliroot | |
589 | //-------------------------------------- | |
590 | //gSystem->Load("libTree"); | |
591 | gSystem->Load("libGeom"); | |
592 | gSystem->Load("libVMC"); | |
593 | gSystem->Load("libXMLIO"); | |
594 | gSystem->Load("libPhysics"); | |
595 | ||
596 | //---------------------------------------------------------- | |
597 | // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< | |
598 | //---------------------------------------------------------- | |
599 | if (analysisMode==mLocal) { | |
600 | //-------------------------------------------------------- | |
601 | // If you want to use already compiled libraries | |
602 | // in the aliroot distribution | |
603 | //-------------------------------------------------------- | |
604 | ||
605 | //================================================================================== | |
606 | //load needed libraries: | |
607 | gSystem->AddIncludePath("-I$ROOTSYS/include"); | |
608 | //gSystem->Load("libTree"); | |
609 | ||
610 | // for AliRoot | |
611 | gSystem->AddIncludePath("-I$ALICE_ROOT/include"); | |
612 | //gSystem->Load("libANALYSIS"); | |
613 | gSystem->Load("libPWG2flowCommon"); | |
614 | //cerr<<"libPWG2flowCommon loaded ..."<<endl; | |
615 | ||
616 | } | |
617 | ||
618 | else if (analysisMode==mLocalSource) { | |
619 | ||
620 | // In root inline compile | |
621 | ||
622 | // Constants | |
623 | gROOT->LoadMacro("AliFlowCommon/AliFlowCommonConstants.cxx+"); | |
624 | gROOT->LoadMacro("AliFlowCommon/AliFlowLYZConstants.cxx+"); | |
625 | gROOT->LoadMacro("AliFlowCommon/AliFlowCumuConstants.cxx+"); | |
626 | ||
627 | // Flow event | |
628 | gROOT->LoadMacro("AliFlowCommon/AliFlowVector.cxx+"); | |
629 | gROOT->LoadMacro("AliFlowCommon/AliFlowTrackSimple.cxx+"); | |
630 | gROOT->LoadMacro("AliFlowCommon/AliFlowEventSimple.cxx+"); | |
631 | ||
632 | // Cuts | |
633 | gROOT->LoadMacro("AliFlowCommon/AliFlowTrackSimpleCuts.cxx+"); | |
634 | ||
635 | // Output histosgrams | |
636 | gROOT->LoadMacro("AliFlowCommon/AliFlowCommonHist.cxx+"); | |
637 | gROOT->LoadMacro("AliFlowCommon/AliFlowCommonHistResults.cxx+"); | |
638 | gROOT->LoadMacro("AliFlowCommon/AliFlowLYZHist1.cxx+"); | |
639 | gROOT->LoadMacro("AliFlowCommon/AliFlowLYZHist2.cxx+"); | |
640 | ||
641 | cout << "finished loading macros!" << endl; | |
642 | ||
643 | } | |
644 | ||
645 | } // end of void LoadLibraries(const libModes analysisMode) |