forked from dongjokim/SPCpaper_plotmacros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFig1_ExpComp.py
131 lines (105 loc) · 4.91 KB
/
Fig1_ExpComp.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
# comparison to ALICE or ATLAS SP methods
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");
# need to add ALICE rho observables
obsPanel = [0,1,2,3]; # it must be in order for now to make the plabel consistent!!!
obsTypeStr = ["4Psi4_n4Psi2","2Psi2_3Psi3_n5Psi5","6Psi6_n6Psi2","6Psi6_n6Psi3"
];
plabel = ["$\\langle cos[4(\\Psi_{4}-\\Psi_{2})]\\rangle$",
"$\\langle cos[2\\Psi_{2}+3\\Psi_{3}-5\\Psi_{5}]\\rangle$",
"$\\langle cos[6(\\Psi_{6}-\\Psi_{2})]\\rangle$",
"$\\langle cos[6(\\Psi_{6}-\\Psi_{3})]\\rangle$" # 2 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':'red','fmt':'o','markersize':5.0},
{'plotType':'data','color':'#e580ff','fmt':'X','fillstyle':'none','markersize':5.5},
{'plotType':'data','color':'#44aa11','fmt':'h','markersize':4.0},
{'plotType':'data','color':'red','fmt':'D','fillstyle':'none','markersize':5.0},
{'plotType':'data','color':'cyan','fmt':'d','fillstyle':'none','markersize':5.5}
];
modelTypePlotParams = [
{'plotType':'theory','color':'#0051a2','linecolor':'#0051a2','alpha':0.5,'linestyle':'solid'},
{'plotType':'theory','color':'#e580ff','linecolor':'#e580ff','alpha':0.5,'linestyle':'dotted'},
{'plotType':'theory','color':'red','linecolor':'red','alpha':0.5,'linestyle':'solid'}
];
def RemovePoints(arrays, pointIndices):
return tuple([np.delete(a,pointIndices) for a in arrays]);
# define panel/xaxis limits/titles
ny = 2;
nx = 2;
xlimits = [(-1.,52.)];
ylimits = [(0,1.0),(0.,0.7)];
ylimitsPri = [(-0.05,1.2),(0,0.75)]
xtitle = ["Centrality percentile"];
ytitle = ["Correlations","Correlations"];
ytitleRight = ["Correlations"];
# 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$";
plot = JPyPlotRatio.JPyPlotRatio(panels=(ny,nx),panelsize=(5,5),
disableRatio=[0,1],
# rowBounds=ylimits, #only one row, add the shared ylims
panelPrivateRowBounds={1:ylimitsPri[0],3:ylimitsPri[1]},
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],
#panelLabel={i:label for i,label in enumerate(plabel)},
panelLabelLoc=(0.07,0.88),panelLabelSize=11,
panelLabel=plabel,
#panelScaling={3:5},
panelLabelAlign="left",
systPatchWidth = 0.03,
legendPanel=0,legendLoc=(0.70,0.26),legendSize=9,ylabel={0:ytitle[0],1:ytitle[1]});
plot.GetPlot().text(0.5,0.05,xtitle[0],size=plot.axisLabelSize,horizontalalignment="center");
plot.GetAxes(1).yaxis.tick_right();
plot.GetAxes(3).yaxis.tick_right();
plot.EnableLatex(True);
#plot.EnableLatex(True);
obsN = len(obsTypeStr);
#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");
plot.GetAxes(2).plot([0,50],[0,0],linestyle=":",color="gray");
plot.GetAxes(3).plot([0,50],[0,0],linestyle=":",color="gray");
for i in range(0,obsN):
gr = f.Get("{:s}{:s}".format(obsTypeStr[i],"_Stat"));
plot1 = plot.Add(obsPanel[i],gr,**dataTypePlotParams[0]);
if(i==0):
plot1 = plot.Add(obsPanel[i],gr,**dataTypePlotParams[0],label=dataTypeStr[0]);
# systematics
grsyst = f.Get("{:s}{:s}".format(obsTypeStr[i],"_Syst"));
_,_,_,yerrsyst = JPyPlotRatio.TGraphErrorsToNumpy(grsyst);
plot.AddSyst(plot1,yerrsyst);
# model
for j in range(0,3):
grmodel = fmodel.Get("{:s}{:s}".format(obsTypeStr[i],dataTypeInRoot[j+1]));
#grmodel.Print();
# plotModel = plot.Add(obsPanel[i],grmodel,**modelTypePlotParams[j],label=dataTypeStr[j+1]);
#plot.Ratio(plotModel,plot1);
f.Close();
# adding rho observables
f276 = ROOT.TFile("data/NL276ALICE_HEPData-ins1599396-v1-root.root","read");
HEPTableName=["Table 14/Graph1D_y1","Table 15/Graph1D_y1","Table 16/Graph1D_y1","Table 17/Graph1D_y1"]; #rho422,rho532,rho6222,633
HEPTableObsName=["$\\rho_{4,22}$","$\\rho_{5,32}$","$\\rho_{6,222}$","$\\rho_{6,33}$"];
for i in [t for t in range(0,4)]:# if t != 1]:
gr_rho = f276.Get("{}".format(HEPTableName[i]));
#[grvn_276_alice[i].RemovePoint(j) for j in [7,7,7]];
plot.Add(i,gr_rho,xshift=0,color="black",fmt="o",mfc="none",markersize=8,label="$\\rho_{n,mk}$, Phys.Lett. B773 (2017) 68");
f276.Close();
#plot.GetPlot().text(0.16,0.31,"ALICE",fontsize=9);
plot.GetPlot().text(0.34,0.75,toptitle,fontsize=9);
plot.GetPlot().text(0.34,0.70,dataDetail,fontsize=9);
#plot.GetAxes(3).text(0.1,0.1,dataDetail,fontsize=9);
plot.Plot();
#plot.GetRatioAxes(3).remove();
plot.Save("figs/Fig1_expcomp.pdf");
plot.Show();