3 TGraphErrors*ResolutionXY[nTerms];
4 TString title[nTerms]={"#LTQ_{x}^{p}Q_{x}^{t}#GT","#LTQ_{y}^{p}Q_{y}^{t}#GT","#LTQ_{x}^{p}Q_{y}^{t}#GT","#LTQ_{y}^{p}Q_{x}^{t}#GT"};
5 TString name[nTerms]={"Qpx_Qtx","Qpy_Qty","Qpx_Qty","Qpy_Qtx"};
6 int color[nTerms]={kBlue,kMagenta+2,kBlue+2,kGreen+2};
7 int symbol[nTerms]={kFullSquare,kFullDiamond,kOpenTriangleUp,kOpenTriangleDown};
8 float myMarkerSize=1.5;
9 float markerSize[nTerms]={myMarkerSize,1.5*myMarkerSize,myMarkerSize,myMarkerSize};
13 float shift[nTerms]={-myShift,myShift,-myShift,myShift};
14 TString centrality_name[9]={"0-5","5-10","10-20","20-30","30-40","40-50","50-60","60-70","70-80"};
15 void CorrelationQpiQtj_hepData(bool rWrite = false, bool dumpHepData=false,TString dataFileName="ALICE_v1_arxiv_1306_4145.root")
17 TGaxis::SetMaxDigits(3);
20 TCanvas *myCan = new TCanvas("myCan","Resolution",800,600);
21 TPad *myPad1 = new TPad("myPad1","myPad1",0.,0,1,1);
22 myPadSetUp(myPad1,0.08, 0.05, 0.01, 0.1);
25 TFile *dataFile = TFile::Open(dataFileName,"READ");
26 ResolutionXY[0] = (TGraphErrors*)dataFile->Get("Qpx_Qtx");
27 ResolutionXY[1] = (TGraphErrors*)dataFile->Get("Qpy_Qty");
28 ResolutionXY[2] = (TGraphErrors*)dataFile->Get("Qpx_Qty");
29 ResolutionXY[3] = (TGraphErrors*)dataFile->Get("Qpy_Qtx");
31 TH1F* myBlankHisto = new TH1F("myBlankHisto","#LTQ_{i}^{p}Q_{j}^{t}#GT",10,0,82);
32 myHistoSetUp(myBlankHisto,"centrality (%)","#LTQ_{r}^{p}Q_{r'}^{t}#GT",-1.05e-2,2.5e-3, 1, 2, 315, 505);
33 TLegend* myLegend = new TLegend(0.35,0.45,0.6,0.7);
34 myLegendSetUp(myLegend,mainFont);
36 for (int i=0; i<nTerms; i++)
38 myTGraphSetUp(ResolutionXY[i],symbol[i],color[i],markerSize[i],1,color[i],2,fillStyle,color[i]);
39 TString draw_opt = "p,eZ,same";
40 myLegend->AddEntry(ResolutionXY[i],title[i],"P");
41 ResolutionXY[i]->Draw(draw_opt);
44 cout<< name[i] <<endl; cout <<"x" << "\t" <<"xlow" << "\t"<< "xhigh"<< "\t"<< "y"<< "\t\t"<<"dy+"<< "\t\t"<<"dy-"<< "\t\t"<<"dy+"<< "\t"<<"dy-"<<endl;
47 for (int j=0; j< ResolutionXY[i]->GetN(); j++)
49 ResolutionXY[i]->GetPoint(j,x,y);
50 cout<< x<< "\t" << x-ResolutionXY[i]->GetErrorXlow(j)<< "\t" << x+ResolutionXY[i]->GetErrorXhigh(j)<< "\t" << y << "\t"<< ResolutionXY[i]->GetErrorY(j)<< "\t"<< ResolutionXY[i]->GetErrorY(j)<<"\tN/A\tN/A" <<endl;
53 ShiftAlongXaxis(ResolutionXY[i], shift[i]);
56 TLatex *myText = new TLatex();
58 myText->SetTextSize(mainFont);
59 myText->DrawLatex(0.12,0.9,"ALICE Pb-Pb #sqrt{s_{NN}}=2.76TeV");
60 myText->DrawLatex(0.57,0.9,"Q^{p,t}_{x,y} from Neutron ZDCs (|#eta|>8.78)");
62 TString fileName="Correlation_QpQt";
66 myCan->SaveAs(fileName+".png");
67 myCan->SaveAs(fileName+".eps");
68 myCan->SaveAs(fileName+".pdf");
72 void myLegendSetUp(TLegend *currentLegend=0,float currentTextSize=0.07){
73 currentLegend->SetBorderSize(0);
74 currentLegend->SetFillStyle(0);
75 currentLegend->SetFillColor(0);
76 currentLegend->SetMargin(0.25);
77 currentLegend->SetTextSize(currentTextSize);
78 currentLegend->SetEntrySeparation(0.5);
81 // myTGraphSetUp(v1etaStat_cent10_20,kFullTriangleUp,kRed+2,myMarkerSize,1,kRed+2,2,fillStyle,kRed+2);
83 void myPadSetUp(TPad *currentPad, float currentLeft=0.11, float currentTop=0.04, float currentRight=0.04, float currentBottom=0.15){
84 currentPad->SetLeftMargin(currentLeft);
85 currentPad->SetTopMargin(currentTop);
86 currentPad->SetRightMargin(currentRight);
87 currentPad->SetBottomMargin(currentBottom);
91 void myGraphSetUp(TGraphErrors *currentGraph=0, Float_t currentMarkerSize = 1.0,
92 int currentMarkerStyle=20, int currentMarkerColor=0,
93 int currentLineStyle=1, int currentLineColor=0)
95 currentGraph->SetMarkerSize(currentMarkerSize);
96 currentGraph->SetMarkerStyle(currentMarkerStyle);
97 currentGraph->SetMarkerColor(currentMarkerColor);
98 currentGraph->SetLineStyle(currentLineStyle);
99 currentGraph->SetLineColor(currentLineColor);
103 void myOptions(Int_t lStat=0){
107 gStyle->SetFrameBorderMode(0);
108 gStyle->SetFrameFillColor(0);
109 gStyle->SetCanvasBorderMode(0);
110 gStyle->SetPadBorderMode(0);
111 gStyle->SetPadColor(10);
112 gStyle->SetCanvasColor(10);
113 gStyle->SetTitleFillColor(10);
114 gStyle->SetTitleBorderSize(1);
115 gStyle->SetStatColor(10);
116 gStyle->SetStatBorderSize(1);
117 gStyle->SetLegendBorderSize(1);
119 gStyle->SetDrawBorder(0);
120 gStyle->SetTextFont(font);
121 gStyle->SetStatFont(font);
122 gStyle->SetLegendFont(font);
123 gStyle->SetStatFontSize(20);
124 gStyle->SetStatX(0.97);
125 gStyle->SetStatY(0.98);
126 gStyle->SetStatH(0.03);
127 gStyle->SetStatW(0.3);
128 gStyle->SetTickLength(0.02,"y");
129 gStyle->SetEndErrorSize(3);
130 gStyle->SetLabelSize(20,"xyz");
131 gStyle->SetLabelFont(font,"xyz");
132 gStyle->SetLabelOffset(0.01,"xyz");
133 gStyle->SetTitleFont(font,"xyz");
134 gStyle->SetTitleOffset(.8,"y");
135 gStyle->SetTitleOffset(1.,"xz");
136 gStyle->SetTitleSize(24,"x");
137 gStyle->SetTitleSize(24,"y");
138 gStyle->SetMarkerSize(1);
139 gStyle->SetPalette(1,0);
142 gStyle->SetOptTitle(1);
143 gStyle->SetOptStat(1111);
144 gStyle->SetOptFit(1111);
147 gStyle->SetOptTitle(0);
148 gStyle->SetOptStat(0);
149 gStyle->SetOptFit(0);
153 TGraphErrors* makeGraphH1(TH1* hist, TString name="")
155 name.ReplaceAll(" ","");
156 Int_t nbins = hist->GetNbinsX();
157 Double_t* x = new Double_t[nbins];
158 Double_t* y = new Double_t[nbins];
159 Double_t* xerr = new Double_t[nbins];
160 Double_t* yerr = new Double_t[nbins];
162 for (Int_t i=0; i<nbins; i++)
164 //if (hist->GetBinContent(i+1)==0.0) continue;
166 x[n] = hist->GetXaxis()->GetBinCenter(i+1);
167 y[n] = hist->GetBinContent(i+1);
169 yerr[n] = hist->GetBinError(i+1);
172 TGraphErrors* gr = new TGraphErrors(n,x,y,xerr,yerr);
180 TGraphErrors* makeGraphPr(TProfile* hist, TString name="")
182 name.ReplaceAll(" ","");
183 Int_t nbins = hist->GetNbinsX();
184 Double_t* x = new Double_t[nbins];
185 Double_t* y = new Double_t[nbins];
186 Double_t* xerr = new Double_t[nbins];
187 Double_t* yerr = new Double_t[nbins];
189 for (Int_t i=0; i<nbins; i++)
191 //if (hist->GetBinContent(i+1)==0.0) continue;
193 x[n] = hist->GetXaxis()->GetBinCenter(i+1);
194 y[n] = hist->GetBinContent(i+1);
196 yerr[n] = hist->GetBinError(i+1);
199 TGraphErrors* gr = new TGraphErrors(n,x,y,xerr,yerr);
209 TH1F *hist=0, TString xTitle="xTitle", TString yTitle="yTitle", float minY=-1, float maxY=1, int lineColor=1, int lineStyle=2,
210 int nDivisionsX=305,int nDivisionsY=305
213 hist->GetXaxis()->SetTitle(xTitle);
214 hist->GetYaxis()->SetTitle(yTitle);
215 hist->SetMinimum(minY);
216 hist->SetMaximum(maxY);
217 hist->SetLineColor(lineColor);
218 hist->SetLineStyle(lineStyle);
219 hist->SetNdivisions(nDivisionsX,"x");
220 hist->SetNdivisions(nDivisionsY,"y");
224 // Shift original TGraphErrors along x-axis by amount determined by 'shift'.
225 void ShiftAlongXaxis(TGraphErrors *ge, Double_t shift)
229 printf("\n WARNING: ge is NULL in ShiftAlongXaxis() !!!! \n\n");
232 Int_t nPoints = ge->GetN();
235 for(Int_t p=0;p<nPoints;p++)
243 void ScaleXaxis(TGraphErrors *ge, Double_t scale)
247 printf("\n WARNING: ge is NULL in ShiftAlongXaxis() !!!! \n\n");
250 Int_t nPoints = ge->GetN();
253 for(Int_t p=0;p<nPoints;p++)
264 TGraphErrors *currentGraph=0,
267 float myMarkerSize=1,
271 int myFillStyle =fillStyle,
275 currentGraph->SetMarkerStyle(myMarkerStyle);
276 currentGraph->SetMarkerColor(myMarkerColor);
277 currentGraph->SetMarkerSize(myMarkerSize);
278 currentGraph->SetLineColor(myLineColor);
279 currentGraph->SetLineStyle(myLineStyle);
280 currentGraph->SetLineWidth(myLineWidth);
281 currentGraph->SetFillStyle(myFillStyle);
282 currentGraph->SetFillColor(myFillColor);
283 // currentGraph->Set();