Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:56

0001 #include <stdio.h>
0002 #include "iomanip.h"
0003 
0004 void makeLcD0()
0005 {
0006   gROOT->Reset();
0007 
0008   const Int_t NConfig = 4;
0009   const Int_t NMax = 5;
0010   const Int_t N[NConfig] = {3, 5, 4, 1}; // ALICE_pp, ALICE_pPb, STAR_AuAu
0011   const Char_t *ExpName[NConfig] = {"STAR","ALICE","ALICE","ALICE"};
0012   const Char_t *CollName[NConfig] = {"AuAu_10_80_200GeV","pp_7TeV","pPb_5p02TeV","PbPb_5p02TeV"};
0013   double x[NConfig][NMax], y[NConfig][NMax], ye[NConfig][NMax], yes_u[NConfig][NMax], yes_d[NConfig][NMax];
0014   TGraphErrors *gr[NConfig];
0015 
0016   // STAR data points
0017   ifstream inData;
0018   for(int i=0;i<NConfig;i++) {
0019     inData.open(Form("dat/%s_LcD0_%s.txt",ExpName[i],CollName[i]));
0020     for(int j=0;j<N[i];j++) {
0021       inData >> x[i][j] >> y[i][j] >> ye[i][j] >> yes_u[i][j] >> yes_d[i][j];
0022     }
0023     inData.close();
0024     gr[i] = new TGraphErrors(N[i], x[i], y[i], 0, ye[i]);
0025     cout << Form("dat/%s_LcD0_%s.txt",ExpName[i],CollName[i]) << endl;
0026     gr[i]->Print();
0027   }
0028 
0029   // STAR Central data
0030   double x_St[1] = {3.96};
0031   double y_St[1] = {1.3935};
0032   double ye_St[1] = {0.3112};
0033   double yes_St[1] = {0.3446};
0034   TGraphErrors *gr_St = new TGraphErrors(1, x_St, y_St, 0, ye_St);
0035   gr_St->SetMarkerStyle(29);
0036   gr_St->SetMarkerSize(2.5);
0037   gr_St->SetMarkerColor(2);
0038   gr_St->SetLineWidth(2);
0039   gr_St->SetLineColor(2);
0040   
0041   // Theory calculations
0042   // pythia6
0043   TFile *fin = new TFile("root/pythia_D_ratio.root");
0044   TGraphErrors *gr_pythia_tmp = (TGraphErrors *)fin->Get("Ratio_Lc_D0");
0045   TGraph *gr_pythia = new TGraph(*gr_pythia_tmp);
0046   gr_pythia->SetLineWidth(2);
0047   gr_pythia->SetLineColor(16);
0048   // pythia8
0049   TFile *fin = new TFile("root/PYTHIA8_D_ratio_200GeV_20181029_0.root");
0050   TDirectoryFile *fLc = (TDirectoryFile *)fin->Get("Lc");
0051   TH1D *h_pythia8 = (TH1D *)fLc->Get("LctoD0_pt_whole_rebin");
0052   TGraph *gr_pythia8 = new TGraph(h_pythia8);
0053   gr_pythia8->SetLineWidth(2);
0054   gr_pythia8->SetLineColor(1);
0055   gr_pythia8->SetLineStyle(2);
0056 
0057   TFile *fin = new TFile("root/PYTHIA8_D_ratio_200GeV_20181029_CR.root");
0058   TDirectoryFile *fLc = (TDirectoryFile *)fin->Get("Lc");
0059   TH1D *h_pythia8_CR = (TH1D *)fLc->Get("LctoD0_pt_whole_rebin");
0060   TGraph *gr_pythia8_CR = new TGraph(h_pythia8_CR);
0061   gr_pythia8_CR->SetLineWidth(2);
0062   gr_pythia8_CR->SetLineColor(1);
0063   gr_pythia8_CR->SetLineStyle(4);
0064   
0065 
0066   TGraph *gr_pythia_7TeV = new TGraph("dat/PYTHIA_Lc_D0_pp_7TeV.txt","%lg %lg");
0067   TGraph *gr_pythia_7TeV_CR = new TGraph("dat/PYTHIACR_Lc_D0_pp_7TeV.txt","%lg %lg");
0068   TGraph *gr_Greco_LHC_1 = new TGraph("dat/Greco_LcD0_1_PbPb5p02TeV.txt","%lg %lg");
0069   TGraph *gr_Greco_LHC_2 = new TGraph("dat/Greco_LcD0_2_PbPb5p02TeV.txt","%lg %lg");
0070   TGraph *gr_ShaoSong_LHC_1 = new TGraph("dat/ShaoSong_LcD0_1_PbPb5p02TeV.txt","%lg %lg");
0071   TGraph *gr_ShaoSong_LHC_2 = new TGraph("dat/ShaoSong_LcD0_2_PbPb5p02TeV.txt","%lg %lg");
0072   /*
0073   const Int_t N_Greco = 14;
0074   Double_t pt_Greco[N_Greco], y_Greco[N_Greco], ye_Greco[N_Greco];
0075   inData.open("dat/LcD0_Greco_1407.5069.txt");
0076   for(int i=0;i<N_Greco;i++) {
0077     double a, b, c;
0078     inData >> a >> b >> c;
0079     pt_Greco[i] = a;
0080     y_Greco[i] = (b+c)/2.;
0081     ye_Greco[i] = fabs(b-c)/2.;
0082   }
0083   inData.close();
0084   TGraphErrors *gr_Greco = new TGraphErrors(N_Greco, pt_Greco, y_Greco, 0, ye_Greco);
0085   gr_Greco->SetFillColor(16);
0086   gr_Greco->SetLineColor(16);
0087   */
0088   TGraph *gr_Greco_1 = new TGraph("dat/Greco_LcD0_1_AuAu200GeV_0_20.dat","%lg %lg");
0089   gr_Greco_1->SetLineWidth(2);
0090   gr_Greco_1->SetLineStyle(2);
0091   gr_Greco_1->SetLineColor(4);
0092   TGraph *gr_Greco_2 = new TGraph("dat/Greco_LcD0_2_AuAu200GeV_0_20.dat","%lg %lg");
0093   gr_Greco_2->SetLineWidth(2);
0094   gr_Greco_2->SetLineStyle(4);
0095   gr_Greco_2->SetLineColor(4);
0096   TGraph *gr_Tsinghua_1 = new TGraph("dat/Tsinghua_LcD0_1_AuAu200GeV_10_80.txt","%lg %lg");
0097   gr_Tsinghua_1->SetLineWidth(2);
0098   gr_Tsinghua_1->SetLineStyle(2);
0099   gr_Tsinghua_1->SetLineColor(kGreen-6);
0100   TGraph *gr_Tsinghua_2 = new TGraph("dat/Tsinghua_LcD0_2_AuAu200GeV_10_80.txt","%lg %lg");
0101   gr_Tsinghua_2->SetLineWidth(2);
0102   gr_Tsinghua_2->SetLineStyle(4);
0103   gr_Tsinghua_2->SetLineColor(kGreen-6);
0104   
0105   
0106   const Int_t N_Ko = 12;
0107   Double_t pt_Ko[N_Ko], y1_Ko[N_Ko], y2_Ko[N_Ko], y3_Ko[N_Ko];
0108   inData.open("dat/LcD0_Ko_0901.1382.txt");
0109   for(int i=0;i<N_Ko;i++) {
0110     inData >> pt_Ko[i] >> y1_Ko[i] >> y2_Ko[i] >> y3_Ko[i];
0111   }
0112   inData.close();
0113   TGraph *gr_Ko_1 = new TGraph(N_Ko, pt_Ko, y1_Ko);
0114   gr_Ko_1->SetLineWidth(2);
0115   gr_Ko_1->SetLineColor(2);
0116   gr_Ko_1->SetLineStyle(3);
0117   TGraph *gr_Ko_2 = new TGraph(N_Ko, pt_Ko, y2_Ko);
0118   gr_Ko_2->SetLineWidth(2);
0119   gr_Ko_2->SetLineColor(2);
0120   gr_Ko_2->SetLineStyle(2);
0121   TGraph *gr_Ko_3 = new TGraph(N_Ko, pt_Ko, y3_Ko);
0122   gr_Ko_3->SetLineWidth(2);
0123   gr_Ko_3->SetLineColor(2);
0124   gr_Ko_3->SetLineStyle(4);
0125   // sPHENIX projection
0126   const Int_t N_sPH = 20;
0127   double pT_sPH[N_sPH], sig_sPH_noPID[N_sPH], sig_sPH_ideal[N_sPH];
0128   double r_sPH[N_sPH], r_err_sPH_noPID[N_sPH], r_err_sPH_ideal[N_sPH];
0129   double pT_sPH_noPID[N_sPH], pT_sPH_ideal[N_sPH];
0130   const Double_t offset = 0.06;
0131   //  TFile *fin = new TFile("signi_0_10.root");
0132   TFile *fin = new TFile("significance/signi_0.root");
0133   TH1D *h1 = (TH1D *)fin->Get("NoPID_signi");
0134   TH1D *h2 = (TH1D *)fin->Get("Cleanideal_signi");
0135   // cout<<" ok "<<endl;
0136   int n_sPH = 0;
0137   for(int i=0;i<h1->GetNbinsX();i++) {
0138     pT_sPH[i] = h1->GetBinCenter(i+1);
0139     sig_sPH_noPID[i] = h1->GetBinContent(i+1);
0140     sig_sPH_ideal[i] = h2->GetBinContent(i+1);
0141 
0142     pT_sPH_noPID[i] = pT_sPH[i]-offset;
0143     pT_sPH_ideal[i] = pT_sPH[i]+offset;
0144     r_sPH[i] = gr[0]->Eval(pT_sPH[i]);
0145     r_err_sPH_noPID[i] = r_sPH[i]/sig_sPH_noPID[i];
0146     r_err_sPH_ideal[i] = r_sPH[i]/sig_sPH_ideal[i];
0147     n_sPH++;
0148   }
0149   TGraphErrors *gr_sPH_noPID = new TGraphErrors(n_sPH, pT_sPH_noPID, r_sPH, 0, r_err_sPH_noPID);
0150   gr_sPH_noPID->SetMarkerStyle(24);
0151   // gr_sPH_noPID->SetMarkerSize(1.8);
0152   gr_sPH_noPID->SetMarkerSize(1.3);
0153   gr_sPH_noPID->SetMarkerColor(1);
0154   gr_sPH_noPID->SetLineColor(1);
0155   gr_sPH_noPID->SetLineWidth(2);
0156   TGraphErrors *gr_sPH_ideal = new TGraphErrors(n_sPH, pT_sPH_ideal, r_sPH, 0, r_err_sPH_ideal);
0157   gr_sPH_ideal->SetMarkerStyle(20);
0158   // gr_sPH_ideal->SetMarkerSize(1.8);
0159   gr_sPH_ideal->SetMarkerSize(1.3);
0160   gr_sPH_ideal->SetMarkerColor(1);
0161   gr_sPH_ideal->SetLineColor(1);
0162   gr_sPH_ideal->SetLineWidth(2);
0163 
0164 
0165   TCanvas *c1 = new TCanvas("c1", "c1",0,0,800,600);
0166   gStyle->SetOptFit(0);
0167   gStyle->SetOptStat(0);
0168   gStyle->SetEndErrorSize(0);
0169 
0170   c1->SetFillColor(10);
0171   c1->SetFillStyle(0);
0172   c1->SetBorderMode(0);
0173   c1->SetBorderSize(0);
0174   c1->SetFrameFillColor(10);
0175   c1->SetFrameFillStyle(0);
0176   c1->SetFrameBorderMode(0);
0177   c1->SetLeftMargin(0.11);
0178   c1->SetRightMargin(0.03);
0179   c1->SetTopMargin(0.03);
0180   c1->SetBottomMargin(0.14);
0181   //  c1->SetLogy();
0182   // c1->SetTickx();
0183   // c1->SetTicky();
0184   c1->Draw();
0185   c1->cd();
0186 
0187 
0188   double x1 = 0.01;
0189   double x2 = 8.99;
0190   double y1 = 0.001;
0191   double y2 = 4;
0192   TH1 *h0 = new TH1D("h0","",1,x1, x2);
0193   h0->SetMinimum(y1);
0194   h0->SetMaximum(y2);
0195   h0->GetXaxis()->SetNdivisions(208);
0196   h0->GetXaxis()->CenterTitle();
0197   h0->GetXaxis()->SetTitle("Transverse Momentum p_{T} (GeV/c)");
0198   h0->GetXaxis()->SetTitleOffset(0.95);
0199   h0->GetXaxis()->SetTitleSize(0.06);
0200   h0->GetXaxis()->SetLabelOffset(0.01);
0201   h0->GetXaxis()->SetLabelSize(0.045);
0202   h0->GetXaxis()->SetLabelFont(42);
0203   h0->GetXaxis()->SetTitleFont(42);
0204   h0->GetYaxis()->SetNdivisions(505);
0205   h0->GetYaxis()->SetTitle("(#Lambda_{c}^{+}+#bar{#Lambda_{c}}^{-})/(D^{0}+#bar{D}^{0})");
0206   h0->GetYaxis()->SetTitleOffset(0.8);
0207   h0->GetYaxis()->SetTitleSize(0.06);
0208   h0->GetYaxis()->SetLabelOffset(0.018);
0209   h0->GetYaxis()->SetLabelSize(0.045);
0210   h0->GetYaxis()->SetLabelFont(42);
0211   h0->GetYaxis()->SetTitleFont(42);
0212   h0->Draw("c");
0213 
0214   TLine *l1 = new TLine(x1,y1,x2,y1);
0215   l1->SetLineWidth(3);
0216   l1->Draw("same");
0217   TLine *l2 = new TLine(x1,y2,x2,y2);
0218   l2->SetLineWidth(3);
0219   l2->Draw("same");
0220   TLine *l3 = new TLine(x1,y1,x1,y2);
0221   l3->SetLineWidth(3);
0222   l3->Draw("same");
0223   TLine *l4 = new TLine(x2,y1,x2,y2);
0224   l4->SetLineWidth(3);
0225   l4->Draw("same");
0226 
0227 
0228   // gr_pythia->SetFillColor(16);
0229   // gr_pythia->SetLineWidth(2);
0230   // gr_pythia->SetLineStyle(2);
0231   // gr_pythia->SetLineColor(1);
0232   // gr_pythia->Draw("c");
0233 
0234   gr_pythia8->Draw("c");
0235   gr_pythia8_CR->Draw("c");
0236   
0237   gr_Greco_1->Draw("c");
0238   gr_Greco_2->Draw("c");
0239   //  gr_Ko_1->Draw("c");
0240   gr_Ko_2->Draw("c");
0241   gr_Ko_3->Draw("c"); // pythia
0242   gr_Tsinghua_1->Draw("c");
0243   gr_Tsinghua_2->Draw("c");
0244 
0245   
0246   TLine *la = new TLine(0.2, 0.24, 1.5, 0.24);
0247   la->SetLineWidth(5);
0248   la->SetLineColor(18);
0249   //  la->Draw("same");
0250 
0251   TLatex *tex = new TLatex(0.5, 0.26, "SHM");
0252   tex->SetTextFont(12);
0253   tex->SetTextSize(0.06);
0254   //  tex->Draw("same");
0255 
0256   /*
0257   // plotting the data points
0258   const Int_t kStyle[NConfig] = {20, 20, 24, 20};
0259   const Int_t kColor[NConfig] = {1, 2, 4, 1};
0260   const double xo = fabs(x2-x1)/80.;
0261   const double yo = fabs(y2-y1)/80.;
0262   for(int i=0;i<1;i++) {  // STAR
0263 
0264     for(int j=0;j<N[i];j++) { 
0265       double x1 = x[i][j] - xo;
0266       double x2 = x[i][j] + xo;
0267       double y1 = y[i][j] - yes_d[i][j];
0268       double y2 = y[i][j] + yes_u[i][j];
0269       
0270       TLine *la = new TLine(x1, y1, x1, y1+yo);
0271       la->SetLineColor(kColor[i]);
0272       la->SetLineWidth(1);
0273       la->Draw("same");
0274       TLine *lb = new TLine(x2, y1, x2, y1+yo);
0275       lb->SetLineColor(kColor[i]);
0276       lb->SetLineWidth(1);
0277       lb->Draw("same");
0278       TLine *lc = new TLine(x1, y2, x1, y2-yo);
0279       lc->SetLineColor(kColor[i]);
0280       lc->SetLineWidth(1);
0281       lc->Draw("same");
0282       TLine *ld = new TLine(x2, y2, x2, y2-yo);
0283       ld->SetLineColor(kColor[i]);
0284       ld->SetLineWidth(1);
0285       ld->Draw("same");
0286       TLine *le = new TLine(x1, y1, x2, y1);
0287       le->SetLineColor(kColor[i]);
0288       le->SetLineWidth(2);
0289       le->Draw("same");
0290       TLine *lf = new TLine(x1, y2, x2, y2);
0291       lf->SetLineColor(kColor[i]);
0292       lf->SetLineWidth(2);
0293       lf->Draw("same");
0294     }
0295     gr[i]->SetMarkerStyle(kStyle[i]);
0296     gr[i]->SetMarkerColor(kColor[i]);
0297     gr[i]->SetMarkerSize(1.8);
0298     gr[i]->SetLineColor(kColor[i]);
0299     gr[i]->SetLineWidth(2);
0300     gr[i]->Draw("p");
0301   }
0302   */
0303   gr_St->Draw("p");
0304   gr_sPH_noPID->Draw("p");
0305   gr_sPH_ideal->Draw("p");
0306 
0307   TLatex *tex = new TLatex(x1+0.2, y2*0.9, "Au+Au, #sqrt{s_{NN}}=200GeV");
0308   tex->SetTextFont(42);
0309   tex->SetTextSize(0.05);
0310   tex->Draw("same");
0311   TLatex *tex = new TLatex(x1+0.2, y2*0.9, "#sqrt{s_{NN}}=200GeV");
0312   tex->SetTextFont(42);
0313   tex->SetTextSize(0.055);
0314   //  tex->Draw("same");
0315   
0316 
0317   TLegend *leg = new TLegend(0.52, 0.82, 0.94, 0.94);
0318    leg->SetFillColor(10);
0319    leg->SetFillStyle(10);
0320    leg->SetLineStyle(4000);
0321    leg->SetLineColor(10);
0322    leg->SetLineWidth(0.);
0323    leg->SetTextFont(42);
0324    leg->SetTextSize(0.035);
0325    leg->AddEntry(gr_sPH_ideal, "sPHENIX proj: ideal TOF, 0-10%", "pl");
0326    leg->AddEntry(gr_sPH_noPID, "sPHENIX proj: noPID, 0-10%", "pl");
0327    leg->AddEntry(gr_St, "STAR prel., 0-20%", "pl");
0328    leg->Draw();
0329 
0330    TLegend *leg = new TLegend(0.56, 0.64, 0.94, 0.8);
0331    leg->SetFillColor(10);
0332    leg->SetFillStyle(10);
0333    leg->SetLineStyle(4000);
0334    leg->SetLineColor(10);
0335    leg->SetLineWidth(0.);
0336    leg->SetTextFont(42);
0337    leg->SetTextSize(0.035);
0338    leg->AddEntry(gr_Tsinghua_2,"Tsinghua: seq. coal, 10-80%","l");
0339    leg->AddEntry(gr_Tsinghua_1,"Tsinghua: simul. coal, 10-80%","l");
0340    leg->AddEntry(gr_Greco_2,"Catania: coal only, 0-20%","l");
0341    leg->AddEntry(gr_Greco_1,"Catania: coal+frag, 0-20%","l");
0342    leg->Draw();
0343 
0344    TLegend *leg = new TLegend(0.68, 0.48, 0.94, 0.64);
0345    leg->SetFillColor(10);
0346    leg->SetFillStyle(10);
0347    leg->SetLineStyle(4000);
0348    leg->SetLineColor(10);
0349    leg->SetLineWidth(0.);
0350    leg->SetTextFont(42);
0351    leg->SetTextSize(0.035);
0352    leg->AddEntry(gr_Ko_3,"TAMU: di-quark 0-5%","l");
0353    leg->AddEntry(gr_Ko_2,"TAMU: 3-quark 0-5%","l");   
0354    leg->AddEntry(gr_pythia8_CR,"PYTHIA8 (CR)","l");   
0355    leg->AddEntry(gr_pythia8,"PYTHIA8 (Monash)","l");   
0356    leg->Draw();
0357 
0358    c1->Update();
0359      
0360   c1->SaveAs("fig/LcD0_proj_0_10_24B.pdf");
0361   c1->SaveAs("fig/LcD0_proj_0_10_24B.png");
0362   
0363   
0364 }