1 // Macro compareFlowResults.C is used to show a set of predefined plots with results
2 // of flow analysis. It's usage is very simple: If you have output root file of flow
3 // analysis <outputFileName> in directory <dir>, simply copy the macro in <dir> and
4 // execute it. Remarks:
5 // 1.) Make sure that the 'TString analysisType' bellow is the same as the one which
6 // was used in the analysis which have produced the <outputFileName>;
7 // 2.) Abbreviations used here are: RF = Reference Flow, RP = Reference Particles,
8 // POI = Particles Of Interest;
9 // 3.) To modify cosmetics of each plot change default settings in function which
10 // have produced that plot. Example: If you want to modify marker colors in
11 // the plot for reference flow, modify array Int_t methodMarkerColor[nMethods]
12 // in the function PlotReferenceFlow().
14 // Set name of the output file of flow analysis to be accessed:
15 TString outputFileName = "AnalysisResults.root";
16 //TString outputFileName = "outputCentrality4.root";
18 // Set here which plots will be shown by default:
20 Bool_t plotReferenceFlow = kTRUE; // reference flow
21 Bool_t plotIntFlowPOI = kTRUE; // integrated flow of POIs
22 Bool_t plotDiffFlowPtPOI = kTRUE; // differential flow v(pt) for POIs
23 Bool_t plotDiffFlowEtaPOI = kTRUE; // differential flow v(eta) for POIs
24 Bool_t plotIntFlowRP = kTRUE; // integrated flow of RPs
25 Bool_t plotDiffFlowPtRP = kTRUE; // differential flow v(pt) for RPs
26 Bool_t plotDiffFlowEtaRP = kTRUE; // differential flow v(eta) for RPs
27 // Results relative to MC:
28 Bool_t plotReferenceFlowRelativeToMC = kTRUE; // plot (v{MC}-v{method})/v{MC} for reference flow
29 Bool_t plotIntFlowRelativeToMCPOI = kTRUE; // plot (v{MC}-v{method})/v{MC} for integrated flow of POIs
30 Bool_t plotDiffFlowPtRelativeToMCPOI = kTRUE; // plot (v{MC}-v{method})/v{MC} as a function of pt for POIs
31 Bool_t plotDiffFlowEtaRelativeToMCPOI = kTRUE; // plot (v{MC}-v{method})/v{MC} as a function of eta for POIs
32 Bool_t plotIntFlowRelativeToMCRP = kTRUE; // plot (v{MC}-v{method})/v{MC} for integrated flow of RPs
33 Bool_t plotDiffFlowPtRelativeToMCRP = kTRUE; // plot (v{MC}-v{method})/v{MC} as a function of pt for RPs
34 Bool_t plotDiffFlowEtaRelativeToMCRP = kTRUE; // plot (v{MC}-v{method})/v{MC} as a function of eta for RPs
35 // Set here if the legends will be shown on the plots:
36 Bool_t showLegend = kTRUE;
37 Bool_t showLegendDiffFlow = kTRUE;
38 // Some quick settings:
39 Bool_t showOnlyReferenceFlow = kFALSE;
40 Bool_t showResultsRelativeToMC = kFALSE;
41 Bool_t showOnlyPlotsForPOIs = kFALSE;
42 Bool_t showOnlyPlotsForRPs = kFALSE;
43 // Set here if you want to rebin pt bins to reduce the statistical errors in the plots for differential flow vs pt:
44 Bool_t rebinInPt = kTRUE;
45 const Int_t nPtIntervals = 3;
46 Double_t ptInterval[nPtIntervals+1] = {0.,2.,5.,10.}; // in GeV
47 Int_t nMergedBins[nPtIntervals] = {1,2,5}; // for instance in 2nd pt interval (2-5 GeV) 5 pt bins will be merged into 1
48 // Set here if you want to use default values for harmonic, pt and eta binning:
49 Bool_t useDefaultValues = kTRUE;
50 TString methodForSettings = "QC"; // alternatively set here method from whose output files harmonic, pt and eta binning will be accessed
51 // Set here if you want to show error mesh:
52 Bool_t showErrorMesh = kTRUE;
53 Bool_t showErrorMeshDiffFlow = kTRUE;
54 // Set here if both the error mesh and markers will be shown for specified method in the plots for differential flow:
55 Bool_t showBothErrorMeshAndMarkers = kFALSE;
57 // Do not touch this unless you are looking for a trouble:
58 const Int_t nMethods = 12;
59 TString method[nMethods] = {"MCEP","SP","GFC","QC","FQD","LYZ1SUM","LYZ1PROD","LYZ2SUM","LYZ2PROD","LYZEP","MH","NL"};
60 TList *list[nMethods] = {NULL}; // lists holding histograms for each flow analysis method
62 enum libModes{mLocal,mLocalSource};
64 //void compareFlowResults(TString analysisType="",Int_t analysisMode=mLocalSource)
65 void compareFlowResults(TString analysisType="ESD",Int_t analysisMode=mLocal)
67 // 1. analysisType: "ESD", "AOD", "MC", "ESDMCkineESD", "ESDMCkineMC", "MK", for analysis 'on the fly' use simply "";
68 // 2. analysisMode: if analysisMode = mLocal -> analyze data on your computer using aliroot
69 // if analysisMode = mLocalSource -> analyze data on your computer using root + source files
71 // Load needed libraries:
72 LoadLibrariesCFR(analysisMode);
74 // Access common output file:
75 TFile *outputFile = AccessOutputFile(outputFileName);
77 // Access from common output file the TDirectoryFile's for each flow analysis method
78 // and from them the lists holding histograms with final results:
79 GetListsWithHistograms(outputFile,analysisType);
81 // Global settings which will affect all plots:
84 // Calling the functions to produce the final plots:
85 if(plotReferenceFlow) PlotReferenceFlow();
86 if(!showOnlyReferenceFlow)
88 if(!showOnlyPlotsForRPs)
90 if(plotIntFlowPOI) PlotIntFlowPOI();
91 if(plotDiffFlowPtPOI) PlotDiffFlowPtPOI();
92 if(plotDiffFlowEtaPOI) PlotDiffFlowEtaPOI();
94 if(!showOnlyPlotsForPOIs)
96 if(plotIntFlowRP) PlotIntFlowRP();
97 if(plotDiffFlowPtRP) PlotDiffFlowPtRP();
98 if(plotDiffFlowEtaRP) PlotDiffFlowEtaRP();
100 if(showResultsRelativeToMC)
102 if(plotReferenceFlowRelativeToMC) PlotReferenceFlowRelativeToMC();
103 if(!showOnlyPlotsForRPs)
105 if(plotIntFlowRelativeToMCPOI) PlotIntFlowRelativeToMCPOI();
106 if(plotDiffFlowPtRelativeToMCPOI) PlotDiffFlowPtRelativeToMCPOI();
107 if(plotDiffFlowEtaRelativeToMCPOI) PlotDiffFlowEtaRelativeToMCPOI();
109 if(!showOnlyPlotsForPOIs)
111 if(plotIntFlowRelativeToMCRP) PlotIntFlowRelativeToMCRP();
112 if(plotDiffFlowPtRelativeToMCRP) PlotDiffFlowPtRelativeToMCRP();
113 if(plotDiffFlowEtaRelativeToMCRP) PlotDiffFlowEtaRelativeToMCRP();
118 } // end of void newCompare(TString analysisType="",Int_t analysisMode=mLocal)
120 // ===========================================================================================
122 void PlotReferenceFlow()
124 // Make a plot which compares the results for reference flow.
126 // Settings for methods:
127 const Int_t nMethods = 13;
128 TString method[nMethods] = {"MCEP","SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","6,QC","8,GFC","8,QC","FQD","LYZ1SUM","LYZ1PROD"};
129 Int_t methodMarkerStyle[nMethods] = {21,21,21,21,21,21,21,21,21,21,21,21,21}; // see available marker styles in TAttMarker
130 Int_t methodMarkerColor[nMethods] = {kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack};
131 // Settings for error mesh:
132 TString methodUsedToMakeErrorMesh = "MCEP";
133 Int_t meshStyle = 1001;
134 Int_t meshColor = kGray;
136 Plot(nMethods,method,methodMarkerStyle,methodMarkerColor,
137 methodUsedToMakeErrorMesh,meshStyle,meshColor,"RF");
139 } // end of void PlotReferenceFlow()
141 // ===========================================================================================
143 void PlotIntFlowPOI()
145 // Make a plot which compares the results for reference flow.
147 // Settings for methods:
148 const Int_t nMethods = 10;
149 TString method[nMethods] = {"MCEP","SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
150 Int_t methodMarkerStyle[nMethods] = {21,21,21,21,21,21,21,21,21,21}; // see available marker styles in TAttMarker
151 Int_t methodMarkerColor[nMethods] = {kRed-3,kRed-3,kRed-3,kRed-3,kRed-3,kRed-3,kRed-3,kRed-3,kRed-3,kRed-3};
152 // Settings for error mesh:
153 TString methodUsedToMakeErrorMesh = "MCEP";
154 Int_t meshStyle = 1001;
155 Int_t meshColor = kRed-10;
157 Plot(nMethods,method,methodMarkerStyle,methodMarkerColor,
158 methodUsedToMakeErrorMesh,meshStyle,meshColor,"POI");
160 } // end of void PlotIntFlowPOI()
162 // ===========================================================================================
166 // Make a plot which compares the results for reference flow.
168 // Settings for methods:
169 const Int_t nMethods = 10;
170 TString method[nMethods] = {"MCEP","SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
171 Int_t methodMarkerStyle[nMethods] = {21,21,21,21,21,21,21,21,21,21}; // see available marker styles in TAttMarker
172 Int_t methodMarkerColor[nMethods] = {kBlue-3,kBlue-3,kBlue-3,kBlue-3,kBlue-3,kBlue-3,kBlue-3,kBlue-3,kBlue-3,kBlue-3};
173 // Settings for error mesh:
174 TString methodUsedToMakeErrorMesh = "MCEP";
175 Int_t meshStyle = 1001;
176 Int_t meshColor = kBlue-10;
178 Plot(nMethods,method,methodMarkerStyle,methodMarkerColor,
179 methodUsedToMakeErrorMesh,meshStyle,meshColor,"RP");
181 } // end of void PlotIntFlowRP()
183 // ===========================================================================================
185 void PlotDiffFlowPtPOI()
187 // Make a plot which compares the results for differential flow of POIs vs pt.
189 // Settings for methods:
190 const Int_t nMethods = 10;
191 TString method[nMethods] = {"MCEP","SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
192 Int_t methodMarkerStyle[nMethods] = {20,3,21,21,20,20,25,24,22,22}; // see available marker styles in TAttMarker
193 Int_t methodMarkerColor[nMethods] = {kRed,kViolet-6,kAzure-7,kOrange-7,kAzure+3,kOrange+3,kAzure-7,kAzure+3,kYellow+3,kGreen+3};
194 // Settings for error mesh:
195 TString methodUsedToMakeErrorMesh = "MCEP";
196 Int_t meshStyle = 1001;
197 Int_t meshColor = kRed-10;
199 PlotDiffFlow(nMethods,method,methodMarkerStyle,methodMarkerColor,
200 methodUsedToMakeErrorMesh,meshStyle,meshColor,"Pt","POI");
202 } // end of void PlotDiffFlowPtPOI()
204 // ===========================================================================================
206 void PlotDiffFlowEtaPOI()
208 // Make a plot which compares the results for differential flow of POIs vs eta.
210 // Settings for methods:
211 const Int_t nMethods = 10;
212 TString method[nMethods] = {"MCEP","SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
213 Int_t methodMarkerStyle[nMethods] = {20,3,21,21,20,20,25,24,22,22}; // see available marker styles in TAttMarker
214 Int_t methodMarkerColor[nMethods] = {kRed,kViolet-6,kAzure-7,kOrange-7,kAzure+3,kOrange+3,kAzure-7,kAzure+3,kYellow+3,kGreen+3};
215 // Settings for error mesh:
216 TString methodUsedToMakeErrorMesh = "MCEP";
217 Int_t meshStyle = 1001;
218 Int_t meshColor = kRed-10;
220 PlotDiffFlow(nMethods,method,methodMarkerStyle,methodMarkerColor,
221 methodUsedToMakeErrorMesh,meshStyle,meshColor,"Eta","POI");
223 } // end of void PlotDiffFlowEtaPOI()
225 // ===========================================================================================
227 void PlotDiffFlowPtRP()
229 // Make a plot which compares the results for differential flow of RPs vs pt.
231 // Settings for methods:
232 const Int_t nMethods = 10;
233 TString method[nMethods] = {"MCEP","SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
234 Int_t methodMarkerStyle[nMethods] = {20,3,21,21,20,20,25,24,22,22}; // see available marker styles in TAttMarker
235 Int_t methodMarkerColor[nMethods] = {kBlue,kViolet-6,kAzure-7,kOrange-7,kAzure+3,kOrange+3,kAzure-7,kAzure+3,kYellow+3,kGreen+3};
236 // Settings for error mesh:
237 TString methodUsedToMakeErrorMesh = "MCEP";
238 Int_t meshStyle = 1001;
239 Int_t meshColor = kBlue-10;
241 PlotDiffFlow(nMethods,method,methodMarkerStyle,methodMarkerColor,
242 methodUsedToMakeErrorMesh,meshStyle,meshColor,"Pt","RP");
244 } // end of void PlotDiffFlowPtRP()
246 // ===========================================================================================
248 void PlotDiffFlowEtaRP()
250 // Make a plot which compares the results for differential flow of RPs vs eta.
252 // Settings for methods:
253 const Int_t nMethods = 10;
254 TString method[nMethods] = {"MCEP","SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
255 Int_t methodMarkerStyle[nMethods] = {20,3,21,21,20,20,25,24,22,22}; // see available marker styles in TAttMarker
256 Int_t methodMarkerColor[nMethods] = {kBlue,kViolet-6,kAzure-7,kOrange-7,kAzure+3,kOrange+3,kAzure-7,kAzure+3,kYellow+3,kGreen+3};
257 // Settings for error mesh:
258 TString methodUsedToMakeErrorMesh = "MCEP";
259 Int_t meshStyle = 1001;
260 Int_t meshColor = kBlue-10;
262 PlotDiffFlow(nMethods,method,methodMarkerStyle,methodMarkerColor,
263 methodUsedToMakeErrorMesh,meshStyle,meshColor,"Eta","RP");
265 } // end of void PlotDiffFlowEtaRP()
267 // ===========================================================================================
269 void PlotReferenceFlowRelativeToMC()
271 // Make a plot (v{MC}-v{method})/v{MC} for reference flow.
273 // Settings for methods:
274 const Int_t nMethods = 12;
275 TString method[nMethods] = {"SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","6,QC","8,GFC","8,QC","FQD","LYZ1SUM","LYZ1PROD"};
276 Int_t methodMarkerStyle[nMethods] = {21,21,21,21,21,21,21,21,21,21,21,21}; // see available marker styles in TAttMarker
277 Int_t methodMarkerColor[nMethods] = {kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack,kBlack};
279 PlotRelativeToMC(nMethods,method,methodMarkerStyle,methodMarkerColor,"RF");
281 } // end of void PlotReferenceFlowRelativeToMC()
283 // ===========================================================================================
285 void PlotIntFlowRelativeToMCPOI()
287 // Make a plot (v{MC}-v{method})/v{MC} for integrated flow of POIs.
289 // Settings for methods:
290 const Int_t nMethods = 9;
291 TString method[nMethods] = {"SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
292 Int_t methodMarkerStyle[nMethods] = {21,21,21,21,21,21,21,21,21}; // see available marker styles in TAttMarker
293 Int_t methodMarkerColor[nMethods] = {kRed-3,kRed-3,kRed-3,kRed-3,kRed-3,kRed-3,kRed-3,kRed-3,kRed-3};
295 PlotRelativeToMC(nMethods,method,methodMarkerStyle,methodMarkerColor,"POI");
297 } // end of void PlotIntFlowRelativeToMCPOI()
299 // ===========================================================================================
301 void PlotIntFlowRelativeToMCRP()
303 // Make a plot (v{MC}-v{method})/v{MC} for integrated flow of RPs.
305 // Settings for methods:
306 const Int_t nMethods = 9;
307 TString method[nMethods] = {"SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
308 Int_t methodMarkerStyle[nMethods] = {21,21,21,21,21,21,21,21,21}; // see available marker styles in TAttMarker
309 Int_t methodMarkerColor[nMethods] = {kBlue-3,kBlue-3,kBlue-3,kBlue-3,kBlue-3,kBlue-3,kBlue-3,kBlue-3,kBlue-3};
311 PlotRelativeToMC(nMethods,method,methodMarkerStyle,methodMarkerColor,"RP");
313 } // end of void PlotIntFlowRelativeToMCRP()
315 // ===========================================================================================
317 void PlotDiffFlowPtRelativeToMCPOI()
319 // Make a plot (v{MC}-v{method})/v{MC} for differential flow of POIs vs pt.
321 // Settings for methods:
322 const Int_t nMethods = 9;
323 TString method[nMethods] = {"SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
324 Int_t methodMarkerStyle[nMethods] = {3,21,21,20,20,25,24,22,22}; // see available marker styles in TAttMarker
325 Int_t methodMarkerColor[nMethods] = {kViolet-6,kAzure-7,kOrange-7,kAzure+3,kOrange+3,kAzure-7,kAzure+3,kYellow+3,kGreen+3};
327 PlotDiffFlowRelativeToMC(nMethods,method,methodMarkerStyle,methodMarkerColor,"Pt","POI");
329 } // end of void PlotDiffFlowPtRelativeToMCPOI()
331 // ===========================================================================================
333 void PlotDiffFlowEtaRelativeToMCPOI()
335 // Make a plot (v{MC}-v{method})/v{MC} for differential flow of POIs vs eta.
337 // Settings for methods:
338 const Int_t nMethods = 9;
339 TString method[nMethods] = {"SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
340 Int_t methodMarkerStyle[nMethods] = {3,21,21,20,20,25,24,22,22}; // see available marker styles in TAttMarker
341 Int_t methodMarkerColor[nMethods] = {kViolet-6,kAzure-7,kOrange-7,kAzure+3,kOrange+3,kAzure-7,kAzure+3,kYellow+3,kGreen+3};
343 PlotDiffFlowRelativeToMC(nMethods,method,methodMarkerStyle,methodMarkerColor,"Eta","POI");
345 } // end of void PlotDiffFlowEtaRelativeToMCPOI()
347 // ===========================================================================================
349 void PlotDiffFlowPtRelativeToMCRP()
351 // Make a plot (v{MC}-v{method})/v{MC} for differential flow of RPs vs pt.
353 // Settings for methods:
354 const Int_t nMethods = 9;
355 TString method[nMethods] = {"SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
356 Int_t methodMarkerStyle[nMethods] = {3,21,21,20,20,25,24,22,22}; // see available marker styles in TAttMarker
357 Int_t methodMarkerColor[nMethods] = {kViolet-6,kAzure-7,kOrange-7,kAzure+3,kOrange+3,kAzure-7,kAzure+3,kYellow+3,kGreen+3};
359 PlotDiffFlowRelativeToMC(nMethods,method,methodMarkerStyle,methodMarkerColor,"Pt","RP");
361 } // end of void PlotDiffFlowPtRelativeToMCRP()
363 // ===========================================================================================
365 void PlotDiffFlowEtaRelativeToMCRP()
367 // Make a plot (v{MC}-v{method})/v{MC} for differential flow of RPs vs eta.
369 // Settings for methods:
370 const Int_t nMethods = 9;
371 TString method[nMethods] = {"SP","2,GFC","2,QC","4,GFC","4,QC","6,GFC","8,GFC","LYZ2SUM","LYZ2PROD"};
372 Int_t methodMarkerStyle[nMethods] = {3,21,21,20,20,25,24,22,22}; // see available marker styles in TAttMarker
373 Int_t methodMarkerColor[nMethods] = {kViolet-6,kAzure-7,kOrange-7,kAzure+3,kOrange+3,kAzure-7,kAzure+3,kYellow+3,kGreen+3};
375 PlotDiffFlowRelativeToMC(nMethods,method,methodMarkerStyle,methodMarkerColor,"Eta","RP");
377 } // end of void PlotDiffFlowPtRelativeToMCRP()
379 // ===========================================================================================
381 TGraph* GetErrorMesh(Int_t nPts, Double_t result, Double_t error, Int_t meshStyle, Int_t meshColor)
383 // Make an error mesh from the specified method.
385 TGraph *g = new TGraph(nPts);
386 g->SetPoint(1,0,result+error);
387 g->SetPoint(2,nPts+1,result+error);
388 g->SetPoint(3,nPts+1,result-error);
389 g->SetPoint(4,0,result-error);
390 g->SetPoint(5,0,result-error);
391 g->SetFillStyle(meshStyle);
392 g->SetFillColor(meshColor);
396 } // end of GetErrorMesh(Int_t nPoints, Double_t result,Double_t error)
398 // ===========================================================================================
400 TGraphErrors* GetGraphErrors(Double_t x, Double_t result, Double_t error, Int_t markerStyle, Int_t markerColor)
402 // From the result and error for each method make TGraphErrors.
404 TGraphErrors *ge = NULL;
406 ge = new TGraphErrors(1);
407 ge->SetPoint(0,x,result);
408 ge->SetPointError(0,0,error);
409 ge->SetMarkerStyle(markerStyle);
410 ge->SetMarkerColor(markerColor);
414 } // end of TGraphErrors* GetGraphErrors(Double_t x, Double_t result, Double_t error, Int_t markerStyle, Int_t markerColor)
416 // ===========================================================================================
418 void PlotDiffFlow(Int_t nMethods, TString *method, Int_t *methodMarkerStyle, Int_t *methodMarkerColor,
419 TString methodUsedToMakeErrorMesh, Int_t meshStyle, Int_t meshColor, TString ptEta, TString rpPoi)
421 // Make plot for differential flow.
424 Int_t sizeX = 1000; // canvas size in pixels along x
425 Int_t sizeY = 600; // canvas size in pixels along y
426 TString title = Form("Differential Flow vs %s (%s)",ptEta.Data(),rpPoi.Data());
427 if(!showLegendDiffFlow) sizeX = 0.75*sizeX;
428 c = new TCanvas(title.Data(),title.Data(),sizeX,sizeY);
429 if(showLegendDiffFlow)
432 c->cd(1)->SetPad(0.0,0.0,0.75,1.0);
435 StyleHistDiffFlow(ptEta.Data(),rpPoi.Data())->Draw();
437 TGraph *errorMesh = GetErrorMeshDiffFlow(methodUsedToMakeErrorMesh.Data(),rpPoi.Data(),ptEta.Data());
438 if(errorMesh && showErrorMeshDiffFlow)
440 errorMesh->SetFillStyle(meshStyle);
441 errorMesh->SetFillColor(meshColor);
442 errorMesh->Draw("lfsame");
444 // Results of methods:
445 for(Int_t b=0;b<nMethods;b++)
447 if(method[b]==methodUsedToMakeErrorMesh && !showBothErrorMeshAndMarkers) continue;
448 TH1D *hist = GetResultHistogram(method[b].Data(),rpPoi.Data(),ptEta.Data());
451 if(rebinInPt && ptEta == "Pt"){hist = RebinInPt(hist);}
452 hist->SetMarkerStyle(methodMarkerStyle[b]);
453 hist->SetMarkerColor(methodMarkerColor[b]);
454 hist->Draw("e1psamex0");
457 if(showLegendDiffFlow)
459 c->cd(2)->SetPad(0.73,0.0,0.97,1.0);
460 DefaultTextInLegend()->Draw();
461 LegendDiffFlow(nMethods,method,methodMarkerStyle,methodMarkerColor,
462 methodUsedToMakeErrorMesh,meshStyle,meshColor,ptEta,rpPoi)->Draw();
464 } // end of void PlotDiffFlow(...)
466 // ===========================================================================================
468 void PlotDiffFlowRelativeToMC(Int_t nMethods, TString *method, Int_t *methodMarkerStyle,
469 Int_t *methodMarkerColor, TString ptEta, TString rpPoi)
471 // Make plot for differential flow.
473 TString title = Form("Differential Flow vs %s (%s) relative to MCEP",ptEta.Data(),rpPoi.Data());
475 TH1D *mcep = GetResultHistogram("MCEP",rpPoi.Data(),ptEta.Data()); // MCEP result and error:
478 cout<<"WARNING: MCEP histogram not available in making the plot for "<<title.Data()<<" !!!!"<<endl;
482 Int_t sizeX = 1000; // canvas size in pixels along x
483 Int_t sizeY = 600; // canvas size in pixels along y
484 if(!showLegendDiffFlow) sizeX = 0.75*sizeX;
485 c = new TCanvas(title.Data(),title.Data(),sizeX,sizeY);
486 if(showLegendDiffFlow)
489 c->cd(1)->SetPad(0.0,0.0,0.75,1.0);
492 Int_t n = 2; // default harmonic
493 if(!useDefaultValues){n = GetHarmonic(methodForSettings);}
494 TH1D *styleHist = StyleHistDiffFlow(ptEta.Data(),rpPoi.Data());
495 styleHist->GetYaxis()->SetTitle(Form("(v_{%d}\{MCEP\}-v_{%d}\{method\})/v_{%d}\{MCEP\}",n,n,n));
496 styleHist->SetTitle(Form("Differential Flow #font[72]{vs} %s (%s) relative to MCEP",ptEta.Data(),rpPoi.Data()));
497 styleHist->SetMinimum(-10.); // to be improved
498 styleHist->SetMaximum(10.); // to be improved
499 styleHist->SetTitle(title.Data());
502 for(Int_t nm=0;nm<nMethods;nm++)
505 if(GetResultHistogram(method[nm].Data(),rpPoi.Data(),ptEta.Data()))
507 hist = (TH1D*)(GetResultHistogram(method[nm].Data(),rpPoi.Data(),ptEta.Data())->Clone());
511 Int_t nBins = hist->GetNbinsX();
512 for(Int_t b=1;b<=nBins;b++)
514 Double_t mcepResult = mcep->GetBinContent(b);
515 Double_t mcepError = mcep->GetBinError(b);
516 if((TMath::Abs(mcepResult) > 1.e-44) && (TMath::Abs(mcepError) > 1.e-44))
518 Double_t result = hist->GetBinContent(b);
519 Double_t error = hist->GetBinError(b);
520 //if((TMath::Abs(result)>1.e-44) && TMath::Abs(error)>1.e-44))
521 if(TMath::Abs(result)>1.e-44)
523 error = pow(pow(error/mcepResult,2.)+pow(result*mcepError/pow(mcepResult,2.),2.),0.5); // Do not switch with the next line!
524 result = (mcepResult-result)/mcepResult;
525 hist->SetBinContent(b,result);
526 hist->SetBinError(b,error);
527 } else // end of if((TMath::Abs(result)>1.e-44) && TMath::Abs(error)>1.e-44))
529 hist->SetBinContent(b,0.);
530 hist->SetBinError(b,0.);
532 } else // end of if(TMath::Abs(mcepResult) > 1.e-44 && TMath::Abs(mcepError) > 1.e-44)
534 hist->SetBinContent(b,0.);
535 hist->SetBinError(b,0.);
537 } // end of for(b=1;b<=nBins;b++)
538 hist->SetMarkerStyle(methodMarkerStyle[nm]);
539 hist->SetMarkerColor(methodMarkerColor[nm]);
540 hist->Draw("e1psame");
542 } // end of for(Int_t nm=0;nm<nMethods;nm++)
543 if(showLegendDiffFlow)
545 c->cd(2)->SetPad(0.73,0.0,0.97,1.0);
546 DefaultTextInLegend()->Draw();
547 LegendDiffFlow(nMethods,method,methodMarkerStyle,methodMarkerColor,"",-1,-1,ptEta,rpPoi)->Draw();
549 } // end of void PlotDiffFlowRelativeToMC(...)
551 // ===========================================================================================
553 TGraph* GetErrorMeshDiffFlow(TString methodUsedToMakeErrorMesh, TString rpPoi, TString ptEta)
555 // Error mesh for differential flow.
557 TH1D *hist = GetResultHistogram(methodUsedToMakeErrorMesh.Data(),rpPoi.Data(),ptEta.Data());
559 // Rebin higher pt bins:
560 if(hist && rebinInPt && ptEta == "Pt")
562 hist = RebinInPt(hist);
566 TGraph *errorMesh = NULL;
569 Int_t nBins = hist->GetNbinsX();
572 // Counting the non-empty bins:
573 Int_t nNonEmptyBins = 0;
574 for(Int_t i=1;i<nBins+1;i++)
576 value = hist->GetBinContent(i);
577 error = hist->GetBinError(i);
578 if(TMath::Abs(value)>0.0 && error>0.0)
582 } // end of for(Int_t i=1;i<nBins+1;i++)
584 errorMesh = new TGraph(2*nNonEmptyBins+1);
586 Double_t binCenter = 0.;
587 for(Int_t i=1;i<nBins+1;i++)
589 value = hist->GetBinContent(i);
590 error = hist->GetBinError(i);
591 // Setting up the the mesh:
592 if(TMath::Abs(value)>0.0 && error>0.0)
594 binCenter = hist->GetBinCenter(i);
595 errorMesh->SetPoint(count,binCenter,value+error);
596 errorMesh->SetPoint(2*nNonEmptyBins-(count+1),binCenter,value-error);
599 } // end of for(Int_t i=1;i<nBins+1;i++)
600 // Closing the mesh area:
601 Double_t xStart = 0.;
602 Double_t yStart = 0.;
603 errorMesh->GetPoint(0,xStart,yStart);
604 errorMesh->SetPoint(2*nNonEmptyBins,xStart,yStart);
609 } // end of TGraph* GetErrorMeshDiffFlow(TString methodUsedToMakeErrorMesh, TString ptEta, TString rpPoi)
611 // ===========================================================================================
613 Int_t GetHarmonic(TString method)
615 // Get harmonic used in analysis from the output file of specified method.
616 Int_t n = -44; // harmonic
618 AliFlowCommonHist *commonHist = NULL;
619 for(Int_t l=0;l<nMethods;l++)
624 temp = TString(list[l]->GetName());
626 if(temp.Contains(method.Data()))
628 commonHist = dynamic_cast<AliFlowCommonHist*> list[l]->FindObject(Form("AliFlowCommonHist%s",method.Data()));
629 if(commonHist && commonHist->GetHarmonic())
631 n = commonHist->GetHarmonic()->GetBinContent(1);
635 cout<<" WARNING: commonHist && commonHist->GetHarmonic() is NULL !!!!"<<endl;
639 } // end of for(Int_t l=0;l<nMethods;l++)
644 cout<<" WARNING: Couldn't access harmonic from common control histogram of specified method."<<endl;
645 cout<< "Try with another method in 'TString methodForSettings'."<<endl;
651 } // end of Int_t GetHarmonic(TString method)
653 // ===========================================================================================
655 TH1D* RebinInPt(TH1D *hist)
657 // Rebin original histograms.
662 cout<<" WARNING: hist is NULL in RebinInPt() !!!!"<<endl;
667 Double_t binWidthOld = hist->GetXaxis()->GetBinWidth(4);
668 Int_t nBinsOld = hist->GetXaxis()->GetNbins();
669 for(Int_t b=1;b<=nBinsOld;b++)
671 if(TMath::Abs(hist->GetXaxis()->GetBinWidth(b)-binWidthOld)>1.e-44)
674 cout<<Form(" WARNING: %s have bins of unequal width !!!!",hist->GetName())<<endl;
675 cout<<" Do not trust rebinning for high pt." <<endl;
678 } // end of for(Int_t b=1;b<=nBinsOld;b++)
679 if(binWidthOld<1.e-44)
682 cout<<Form(" WARNING: in %s bin width is 0 !!!!",hist->GetName())<<endl;
683 cout<<" Cannot do rebinning in pt." <<endl;
688 // Book rebinned histogram:
690 for(Int_t i=0;i<nPtIntervals;i++)
692 Double_t xMin = TMath::Nint(ptInterval[i]/binWidthOld)*binWidthOld;
693 Double_t xMax = TMath::Nint(ptInterval[i+1]/binWidthOld)*binWidthOld;
694 Int_t nBins = TMath::Nint((xMax-xMin)/binWidthOld);
698 cout<<Form(" WARNING: nBins <=0 when rebinning %s !!!!",hist->GetName())<<endl;
699 cout<<" Check entries in array ptInterval." <<endl;
703 if(nBins % nMergedBins[i] == 0)
705 nBinsNew += nBins/nMergedBins[i];
708 nBinsNew += (nBins/nMergedBins[i] + 1);
710 } // end of for(Int_t i=0;i<nPtIntervals;i++)
711 const Int_t nBinsRebinned = nBinsNew;
712 Double_t binEdges[nBinsRebinned+1] = {0.};
713 Int_t counterForRebinnedBins = 0;
714 for(Int_t i=0;i<nPtIntervals;i++)
716 Double_t xMin = TMath::Nint(ptInterval[i]/binWidthOld)*binWidthOld;
717 Double_t xMax = TMath::Nint(ptInterval[i+1]/binWidthOld)*binWidthOld;
718 Int_t nBins = TMath::Nint((xMax-xMin)/binWidthOld);
719 if(nBins % nMergedBins[i] == 0)
721 nBins = nBins/nMergedBins[i];
724 nBins = (nBins/nMergedBins[i] + 1);
726 for(Int_t b=0;b<nBins;b++)
728 binEdges[counterForRebinnedBins] = xMin + b*binWidthOld*nMergedBins[i];
729 counterForRebinnedBins++;
731 } // end of for(Int_t i=0;i<nPtIntervals;i++)
733 binEdges[counterForRebinnedBins] = hist->GetXaxis()->GetXmax();
735 TH1D *temp = new TH1D("","",nBinsRebinned,binEdges); // rebinned histogram
736 for(Int_t br=0;br<nBinsRebinned;br++) // bins in rebinned histogram
740 Double_t dSum1 = 0.; // sum value_i/(error_i)^2
741 Double_t dSum2 = 0.; // sum 1/(error_i)^2
742 Int_t startingBin = hist->FindBin(binEdges[br]);
743 Int_t endingBin = hist->FindBin(binEdges[br+1]);
744 for(Int_t bo=startingBin;bo<endingBin;bo++) // bins in original histogram
746 value = hist->GetBinContent(bo);
747 error = hist->GetBinError(bo);
750 dSum1+=value/(error*error);
751 dSum2+=1./(error*error);
756 temp->SetBinContent(br+1,dSum1/dSum2);
757 temp->SetBinError(br+1,pow(1./dSum2,0.5));
759 } // end of for(Int_t b=1;b<=nBinsOld;b++)
763 } // end of RebinInPt()
765 // ===========================================================================================
767 TH1D* StyleHistDiffFlow(TString ptEta, TString rpPoi)
769 // Style histogram for differential flow.
771 Int_t n = 2; // default harmonic
772 if(!useDefaultValues){n = GetHarmonic(methodForSettings);}
773 TH1D *styleHistDiffFlow = NULL;
776 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
777 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
778 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
779 if(!useDefaultValues)
781 AliFlowCommonHist *commonHist = NULL;
782 for(Int_t l=0;l<nMethods;l++)
787 temp = TString(list[l]->GetName());
789 if(temp.Contains(methodForSettings.Data()))
791 commonHist = dynamic_cast<AliFlowCommonHist*> list[l]->FindObject(Form("AliFlowCommonHist%s",methodForSettings.Data()));
792 if(commonHist && commonHist->GetHistPtRP() && rpPoi == "RP")
794 iNbinsPt = commonHist->GetHistPtRP()->GetNbinsX();
795 dPtMin = commonHist->GetHistPtRP()->GetXaxis()->GetXmin();
796 dPtMax = commonHist->GetHistPtRP()->GetXaxis()->GetXmax();
797 } else if(commonHist && commonHist->GetHistPtPOI() && rpPoi == "POI")
799 iNbinsPt = commonHist->GetHistPtPOI()->GetNbinsX();
800 dPtMin = commonHist->GetHistPtPOI()->GetXaxis()->GetXmin();
801 dPtMax = commonHist->GetHistPtPOI()->GetXaxis()->GetXmax();
806 cout<<" WARNING: Coudn't access common control histogram for pt yield !!!!"<<endl;
810 } // end of for(Int_t l=0;l<nMethods;l++)
811 } // end of if(!useDefaultValues)
812 styleHistDiffFlow = new TH1D("","styleHistDiffFlow",iNbinsPt,dPtMin,dPtMax);
813 styleHistDiffFlow->SetTitle(Form("Differential Flow #font[72]{vs} p_{t} (%s)",rpPoi.Data()));
814 styleHistDiffFlow->SetXTitle("p_{t} [GeV]");
815 styleHistDiffFlow->SetYTitle(Form("v_{%d}",n));
817 else if(ptEta == "Eta")
819 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
820 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
821 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
822 if(!useDefaultValues)
824 AliFlowCommonHist *commonHist = NULL;
825 for(Int_t l=0;l<nMethods;l++)
830 temp = TString(list[l]->GetName());
832 if(temp.Contains(methodForSettings.Data()))
834 commonHist = dynamic_cast<AliFlowCommonHist*> list[l]->FindObject(Form("AliFlowCommonHist%s",methodForSettings.Data()));
835 if(commonHist && commonHist->GetHistEtaRP() && rpPoi == "RP")
837 iNbinsEta = commonHist->GetHistEtaRP()->GetNbinsX();
838 dEtaMin = commonHist->GetHistEtaRP()->GetXaxis()->GetXmin();
839 dEtaMax = commonHist->GetHistEtaRP()->GetXaxis()->GetXmax();
840 } else if(commonHist && commonHist->GetHistEtaPOI() && rpPoi == "POI")
842 iNbinsEta = commonHist->GetHistEtaPOI()->GetNbinsX();
843 dEtaMin = commonHist->GetHistEtaPOI()->GetXaxis()->GetXmin();
844 dEtaMax = commonHist->GetHistEtaPOI()->GetXaxis()->GetXmax();
849 cout<<" WARNING: Coudn't access common control histogram for eta distribution !!!!"<<endl;
853 } // end of for(Int_t l=0;l<nMethods;l++)
854 } // end of if(!useDefaultValues)
855 styleHistDiffFlow = new TH1D("","",iNbinsEta,dEtaMin,dEtaMax);
856 styleHistDiffFlow->SetTitle(Form("Differential Flow #font[72]{vs} #eta (%s)",rpPoi.Data()));
857 styleHistDiffFlow->SetXTitle("#eta");
858 styleHistDiffFlow->SetYTitle(Form("v_{%d}",n));
860 if(styleHistDiffFlow)
862 styleHistDiffFlow->SetMinimum(-0.25); // to be improved - implement algorithm for this
863 styleHistDiffFlow->SetMaximum(1.); // to be improved - implement algorithm for this
864 //styleHistDiffFlow->GetYaxis()->SetLabelSize(0.05);
865 //styleHistDiffFlow->GetYaxis()->SetTitleSize(0.06);
866 //styleHistDiffFlow->GetYaxis()->SetTitleOffset(0.55);
867 //styleHistDiffFlow->GetXaxis()->SetLabelSize(0.05);
868 //styleHistDiffFlow->GetXaxis()->SetTitleSize(0.06);
869 //styleHistDiffFlow->GetXaxis()->SetTitleOffset(0.6);
870 //styleHistDiffFlow->GetXaxis()->SetLabelOffset(0.02);
873 return styleHistDiffFlow;
875 } // end of TH1D* StyleHistDiffFlow(TString ptEta, TString rpPoi)
877 // ===========================================================================================
879 void Plot(const Int_t nMethods,TString *method,Int_t *methodMarkerStyle,Int_t *methodMarkerColor,
880 TString methodUsedToMakeErrorMesh,Int_t meshStyle,Int_t meshColor,TString rfRpPoi)
882 // Make a plot for reference and integrated flow.
887 title = "Reference Flow";
888 } else if(rfRpPoi == "POI")
890 title = "Integrated Flow (POI)";
891 } else if(rfRpPoi == "RP")
893 title = "Integrated Flow (RP)";
896 Double_t x = 0.; // determines position of the marker on x axis
897 Double_t results[nMethods] = {0.};
898 Double_t errors[nMethods] = {0.};
899 TGraphErrors *ge[nMethods] = {NULL};
900 TGraph *errorMesh = NULL;
901 for(Int_t b=0;b<nMethods;b++)
905 hist = GetResultHistogram(method[b].Data(),rfRpPoi.Data());
908 results[b] = hist->GetBinContent(1);
909 errors[b] = hist->GetBinError(1);
910 if(TMath::Abs(results[b])>1.e-44)
912 ge[b] = GetGraphErrors(x,results[b],errors[b],methodMarkerStyle[b],methodMarkerColor[b]);
914 if(strcmp(method[b].Data(),methodUsedToMakeErrorMesh.Data()) == 0)
916 errorMesh = GetErrorMesh(nMethods+1,results[b],errors[b],meshStyle,meshColor);
920 //cout<<"WARNING: For a method "<<method[b].Data()<<" couldn't get the histogram with result"<<endl;
921 //cout<<" for "<<title.Data()<<" !!!! "<<endl;
923 } // end of for(Int_t b=0;b<nMethods;b++)
927 // Settings for canvas:
928 Int_t sizeX = 1000; // canvas size in pixels along x
929 Int_t sizeY = 600; // canvas size in pixels along y
930 if(!showLegend) sizeX = 0.75*sizeX;
931 c = new TCanvas(title.Data(),title.Data(),sizeX,sizeY);
935 c->cd(1)->SetPad(0.0,0.0,0.75,1.0);
937 StyleHist(title,nMethods,method,results,errors)->Draw();
938 if(errorMesh && showErrorMesh){errorMesh->Draw("lfsame");}
939 for(Int_t b=0;b<nMethods;b++)
941 if(ge[b])ge[b]->Draw("psame");
945 c->cd(2)->SetPad(0.73,0.0,0.97,1.0);
946 DefaultTextInLegend()->Draw();
947 Legend(nMethods,method,rfRpPoi)->Draw();
952 } // end of Plot(...)
954 // ===========================================================================================
956 void PlotRelativeToMC(const Int_t nMethods, TString *method, Int_t *methodMarkerStyle,
957 Int_t *methodMarkerColor, TString rfRpPoi)
959 // Make a plot (v{MC}-v{method})/v{MC} for reference and integrated flow.
964 title = "Reference Flow relative to MCEP";
965 } else if(rfRpPoi == "POI")
967 title = "Integrated Flow (POI) relative to MCEP";
968 } else if(rfRpPoi == "RP")
970 title = "Integrated Flow (RP) relative to MCEP";
973 Double_t x = 0.; // determines position of the marker on x axis
974 Double_t results[nMethods] = {0.};
975 Double_t errors[nMethods] = {0.};
976 // MCEP result and error:
977 TH1D *mcep = GetResultHistogram("MCEP","RF");
978 Double_t mcepResult = 0.;
979 Double_t mcepError = 0.;
982 mcepResult = mcep->GetBinContent(1);
983 mcepError = mcep->GetBinError(1);
986 cout<<"WARNING: MCEP histogram not available in making the plot for "<<title.Data()<<" !!!!"<<endl;
989 if(TMath::Abs(mcepResult) < 1.e-44 || TMath::Abs(mcepError) < 1.e-44)
991 cout<<"WARNING: Result or error for v{MCEP} is zero in making the plot for "<<title.Data()<<" !!!!"<<endl;
994 TGraphErrors *ge[nMethods] = {NULL};
995 for(Int_t b=0;b<nMethods;b++)
999 hist = GetResultHistogram(method[b].Data(),rfRpPoi.Data());
1002 results[b] = hist->GetBinContent(1);
1003 errors[b] = hist->GetBinError(1);
1004 if(TMath::Abs(results[b])>1.e-44)
1006 errors[b] = pow(pow(errors[b]/mcepResult,2.)+pow(results[b]*mcepError/pow(mcepResult,2.),2.),0.5); // Do not switch with the next line!
1007 results[b] = (mcepResult-results[b])/mcepResult;
1008 ge[b] = GetGraphErrors(x,results[b],errors[b],methodMarkerStyle[b],methodMarkerColor[b]);
1012 //cout<<"WARNING: For a method "<<method[b].Data()<<" couldn't get the histogram with result"<<endl;
1013 //cout<<" for "<<title.Data()<<" !!!! "<<endl;
1015 } // end of for(Int_t b=0;b<nMethods;b++)
1019 // Settings for canvas:
1020 Int_t sizeX = 1000; // canvas size in pixels along x
1021 Int_t sizeY = 600; // canvas size in pixels along y
1022 if(!showLegend) sizeX = 0.75*sizeX;
1023 c = new TCanvas(title.Data(),title.Data(),sizeX,sizeY);
1027 c->cd(1)->SetPad(0.0,0.0,0.75,1.0);
1030 Int_t n = 2; // default harmonic
1031 if(!useDefaultValues){n = GetHarmonic(methodForSettings);}
1032 TH1D *styleHist = StyleHist(title,nMethods,method,results,errors);
1033 styleHist->GetYaxis()->SetTitleOffset(1.25);
1034 styleHist->GetYaxis()->SetTitleSize(0.03);
1035 styleHist->GetYaxis()->SetLabelSize(0.03);
1036 styleHist->GetYaxis()->SetTitle(Form("(v_{%d}\{MCEP\}-v_{%d}\{method\})/v_{%d}\{MCEP\}",n,n,n));
1039 for(Int_t b=0;b<nMethods;b++)
1041 if(ge[b])ge[b]->Draw("psame");
1045 c->cd(2)->SetPad(0.73,0.0,0.97,1.0);
1046 DefaultTextInLegend()->Draw();
1047 Legend(nMethods,method,rfRpPoi)->Draw();
1052 } // end of void PlotRelativeToMC(...)
1054 // ===========================================================================================
1056 TPaveText* DefaultTextInLegend()
1058 // Determine the default text in legend.
1060 TPaveText *textDefault = new TPaveText(0.05,0.77,0.95,0.90,"NDC");
1061 textDefault->SetTextFont(72);
1062 textDefault->SetTextSize(0.08);
1063 textDefault->AddText("Average Multiplicity");
1064 textDefault->AddText("and");
1065 textDefault->AddText("Number of Events");
1066 textDefault->SetFillStyle(0); // white instead of default grey
1070 } // end of TPaveText* DefaultTextInLegend()
1072 // ===========================================================================================
1074 TPaveText* Legend(Int_t nMethods, TString *method, TString rfRpPoi)
1078 TPaveText *legend = new TPaveText(0.05,0.12,0.95,0.70,"NDC");
1079 legend->SetTextFont(72);
1080 legend->SetTextSize(0.06);
1081 legend->SetFillStyle(0); // white instead of default grey
1082 const Int_t nLegendEntries = 11;
1083 TString legendEntries[nLegendEntries] = {"MCEP ...... ","SP ........ ","GFC ....... ",
1084 "QC{2} ..... ","QC{4} ..... ","QC{6} ..... ",
1085 "QC{8} ..... ","FQD ....... ","LYZ{sum} .. ",
1086 "LYZ{prod} . ","LYZEP ..... "};
1088 Int_t gfcCounter = 0; // represent "2,GFC", "4,GFC", "6,GFC" and "8,GFC" with the same entry GFC
1089 for(Int_t b=0;b<nMethods;b++)
1091 for(Int_t le=0;le<nLegendEntries;le++)
1093 if(legendEntries[le].Contains(method[b].Data())) // this is either MCEP, FQD, SP or LYZEP
1095 temp = legendEntries[le]+GetAvMultiplicityAndNoOfEvents(method[b].Data(),rfRpPoi);
1096 legend->AddText(temp.Data());
1098 else if(method[b].Contains("GFC") && gfcCounter == 0 && legendEntries[le].Contains("GFC")) // GFC
1100 temp = legendEntries[le]+GetAvMultiplicityAndNoOfEvents(method[b].Data(),rfRpPoi);
1101 legend->AddText(temp.Data());
1104 else if(method[b].Contains("QC") && legendEntries[le].Contains("QC")) // QC
1106 for(Int_t o=1;o<=4;o++) // QC order
1108 if(method[b].Contains(Form("%d",2*o)) && legendEntries[le].Contains(Form("%d",2*o)))
1110 temp = legendEntries[le]+GetAvMultiplicityAndNoOfEvents(method[b].Data(),rfRpPoi);
1111 legend->AddText(temp.Data());
1113 } // end of for(Int o=1;o<=4;o++) // QC order
1115 else if((method[b].Contains("LYZ1SUM")||method[b].Contains("LYZ2SUM")) && legendEntries[le].Contains("LYZ{sum}"))
1117 temp = legendEntries[le]+GetAvMultiplicityAndNoOfEvents(method[b].Data(),rfRpPoi);
1118 legend->AddText(temp.Data());
1120 else if((method[b].Contains("LYZ1PROD")||method[b].Contains("LYZ2PROD")) && legendEntries[le].Contains("LYZ{prod}"))
1122 temp = legendEntries[le]+GetAvMultiplicityAndNoOfEvents(method[b].Data(),rfRpPoi);
1123 legend->AddText(temp.Data());
1125 } // end of for(Int_t le=0;le<nLegendEntries;le++)
1126 } // end of for(Int_t b=0;b<nMethods;b++)
1130 } // end of TPaveText* Legend(Int_t nMethods, TString *method, TString rfRpPoi)
1131 // ===========================================================================================
1133 TLegend* LegendDiffFlow(Int_t nMethods, TString *method, Int_t *methodMarkerStyle, Int_t *methodMarkerColor,
1134 TString methodUsedToMakeErrorMesh, Int_t meshStyle, Int_t meshColor, TString ptEta, TString rpPoi)
1136 // Make a legend for differential flow.
1138 TLegend *legend = new TLegend(0.0,0.12,0.99,0.70);
1139 legend->SetMargin(0.15);
1140 legend->SetTextFont(72);
1141 legend->SetTextSize(0.06);
1142 legend->SetFillStyle(0); // white instead of default grey
1143 const Int_t nLegendEntries = 14;
1144 TString legendEntries[nLegendEntries] = {"MCEP ...... ","SP ........ ","GFC{2} .... ","QC{2} ..... ",
1145 "GFC{4} .... ","QC{4} ..... ","GFC{6} .... ","QC{6} ..... ",
1146 "GFC{8} .... ","QC{8} ..... ","FQD ....... ","LYZ{sum} .. ",
1147 "LYZ{prod} . ","LYZEP ..... "};
1151 for(Int_t b=0;b<nMethods;b++)
1153 for(Int_t le=0;le<nLegendEntries;le++)
1155 if(legendEntries[le].Contains(method[b].Data())) // this is either MCEP, FQD, SP or LYZEP
1157 temp = legendEntries[le]+GetAvMultiplicityAndNoOfEvents(method[b].Data(),rpPoi);
1158 hist = GetResultHistogram(method[b].Data(),rpPoi.Data(),ptEta.Data());
1161 hist->SetMarkerStyle(methodMarkerStyle[b]);
1162 hist->SetMarkerColor(methodMarkerColor[b]);
1163 if(methodUsedToMakeErrorMesh == method[b].Data())
1165 hist->SetFillStyle(meshStyle);
1166 hist->SetFillColor(meshColor);
1167 legend->AddEntry(hist,temp.Data(),"f");
1170 legend->AddEntry(hist,temp.Data(),"p");
1172 } // end of if(hist)
1174 else if(method[b].Contains("GFC") && legendEntries[le].Contains("GFC")) // GFC
1176 for(Int_t o=1;o<=4;o++) // GFC order
1178 if(method[b].Contains(Form("%d",2*o)) && legendEntries[le].Contains(Form("%d",2*o)))
1180 temp = legendEntries[le]+GetAvMultiplicityAndNoOfEvents(method[b].Data(),rpPoi);
1181 hist = GetResultHistogram(method[b].Data(),rpPoi.Data(),ptEta.Data());
1184 hist->SetMarkerStyle(methodMarkerStyle[b]);
1185 hist->SetMarkerColor(methodMarkerColor[b]);
1186 if(methodUsedToMakeErrorMesh == method[b].Data())
1188 hist->SetFillStyle(meshStyle);
1189 hist->SetFillColor(meshColor);
1190 legend->AddEntry(hist,temp.Data(),"f");
1193 legend->AddEntry(hist,temp.Data(),"p");
1195 } // end of if(hist)
1199 else if(method[b].Contains("QC") && legendEntries[le].Contains("QC")) // QC
1201 for(Int_t o=1;o<=4;o++) // QC order
1203 if(method[b].Contains(Form("%d",2*o)) && legendEntries[le].Contains(Form("%d",2*o)))
1205 temp = legendEntries[le]+GetAvMultiplicityAndNoOfEvents(method[b].Data(),rpPoi);
1206 hist = GetResultHistogram(method[b].Data(),rpPoi.Data(),ptEta.Data());
1209 hist->SetMarkerStyle(methodMarkerStyle[b]);
1210 hist->SetMarkerColor(methodMarkerColor[b]);
1211 if(methodUsedToMakeErrorMesh == method[b].Data())
1213 hist->SetFillStyle(meshStyle);
1214 hist->SetFillColor(meshColor);
1215 legend->AddEntry(hist,temp.Data(),"f");
1218 legend->AddEntry(hist,temp.Data(),"p");
1220 } // end of if(hist)
1222 } // end of for(Int o=1;o<=4;o++) // QC order
1224 else if((method[b].Contains("LYZ1SUM")||method[b].Contains("LYZ2SUM")) && legendEntries[le].Contains("LYZ{sum}"))
1226 temp = legendEntries[le]+GetAvMultiplicityAndNoOfEvents(method[b].Data(),rpPoi);
1227 hist = GetResultHistogram(method[b].Data(),rpPoi.Data(),ptEta.Data());
1230 hist->SetMarkerStyle(methodMarkerStyle[b]);
1231 hist->SetMarkerColor(methodMarkerColor[b]);
1232 if(methodUsedToMakeErrorMesh == method[b].Data())
1234 hist->SetFillStyle(meshStyle);
1235 hist->SetFillColor(meshColor);
1236 legend->AddEntry(hist,temp.Data(),"f");
1239 legend->AddEntry(hist,temp.Data(),"p");
1241 } // end of if(hist)
1243 else if((method[b].Contains("LYZ1PROD")||method[b].Contains("LYZ2PROD")) && legendEntries[le].Contains("LYZ{prod}"))
1245 temp = legendEntries[le]+GetAvMultiplicityAndNoOfEvents(method[b].Data(),rpPoi);
1246 hist = GetResultHistogram(method[b].Data(),rpPoi.Data(),ptEta.Data());
1249 hist->SetMarkerStyle(methodMarkerStyle[b]);
1250 hist->SetMarkerColor(methodMarkerColor[b]);
1251 if(methodUsedToMakeErrorMesh == method[b].Data())
1253 hist->SetFillStyle(meshStyle);
1254 hist->SetFillColor(meshColor);
1255 legend->AddEntry(hist,temp.Data(),"f");
1258 legend->AddEntry(hist,temp.Data(),"p");
1260 } // end of if(hist)
1262 } // end of for(Int_t le=0;le<nLegendEntries;le++)
1263 } // end of for(Int_t b=0;b<nMethods;b++)
1267 } // end of TLegend* Legend(...)
1269 // ===========================================================================================
1271 TString GetAvMultiplicityAndNoOfEvents(TString method, TString rfRpPoi)
1273 // Get average multiplicity and number of events for specified method and return it as "M = <AvM>, N = <N>".
1275 TString MN = ""; // string to hold "M = <AvM>, N = <N>"
1276 Long_t N = 0; // number of events
1277 Double_t M = 0.; // average multiplicity
1279 TH1F *hist = GetControlHistogram(method,rfRpPoi);
1282 N = hist->GetEntries();
1283 M = hist->GetMean();
1286 MN.Append(", N = ");
1295 } // end of TString GetAvMultiplicityAndNoOfEvents(TString *method, TString rfRpPoi)
1297 // ===========================================================================================
1299 TH1F* GetControlHistogram(TString method, TString rfRpPoi)
1301 // Get the control histogram for specified method holding the average multiplicity and number of events.
1303 AliFlowCommonHist *commonHist = NULL;
1304 TString methodName = method.Data();
1305 Int_t cumulantOrder = 0;
1306 if(method.Contains("GFC"))
1308 TString methodNameTemp1 = method;
1309 TString methodNameTemp2 = method;
1310 methodName = methodNameTemp1.Remove(0,2);
1311 cumulantOrder = methodNameTemp2.Remove(1,4).Atoi();
1312 } else if(method.Contains("QC"))
1314 TString methodNameTemp1 = method;
1315 TString methodNameTemp2 = method;
1316 methodName = methodNameTemp1.Remove(0,2);
1317 cumulantOrder = methodNameTemp2.Remove(1,3).Atoi();
1320 // Get for specified methodName (and cumulantOrder, if needed) the common control histogram:
1321 // (to be improved - this can certainly be implemented better, but some redesign of the flow code is first in order)
1322 for(Int_t l=0;l<nMethods;l++)
1327 temp = TString(list[l]->GetName());
1329 if(temp.Contains(methodName.Data()))
1331 // Access from the common list the needed common result histogram:
1332 if(!(methodName.Contains("QC")))
1334 commonHist = dynamic_cast<AliFlowCommonHist*> list[l]->FindObject(Form("AliFlowCommonHist%s",methodName.Data()));
1336 else if(methodName=="QC")
1338 if(cumulantOrder==2)
1340 commonHist = dynamic_cast<AliFlowCommonHist*> list[l]->FindObject("AliFlowCommonHist2ndOrderQC");
1342 else if(cumulantOrder==4)
1344 commonHist = dynamic_cast<AliFlowCommonHist*> list[l]->FindObject("AliFlowCommonHist4thOrderQC");
1346 else if(cumulantOrder==6)
1348 commonHist = dynamic_cast<AliFlowCommonHist*> list[l]->FindObject("AliFlowCommonHist6thOrderQC");
1350 else if(cumulantOrder==8)
1352 commonHist = dynamic_cast<AliFlowCommonHist*> list[l]->FindObject("AliFlowCommonHist8thOrderQC");
1356 cout<<"WARNING: You have specified cumulant order to be "<<cumulantOrder<<" !!!!"<<endl;
1357 cout<<" There are no results for this cumulant order. "<<endl;
1359 } // end of else if(methodName=="QC")
1360 } // end of if(temp.Contains(methodName.Data()))
1361 } // end of for(Int_t l=0;l<nMethods;l++)
1365 //cout<<"WARNING: For a method "<<method.Data()<<" couldn't access the common hist result !!!!"<<endl;
1366 //cout<<" File absent? Or perhaps a typo in the method's name?"<<endl;
1367 if(methodName.Contains("QC"))
1369 //cout<<" Or impossible cumulant order? Otherwise.... :'( "<<endl;
1373 // Finally, from commonHist access the required histogram:
1377 if(rfRpPoi == "RF" || rfRpPoi == "RP")
1379 hist = commonHist->GetHistMultRP();
1380 } else if(rfRpPoi == "POI")
1382 hist = commonHist->GetHistMultPOI();
1385 cout<<"WARNING: Impossible TString rfRpPoi in GetControlHistogram() !!!!"<<endl;
1392 } // end of TH1D* GetControlHistogram(TString method, TString rfRpPoi)
1394 // ===========================================================================================
1396 TH1D* StyleHist(TString title, Int_t nMethods, TString *method, Double_t *results, Double_t *errors)
1398 // Make style histogram.
1399 TH1D *styleHist = new TH1D("",title.Data(),nMethods,0,nMethods);
1400 Int_t n = 2; // default harmonic
1401 if(!useDefaultValues){n = GetHarmonic(methodForSettings);}
1402 Double_t styleHistMin = 44.;
1403 Double_t styleHistMax = -44.;
1404 for(Int_t b=0;b<nMethods;b++)
1406 // Form bin labels from method's names:
1407 styleHist->GetXaxis()->SetBinLabel(b+1,Form("v_{%d}\{%s\}",n,method[b].Data()));
1408 if(method[b].Contains("LYZ1SUM") || method[b].Contains("LYZ2SUM"))
1410 styleHist->GetXaxis()->SetBinLabel(b+1,Form("v_{%d}\{LYZ,sum\}",n));
1412 if(method[b].Contains("LYZ1PROD") || method[b].Contains("LYZ2PROD"))
1414 styleHist->GetXaxis()->SetBinLabel(b+1,Form("v_{%d}\{LYZ,prod\}",n));
1416 // Establish min and max values for style histograms:
1417 if(TMath::Abs(results[b])>1.e-44)
1419 if(styleHistMin > results[b]-errors[b]) styleHistMin = results[b]-errors[b]; // min value
1420 if(styleHistMax < results[b]+errors[b]) styleHistMax = results[b]+errors[b]; // max value
1424 styleHist->SetMinimum(0.99*styleHistMin);
1425 styleHist->SetMaximum(1.01*styleHistMax);
1427 styleHist->GetYaxis()->SetNdivisions(5,5,0);
1428 styleHist->GetYaxis()->SetLabelSize(0.05);
1429 styleHist->GetXaxis()->SetLabelSize(0.07);
1430 styleHist->GetXaxis()->SetLabelOffset(0.01);
1435 } // end of TH1D* StyleHist(TString *title, Int_t nMethods, TString *method, Double_t *results, Double_t *errors)
1437 // ===========================================================================================
1439 TFile* AccessOutputFile(TString outputFileName)
1441 // Access the common output file.
1443 TFile *outputFile = NULL;
1444 if(!(gSystem->AccessPathName(Form("%s%s%s",gSystem->pwd(),"/",outputFileName.Data()),kFileExists)))
1446 outputFile = TFile::Open(outputFileName.Data(),"READ");
1450 cout<<"WARNING: Couldn't find the file "<<outputFileName.Data()<<" in "<<endl;
1451 cout<<" directory "<<gSystem->pwd()<<" !!!!"<<endl;
1458 } // end of TFile* AccessOutputFile(TString outputFileName)
1460 // ===========================================================================================
1462 void GetListsWithHistograms(TFile *outputFile, TString analysisType)
1464 // Access from common output file the TDirectoryFile's for each flow analysis method
1465 // and from them the TList's holding histograms with final results:
1467 TString fileName[nMethods];
1468 TDirectoryFile *dirFile[nMethods] = {NULL};
1469 TString listName[nMethods];
1470 Int_t failureCounter = 0;
1471 for(Int_t i=0;i<nMethods;i++)
1473 // Form a file name for each method:
1474 fileName[i]+="output";
1475 fileName[i]+=method[i].Data();
1476 fileName[i]+="analysis";
1477 fileName[i]+=analysisType.Data();
1478 // Access this file:
1479 dirFile[i] = (TDirectoryFile*)outputFile->FindObjectAny(fileName[i].Data());
1480 // Form a list name for each method:
1483 TList* listTemp = dirFile[i]->GetListOfKeys();
1484 if(listTemp && listTemp->GetEntries() == 1)
1486 listName[i] = listTemp->At(0)->GetName(); // to be improved - implemented better (use dynamic_cast instead)
1487 dirFile[i]->GetObject(listName[i].Data(),list[i]);
1490 cout<<" WARNING: Accessing TList from TDirectoryFile failed for method "<<method[i].Data()<<" !!!!"<<endl;
1491 cout<<" Did you actually use "<<method[i].Data()<<" in the analysis?"<<endl;
1496 cout<<" WARNING: Couldn't find a TDirectoryFile "<<fileName[i].Data()<<".root !!!!"<<endl;
1499 } // end of for(Int_t i=0;i<nMethods;i++)
1501 // If no files were found most probably the 'TString analysisType' was specified wrongly:
1502 if(failureCounter == nMethods)
1505 cout<<"Did you specify 'TString analysisType' correctly? Can be \"\", \"ESD\", \"AOD\", etc."<<endl;
1510 } // end of void GetListsWithHistograms(TFile *outputFile, TString analysisType)
1512 // ===========================================================================================
1514 TH1D* GetResultHistogram(TString method, TString rfRpPoi, TString ptEta="")
1516 // Get the specified histogram holding result.
1518 AliFlowCommonHistResults *commonHistRes = NULL;
1519 TString methodName = method.Data();
1520 Int_t cumulantOrder = 0;
1521 if(method.Contains("GFC"))
1523 TString methodNameTemp1 = method;
1524 TString methodNameTemp2 = method;
1525 methodName = methodNameTemp1.Remove(0,2);
1526 cumulantOrder = methodNameTemp2.Remove(1,4).Atoi();
1527 } else if(method.Contains("QC"))
1529 TString methodNameTemp1 = method;
1530 TString methodNameTemp2 = method;
1531 methodName = methodNameTemp1.Remove(0,2);
1532 cumulantOrder = methodNameTemp2.Remove(1,3).Atoi();
1534 // Get for specified methodName (and cumulantOrder, if needed) the common hist result:
1535 // (to be improved - this can certainly be implemented better, but some redesign of the flow code is first in order)
1536 for(Int_t l=0;l<nMethods;l++)
1541 temp = TString(list[l]->GetName());
1543 if(temp.Contains(methodName.Data()))
1545 // Access from the common list the needed common result histogram:
1546 if(!(methodName.Contains("GFC") || methodName.Contains("QC")))
1548 commonHistRes = dynamic_cast<AliFlowCommonHistResults*> list[l]->FindObject(Form("AliFlowCommonHistResults%s",methodName.Data()));
1550 else if(methodName=="GFC")
1552 if(cumulantOrder==2)
1554 commonHistRes = dynamic_cast<AliFlowCommonHistResults*> list[l]->FindObject("AliFlowCommonHistResults2ndOrderGFC");
1556 else if(cumulantOrder==4)
1558 commonHistRes = dynamic_cast<AliFlowCommonHistResults*> list[l]->FindObject("AliFlowCommonHistResults4thOrderGFC");
1560 else if(cumulantOrder==6)
1562 commonHistRes = dynamic_cast<AliFlowCommonHistResults*> list[l]->FindObject("AliFlowCommonHistResults6thOrderGFC");
1564 else if(cumulantOrder==8)
1566 commonHistRes = dynamic_cast<AliFlowCommonHistResults*> list[l]->FindObject("AliFlowCommonHistResults8thOrderGFC");
1570 cout<<"WARNING: You have specified cumulant order to be "<<cumulantOrder<<" !!!!"<<endl;
1571 cout<<" That is really not funny.... "<<endl;
1573 } // end of else if(methodName=="GFC")
1574 else if(methodName=="QC")
1576 if(cumulantOrder==2)
1578 commonHistRes = dynamic_cast<AliFlowCommonHistResults*> list[l]->FindObject("AliFlowCommonHistResults2ndOrderQC");
1580 else if(cumulantOrder==4)
1582 commonHistRes = dynamic_cast<AliFlowCommonHistResults*> list[l]->FindObject("AliFlowCommonHistResults4thOrderQC");
1584 else if(cumulantOrder==6)
1586 commonHistRes = dynamic_cast<AliFlowCommonHistResults*> list[l]->FindObject("AliFlowCommonHistResults6thOrderQC");
1588 else if(cumulantOrder==8)
1590 commonHistRes = dynamic_cast<AliFlowCommonHistResults*> list[l]->FindObject("AliFlowCommonHistResults8thOrderQC");
1594 cout<<"WARNING: You have specified cumulant order to be "<<cumulantOrder<<" !!!!"<<endl;
1595 cout<<" There are no results for this cumulant order. "<<endl;
1597 } // end of else if(methodName=="QC")
1598 } // end of if(temp.Contains(methodName.Data()))
1599 } // end of for(Int_t l=0;l<nMethods;l++)
1603 //cout<<"WARNING: For a method "<<method.Data()<<" couldn't access the common hist result !!!!"<<endl;
1604 //cout<<" File absent? Or perhaps a typo in the method's name?"<<endl;
1605 if(methodName.Contains("GFC") || methodName.Contains("QC"))
1607 //cout<<" Or impossible cumulant order? Otherwise.... :'( "<<endl;
1612 // Finally, from commonHistRes access the required histogram:
1618 hist = commonHistRes->GetHistIntFlow();
1619 } else if(rfRpPoi == "RP")
1623 hist = commonHistRes->GetHistIntFlowRP();
1624 } else if(ptEta == "Pt")
1626 hist = commonHistRes->GetHistDiffFlowPtRP();
1627 } else if(ptEta == "Eta")
1629 hist = commonHistRes->GetHistDiffFlowEtaRP();
1631 } else if(rfRpPoi == "POI")
1635 hist = commonHistRes->GetHistIntFlowPOI();
1636 } else if(ptEta == "Pt")
1638 hist = commonHistRes->GetHistDiffFlowPtPOI();
1639 } else if(ptEta == "Eta")
1641 hist = commonHistRes->GetHistDiffFlowEtaPOI();
1648 } // end of TH1D* GetResultHistogram(TString method, TString rfRpPoi, TString ptEta="")
1650 // ===========================================================================================
1652 void GlobalSettings()
1654 // Settings which will affect all plots.
1656 gROOT->SetStyle("Plain"); // default color is white instead of gray
1657 gStyle->SetOptStat(0); // remove stat. box from all histos
1658 TGaxis::SetMaxDigits(4); // prefer exp notation for 5 and more significant digits
1660 } // end of void GlobalSettings()
1662 // ===========================================================================================
1664 void LoadLibrariesCFR(const libModes analysisMode) {
1666 //--------------------------------------
1667 // Load the needed libraries most of them already loaded by aliroot
1668 //--------------------------------------
1669 //gSystem->Load("libTree");
1670 gSystem->Load("libGeom");
1671 gSystem->Load("libVMC");
1672 gSystem->Load("libXMLIO");
1673 gSystem->Load("libPhysics");
1675 //----------------------------------------------------------
1676 // >>>>>>>>>>> Local mode <<<<<<<<<<<<<<
1677 //----------------------------------------------------------
1678 if (analysisMode==mLocal) {
1679 //--------------------------------------------------------
1680 // If you want to use already compiled libraries
1681 // in the aliroot distribution
1682 //--------------------------------------------------------
1684 //==================================================================================
1685 //load needed libraries:
1686 gSystem->AddIncludePath("-I$ROOTSYS/include");
1687 //gSystem->Load("libTree");
1690 gSystem->AddIncludePath("-I$ALICE_ROOT/include");
1691 gSystem->Load("libANALYSIS");
1692 gSystem->Load("libPWGflowBase");
1693 //cerr<<"libPWGflowBase loaded ..."<<endl;
1697 else if (analysisMode==mLocalSource) {
1699 // In root inline compile
1702 gROOT->LoadMacro("BaseAliFlowCommonConstants.cxx+");
1703 gROOT->LoadMacro("BaseAliFlowLYZConstants.cxx+");
1706 gROOT->LoadMacro("BaseAliFlowVector.cxx+");
1707 gROOT->LoadMacro("BaseAliFlowTrackSimple.cxx+");
1708 gROOT->LoadMacro("BaseAliFlowTrackSimpleCuts.cxx+");
1709 gROOT->LoadMacro("BaseAliFlowEventSimple.cxx+");
1711 // Output histosgrams
1712 gROOT->LoadMacro("BaseAliFlowCommonHist.cxx+");
1713 gROOT->LoadMacro("BaseAliFlowCommonHistResults.cxx+");
1714 gROOT->LoadMacro("BaseAliFlowLYZHist1.cxx+");
1715 gROOT->LoadMacro("BaseAliFlowLYZHist2.cxx+");
1717 cout << "finished loading macros!" << endl;
1721 } // end of void LoadLibrariesCFR(const libModes analysisMode)