1 #include "sPhenixStyle.h"
2 #include "sPhenixStyle.C"
7 TH1::SetDefaultSumw2();
8 TH2::SetDefaultSumw2();
10 TChain *ct =
new TChain(
"T");
11 ct->Add(
"../macro/output.root");
13 vector<float> *
pt =
nullptr;
15 ct->SetBranchAddress(
"pt", &pt);
22 TH1F *pt_hist =
new TH1F(
"h_MC_Reso",
"", pt_N, pt_min, pt_max);
24 Long64_t nEntries = ct->GetEntries();
26 for (Long64_t iEntry = 0; iEntry < nEntries; ++iEntry) {
30 for (
size_t i = 0;
i < pt->size(); ++
i) {
31 pt_hist->Fill((*pt)[
i]);
36 TCanvas *canvas =
new TCanvas(
"canvas",
"canvas",10,54,700,500);
37 canvas->Range(41,-4.051882,51,0.1891844);
38 canvas->SetFillColor(0);
39 canvas->SetBorderMode(0);
40 canvas->SetBorderSize(2);
42 canvas->SetFrameBorderMode(0);
43 canvas->SetFrameBorderMode(0);
45 TPaveStats *ptstats =
new TPaveStats(0.78,0.775,0.98,0.935,
"brNDC");
46 ptstats->SetName(
"stats");
47 ptstats->SetBorderSize(1);
48 ptstats->SetFillColor(0);
49 ptstats->SetTextAlign(12);
50 ptstats->SetTextFont(42);
51 TText *ptstats_LaTex = ptstats->AddText(
"pt_hist");
52 ptstats_LaTex->SetTextSize(0.0368);
53 ptstats_LaTex = ptstats->AddText(
"Entries = 23023 ");
54 ptstats_LaTex = ptstats->AddText(
"Mean = 44.05");
55 ptstats_LaTex = ptstats->AddText(
"s_{NN}=200 GeV");
56 ptstats_LaTex = ptstats->AddText(
"-0.3 < #eta < 0.7");
57 ptstats->SetOptStat(1111);
58 ptstats->SetOptFit(0);
60 pt_hist->GetListOfFunctions()->Add(ptstats);
61 ptstats->SetParent(pt_hist);
64 for (
int biny = 1; biny <= pt_hist->GetNbinsY(); ++biny) {
65 double binContenty = pt_hist->GetBinContent(biny);
66 double binWidthy = pt_hist->GetBinWidth(biny);
67 pt_hist->SetBinContent(biny, binContenty / binWidthy);
70 for (
int bin = 1; bin <= pt_hist->GetNbinsX(); ++bin) {
71 double binContent = pt_hist->GetBinContent(bin);
72 double binWidth = pt_hist->GetBinWidth(bin);
73 pt_hist->SetBinContent(bin, binContent / binWidth);
79 ci = TColor::GetColor(
"#000099");
80 pt_hist->SetLineColor(ci);
81 pt_hist->GetXaxis()->SetTitle(
"p_{T}");
82 pt_hist->GetXaxis()->SetLabelFont(42);
83 pt_hist->GetXaxis()->SetTitleOffset(1);
84 pt_hist->GetXaxis()->SetTitleFont(42);
85 pt_hist->GetYaxis()->SetTitle(
"N Jets (arbitrary units)");
86 pt_hist->GetYaxis()->SetLabelFont(42);
87 pt_hist->GetYaxis()->SetTitleFont(42);
88 pt_hist->GetZaxis()->SetLabelFont(42);
89 pt_hist->GetZaxis()->SetTitleOffset(1);
90 pt_hist->GetZaxis()->SetTitleFont(42);
91 pt_hist->Scale(1.0/pt_hist->Integral(
"width"));
94 TPaveLabel *
label =
new TPaveLabel(0.2, 0.5, 0.5, 0.6,
"s_{NN}=200GeV");
95 label->SetTextSize(0.04);
96 label->SetTextFont(42);
97 label->SetFillColor(0);
100 TPaveText *pt_textt =
new TPaveText(0.4742407,0.9366491,0.5257593,0.995,
"blNDC");
101 pt_textt->SetName(
"title");
102 pt_textt->SetBorderSize(0);
103 pt_textt->SetFillColor(0);
104 pt_textt->SetFillStyle(0);
106 pt_textt->SetTextFont(42);
107 TText *pt_LaTex = pt_textt->AddText(
"Jet Spectra R=0.4 [Simulation]");
108 pt_LaTex->SetTextSize(0.04);
109 pt_LaTex->SetTextFont(42);
113 canvas->SetSelected(canvas);
114 canvas->SaveAs(
"JetSpectra.pdf");