Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
drawCorr.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file drawCorr.C
1 #include "sPhenixStyle.h"
2 #include "sPhenixStyle.C"
3 
4 void drawCorr()
5 {
7 
8  TCanvas *cJer = new TCanvas();
9  TCanvas *cJes = new TCanvas();
10  TLegend *leg = new TLegend(.4,.5,.9,.9);
11  TLegend *corr = new TLegend(0.35,0.5,0.85,0.75);
12  corr -> SetFillStyle(0);
13  corr -> SetBorderSize(0);
14  leg -> SetFillStyle(0);
15  leg -> SetBorderSize(0);
16  TLatex tag;
17  leg->AddEntry("","#it{#bf{sPHENIX}} Internal","");
18  leg->AddEntry("","p+p #sqrt{s_{NN}}=200 GeV","");
19  leg->AddEntry("","anti-#it{k}_{#it{t}} #it{R} = 0.4, |#eta| < 1.1","");
20  string rad[] = {"0","1","1.5","2","2.5"};
21 
22  const int nCorrStat = 2;//sizeof(corr)/sizeof(corr[0]);
23  const int nRads = sizeof(rad)/sizeof(rad[0]);
24 
25  TGraphErrors *jes[nCorrStat][nRads];
26  TGraphErrors *jer[nCorrStat][nRads];
27 
28  TFile *fin[nCorrStat][nRads];
29 
30 
31  int colors[] = {1, 2, 4, kGreen +2, kViolet, kCyan, kOrange, kMagenta+2, kAzure-2};
32 
33  for(int i = 0; i < nCorrStat; i++)
34  {
35  for(int j = 0; j < nRads; j++)
36  {
37  fin[i][j] = new TFile(Form("hists_R04_dR%s_Corr%d_isLin0.root",rad[j].c_str(),i));
38 
39  jes[i][j] = (TGraphErrors*)fin[i][j] -> Get("g_jes_cent0");
40  jes[i][j] -> SetTitle(";p_{T,truth} [GeV]; #LTp_{T,reco}/p_{T,truth}#GT");
41 
42  jer[i][j] = (TGraphErrors*)fin[i][j] -> Get("g_jer_cent0");
43  jer[i][j] -> SetTitle(";p_{T,truth} [GeV];#sigma(p_{T,reco}/p_{T,truth}) / #LTp_{T,reco}/p_{T,truth}#GT");
44 
45 
46  jes[i][j] -> SetMarkerColor(colors[j]);
47  jer[i][j] -> SetMarkerColor(colors[j]);
48  if(i)
49  {
50  jes[i][j] -> SetMarkerStyle(20);
51  jer[i][j] -> SetMarkerStyle(20);
52  }
53  else
54  {
55  jes[i][j] -> SetMarkerStyle(4);
56  jer[i][j] -> SetMarkerStyle(4);
57  }
58  if(i == 0)leg -> AddEntry(jes[i][j],Form("#DeltaR = %sR", rad[j].c_str()),"p");
59  else corr -> AddEntry(jes[i][j]," ","p");
60  cJes -> cd();
61  if(i == 0 && j == 0)
62  {
63  jes[i][j] -> Draw("ap");
64  jes[i][j] -> GetYaxis() -> SetRangeUser(0.5,1.8);
65  jes[i][j] -> GetXaxis() -> SetLimits(0,80);
66  }
67  else jes[i][j] -> Draw("samep");
68 
69  cJer -> cd();
70  if(i == 0 && j == 0) jer[i][j] -> Draw("ap");
71  else jer[i][j] -> Draw("samep");
72  }
73 
74  }
75 
76  TLine *one = new TLine(0,1,80,1);
77  one -> SetLineStyle(8);
78  cJes -> cd();
79  tag.SetTextSize(0.04);
80  tag.DrawLatexNDC(0.39,0.75,"W/ W/o");
81  leg -> Draw("same");
82  corr -> Draw("same");
83  one -> Draw("same");
84  cJes -> SaveAs("plots/JES_CorrectionComp.pdf");
85 
86  cJer -> cd();
87  tag.SetTextSize(0.04);
88  tag.DrawLatexNDC(0.39,0.75,"W/ W/o");
89  leg -> Draw("same");
90  corr -> Draw("same");
91  cJer -> SaveAs("plots/JER_CorrectionComp.pdf");
92 
93  //make one with no iso cut so it's cleaner
94 
95  TCanvas *cJesClean = new TCanvas();
96  jes[0][0] -> GetYaxis() -> SetRangeUser(0.5,1.80);
97  jes[0][0] -> Draw("ap");
98  jes[1][0] -> Draw("same p");
99  jes[1][0] -> SetMarkerStyle(20);
100  jes[0][0] -> SetMarkerStyle(20);
101 
102  jes[1][0] -> SetMarkerColor(2);
103 
104  one -> Draw("same");
105  leg -> Clear();
106  leg->AddEntry("","#it{#bf{sPHENIX}} Internal","");
107  leg->AddEntry("","p+p #sqrt{s_{NN}}=200 GeV","");
108  leg->AddEntry("","anti-#it{k}_{#it{t}} #it{R} = 0.4, |#eta| < 1.1","");
109  leg -> AddEntry(jes[0][0],"Uncalibrated","p");
110  leg -> AddEntry(jes[1][0],"Calibrated","p");
111 
112  leg -> Draw("same");
113 
114 
115  TCanvas *cJerClean = new TCanvas();
116  jer[0][0] -> Draw("ap");
117  jer[1][0] -> Draw("same p");
118  jer[1][0] -> SetMarkerStyle(20);
119  jer[1][0] -> SetMarkerColor(2);
120 
121  leg -> Draw("same");
122 
123  cJerClean -> SaveAs("plots/JER_CorrectionComp_NoIso.pdf");
124  cJesClean -> SaveAs("plots/JES_CorrectionComp_NoIso.pdf");
125 
126  TCanvas *cJesCleanZoom = new TCanvas();
127  jes[1][0] -> GetYaxis() -> SetRangeUser(0.98,1.02);
128  jes[1][0] -> GetXaxis() -> SetLimits(0,80);
129  jes[1][0] -> Draw("aP");
130  one -> Draw("same");
131  gPad -> SetGridy();
132 
133  cJesCleanZoom -> SaveAs("plots/JES_CorrectionComp_NoIso_Zoom.pdf");
134 
135 
136 }
137