Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:10:54

0001 //need to run make_ggg_contribution_graphs.C first
0002 
0003 #include <fstream>
0004 #include <iostream>
0005 #include "stdio.h"
0006 
0007 #include <TChain.h>
0008 #include <TFile.h>
0009 #include <TGraphAsymmErrors.h>
0010 #include <TGraphErrors.h>
0011 #include <TLatex.h>
0012 #include <TLegend.h>
0013 #include <TLine.h>
0014 #include <TMath.h>
0015 #include <TROOT.h>
0016 #include <TString.h>
0017 #include <TTree.h>
0018 #include <TVectorD.h>
0019 #include <TVirtualFitter.h>
0020 #include <cassert>
0021 #include <cmath>
0022 #include <vector>
0023 
0024 #include "SaveCanvas.C"
0025 #include "sPhenixStyle.C"
0026 
0027 const int NUM_PT_BINS = 4;
0028 const float BIN_CENTERS[NUM_PT_BINS] = {5.39, 6.69, 8.77, 11.9};
0029 const float ASYMMETRY[NUM_PT_BINS] =
0030     {0, 0, 0, 0};
0031 const float STAT_ERR[NUM_PT_BINS] =
0032     {0.0010, 0.0013, 0.0025, 0.0035};
0033 
0034 //https://arxiv.org/abs/2002.08384
0035 //https://arxiv.org/abs/1410.3448
0036 const int NUM_QGQ_PT_BINS = 12;
0037 const float PT[NUM_QGQ_PT_BINS] =
0038     {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
0039 const float QGQ[NUM_QGQ_PT_BINS] =
0040     {-0.000500, -0.000434, -0.000339, -0.000213, -0.000054, 0.000137, 0.000357,
0041      0.000603, 0.000874, 0.001166, 0.001477, 0.001804};
0042 const float QGQ_ERR[NUM_QGQ_PT_BINS] =
0043     {0.000077, 0.000070, 0.000072, 0.000079, 0.000091, 0.000113, 0.000146,
0044      0.000191, 0.000250, 0.000321, 0.000405, 0.000501};
0045 
0046 const double pp_inelastic_crosssec = 42e-3;        // 42 mb [sPH-TRG-000]
0047 const double pp_rec_3year = 62e12;                 // BUP2020
0048 const double pp_rec_5year = pp_rec_3year + 80e12;  // BUP2020
0049 const double pp_beam_pol = 0.57;
0050 
0051 TGraphErrors *GraphShiftScaling(TGraphErrors *gr_src, const double x_shift, const double err_scaling)
0052 {
0053   assert(gr_src);
0054 
0055   const int npoint = gr_src->GetN();
0056 
0057   TVectorD vx(npoint);
0058   TVectorD vy(npoint);
0059   TVectorD vex(npoint);
0060   TVectorD vey(npoint);
0061 
0062   int nfilled = 0;
0063   for (int i = 0; i < npoint; ++i)
0064   {
0065     const double &x = gr_src->GetX()[i];
0066     //        if (x<x_min or x>x_max) continue;
0067 
0068     vx[nfilled] = x + x_shift;
0069     vy[nfilled] = gr_src->GetY()[i];
0070     vex[nfilled] = gr_src->GetEX()[i];
0071     vey[nfilled] = gr_src->GetEY()[i] * err_scaling;
0072 
0073     ++nfilled;
0074   }
0075 
0076   TGraphErrors *gr = new TGraphErrors(nfilled, vx.GetMatrixArray(), vy.GetMatrixArray(),
0077                                       vex.GetMatrixArray(), vey.GetMatrixArray());
0078 
0079   gr->SetMarkerColor(gr_src->GetMarkerColor());
0080   gr->SetMarkerStyle(gr_src->GetMarkerStyle());
0081   gr->SetMarkerSize(gr_src->GetMarkerSize());
0082   gr->SetLineWidth(gr_src->GetLineWidth());
0083   gr->SetLineColor(gr_src->GetLineColor());
0084 
0085   return gr;
0086 }
0087 
0088 void plot_sPHENIX_A_N_dp_BUP2020()
0089 {
0090   SetsPhenixStyle();
0091 
0092   const double ref_Lum = 100e12;
0093   const double err_scale = sqrt(ref_Lum / pp_rec_3year);
0094 
0095   //  TAxis *xAxis = frame->GetXaxis();
0096   //  xAxis->SetTitleSize(0.05);
0097   //  xAxis->SetLabelSize(0.055);
0098   //  xAxis->SetTitleOffset(1.2);
0099   //  TAxis *yAxis = frame->GetYaxis();
0100   //  yAxis->SetTitleSize(0.07);
0101   //  yAxis->SetLabelSize(0.055);
0102   //  yAxis->CenterTitle(true);
0103   //  yAxis->SetTitleOffset(0.8);
0104   //  yAxis->SetNdivisions(504);  //310 );
0105 
0106   TGraphErrors *projectedMeasurement_ref =
0107       new TGraphErrors(NUM_PT_BINS, BIN_CENTERS, ASYMMETRY, 0, STAT_ERR);
0108 
0109   TGraphErrors *projectedMeasurement =
0110       GraphShiftScaling(projectedMeasurement_ref, 0, err_scale);
0111   projectedMeasurement->SetMarkerStyle(kFullCircle);
0112   projectedMeasurement->SetMarkerSize(2);
0113   projectedMeasurement->SetLineWidth(4);
0114   projectedMeasurement->SetLineColorAlpha(kBlack, 1);
0115 
0116   TF1 *zeroLine = new TF1("zeroLine", "0", 0, 20);
0117   zeroLine->SetLineColor(kBlack);
0118 //  zeroLine->SetLineStyle(2);
0119 
0120   TFile *trigluonFile = TFile::Open("gggContribution.root");
0121   //https://arxiv.org/abs/1112.1161
0122   TGraphErrors *ggg1 = (TGraphErrors *) trigluonFile->Get("model1");
0123   ggg1->SetFillStyle(3005);
0124   ggg1->SetFillColor(kRed);
0125   ggg1->SetLineColor(kWhite);
0126   TGraphErrors *ggg2 = (TGraphErrors *) trigluonFile->Get("model2");
0127   ggg2->SetFillStyle(3004);
0128   ggg2->SetFillColor(kBlue);
0129   ggg2->SetLineColor(kWhite);
0130 
0131   TGraphErrors *qgq = new TGraphErrors(NUM_QGQ_PT_BINS, PT, QGQ,
0132                                        0, QGQ_ERR);
0133   qgq->SetFillColor(kGreen + 3);
0134   qgq->SetFillStyle(3003);
0135   qgq->SetLineColor(kGreen + 2);
0136   qgq->SetLineWidth(5);
0137 
0138   TCanvas *c1 = new TCanvas("AN_dp_sPHENIX", "AN_dp_sPHENIX", 1100, 800);
0139   c1->Divide(1, 1);
0140   int idx = 1;
0141   TPad *p;
0142 
0143   p = (TPad *) c1->cd(idx++);
0144   c1->Update();
0145 
0146   p->DrawFrame(4.69, -0.015, 12.6, 0.015)->SetTitle(";#it{p}_{T} [GeV];A_{N}");
0147 
0148   //  TH1 *frame = new TH2F("frame", " ", 1, 4.69, 12.6, 1, -0.018, 0.015);
0149   //  frame->SetTitle("; p_{T} [GeV/c]; A_{N}");
0150   //  frame->SetStats(false);
0151 
0152   //  TCanvas *c1 = new TCanvas("c11", "with QGQ", 200, 200, 800, 500);
0153   //  gPad->SetBottomMargin(0.15);
0154   //  gPad->SetLeftMargin(0.15);
0155 
0156   //  frame->Draw("");
0157   ggg1->Draw("3");
0158   ggg2->Draw("3");
0159   qgq->Draw("C3");
0160   projectedMeasurement->Draw("P");
0161   zeroLine->Draw("same");
0162 
0163   //  TLatex text1;
0164   //  text1.SetTextSize(0.05);
0165   //  //  text1.SetTextAlign( 13 );
0166   //  text1.DrawLatex(5, 0.012, "p^{#uparrow} + p #rightarrow #gamma + X");
0167   //  text1.DrawLatex(5.25, 0.0095, "#sqrt{s} = 200 GeV");
0168   //  text1.DrawLatex(10, 0.012, "sPHENIX:");
0169   //  text1.DrawLatex(10, 0.0095, "L=100/pb P=0.57");
0170 
0171   TLegend *leg = new TLegend(.2, .75, .83, .9);
0172   leg->SetFillStyle(0);
0173   //     leg->AddEntry("", "#it{#bf{sPHENIX}} Projection", "");
0174   leg->AddEntry("", Form("#it{#bf{sPHENIX}} Projection, Years 1-3"), "");
0175   leg->AddEntry("", Form("%.0f pb^{-1} samp. #it{p}^{#uparrow}+#it{p}#rightarrow #gamma + X, P=%.2f", pp_rec_3year / 1e12, pp_beam_pol), "");
0176   leg->Draw();
0177 
0178   leg = new TLegend(0.18, 0.18, 0.5, 0.41);
0179   leg->AddEntry(qgq, "qgq Contribution (D.Pitonyak)", "l");
0180   leg->AddEntry(ggg1, "Trigluon Contribution Model 1 (S.Yoshida)", "f");
0181   leg->AddEntry(ggg2, "Trigluon Contribution Model 2 (S.Yoshida)", "f");
0182 //  leg->SetBorderSize(0);
0183 //  leg->SetTextSize(0.04);
0184   leg->Draw();
0185 
0186   SaveCanvas(c1, TString(c1->GetName()), kTRUE);
0187     c1->SaveAs("AN_dp_sPHENIX.pdf");
0188 }