forked from dongjokim/SPCpaper_plotmacros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFig1_AllObs.py
133 lines (110 loc) · 4.96 KB
/
Fig1_AllObs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import numpy as np
import ROOT
import scipy
from scipy import interpolate
import sys
sys.path.append("JPyPlotRatio");
import JPyPlotRatio
f = ROOT.TFile("data/Output_ALICE.root","read");
fmodel = ROOT.TFile("data/Output_TrentoVISHNU.root","read");
obsPanel = [0,0,0,0,1,1,1,1,1];
obsleg = [0,0,0,0,1,1,2,1,2];
obsTypeStr = ["4Psi4_n4Psi2","6Psi3_n6Psi2","6Psi6_n6Psi2","6Psi6_n6Psi3",
"2Psi2_3Psi3_n5Psi5","8Psi2_n3Psi3_n5Psi5","2Psi2_n6Psi3_4Psi4","2Psi2_4Psi4_n6Psi6",
"2Psi2_n3Psi3_n4Psi4_5Psi5"
];
plabel = ["$\\langle cos[4(\\Psi_{4}-\\Psi_{2})]\\rangle$",
"$\\langle cos[6(\\Psi_{2}-\\Psi_{3})]\\rangle$",
"$\\langle cos[6(\\Psi_{6}-\\Psi_{2})]\\rangle$",
"$\\langle cos[6(\\Psi_{6}-\\Psi_{3})]\\rangle$", # 2 har
"$\\langle cos[2\\Psi_{2}+3\\Psi_{3}-5\\Psi_{5}]\\rangle$",
"$\\langle cos[8\\Psi_{2}-3\\Psi_{3}-5\\Psi_{5}]\\rangle$",
"$\\langle cos[2\\Psi_{2}-6\\Psi_{3}+4\\Psi_{4}]\\rangle$",
"$\\langle cos[2\\Psi_{2}+4\\Psi_{4}-6\\Psi_{6}]\\rangle$", # 3 har
"$\\langle cos[2\\Psi_{2}-3\\Psi_{3}-4\\Psi_{4}+5\\Psi_{5}]\\rangle$" # 4 har
];
dataTypeStr = ["ALICE","{T\\raisebox{-.5ex}{R}ENTo} (cumulants)","{T\\raisebox{-.5ex}{R}ENTo} (eccentricities)","{T\\raisebox{-.5ex}{R}ENTo} + VISH2+1 + UrQMD"];
dataTypeInRoot = ["ALICE","_Trento_Cumulants","_Trento_Ecc","_TrentoVISHNU_FinalState"];
dataTypePlotParams = [
{'plotType':'data','color':'black','fmt':'o','markersize':5.5},
{'plotType':'data','color':'#0051a2','fmt':'d','fillstyle':'none','markersize':6.0},
{'plotType':'data','color':'blue','fmt':'D','fillstyle':'none','markersize':5.5},
{'plotType':'data','color':'red','fmt':'s','markersize':5.5},# 2 har
{'plotType':'data','color':'#660080','fmt':'*','fillstyle':'none','markersize':6.0},
{'plotType':'data','color':'#9955ff','fmt':'d','markersize':6.0},
{'plotType':'data','color':'m','fmt':'X','fillstyle':'none','markersize':5.5},
{'plotType':'data','color':'seagreen','fmt':'h','markersize':5.5},
{'plotType':'data','color':'red','fmt':'H','fillstyle':'none','markersize':5.5}
];
def RemovePoints(arrays, pointIndices):
return tuple([np.delete(a,pointIndices) for a in arrays]);
modelDraw = 0
imodel = 3; # based on dataTypeStr and dataTypeInRoot
# define panel/xaxis limits/titles
ny = 1;
nx = 2;
xlimits = [(-1.,52.)];
ylimits = [(-0.3,0.55)];
xtitle = ["Centrality percentile"];
ytitle = ["Correlations"];
ytitleRight = ["NSC(k,l,m)"];
# Following two must be added
toptitle = "PbPb $\\sqrt{s_{NN}}$ = 2.76 TeV"; # need to add on the top
dataDetail = "$0.2 < p_\\mathrm{T} < 5.0\\,\\mathrm{GeV}/c$\n$|\\eta| < 0.8$";
plables = [ "(a)", "(b)" ];
plot = JPyPlotRatio.JPyPlotRatio(panels=(ny,nx),panelsize=(5,6),disableRatio=[0],
rowBounds=ylimits, #only one row, add the shared ylims
colBounds={0:xlimits[0],1:xlimits[0]}, #two columns, set xlimit for both of them
ratioBounds={0:(-1,3),1:(-1,3)},
#panelPrivateScale=[1,3,5],
#panelLabel={i:label for i,label in enumerate(plabel)},
panelLabelLoc=(0.93,0.94),panelLabelSize=11,
panelLabel=plables,
#panelScaling={3:5},
panelLabelAlign="left",
systPatchWidth = 0.03,
legendPanel={0:0,1:1,2:1},legendLoc={0:(0.65,0.16),1:(0.23,0.15),2:(0.71,0.15)},legendSize=9,xlabel=xtitle[0],ylabel=ytitle[0]);
plot.GetAxes(1).yaxis.tick_right();
plot.EnableLatex(True);
#plot.EnableLatex(True);
obsN = len(obsTypeStr);
datN = len(dataTypeStr);
#scale1 = {4:10,5:10};
plot.GetAxes(0).plot([0,50],[0,0],linestyle=":",color="gray");
plot.GetAxes(1).plot([0,50],[0,0],linestyle=":",color="gray");
for i in range(0,obsN):
gr = f.Get("{:s}{:s}".format(obsTypeStr[i],"_Stat"));
x,y,_,yerr = JPyPlotRatio.TGraphErrorsToNumpy(gr);
if(i==5 or i==8):
x = x[1:]
y = y[1:]
yerr = yerr[1:]
if(modelDraw == 0):
plot1 = plot.Add(obsPanel[i],(x,y,yerr),**dataTypePlotParams[i],label=plabel[i],labelLegendId=obsleg[i]);
# systematics
grsyst = f.Get("{:s}{:s}".format(obsTypeStr[i],"_Syst"));
_,_,_,yerrsyst = JPyPlotRatio.TGraphErrorsToNumpy(grsyst);
if(i==5 or i==8):
yerrsyst = yerrsyst[1:]
plot.AddSyst(plot1,yerrsyst);
if(modelDraw == 1 and i!=5):
# model
grmodel = fmodel.Get("{:s}{:s}".format(obsTypeStr[i],dataTypeInRoot[imodel]));
plotModel = plot.Add(obsPanel[i],grmodel,**dataTypePlotParams[i],label=plabel[i],labelLegendId=obsleg[i]);
f.Close();
#plot.GetRatioAxes(3).remove();
if(modelDraw==0):
plot.GetPlot().text(0.15,0.81,"ALICE",fontsize=9);
plot.GetPlot().text(0.15,0.77,toptitle,fontsize=9);
plot.GetPlot().text(0.16,0.25,dataDetail,fontsize=9);
#plot.GetAxes(3).text(0.1,0.1,dataDetail,fontsize=9);
plot.Plot();
plot.Save("figs/Fig1_AllObs.pdf");
if(modelDraw==1):
plot.GetPlot().text(0.15,0.81,dataTypeStr[imodel],fontsize=9);
plot.GetPlot().text(0.15,0.77,toptitle,fontsize=9);
plot.GetPlot().text(0.16,0.25,dataDetail,fontsize=9);
#plot.GetAxes(3).text(0.1,0.1,dataDetail,fontsize=9);
plot.Plot();
plot.Save("figs/Fig1_AllObs_{:s}.pdf".format(dataTypeInRoot[imodel]));
plot.Show();