Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plot_sPHENIX_A_N_dp_BUP2020.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plot_sPHENIX_A_N_dp_BUP2020.C
1 //need to run make_ggg_contribution_graphs.C first
2 
3 #include <fstream>
4 #include <iostream>
5 #include "stdio.h"
6 
7 #include <TChain.h>
8 #include <TFile.h>
9 #include <TGraphAsymmErrors.h>
10 #include <TGraphErrors.h>
11 #include <TLatex.h>
12 #include <TLegend.h>
13 #include <TLine.h>
14 #include <TMath.h>
15 #include <TROOT.h>
16 #include <TString.h>
17 #include <TTree.h>
18 #include <TVectorD.h>
19 #include <TVirtualFitter.h>
20 #include <cassert>
21 #include <cmath>
22 #include <vector>
23 
24 #include "SaveCanvas.C"
25 #include "sPhenixStyle.C"
26 
27 const int NUM_PT_BINS = 4;
28 const float BIN_CENTERS[NUM_PT_BINS] = {5.39, 6.69, 8.77, 11.9};
29 const float ASYMMETRY[NUM_PT_BINS] =
30  {0, 0, 0, 0};
31 const float STAT_ERR[NUM_PT_BINS] =
32  {0.0010, 0.0013, 0.0025, 0.0035};
33 
34 //https://arxiv.org/abs/2002.08384
35 //https://arxiv.org/abs/1410.3448
36 const int NUM_QGQ_PT_BINS = 12;
37 const float PT[NUM_QGQ_PT_BINS] =
38  {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
39 const float QGQ[NUM_QGQ_PT_BINS] =
40  {-0.000500, -0.000434, -0.000339, -0.000213, -0.000054, 0.000137, 0.000357,
41  0.000603, 0.000874, 0.001166, 0.001477, 0.001804};
42 const float QGQ_ERR[NUM_QGQ_PT_BINS] =
43  {0.000077, 0.000070, 0.000072, 0.000079, 0.000091, 0.000113, 0.000146,
44  0.000191, 0.000250, 0.000321, 0.000405, 0.000501};
45 
46 const double pp_inelastic_crosssec = 42e-3; // 42 mb [sPH-TRG-000]
47 const double pp_rec_3year = 62e12; // BUP2020
48 const double pp_rec_5year = pp_rec_3year + 80e12; // BUP2020
49 const double pp_beam_pol = 0.57;
50 
51 TGraphErrors *GraphShiftScaling(TGraphErrors *gr_src, const double x_shift, const double err_scaling)
52 {
53  assert(gr_src);
54 
55  const int npoint = gr_src->GetN();
56 
57  TVectorD vx(npoint);
58  TVectorD vy(npoint);
59  TVectorD vex(npoint);
60  TVectorD vey(npoint);
61 
62  int nfilled = 0;
63  for (int i = 0; i < npoint; ++i)
64  {
65  const double &x = gr_src->GetX()[i];
66  // if (x<x_min or x>x_max) continue;
67 
68  vx[nfilled] = x + x_shift;
69  vy[nfilled] = gr_src->GetY()[i];
70  vex[nfilled] = gr_src->GetEX()[i];
71  vey[nfilled] = gr_src->GetEY()[i] * err_scaling;
72 
73  ++nfilled;
74  }
75 
76  TGraphErrors *gr = new TGraphErrors(nfilled, vx.GetMatrixArray(), vy.GetMatrixArray(),
77  vex.GetMatrixArray(), vey.GetMatrixArray());
78 
79  gr->SetMarkerColor(gr_src->GetMarkerColor());
80  gr->SetMarkerStyle(gr_src->GetMarkerStyle());
81  gr->SetMarkerSize(gr_src->GetMarkerSize());
82  gr->SetLineWidth(gr_src->GetLineWidth());
83  gr->SetLineColor(gr_src->GetLineColor());
84 
85  return gr;
86 }
87 
89 {
91 
92  const double ref_Lum = 100e12;
93  const double err_scale = sqrt(ref_Lum / pp_rec_3year);
94 
95  // TAxis *xAxis = frame->GetXaxis();
96  // xAxis->SetTitleSize(0.05);
97  // xAxis->SetLabelSize(0.055);
98  // xAxis->SetTitleOffset(1.2);
99  // TAxis *yAxis = frame->GetYaxis();
100  // yAxis->SetTitleSize(0.07);
101  // yAxis->SetLabelSize(0.055);
102  // yAxis->CenterTitle(true);
103  // yAxis->SetTitleOffset(0.8);
104  // yAxis->SetNdivisions(504); //310 );
105 
106  TGraphErrors *projectedMeasurement_ref =
107  new TGraphErrors(NUM_PT_BINS, BIN_CENTERS, ASYMMETRY, 0, STAT_ERR);
108 
109  TGraphErrors *projectedMeasurement =
110  GraphShiftScaling(projectedMeasurement_ref, 0, err_scale);
111  projectedMeasurement->SetMarkerStyle(kFullCircle);
112  projectedMeasurement->SetMarkerSize(2);
113  projectedMeasurement->SetLineWidth(4);
114  projectedMeasurement->SetLineColorAlpha(kBlack, 1);
115 
116  TF1 *zeroLine = new TF1("zeroLine", "0", 0, 20);
117  zeroLine->SetLineColor(kBlack);
118 // zeroLine->SetLineStyle(2);
119 
120  TFile *trigluonFile = TFile::Open("gggContribution.root");
121  //https://arxiv.org/abs/1112.1161
122  TGraphErrors *ggg1 = (TGraphErrors *) trigluonFile->Get("model1");
123  ggg1->SetFillStyle(3005);
124  ggg1->SetFillColor(kRed);
125  ggg1->SetLineColor(kWhite);
126  TGraphErrors *ggg2 = (TGraphErrors *) trigluonFile->Get("model2");
127  ggg2->SetFillStyle(3004);
128  ggg2->SetFillColor(kBlue);
129  ggg2->SetLineColor(kWhite);
130 
131  TGraphErrors *qgq = new TGraphErrors(NUM_QGQ_PT_BINS, PT, QGQ,
132  0, QGQ_ERR);
133  qgq->SetFillColor(kGreen + 3);
134  qgq->SetFillStyle(3003);
135  qgq->SetLineColor(kGreen + 2);
136  qgq->SetLineWidth(5);
137 
138  TCanvas *c1 = new TCanvas("AN_dp_sPHENIX", "AN_dp_sPHENIX", 1100, 800);
139  c1->Divide(1, 1);
140  int idx = 1;
141  TPad *p;
142 
143  p = (TPad *) c1->cd(idx++);
144  c1->Update();
145 
146  p->DrawFrame(4.69, -0.015, 12.6, 0.015)->SetTitle(";#it{p}_{T} [GeV];A_{N}");
147 
148  // TH1 *frame = new TH2F("frame", " ", 1, 4.69, 12.6, 1, -0.018, 0.015);
149  // frame->SetTitle("; p_{T} [GeV/c]; A_{N}");
150  // frame->SetStats(false);
151 
152  // TCanvas *c1 = new TCanvas("c11", "with QGQ", 200, 200, 800, 500);
153  // gPad->SetBottomMargin(0.15);
154  // gPad->SetLeftMargin(0.15);
155 
156  // frame->Draw("");
157  ggg1->Draw("3");
158  ggg2->Draw("3");
159  qgq->Draw("C3");
160  projectedMeasurement->Draw("P");
161  zeroLine->Draw("same");
162 
163  // TLatex text1;
164  // text1.SetTextSize(0.05);
165  // // text1.SetTextAlign( 13 );
166  // text1.DrawLatex(5, 0.012, "p^{#uparrow} + p #rightarrow #gamma + X");
167  // text1.DrawLatex(5.25, 0.0095, "#sqrt{s} = 200 GeV");
168  // text1.DrawLatex(10, 0.012, "sPHENIX:");
169  // text1.DrawLatex(10, 0.0095, "L=100/pb P=0.57");
170 
171  TLegend *leg = new TLegend(.2, .75, .83, .9);
172  leg->SetFillStyle(0);
173  // leg->AddEntry("", "#it{#bf{sPHENIX}} Projection", "");
174  leg->AddEntry("", Form("#it{#bf{sPHENIX}} Projection, Years 1-3"), "");
175  leg->AddEntry("", Form("%.0f pb^{-1} samp. #it{p}^{#uparrow}+#it{p}#rightarrow #gamma + X, P=%.2f", pp_rec_3year / 1e12, pp_beam_pol), "");
176  leg->Draw();
177 
178  leg = new TLegend(0.18, 0.18, 0.5, 0.41);
179  leg->AddEntry(qgq, "qgq Contribution (D.Pitonyak)", "l");
180  leg->AddEntry(ggg1, "Trigluon Contribution Model 1 (S.Yoshida)", "f");
181  leg->AddEntry(ggg2, "Trigluon Contribution Model 2 (S.Yoshida)", "f");
182 // leg->SetBorderSize(0);
183 // leg->SetTextSize(0.04);
184  leg->Draw();
185 
186  SaveCanvas(c1, TString(c1->GetName()), kTRUE);
187  c1->SaveAs("AN_dp_sPHENIX.pdf");
188 }