void draw_cross_pt(bool sysByHand=false, bool noPtWeight=false, bool isScale=true, bool isLog=true, int isPA = 1, bool isPrompt=true) { gROOT->Macro("./tdrstyle_kyo.C"); gStyle->SetTitleYOffset(1.38); //KYO //int iPos=0.;//outOfFrame int iPos=33;//right corner //int iPos=11;//left corner //// pileup rejection!! Double_t pileReg; if (isPA==0) pileReg = 1; else pileReg = 128234./123240.; //const Double_t pileRegRelErr = 0.23; //// zvtx correction!! //const Double_t zvtxCor = 1.064; // not used anymore!! //// BR and lumi info. const Double_t br = 0.0593 ; const Double_t brErr = 0.0006; const Double_t pp_lumi_pb =27.972; // 28.0/pb const Double_t pp_lumi_pb_err = 0.643; // 2.3 % const Double_t pPb_lumi_nb = 34.622; // 34.6/nb const Double_t pPb_lumi_nb_err = 1.211; // 3.5 % Double_t lumi_mub; Double_t lumi_mub_err; if (isPA==0) { lumi_mub = pp_lumi_pb *1000*1000; lumi_mub_err = pp_lumi_pb_err *1000*1000; } else if (isPA==1) { lumi_mub = pPb_lumi_nb * 1000; lumi_mub_err = pPb_lumi_nb_err * 1000; } else { cout << "select among isPA = 0 or 1"<< endl; return ; } cout << "isPA = " << isPA << ", and lumi_mub = " << lumi_mub <<"+-" <<lumi_mub_err << endl; cout << " *** pileReg = " << pileReg << endl; ///////////////////////////////////////////////////////////////////////// //// bin center & systematic uncertainties by hand const int nRap = 8; const int nPt = 9; const int nRapTmp = nRap + 1; const int nPtTmp = nPt + 1; const int nRapRFB = 3; const int nPtRFB = 3; Double_t pxtmp[nRap][nPt]; //x point to fill remporarily Double_t pytmp[nRap][nPt]; //y point to fill remporarily Double_t eytmp[nRap][nPt]; //y point error to fill remporarily Double_t px[nRap][nPt]; /* Double_t px_pp[nRap][nPt] = { //x point (mean pT) by JB -- from FW to BW {2.54567, 3.50886, 4.48508, 5.69331, 6.97532, 7.97107, 9.17601, 11.5322, 17.4867}, {0, 0, 4.54938, 5.75633, 6.9727, 7.97359, 9.17558, 11.4729, 17.4391}, {0, 0, 0, 0, 7.0061, 7.97991, 9.19355, 11.5729, 17.6818}, {0, 0, 0, 0, 7.08557, 8.01392, 9.2137, 11.6042, 17.9741}, {0, 0, 0, 0, 7.08944, 8.01343, 9.21616, 11.6091, 17.7608}, {0, 0, 0, 0, 7.00408, 7.98632, 9.19122, 11.5535, 17.7004}, {0, 0, 4.54198, 5.76465, 6.97492, 7.96787, 9.18318, 11.5223, 17.4279}, {2.54164, 3.5085, 4.48298, 5.69705, 6.97263, 7.97372, 9.17313, 11.5032, 17.3023} }; Double_t px_pA[nRap][nPt] = { //x point (mean pT) by JB -- from FW to BW {2.525, 3.51255, 4.4772, 5.70327, 6.96635, 7.96061, 9.17243, 11.5938, 18.0681}, {0, 0, 4.52793, 5.74033, 6.97622, 7.98335, 9.19458, 11.4927, 17.6693}, {0, 0, 0, 0, 7.018, 8.00224, 9.19714, 11.5483, 17.6577}, {0, 0, 0, 0, 7.11111, 8.02103, 9.24485, 11.6204, 17.8454}, {0, 0, 0, 0, 7.05329, 8.00998, 9.20583, 11.5222, 17.4633}, {0, 0, 0, 5.84477, 6.98466, 7.97917, 9.17551, 11.5322, 17.34}, {0, 0, 4.52204, 5.72881, 6.97074, 7.95284, 9.14157, 11.4976, 17.3058}, {2.51699, 3.4959, 4.47636, 5.68624, 6.97338, 7.97824, 9.1805, 11.4841, 16.8762} }; */ //// for middle Double_t px_pp[nRap][nPt] = { {2.5, 3.5, 4.5, 5.75, 7, 8, 9.25, 12., 22}, {0., 0., 4.5, 5.75, 7, 8, 9.25, 12., 22}, {0., 0., 0., 0., 7, 8, 9.25, 12., 22}, {0., 0., 0., 0., 7, 8, 9.25, 12., 22}, {0., 0., 0., 0., 7, 8, 9.25, 12., 22}, {0., 0., 0., 0., 7, 8, 9.25, 12., 22}, {0., 0., 4.5, 5.75, 7, 8, 9.25, 12., 22}, {2.5, 3.5, 4.5, 5.75, 7, 8, 9.25, 12., 22} }; Double_t px_pA[nRap][nPt] = { {2.5, 3.5, 4.5, 5.75, 7, 8, 9.25, 12., 22}, {0., 0., 4.5, 5.75, 7, 8, 9.25, 12., 22}, {0., 0., 0., 0., 7, 8, 9.25, 12., 22}, {0., 0., 0., 0., 7, 8, 9.25, 12., 22}, {0., 0., 0., 0., 7, 8, 9.25, 12., 22}, {0., 0., 0., 5.75, 7, 8, 9.25, 12., 22}, {0., 0., 4.5, 5.75, 7, 8, 9.25, 12., 22}, {2.5, 3.5, 4.5, 5.75, 7, 8, 9.25, 12., 22} }; Double_t ex[nPt] = {0,0,0,0,0,0,0,0,0}; // x stat error Double_t exlow[nRap][nPt]; // x binWidth Double_t exhigh[nRap][nPt]; // x binWidth Double_t exsys[nPt] = {0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4}; // x sys error Double_t eysysrel[nRap][nPt]; //relative y sys error Double_t eysys[nRap][nPt]; //absolute y sys error for (Int_t iy=0; iy<nRap; iy++) { for (Int_t ipt=0; ipt<nPt; ipt++) { if (isPA==0) { px[iy][ipt] = px_pp[iy][ipt]; } else { px[iy][ipt] = px_pA[iy][ipt]; } } } //// scaling for drawing double scaleF[nRap]; double scaleF_pp[nRap] = {1000., 100., 10., 1., 1., 10., 100., 1000.}; double scaleF_pA[nRap] = {100., 10., 1., 1., 10., 100., 1000., 10000.}; for (int iy=0; iy<nRap; iy++){ if (isPA==0) {scaleF[iy] = scaleF_pp[iy]; } else {scaleF[iy] = scaleF_pA[iy]; } if (!isScale) { scaleF[iy] = 1.; }; cout << "scaleF["<<iy<<"] = " << scaleF[iy] << endl; } //// 1) y_CM array (from forward to backward) Double_t rapArrNumFB_pA[nRapTmp] = {1.93, 1.5, 0.9, 0., -0.9, -1.5, -1.93, -2.4, -2.87};// for pt dist. //Double_t rapArrNumBF_pA[nRapTmp] = {-2.87, -2.4, -1.93, -1.5, -0.9, 0., 0.9, 1.5, 1.93};// for rap dist. Double_t rapArrNumFB_pp[nRapTmp] = {2.4, 1.93, 1.5, 0.9, 0., -0.9, -1.5, -1.93, -2.4};// for pt dist. //Double_t rapArrNumBF_pp[nRapTmp] = {-2.4, -1.93, -1.5, -0.9, 0., 0.9, 1.5, 1.93, 2.4};// for rap dist. Double_t rapArrNumFB[nRapTmp]; for (Int_t iy=0; iy<nRapTmp; iy++) { if (isPA==0) { rapArrNumFB[iy] = rapArrNumFB_pp[iy]; } else { rapArrNumFB[iy] = rapArrNumFB_pA[iy]; } } Double_t rapBinW[nRap]; for (Int_t iy=0; iy<nRap; iy++) { rapBinW[iy] = rapArrNumFB[iy]-rapArrNumFB[iy+1]; //rapBinW[iy] = rapArrNumBF[iy+1]-rapArrNumBF[iy]; } //// 2) pt array Double_t ptArrNum[nPtTmp] = {2.0, 3.0, 4.0, 5.0, 6.5, 7.5, 8.5, 10., 14., 30.}; Double_t ptBinW[nPt]; for (Int_t ipt=0; ipt<nPt; ipt++) { ptBinW[ipt] = ptArrNum[ipt+1]-ptArrNum[ipt]; } //// array string TString rapArr[nRap]; for (Int_t iy=0; iy<nRap; iy++) { formRapArr(rapArrNumFB[iy+1], rapArrNumFB[iy], &rapArr[iy]); cout << iy <<"th rapArr = " << rapArr[iy] << endl; } TString ptArr[nPt]; for (Int_t ipt=0; ipt<nPt; ipt++) { formPtArr(ptArrNum[ipt], ptArrNum[ipt+1], &ptArr[ipt]); cout << ipt <<"th ptArr = " << ptArr[ipt] << endl; } //// ex calculation for (Int_t iy=0; iy<nRap; iy++) { for (Int_t ipt=0; ipt<nPt; ipt++) { exlow[iy][ipt] = px[iy][ipt]-ptArrNum[ipt]; exhigh[iy][ipt] = ptArrNum[ipt+1]-px[iy][ipt]; } } ////////////////////////////////////////////////////////////// //// read-in sys. file TFile * fSys; if (isPA==0) fSys = new TFile("../TotalSys/TotSys_8rap9pt_pp_etOpt0.root"); else fSys = new TFile("../TotalSys/TotSys_8rap9pt_pA_etOpt0.root"); TH2D* h2D_SysErr; if (isPrompt) h2D_SysErr = (TH2D*)fSys->Get("hTotalPR"); else h2D_SysErr = (TH2D*)fSys->Get("hTotalNP"); ////////////////////////////////////////////////////////////// //// read-in corr-yield file TFile * f2D; if (isPA==0) { if (noPtWeight) f2D = new TFile("../FittingResult/totalHist_pp_8rap9pt_newcut_nominal_Zvtx0_SF1_etOpt0_noPtWeight.root"); else f2D = new TFile("../FittingResult/totalHist_pp_8rap9pt_newcut_nominal_Zvtx0_SF1_etOpt0.root"); } else { if (noPtWeight) f2D = new TFile("../FittingResult/totalHist_pA_8rap9pt_newcut_nominal_Zvtx1_SF1_etOpt0_noPtWeight.root"); else f2D = new TFile("../FittingResult/totalHist_pA_8rap9pt_newcut_nominal_Zvtx1_SF1_etOpt0.root"); } //// read-in 2D hist for corrected yield TH2D* h2D_CorrY; if (isPA==0) { if (isPrompt) h2D_CorrY = (TH2D*)f2D->Get("h2D_CorrY_PR_pp"); else h2D_CorrY = (TH2D*)f2D->Get("h2D_CorrY_NP_pp"); } else { if (isPrompt) h2D_CorrY = (TH2D*)f2D->Get("h2D_CorrY_PR_pA"); else h2D_CorrY = (TH2D*)f2D->Get("h2D_CorrY_NP_pA"); } const int nbinsX = h2D_CorrY->GetNbinsX(); const int nbinsY = h2D_CorrY->GetNbinsY(); if (nbinsX != nRap) { cout << " *** Error!!! nbinsX != nRap"; return; }; if (nbinsY != nPt) { cout << " *** Error!!! nbinsY != nPt"; return; }; //// projection to 1D hist : iy=0 refers to forwards !!! (ordering here) TH1D* h1D_CorrY[nRap]; TH1D* h1D_SysErr[nRap]; for (Int_t iy = 0; iy < nRap; iy++) { if ( isPA==0) { h1D_CorrY[iy] = h2D_CorrY->ProjectionY(Form("h1D_CorrY_%d",iy),nRap-iy,nRap-iy); h1D_SysErr[iy] = h2D_SysErr->ProjectionY(Form("h1D_SysErr_%d",iy),nRap-iy,nRap-iy); } else { h1D_CorrY[iy] = h2D_CorrY->ProjectionY(Form("h1D_CorrY_%d",iy),iy+1,iy+1); h1D_SysErr[iy] = h2D_SysErr->ProjectionY(Form("h1D_SysErr_%d",iy),iy+1,iy+1); } } //// read sys values from hist for (Int_t iy = 0; iy < nRap; iy++) { for (int ipt=0; ipt <nPt; ipt ++ ){ eysysrel[iy][ipt] = h1D_SysErr[iy]->GetBinContent(ipt+1); } } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// //// calcualte cross-section = corrY/(dPt*dY*lumi) TH1D* h1D_cross[nRap]; for (Int_t iy = 0; iy < nRap; iy++) { h1D_cross[iy] = (TH1D*)h1D_CorrY[iy]->Clone(Form("h1D_cross_%d",iy)); //// normalization h1D_cross[iy]->Scale(1,"width"); //pT bin h1D_cross[iy]->Scale(1./rapBinW[iy]); //rap bin h1D_cross[iy]->Scale(1./lumi_mub); // lumi // h1D_cross[iy]->Scale(1./br); //br h1D_cross[iy]->Scale(pileReg); // pileup correction h1D_cross[iy]->Scale(scaleF[iy]); // scaling for drawing } //// set values as zero for unused bins for (Int_t iy = 0; iy < nRap; iy++) { if (iy>=1 && iy<=6) { h1D_cross[iy]->SetBinContent(1,-532); h1D_cross[iy]->SetBinError(1,0); h1D_cross[iy]->SetBinContent(2,-532); h1D_cross[iy]->SetBinError(2,0); exlow[iy][0]=0; exhigh[iy][0]=0; exlow[iy][1]=0; exhigh[iy][1]=0; } if (iy>=2 && iy<=5) { h1D_cross[iy]->SetBinContent(3,-532); h1D_cross[iy]->SetBinError(3,0); exlow[iy][2]=0; exhigh[iy][2]=0; } if (isPA==0) { if (iy>=2 && iy<=5) { h1D_cross[iy]->SetBinContent(4,-532); h1D_cross[iy]->SetBinError(4,0); exlow[iy][3]=0; exhigh[iy][3]=0; } } else { if (iy>=2 && iy<=4) { h1D_cross[iy]->SetBinContent(4,-532); h1D_cross[iy]->SetBinError(4,0); exlow[iy][3]=0; exhigh[iy][3]=0; } } } ////////////////////////////////////////////////////////////////// TLegend *legBLFW; TLegend *legBLBW; if (isPA==0) { //legBLFW = new TLegend(0.19, 0.160, 0.46, 0.320); //legBLBW = new TLegend(0.19, 0.160, 0.46, 0.320); legBLFW = new TLegend(0.19, 0.160, 0.46, 0.160+0.035*4+0.035*1.2); legBLBW = new TLegend(0.19, 0.160, 0.46, 0.160+0.035*4+0.035*1.2); } else { legBLFW = new TLegend(0.19, 0.160, 0.46, 0.160+0.035*3+0.035*1.2); legBLBW = new TLegend(0.19, 0.160, 0.46, 0.160+0.035*5+0.035*1.2); } SetLegendStyle(legBLFW); SetLegendStyle(legBLBW); //legBLFW->SetTextSize(0.034); //legBLBW->SetTextSize(0.034); TLatex* globtex = new TLatex(); globtex->SetNDC(); //globtex->SetTextAlign(12); //1:left, 2:vertical center globtex->SetTextAlign(32); //3:right 2:vertical center globtex->SetTextFont(42); globtex->SetTextSize(0.04); ////////////////////////////////////////////////////////////////////////////////////// //// convert to TGraphAsymErrors TGraphAsymmErrors* g_cross_sys[nRap]; TGraphAsymmErrors* g_cross[nRap]; for (Int_t iy = 0; iy < nRap; iy++) { g_cross_sys[iy] = new TGraphAsymmErrors(h1D_cross[iy]); g_cross[iy] = new TGraphAsymmErrors(h1D_cross[iy]); g_cross_sys[iy]->SetName(Form("g_cross_sys_%d",iy)); g_cross[iy]->SetName(Form("g_cross_%d",iy)); cout << "::: for excel ::: iy= " << iy << endl; for (Int_t ipt=0; ipt<nPt; ipt++ ){ g_cross_sys[iy]->GetPoint(ipt, pxtmp[iy][ipt], pytmp[iy][ipt]); g_cross_sys[iy]->SetPoint(ipt, px[iy][ipt], pytmp[iy][ipt]); //// absolute error calculation eysys[iy][ipt]=eysysrel[iy][ipt]*pytmp[iy][ipt]; //g_cross_sys[iy]->SetPointError(ipt, exsys[ipt], exsys[ipt], eysys[iy][ipt], eysys[iy][ipt]); g_cross_sys[iy]->SetPointError(ipt, exlow[iy][ipt], exhigh[iy][ipt], eysys[iy][ipt], eysys[iy][ipt]); g_cross[iy]->GetPoint(ipt, pxtmp[iy][ipt], pytmp[iy][ipt]); eytmp[iy][ipt] = g_cross[iy]-> GetErrorY(ipt); g_cross[iy]->SetPoint(ipt, px[iy][ipt], pytmp[iy][ipt]); g_cross[iy]->SetPointEXlow(ipt, ex[ipt]); g_cross[iy]->SetPointEXhigh(ipt, ex[ipt]); //cout << "" << endl; //cout << "cross["<<iy<<"]["<<ipt<<"] = " << pytmp[iy][ipt]<<endl; //cout << "stat.["<<iy<<"]["<<ipt<<"] = " << eytmp[iy][ipt]<<endl; //cout << "sys.["<<iy<<"]["<<ipt<<"] = " << eysys[iy][ipt]<<endl; cout << pytmp[iy][ipt] <<"\t"<<eytmp[iy][ipt] << "\t "<<eysys[iy][ipt]<<endl; } } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// //// Draw ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// int fw_init_pp = 0, fw_init_pA = 0; int bw_init_pp = 4, bw_init_pA = 3; int fw_init, bw_init; if (isPA==0) { fw_init=fw_init_pp; bw_init=bw_init_pp; } else { fw_init=fw_init_pA; bw_init=bw_init_pA; } for (Int_t iy = 0; iy < nRap; iy++) { g_cross_sys[iy]->GetXaxis()->SetTitle("p_{T} (GeV/c)"); g_cross_sys[iy]->GetXaxis()->CenterTitle(""); g_cross_sys[iy]->GetYaxis()->SetTitle("B d^{2}#sigma/dp_{T}dy (#mub/ GeV/c)"); g_cross_sys[iy]->GetYaxis()->CenterTitle(""); if (isLog) { if (isPA==0) { g_cross_sys[iy]->SetMinimum(0.0000001); g_cross_sys[iy]->SetMaximum(1000.); } else { g_cross_sys[iy]->SetMinimum(0.00001); //g_cross_sys[iy]->SetMaximum(1000000.); g_cross_sys[iy]->SetMaximum(500000.); } } else { g_cross_sys[iy]->SetMinimum(0.0); if (isPA==0) { if (isPrompt) g_cross_sys[iy]->SetMaximum(0.16); else g_cross_sys[iy]->SetMaximum(0.016); } else { if (isPrompt) g_cross_sys[iy]->SetMaximum(20); else g_cross_sys[iy]->SetMaximum(2); } } //g_cross_sys[iy]->GetXaxis()->SetLimits(0.0, 20.); g_cross_sys[iy]->GetXaxis()->SetLimits(0.0, 32.); } //// different color scheme for pp and pA if (isPA==0) { g_cross_sys[0]->SetFillColorAlpha(kMagenta-10,0.5); g_cross_sys[1]->SetFillColorAlpha(kGreen-10,0.5); g_cross_sys[2]->SetFillColorAlpha(kBlue-10,0.5); g_cross_sys[3]->SetFillColorAlpha(kRed-10,0.5); g_cross_sys[4]->SetFillColorAlpha(kRed-10,0.5); g_cross_sys[5]->SetFillColorAlpha(kBlue-10,0.5); g_cross_sys[6]->SetFillColorAlpha(kGreen-10,0.5); g_cross_sys[7]->SetFillColorAlpha(kMagenta-10,0.5); g_cross_sys[0]->SetLineColor(kViolet-6); g_cross_sys[1]->SetLineColor(kGreen+3); g_cross_sys[2]->SetLineColor(kBlue-2); g_cross_sys[3]->SetLineColor(kPink-6); g_cross_sys[4]->SetLineColor(kPink-6); g_cross_sys[5]->SetLineColor(kBlue-2); g_cross_sys[6]->SetLineColor(kGreen+3); g_cross_sys[7]->SetLineColor(kViolet-6); SetGraphStyleFinal(g_cross[0], 8,6); g_cross[0]->SetMarkerSize(1.4); SetGraphStyleFinal(g_cross[1], 0,5); g_cross[1]->SetMarkerSize(2.1); SetGraphStyleFinal(g_cross[2], 2,3); g_cross[2]->SetMarkerSize(1.4); SetGraphStyleFinal(g_cross[3], 1,0); g_cross[3]->SetMarkerSize(1.4); SetGraphStyleFinal(g_cross[4], 1,0); g_cross[4]->SetMarkerSize(1.4); SetGraphStyleFinal(g_cross[5], 2,3); g_cross[5]->SetMarkerSize(1.4); SetGraphStyleFinal(g_cross[6], 0,5); g_cross[6]->SetMarkerSize(2.1); SetGraphStyleFinal(g_cross[7], 8,6); g_cross[7]->SetMarkerSize(1.4); } else { g_cross_sys[0]->SetFillColorAlpha(kGreen-10,0.5); g_cross_sys[1]->SetFillColorAlpha(kBlue-10,0.5); g_cross_sys[2]->SetFillColorAlpha(kRed-10,0.5); g_cross_sys[3]->SetFillColorAlpha(kRed-10,0.5); g_cross_sys[4]->SetFillColorAlpha(kBlue-10,0.5); g_cross_sys[5]->SetFillColorAlpha(kGreen-10,0.5); g_cross_sys[6]->SetFillColorAlpha(kMagenta-10,0.5); g_cross_sys[7]->SetFillColorAlpha(kGray+1,0.5); g_cross_sys[0]->SetLineColor(kGreen+3); g_cross_sys[1]->SetLineColor(kBlue-2); g_cross_sys[2]->SetLineColor(kPink-6); g_cross_sys[3]->SetLineColor(kPink-6); g_cross_sys[4]->SetLineColor(kBlue-2); g_cross_sys[5]->SetLineColor(kGreen+3); g_cross_sys[6]->SetLineColor(kViolet-6); g_cross_sys[7]->SetLineColor(kBlack); SetGraphStyleFinal(g_cross[0], 0,5); g_cross[0]->SetMarkerSize(2.1); SetGraphStyleFinal(g_cross[1], 2,3); g_cross[1]->SetMarkerSize(1.4); SetGraphStyleFinal(g_cross[2], 1,0); g_cross[2]->SetMarkerSize(1.4); SetGraphStyleFinal(g_cross[3], 1,0); g_cross[3]->SetMarkerSize(1.4); SetGraphStyleFinal(g_cross[4], 2,3); g_cross[4]->SetMarkerSize(1.4); SetGraphStyleFinal(g_cross[5], 0,5); g_cross[5]->SetMarkerSize(2.1); SetGraphStyleFinal(g_cross[6], 8,6); g_cross[6]->SetMarkerSize(1.4); SetGraphStyleFinal(g_cross[7], 9,4); g_cross[7]->SetMarkerSize(2.1); } //////// Forward TCanvas* c_fw = new TCanvas("c_fw","c_fw",200,10,600,600); c_fw->cd(); if (isLog) gPad->SetLogy(1); else gPad->SetLogy(0); //// 1) cross_sys for (Int_t iy = fw_init; iy < bw_init; iy++) { if (iy==fw_init) g_cross_sys[iy]->Draw("A5"); else g_cross_sys[iy]->Draw("5"); } //// 2) cross for (Int_t iy = fw_init; iy < bw_init; iy++) { g_cross[iy]->Draw("P"); } //// leg legBLFW->SetTextSize(0.032*1.2); legBLFW -> SetHeader("Forward rapidity"); legBLFW->SetTextSize(0.032); for (Int_t iy = fw_init; iy < bw_init; iy++) { if (isScale && scaleF[bw_init-iy-1]!=1.) legBLFW -> AddEntry(g_cross[bw_init-iy-1],Form("%s (x%.0f)",rapArr[bw_init-iy-1].Data(),scaleF[bw_init-iy-1]),"lp"); else legBLFW -> AddEntry(g_cross[bw_init-iy-1],Form("%s",rapArr[bw_init-iy-1].Data()),"lp"); //if (isScale && scaleF[iy]!=1.) legBLFW -> AddEntry(g_cross[iy],Form("%s (x%.0f)",rapArr[iy].Data(),scaleF[iy]),"lp"); //else legBLFW -> AddEntry(g_cross[iy],Form("%s",rapArr[iy].Data()),"lp"); } if (isLog) legBLFW->Draw(); globtex->SetTextSize(0.048); globtex->SetTextFont(42); if (isPrompt) globtex->DrawLatex(0.92, 0.77, "Prompt J/#psi"); else globtex->DrawLatex(0.92, 0.77, "Nonprompt J/#psi"); // globtex->SetTextSize(0.035); // globtex->SetTextFont(42); // if (isPA==0) globtex->DrawLatex(0.91, 0.80, "Global uncertainty : 4 \%"); // else globtex->DrawLatex(0.91, 0.80, "Global uncertainty : 3.5 \%"); CMS_lumi( c_fw, isPA, iPos ); c_fw->Update(); if (isPA==0){ if (noPtWeight) { c_fw->SaveAs(Form("plot_cross/pp_fw_cross_pt_isPrompt%d_isLog%d_isScale%d_noPtWeight.pdf",(int)isPrompt,(int)isLog,(int)isScale)); c_fw->SaveAs(Form("plot_cross/pp_fw_cross_pt_isPrompt%d_isLog%d_isScale%d_noPtWeight.png",(int)isPrompt,(int)isLog,(int)isScale)); } else { c_fw->SaveAs(Form("plot_cross/pp_fw_cross_pt_isPrompt%d_isLog%d_isScale%d.pdf",(int)isPrompt,(int)isLog,(int)isScale)); c_fw->SaveAs(Form("plot_cross/pp_fw_cross_pt_isPrompt%d_isLog%d_isScale%d.png",(int)isPrompt,(int)isLog,(int)isScale)); } } else { if (noPtWeight) { c_fw->SaveAs(Form("plot_cross/pA_fw_cross_pt_isPrompt%d_isLog%d_isScale%d_noPtWeight.pdf",(int)isPrompt,(int)isLog,(int)isScale)); c_fw->SaveAs(Form("plot_cross/pA_fw_cross_pt_isPrompt%d_isLog%d_isScale%d_noPtWeight.png",(int)isPrompt,(int)isLog,(int)isScale)); } else { c_fw->SaveAs(Form("plot_cross/pA_fw_cross_pt_isPrompt%d_isLog%d_isScale%d.pdf",(int)isPrompt,(int)isLog,(int)isScale)); c_fw->SaveAs(Form("plot_cross/pA_fw_cross_pt_isPrompt%d_isLog%d_isScale%d.png",(int)isPrompt,(int)isLog,(int)isScale)); } } legBLFW->Clear(); //////// Backward TCanvas* c_bw = new TCanvas("c_bw","c_bw",200,10,600,600); c_bw->cd(); if (isLog) gPad->SetLogy(1); else gPad->SetLogy(0); //// 1) cross_sys for (Int_t iy = bw_init; iy < nRap; iy++) { if (iy==bw_init) g_cross_sys[iy]->Draw("A5"); else g_cross_sys[iy]->Draw("5"); } //// 2) cross for (Int_t iy = bw_init; iy < nRap; iy++) { g_cross[iy]->Draw("P"); } //// leg legBLBW->SetTextSize(0.032*1.2); legBLBW -> SetHeader("Backward rapidity"); legBLBW->SetTextSize(0.032); for (Int_t iy = bw_init; iy < nRap; iy++) { if (isScale && scaleF[iy]!=1.) legBLBW -> AddEntry(g_cross[iy],Form("%s (x%.0f)",rapArr[iy].Data(),scaleF[iy]),"lp"); else legBLBW -> AddEntry(g_cross[iy],Form("%s",rapArr[iy].Data()),"lp"); } if (isLog) legBLBW->Draw(); globtex->SetTextSize(0.048); globtex->SetTextFont(42); if (isPrompt) globtex->DrawLatex(0.92, 0.77, "Prompt J/#psi"); else globtex->DrawLatex(0.92, 0.77, "Nonprompt J/#psi"); // globtex->SetTextSize(0.035); // globtex->SetTextFont(42); // if (isPA==0) globtex->DrawLatex(0.91, 0.80, "Global uncertainty : 4 \%"); // else globtex->DrawLatex(0.91, 0.80, "Global uncertainty : 3.5 \%"); CMS_lumi( c_bw, isPA, iPos ); c_bw->Update(); if (isPA==0){ if (noPtWeight) { c_bw->SaveAs(Form("plot_cross/pp_bw_cross_pt_isPrompt%d_isLog%d_isScale%d_noPtWeight.pdf",(int)isPrompt,(int)isLog,(int)isScale)); c_bw->SaveAs(Form("plot_cross/pp_bw_cross_pt_isPrompt%d_isLog%d_isScale%d_noPtWeight.png",(int)isPrompt,(int)isLog,(int)isScale)); } else { c_bw->SaveAs(Form("plot_cross/pp_bw_cross_pt_isPrompt%d_isLog%d_isScale%d.pdf",(int)isPrompt,(int)isLog,(int)isScale)); c_bw->SaveAs(Form("plot_cross/pp_bw_cross_pt_isPrompt%d_isLog%d_isScale%d.png",(int)isPrompt,(int)isLog,(int)isScale)); } } else { if (noPtWeight) { c_bw->SaveAs(Form("plot_cross/pA_bw_cross_pt_isPrompt%d_isLog%d_isScale%d_noPtWeight.pdf",(int)isPrompt,(int)isLog,(int)isScale)); c_bw->SaveAs(Form("plot_cross/pA_bw_cross_pt_isPrompt%d_isLog%d_isScale%d_noPtWeight.png",(int)isPrompt,(int)isLog,(int)isScale)); } else { c_bw->SaveAs(Form("plot_cross/pA_bw_cross_pt_isPrompt%d_isLog%d_isScale%d.pdf",(int)isPrompt,(int)isLog,(int)isScale)); c_bw->SaveAs(Form("plot_cross/pA_bw_cross_pt_isPrompt%d_isLog%d_isScale%d.png",(int)isPrompt,(int)isLog,(int)isScale)); } } legBLBW->Clear(); /////////////////////////////////////////////////////////////////// //// save as a root file TFile *outFile; if (isPA==0) { if (noPtWeight) { outFile = new TFile(Form("plot_cross/pp_cross_pt_isPrompt%d_isLog%d_isScale%d_noPtWeight.root",(int)isPrompt,(int)isLog,(int)isScale),"RECREATE"); } else { outFile = new TFile(Form("plot_cross/pp_cross_pt_isPrompt%d_isLog%d_isScale%d.root",(int)isPrompt,(int)isLog,(int)isScale),"RECREATE"); } }else { if (noPtWeight) { outFile = new TFile(Form("plot_cross/pA_cross_pt_isPrompt%d_isLog%d_isScale%d_noPtWeight.root",(int)isPrompt,(int)isLog,(int)isScale),"RECREATE"); } else { outFile = new TFile(Form("plot_cross/pA_cross_pt_isPrompt%d_isLog%d_isScale%d.root",(int)isPrompt,(int)isLog,(int)isScale),"RECREATE"); } } outFile->cd(); for (Int_t iy = 0; iy < nRap; iy++) { g_cross_sys[iy]->Write(); g_cross[iy]->Write(); } outFile->Close(); return; } // end of main func.
void draw_RFB_pt_mergedBin(bool sysByHand=false, bool noPtWeight=false, bool isPrompt=false) { gROOT->Macro("./tdrstyle_kyo.C"); //cmsTextFont = 42; // for b.hong //extraTextFont = 42; // for b.hong int isPA = 1; // 0:pp, 1:pPb //int iPos=0; //outside topleft int iPos=33; //right corner //// BR and lumi info. const Double_t br = 0.0593 ; const Double_t brErr = 0.0006; const Double_t pPb_lumi_nb = 34.622; // 34.6/nb const Double_t pPb_lumi_nb_err = 1.211; // 3.5 % const Double_t pPb_lumi_mub = pPb_lumi_nb * 1000; // (nb)^{-1} -> {#mub}^{-1} const Double_t pPb_lumi_mub_err = pPb_lumi_nb_err * 1000; // (nb)^{-1} -> {#mub}^{-1} ///////////////////////////////////////////////////////////////////////// // bin center & systematic uncertainties by hand // for 1.5 - 1.93 const int nRap = 8; const int nPt = 9; const int nRapTmp = nRap + 1; const int nPtTmp = nPt + 1; const int nRapRFB = 3; const int nPtRFB = 3; Double_t pxtmp[nRapRFB][nPtRFB]; //x point to fill remporarily Double_t pytmp[nRapRFB][nPtRFB]; //y point to fill remporarily Double_t eytmp[nRapRFB][nPtRFB]; //y point error to fill remporarily /// 2015 PAS Double_t px[nRapRFB][nPtRFB] = { // x point (mean pT) {5.75945, 7.90077, 13.2826}, //1.5-1.93 {-531, 7.98106, 13.2588}, //0.9-1.5 {-531, 8.2616, 13.5598} //0.0-0.9 }; Double_t ex[nPtRFB] = {0.,0.,0.}; // x stat error (0) Double_t exlow[nRapRFB][nPtRFB]; Double_t exhigh[nRapRFB][nPtRFB]; //Double_t exsys[nPtRFB] = {0.25,0.25,0.25}; // x sys err (box width) Double_t exsys[nPtRFB] = {0.3,0.3,0.3}; // x sys err (box width) Double_t eysys[nRapRFB][nPtRFB]; //absolute y sys error //Double_t eysysrel[nRapRFB][nPtRFB]; //relative y sys error /* Double_t eysysrelPR[nRapRFB][nPtRFB] = { {0.04529, 0.04795, 0.06486}, //1.5-1.03 {0.00, 0.04245, 0.03360}, //0.9-1.5 {0.00, 0.04694, 0.03705} //0.0-0.9 }; Double_t eysysrelNP[nRapRFB][nPtRFB] = { {0.06133, 0.10487, 0.09280}, {0.00, 0.06288, 0.05592}, {0.00, 0.07412, 0.04483} }; for (int iy=0; iy<nRapRFB; iy++){ for (int ipt=0; ipt<nPtRFB; ipt++){ if(isPrompt) eysysrel[iy][ipt] = eysysrelPR[iy][ipt]; else eysysrel[iy][ipt] = eysysrelNP[iy][ipt]; } } */ //// 1) y_CM array (from forward to backward) Double_t rapArrNumFB[nRapTmp] = {1.93, 1.5, 0.9, 0., -0.9, -1.5, -1.93, -2.4, -2.87};// for pt dist. //Double_t rapArrNumBF[nRapTmp] = {-2.87, -2.4, -1.93, -1.5, -0.9, 0., 0.9, 1.5, 1.93};// for rap dist. Double_t rapBinW[nRap]; for (Int_t iy=0; iy<nRap; iy++) { rapBinW[iy] = rapArrNumFB[iy]-rapArrNumFB[iy+1]; //cout << iy <<"th rapBinW = " << rapBinW[iy] <<endl; } //// 2) pt array Double_t ptArrNum[nPtTmp] = {2.0, 3.0, 4.0, 5.0, 6.5, 7.5, 8.5, 10., 14., 30.}; Double_t ptBinW[nPt]; for (Int_t ipt=0; ipt<nPt; ipt++) { ptBinW[ipt] = ptArrNum[ipt+1]-ptArrNum[ipt]; //cout << ipt <<"th ptBinW = " << ptBinW[ipt] <<endl; } //// array string TString rapArr[nRap]; for (Int_t iy=0; iy<nRap; iy++) { formRapArr(rapArrNumFB[iy+1], rapArrNumFB[iy], &rapArr[iy]); cout << iy <<"th rapArr = " << rapArr[iy] << endl; } TString ptArr[nPt]; for (Int_t ipt=0; ipt<nPt; ipt++) { formPtArr(ptArrNum[ipt], ptArrNum[ipt+1], &ptArr[ipt]); cout << ipt <<"th ptArr = " << ptArr[ipt] << endl; } ////////////////////////////////////////////////////////////// //// read-in sys. file TFile * fSys; if (isPA==0) fSys = new TFile("../TotalSys/TotSys_8rap9pt_pp_etOpt0.root"); else fSys = new TFile("../TotalSys/TotSys_8rap9pt_pA_etOpt0.root"); TH2D* h2D_SysErr; if (isPrompt) h2D_SysErr = (TH2D*)fSys->Get("hTotalPR"); else h2D_SysErr = (TH2D*)fSys->Get("hTotalNP"); // cout << " *** h2D_SysErr = " << h2D_SysErr << endl; ///////////////////////////////////////////////////////////////////////// //// read-in file TFile * f2D; if (noPtWeight) f2D = new TFile("../FittingResult/totalHist_pA_8rap9pt_newcut_nominal_Zvtx1_SF1_etOpt0_noPtWeight.root"); else f2D = new TFile("../FittingResult/totalHist_pA_8rap9pt_newcut_nominal_Zvtx1_SF1_etOpt0.root"); //// read-in 2D hist TH2D* h2D_CorrY; if (isPrompt) h2D_CorrY = (TH2D*)f2D->Get("h2D_CorrY_PR_pA"); else h2D_CorrY = (TH2D*)f2D->Get("h2D_CorrY_NP_pA"); h2D_CorrY->SetName("h2D_CorrY"); const int nbinsX = h2D_CorrY->GetNbinsX(); const int nbinsY = h2D_CorrY->GetNbinsY(); if (nbinsX != nRap) { cout << " *** Error!!! nbinsX != nRap"; return; }; if (nbinsY != nPt) { cout << " *** Error!!! nbinsY != nPt"; return; }; //// projection to 1D hist : iy=0 refers to forwards !!! (ordering here) TH1D* h1D_CorrY[nRap]; TH1D* h1D_SysErr[nRap]; for (Int_t iy = 0; iy < nRap; iy++) { h1D_CorrY[iy] = h2D_CorrY->ProjectionY(Form("h1D_CorrY_%d",iy),iy+1,iy+1); h1D_SysErr[iy] = h2D_SysErr->ProjectionY(Form("h1D_SysErr_%d",iy),iy+1,iy+1); } ////////////////////////////////////////////////////////////////// //// calculate RFB TH1D* h1D_RFB_tmp[nRap]; // CorrYield with merged pT TH1D* h1D_RFB[nRapRFB]; // actual RFB TH1D* h1D_RFBSys_tmp[nRap]; // Sys with merged pT TH1D* h1D_RFBSys[nRapRFB]; // Sys F/B //// RFB bin setting TString rapAbsArr[nRap]; for (Int_t iy=0; iy<nRapRFB; iy++) { formAbsRapArr(rapArrNumFB[iy+1], rapArrNumFB[iy], &rapAbsArr[iy]); cout << iy <<"th rapAbsArr = " << rapAbsArr[iy] << endl; } Double_t ptArrRFBNum[nPtRFB+1] = {5.0, 6.5, 10., 30.}; //// ex calculation for (Int_t iy=0; iy<nRapRFB; iy++) { for (Int_t ipt=0; ipt<nPtRFB; ipt++) { exlow[iy][ipt] = px[iy][ipt]-ptArrRFBNum[ipt]; exhigh[iy][ipt] = ptArrRFBNum[ipt+1]-px[iy][ipt]; //cout << iy<<"th y, "<<ipt<<"th pt"<<endl; //cout << "exlow = "<< exlow[iy][ipt] << endl; //cout << "exhigh = " <<exhigh[iy][ipt] << endl; } } //// take proper error propagataion for sys (merge pT bins (KYO - byHand)) double tmpsys01, tmpsys02, tmpsys03; double actsys01, actsys02, actsys03; for (int iy=0; iy<nRapRFB*2; iy++){ h1D_RFBSys_tmp[iy]= new TH1D(Form("h1D_RFBSys_tmp_%d",iy),Form("h1D_RFBSys_tmp_%d",iy),nPtRFB,ptArrRFBNum); h1D_RFBSys_tmp[iy]->Sumw2(); actsys01=0; actsys02=0; actsys03=0; //// 1) pT 5-6.5 GeV tmpsys01=0; tmpsys02=0;tmpsys03=0; if (iy==0 || iy==nRapRFB*2-1){ //// from relative error to absolute error //actsys01=h1D_SysErr[iy]->GetBinContent(4); actsys01=h1D_SysErr[iy]->GetBinContent(4)*h1D_CorrY[iy]->GetBinContent(4); h1D_RFBSys_tmp[iy]->SetBinContent(1,actsys01); } else { h1D_RFBSys_tmp[iy]->SetBinContent(1,0.); } //// 2) pT 6.5-10. GeV tmpsys01=0; tmpsys02=0;tmpsys03=0; //// from relative error to absolute error tmpsys01=h1D_SysErr[iy]->GetBinContent(5)*h1D_CorrY[iy]->GetBinContent(5); tmpsys02=h1D_SysErr[iy]->GetBinContent(6)*h1D_CorrY[iy]->GetBinContent(6); tmpsys03=h1D_SysErr[iy]->GetBinContent(7)*h1D_CorrY[iy]->GetBinContent(7); //actsys02=TMath::Sqrt( TMath::Power(tmpsys01,2) + TMath::Power(tmpsys02,2) +TMath::Power(tmpsys03,2) ); actsys02= TMath::Abs(tmpsys01) + TMath::Abs(tmpsys02) +TMath::Abs(tmpsys03) ; h1D_RFBSys_tmp[iy]->SetBinContent(2,actsys02); //// 3) pT 10.-30. GeV tmpsys01=0; tmpsys02=0;tmpsys03=0; //// from relative error to absolute error tmpsys01=h1D_SysErr[iy]->GetBinContent(8)*h1D_CorrY[iy]->GetBinContent(8); tmpsys02=h1D_SysErr[iy]->GetBinContent(9)*h1D_CorrY[iy]->GetBinContent(9); //actsys03=TMath::Sqrt( TMath::Power(tmpsys01,2) + TMath::Power(tmpsys02,2) ); actsys03= TMath::Abs(tmpsys01) + TMath::Abs(tmpsys02) ; h1D_RFBSys_tmp[iy]->SetBinContent(3,actsys03); } //TCanvas *ctmp = new TCanvas("ctmp","",1200,800); ctmp->Divide(3,2); //for (int iy=0; iy<nRapRFB*2; iy++){ // ctmp->cd(iy+1); // h1D_RFBSys_tmp[iy]->Draw(""); //} //// merge pT bins (KYO - byHand) double tmpPRval01, tmpPRerr01, tmpPRval02, tmpPRerr02, tmpPRval03, tmpPRerr03; double actPRval01, actPRerr01, actPRval02, actPRerr02, actPRval03, actPRerr03; for (int iy=0; iy<nRapRFB*2; iy++){ h1D_RFB_tmp[iy]= new TH1D(Form("h1D_RFB_tmp_%d",iy),Form("h1D_RFB_tmp_%d",iy),nPtRFB,ptArrRFBNum); h1D_RFB_tmp[iy]->Sumw2(); actPRval01=0; actPRval02=0; actPRval03=0; actPRerr01=0; actPRerr02=0; actPRerr03=0; //// 1) pT 5-6.5 GeV tmpPRval01=0; tmpPRval02=0;tmpPRval03=0; tmpPRerr01=0; tmpPRerr02=0;tmpPRerr03=0; if (iy==0 || iy==nRapRFB*2-1){ actPRval01=h1D_CorrY[iy]->GetBinContent(4); actPRerr01=h1D_CorrY[iy]->GetBinError(4); h1D_RFB_tmp[iy]->SetBinContent(1,actPRval01); h1D_RFB_tmp[iy]->SetBinError(1,actPRerr01); } else { h1D_RFB_tmp[iy]->SetBinContent(1,0.); h1D_RFB_tmp[iy]->SetBinError(1,0.); } //// 2) pT 6.5-10. GeV tmpPRval01=0; tmpPRval02=0;tmpPRval03=0; tmpPRerr01=0; tmpPRerr02=0;tmpPRerr03=0; tmpPRval01=h1D_CorrY[iy]->GetBinContent(5); tmpPRerr01=h1D_CorrY[iy]->GetBinError(5); tmpPRval02=h1D_CorrY[iy]->GetBinContent(6); tmpPRerr02=h1D_CorrY[iy]->GetBinError(6); tmpPRval03=h1D_CorrY[iy]->GetBinContent(7); tmpPRerr03=h1D_CorrY[iy]->GetBinError(7); actPRval02=tmpPRval01+tmpPRval02+tmpPRval03; actPRerr02=TMath::Sqrt( TMath::Power(tmpPRerr01,2) + TMath::Power(tmpPRerr02,2) +TMath::Power(tmpPRerr03,2) ); h1D_RFB_tmp[iy]->SetBinContent(2,actPRval02); h1D_RFB_tmp[iy]->SetBinError(2,actPRerr02); //// 3) pT 10.-30. GeV tmpPRval01=0; tmpPRval02=0;tmpPRval03=0; tmpPRerr01=0; tmpPRerr02=0;tmpPRerr03=0; tmpPRval01=h1D_CorrY[iy]->GetBinContent(8); tmpPRerr01=h1D_CorrY[iy]->GetBinError(8); tmpPRval02=h1D_CorrY[iy]->GetBinContent(9); tmpPRerr02=h1D_CorrY[iy]->GetBinError(9); actPRval03=tmpPRval01+tmpPRval02; actPRerr03=TMath::Sqrt( TMath::Power(tmpPRerr01,2) + TMath::Power(tmpPRerr02,2) ); h1D_RFB_tmp[iy]->SetBinContent(3,actPRval03); h1D_RFB_tmp[iy]->SetBinError(3,actPRerr03); //for (int ipt=0; ipt<nPtRFB; ipt++){ // cout << iy<<"th rap, pT merged PR CorrYield = " << h1D_RFB_tmp[iy]->GetBinContent(ipt+1) <<endl; //} } ////////////////////////////////////////////////////////////////// //// actual RFB calculation for (int iy=0; iy<nRapRFB; iy++){ h1D_RFB[iy] = (TH1D*)h1D_RFB_tmp[iy]->Clone(Form("h1D_RFB_%d",iy)); h1D_RFB[iy]->Divide(h1D_RFB_tmp[2*nRapRFB-iy-1]); } //// sys F/B calculation Double_t dummy; for (int iy=0; iy<nRapRFB; iy++){ for (int ipt=0; ipt<nPtRFB; ipt++){ //eysysrel[iy][ipt] = TMath::Sqrt(h1D_RFBSys_tmp[iy]->GetBinContent(ipt+1)*h1D_RFBSys_tmp[iy]->GetBinContent(ipt+1)+ h1D_RFBSys_tmp[2*nRapRFB-iy-1]->GetBinContent(ipt+1)*h1D_RFBSys_tmp[2*nRapRFB-iy-1]->GetBinContent(ipt+1)); DivideValue(h1D_RFB_tmp[iy]->GetBinContent(ipt+1),h1D_RFBSys_tmp[iy]->GetBinContent(ipt+1),h1D_RFB_tmp[2*nRapRFB-iy-1]->GetBinContent(ipt+1),h1D_RFBSys_tmp[2*nRapRFB-iy-1]->GetBinContent(ipt+1),&dummy,&eysys[iy][ipt]); //cout << "FW bin = " << h1D_RFBSys_tmp[iy]->GetBinContent(ipt+1) << endl; //cout << "BW bin = " << h1D_RFBSys_tmp[2*nRapRFB-iy-1]->GetBinContent(ipt+1) << endl; //cout << "dummy = " << dummy << endl; //cout << "eysys["<<iy<<"]["<<ipt<<"] = " << eysys[iy][ipt] << endl; } } ////////////////////////////////////////////////////////////////// TLegend *legBR = new TLegend(0.50, 0.18, 0.70, 0.39); SetLegendStyle(legBR); legBR->SetTextSize(0.05); TLatex* globtex = new TLatex(); globtex->SetNDC(); globtex->SetTextAlign(12); //1:left, 2:vertical center //globtex->SetTextAlign(32); //3:right 2:vertical center globtex->SetTextFont(42); globtex->SetTextSize(0.04); //TCanvas* c1 = new TCanvas("c1","c1",600,600); //c1->cd(); ////////////////////////////////////////////////////////////////// //// convert to TGraphAsymErrors const int fw_init = 0; //// 1) sys graph TGraphAsymmErrors*gRFB_sys[nRapRFB]; for (int iy=0; iy<nRapRFB; iy++){ gRFB_sys[iy] = new TGraphAsymmErrors(h1D_RFB[iy]); gRFB_sys[iy] -> SetName(Form("gRFB_sys_%d",iy)); for (int ipt=0; ipt<nPtRFB; ipt++){ gRFB_sys[iy]->GetPoint(ipt, pxtmp[iy][ipt], pytmp[iy][ipt]); gRFB_sys[iy]->SetPoint(ipt, px[iy][ipt], pytmp[iy][ipt]); //// absolute err calculation //eysys[iy][ipt]=eysysrel[iy][ipt]*pytmp[iy][ipt]; //gRFB_sys[iy]->SetPointError(ipt, exsys[ipt], exsys[ipt], eysys[iy][ipt], eysys[iy][ipt]); gRFB_sys[iy]->SetPointError(ipt, exlow[iy][ipt], exhigh[iy][ipt], eysys[iy][ipt], eysys[iy][ipt]); } gRFB_sys[iy]->GetXaxis()->SetTitle("p_{T} (GeV/c)"); gRFB_sys[iy]->GetXaxis()->CenterTitle(); gRFB_sys[iy]->GetYaxis()->SetTitle("R_{FB}"); gRFB_sys[iy]->GetYaxis()->CenterTitle(); gRFB_sys[iy]->GetXaxis()->SetLimits(0.,32.0); gRFB_sys[iy]->SetMinimum(0.0); gRFB_sys[iy]->SetMaximum(1.8); } gRFB_sys[0]->SetFillColorAlpha(kGreen-10,0.5); gRFB_sys[1]->SetFillColorAlpha(kRed-10,0.5); gRFB_sys[2]->SetFillColorAlpha(kBlue-10,0.5); gRFB_sys[0]->SetLineColor(kGreen+3); gRFB_sys[1]->SetLineColor(kPink-6); gRFB_sys[2]->SetLineColor(kBlue-3); //// 2) RFB graph TGraphAsymmErrors*gRFB[nRapRFB]; for (int iy=0; iy<nRapRFB; iy++){ gRFB[iy] = new TGraphAsymmErrors(h1D_RFB[iy]); gRFB[iy] -> SetName(Form("gRFB_%d",iy)); cout << "::: for excel ::: iy= " << iy << endl; for (int ipt=0; ipt<nPtRFB; ipt++){ gRFB[iy]->GetPoint(ipt, pxtmp[iy][ipt], pytmp[iy][ipt]); eytmp[iy][ipt] = gRFB[iy]-> GetErrorY(ipt); gRFB[iy]->SetPoint(ipt, px[iy][ipt], pytmp[iy][ipt]); gRFB[iy]->SetPointEXlow(ipt, ex[iy]); gRFB[iy]->SetPointEXhigh(ipt, ex[iy]); cout << pytmp[iy][ipt] <<"\t"<<eytmp[iy][ipt] << "\t "<<eysys[iy][ipt]<<endl; } } SetGraphStyleFinal(gRFB[0], 0, 5); //1.5-1.93 SetGraphStyleFinal(gRFB[1], 1, 3); //0.9-1.5 SetGraphStyleFinal(gRFB[2], 2, 0); //0-0.9 gRFB[0]->SetMarkerSize(2.6); gRFB[1]->SetMarkerSize(1.4); gRFB[2]->SetMarkerSize(1.4); ///////////////// CANVAS 1 TCanvas* c1 = new TCanvas("c1","c1",600,600); c1->cd(); gRFB_sys[0]->Draw("A5"); solidLine(0.,1.,32.,1.,1,1); gRFB[0]->Draw("P"); TLegendEntry *le1=legBR->AddEntry("le1",Form(" %s", rapAbsArr[2].Data()),"lpf"); le1->SetFillColorAlpha(kBlue-10,0.5); le1->SetFillStyle(1001); le1->SetLineColor(kBlue-3); le1->SetMarkerStyle(kFullCircle); le1->SetMarkerColor(kBlue-3); le1->SetMarkerSize(2.1); TLegendEntry *le2=legBR->AddEntry("le2",Form(" %s", rapAbsArr[1].Data()),"lpf"); le2->SetFillColorAlpha(kRed-10,0.5); le2->SetFillStyle(1001); le2->SetLineColor(kPink-6); le2->SetMarkerStyle(kFullSquare); le2->SetMarkerColor(kPink-6); le2->SetMarkerSize(2.1); TLegendEntry *le3=legBR->AddEntry("le3",Form(" %s", rapAbsArr[0].Data()),"lpf"); le3->SetFillColorAlpha(kGreen-10,0.5); le3->SetFillStyle(1001); le3->SetLineColor(kGreen+3); le3->SetMarkerStyle(kFullDiamond); le3->SetMarkerColor(kGreen+3); le3->SetMarkerSize(3.3); //legBR->Draw(); globtex->SetTextAlign(32); //3:right 2:vertical center globtex->SetTextFont(42); globtex->SetTextSize(0.05); globtex->DrawLatex(0.9, 0.23, rapAbsArr[0].Data()); globtex->SetTextAlign(12); //1:left, 2:vertical center globtex->SetTextSize(0.055); globtex->SetTextFont(42); if (isPrompt) globtex->DrawLatex(0.21, 0.84, "Prompt J/#psi"); else globtex->DrawLatex(0.21, 0.84, "Nonprompt J/#psi"); CMS_lumi( c1, isPA, iPos ); c1->Update(); if (noPtWeight) { c1->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_noPtWeight_rap1.pdf",(int)isPrompt)); c1->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_noPtWeight_rap1.png",(int)isPrompt)); } else { c1->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_rap1.pdf",(int)isPrompt)); c1->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_rap1.png",(int)isPrompt)); } ///////////////// CANVAS 2 TCanvas* c2 = new TCanvas("c2","c2",600,600); c2->cd(); gRFB_sys[1]->Draw("A5"); solidLine(0.,1.,32.,1.,1,1); gRFB[1]->Draw("P"); //legBR->Draw(); globtex->SetTextAlign(32); //3:right 2:vertical center globtex->SetTextFont(42); globtex->SetTextSize(0.05); globtex->DrawLatex(0.9, 0.23, rapAbsArr[1].Data()); globtex->SetTextAlign(12); //1:left, 2:vertical center globtex->SetTextSize(0.055); globtex->SetTextFont(42); if (isPrompt) globtex->DrawLatex(0.21, 0.84, "Prompt J/#psi"); else globtex->DrawLatex(0.21, 0.84, "Nonprompt J/#psi"); CMS_lumi( c2, isPA, iPos ); c2->Update(); if (noPtWeight) { c2->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_noPtWeight_rap2.pdf",(int)isPrompt)); c2->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_noPtWeight_rap2.png",(int)isPrompt)); } else { c2->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_rap2.pdf",(int)isPrompt)); c2->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_rap2.png",(int)isPrompt)); } ///////////////// CANVAS 3 TCanvas* c3 = new TCanvas("c3","c3",600,600); c3->cd(); gRFB_sys[2]->Draw("A5"); solidLine(0.,1.,32.,1.,1,1); gRFB[2]->Draw("P"); ///legBR->Draw(); globtex->SetTextAlign(32); //3:right 2:vertical center globtex->SetTextFont(42); globtex->SetTextSize(0.05); globtex->DrawLatex(0.9, 0.23, rapAbsArr[2].Data()); globtex->SetTextAlign(12); //1:left, 2:vertical center globtex->SetTextSize(0.055); globtex->SetTextFont(42); if (isPrompt) globtex->DrawLatex(0.21, 0.84, "Prompt J/#psi"); else globtex->DrawLatex(0.21, 0.84, "Nonprompt J/#psi"); CMS_lumi( c3, isPA, iPos ); c3->Update(); if (noPtWeight) { c3->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_noPtWeight_rap3.pdf",(int)isPrompt)); c3->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_noPtWeight_rap3.png",(int)isPrompt)); } else { c3->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_rap3.pdf",(int)isPrompt)); c3->SaveAs(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_rap3.png",(int)isPrompt)); } /////////////////////////////////////////////////////////////////// //// save as a root file TFile *outFile; if (noPtWeight) outFile = new TFile(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d_noPtWeight.root",(int)isPrompt),"RECREATE"); else outFile = new TFile(Form("plot_RFB/RFB_pt_mergedBin_isPrompt%d.root",(int)isPrompt),"RECREATE"); outFile->cd(); for (int iy=0; iy<nRapRFB; iy++){ gRFB_sys[iy]->Write(); gRFB[iy]->Write(); } outFile->Close(); return; } // end of main func.
void comp_RpPb_pt_Bmeson(bool isPrompt = false) { gROOT->Macro("./tdrstyle_kyo.C"); int isPA = 10; int iPos=33; //// BR and lumi info. const Double_t br = 0.0593 ; const Double_t brErr = 0.0006; const Double_t pp_lumi_pb =27.972; // 28.0/pb const Double_t pp_lumi_pb_err = 0.643; // 2.3 % const Double_t pPb_lumi_nb = 34.622; // 34.6/nb const Double_t pPb_lumi_nb_err = 1.211; // 3.5 % const Double_t pp_lumi_mub = pp_lumi_pb *1000*1000; const Double_t pPb_lumi_mub_err = pp_lumi_pb_err *1000*1000; double A_pb =208; //// read our result TFile *inFile_pp; if (isPrompt) inFile_pp = new TFile("plot_cross/pp_cross_pt_integ_middle_isPrompt1_isLog0_isScale0_maxrap386.root"); else inFile_pp= new TFile("plot_cross/pp_cross_pt_integ_middle_isPrompt0_isLog0_isScale0_maxrap386.root"); TGraphAsymmErrors* g_cross_fwrap_pp = (TGraphAsymmErrors*)inFile_pp->Get("g_cross_fwrap"); TGraphAsymmErrors* g_cross_sys_fwrap_pp = (TGraphAsymmErrors*)inFile_pp->Get("g_cross_sys_fwrap"); //// read our result TFile *inFile_pA; if (isPrompt) inFile_pA = new TFile("plot_cross/pA_cross_pt_integ_middle_isPrompt1_isLog0_isScale0_maxrap386.root"); else inFile_pA= new TFile("plot_cross/pA_cross_pt_integ_middle_isPrompt0_isLog0_isScale0_maxrap386.root"); TGraphAsymmErrors* g_cross_fwrap_pA = (TGraphAsymmErrors*)inFile_pA->Get("g_cross_fwrap"); TGraphAsymmErrors* g_cross_sys_fwrap_pA = (TGraphAsymmErrors*)inFile_pA->Get("g_cross_sys_fwrap"); const int nPt = 5; double dummy1; double pxtmp[nPt]; double pytmp_pp[nPt]; double pytmp_pA[nPt]; double rppb[nPt]; double eytmp_pp[nPt]; double eytmp_pA[nPt]; double ey_rppb[nPt]; double eysystmp_pp[nPt]; double eysystmp_pA[nPt]; double eysys_rppb[nPt]; for (int ipt=0; ipt<nPt; ipt++) { g_cross_fwrap_pp->GetPoint(ipt+4, pxtmp[ipt], pytmp_pp[ipt]); g_cross_fwrap_pA->GetPoint(ipt+4, pxtmp[ipt], pytmp_pA[ipt]); eytmp_pp[ipt] = g_cross_fwrap_pp->GetErrorY(ipt+4); eytmp_pA[ipt] = g_cross_fwrap_pA->GetErrorY(ipt+4); eysystmp_pp[ipt] = g_cross_sys_fwrap_pp->GetErrorY(ipt+4); eysystmp_pA[ipt] = g_cross_sys_fwrap_pA->GetErrorY(ipt+4); } cout << "::: for excel ::: " << endl; for (int ipt=0; ipt<nPt; ipt++) { DivideValue(pytmp_pA[ipt],eytmp_pA[ipt],pytmp_pp[ipt],eytmp_pp[ipt],&rppb[ipt],&ey_rppb[ipt]); //actual values DivideValue(pytmp_pA[ipt],eysystmp_pA[ipt],pytmp_pp[ipt],eysystmp_pp[ipt],&dummy1,&eysys_rppb[ipt]); //syst. rppb[ipt]/=A_pb; ey_rppb[ipt]/=A_pb; eysys_rppb[ipt]/=A_pb; //cout << " "<<endl; //cout << "rppb["<<ipt<<"] =" << rppb[ipt] << endl; //cout << "stat.["<<ipt<<"] =" << ey_rppb[ipt] << endl; //cout << "syst.["<<ipt<<"] =" << eysys_rppb[ipt] << endl; cout << rppb[ipt] <<"\t"<<ey_rppb[ipt] << "\t "<<eysys_rppb[ipt]<<endl; } Double_t exsys[nPt] = {0.4,0.4,0.4,0.4,0.4}; Double_t exlow[nPt]; Double_t exhigh[nPt]; Double_t ptArrNum[nPt+1] = {6.5, 7.5, 8.5, 10., 14., 30.}; //// ex calculation for (Int_t ipt=0; ipt<nPt; ipt++) { exlow[ipt] = pxtmp[ipt]-ptArrNum[ipt]; exhigh[ipt] = ptArrNum[ipt+1]-pxtmp[ipt]; } /////////////////////////////////////////////////// ///////////////////// Bmeson //////////////////////// /////////////////////////////////////////////////// TCanvas *c1 = new TCanvas("c1","c1",600,600); const int nPtBmeson = 5; double px_Bmeson[nPtBmeson] = {12.5, 17.5, 22.5, 27.5, 45}; double rppb_Bmeson[nPtBmeson] = {1.11, 1.19, 0.91, 0.86, 1.14}; double ex_Bmeson[nPtBmeson] = {0,0,0,0,0}; double exsys_Bmeson[nPtBmeson] = {2.5, 2.5, 2.5, 2.5, 15.}; double ey_Bmeson[nPtBmeson] = {0.08, 0.10, 0.12, 0.18, 0.19}; double eysys_Bmeson[nPtBmeson] = {0.17, 0.17, 0.13, 0.12, 0.17}; double eysysFONLLlow_Bmeson[nPtBmeson] = {0.29,0.28,0.19,0.16,0.18}; double eysysFONLLhigh_Bmeson[nPtBmeson] = {0.33,0.31,0.21,0.18,0.21}; TGraphAsymmErrors* g_RpPb_Bmeson_sys = new TGraphAsymmErrors(nPtBmeson, px_Bmeson, rppb_Bmeson, exsys_Bmeson, exsys_Bmeson, eysys_Bmeson, eysys_Bmeson); TGraphAsymmErrors* g_RpPb_Bmeson_sysFONLL = new TGraphAsymmErrors(nPtBmeson, px_Bmeson, rppb_Bmeson, exsys_Bmeson, exsys_Bmeson, eysysFONLLlow_Bmeson, eysysFONLLhigh_Bmeson); TGraphAsymmErrors* g_RpPb_Bmeson = new TGraphAsymmErrors(nPtBmeson, px_Bmeson, rppb_Bmeson, ex_Bmeson, ex_Bmeson, ey_Bmeson, ey_Bmeson); g_RpPb_Bmeson_sysFONLL->GetXaxis()->SetTitle("p_{T} (GeV/c)"); g_RpPb_Bmeson_sysFONLL->GetXaxis()->CenterTitle(); g_RpPb_Bmeson_sysFONLL->GetYaxis()->SetTitle("R_{pPb}"); g_RpPb_Bmeson_sysFONLL->GetYaxis()->CenterTitle(); g_RpPb_Bmeson_sysFONLL->GetXaxis()->SetLimits(0.,62.0); g_RpPb_Bmeson_sysFONLL->SetMinimum(0.0); g_RpPb_Bmeson_sysFONLL->SetMaximum(2.0); g_RpPb_Bmeson_sysFONLL->SetLineColor(kGray); g_RpPb_Bmeson_sysFONLL->SetFillColor(kWhite); g_RpPb_Bmeson_sysFONLL->SetFillStyle(4000); g_RpPb_Bmeson_sysFONLL->SetLineWidth(3); g_RpPb_Bmeson_sysFONLL->SetLineStyle(7); g_RpPb_Bmeson_sys->SetFillColor(kGray); //g_RpPb_Bmeson_sys->SetFillStyle(3001); SetGraphStyleFinal(g_RpPb_Bmeson, 9, 13); g_RpPb_Bmeson->SetMarkerSize(1.2); ////////////////////////////////////////////////////////////// TLatex* globtex = new TLatex(); globtex->SetNDC(); globtex->SetTextAlign(12); //1:left, 2:vertical center //globtex->SetTextAlign(32); //3:right 2:vertical center globtex->SetTextFont(42); globtex->SetTextSize(0.04); TBox * globbox_br = new TBox(2, 0.969, 4, 1.031); //for B+ branching ratio globbox_br->SetFillColorAlpha(kWhite,0.5); globbox_br->SetLineColor(kBlack); //// our results TGraphAsymmErrors* g_RpPb_sys = new TGraphAsymmErrors(nPt, pxtmp, rppb, exlow, exhigh, eysys_rppb, eysys_rppb); TGraphAsymmErrors* g_RpPb = new TGraphAsymmErrors(nPt, pxtmp, rppb, exsys, exsys, ey_rppb, ey_rppb); g_RpPb_sys->SetFillColorAlpha(kRed-10,0.5); g_RpPb_sys->SetLineColor(kPink-6); SetGraphStyleFinal(g_RpPb, 1, 0); g_RpPb->SetMarkerSize(1.2); ////// actual draw g_RpPb_Bmeson_sysFONLL->Draw("A5"); g_RpPb_Bmeson_sys->Draw("2"); g_RpPb_sys->Draw("5"); solidLine(0.,1.,62.,1.,1,1); g_RpPb->Draw("p"); g_RpPb_Bmeson->Draw("p"); //TLegend *legBL = new TLegend(0.50,0.18,0.90,0.25); TLegend *legBL = new TLegend(0.18,0.18,0.77,0.32); SetLegendStyle(legBL); //legBL->SetTextSize(0.037); legBL->SetTextSize(0.043); legBL->SetTextFont(42); legBL -> AddEntry(g_RpPb,"Nonprompt J/#psi: |y_{CM}| < 1.93","lp"); legBL -> AddEntry(g_RpPb_Bmeson,"B^{+}: -2.86 < y_{CM} < 1.93","lp"); legBL -> Draw(); globtex->SetTextSize(0.055); globtex->SetTextFont(42); globtex->DrawLatex(0.212, 0.852, "Open beauty"); //if (isPrompt) globtex->DrawLatex(0.212, 0.852, "Prompt J/#psi"); //else globtex->DrawLatex(0.212, 0.852, "Nonprompt J/#psi"); CMS_lumi( c1, isPA, iPos ); c1->Update(); c1->SaveAs(Form("plot_otherExp/comp_RpPb_pt_Bmeson_isPrompt%d.pdf",(int)isPrompt)); c1->SaveAs(Form("plot_otherExp/comp_RpPb_pt_Bmeson_isPrompt%d.png",(int)isPrompt)); return; }
void comp_RpPb_pt_ATLAS(bool isPrompt = true) { gROOT->Macro("./tdrstyle_kyo.C"); int isPA = 10; int iPos=33; //// BR and lumi info. const Double_t br = 0.0593 ; const Double_t brErr = 0.0006; const Double_t pp_lumi_pb =27.972; // 28.0/pb const Double_t pp_lumi_pb_err = 0.643; // 2.3 % const Double_t pPb_lumi_nb = 34.622; // 34.6/nb const Double_t pPb_lumi_nb_err = 1.211; // 3.5 % const Double_t pp_lumi_mub = pp_lumi_pb *1000*1000; const Double_t pPb_lumi_mub_err = pp_lumi_pb_err *1000*1000; double A_pb =208; //// read our result TFile *inFile_pp; if (isPrompt) inFile_pp = new TFile("plot_cross/pp_cross_pt_integ_middle_isPrompt1_isLog0_isScale0_maxrap300.root"); else inFile_pp= new TFile("plot_cross/pp_cross_pt_integ_middle_isPrompt0_isLog0_isScale0_maxrap300.root"); TGraphAsymmErrors* g_cross_fwrap_pp = (TGraphAsymmErrors*)inFile_pp->Get("g_cross_fwrap"); TGraphAsymmErrors* g_cross_sys_fwrap_pp = (TGraphAsymmErrors*)inFile_pp->Get("g_cross_sys_fwrap"); //// read our result TFile *inFile_pA; if (isPrompt) inFile_pA = new TFile("plot_cross/pA_cross_pt_integ_middle_isPrompt1_isLog0_isScale0_maxrap300.root"); else inFile_pA= new TFile("plot_cross/pA_cross_pt_integ_middle_isPrompt0_isLog0_isScale0_maxrap300.root"); TGraphAsymmErrors* g_cross_fwrap_pA = (TGraphAsymmErrors*)inFile_pA->Get("g_cross_fwrap"); TGraphAsymmErrors* g_cross_sys_fwrap_pA = (TGraphAsymmErrors*)inFile_pA->Get("g_cross_sys_fwrap"); const int nPt = 5; double dummy1; double pxtmp[nPt]; double pytmp_pp[nPt]; double pytmp_pA[nPt]; double rppb[nPt]; double eytmp_pp[nPt]; double eytmp_pA[nPt]; double ey_rppb[nPt]; double eysystmp_pp[nPt]; double eysystmp_pA[nPt]; double eysys_rppb[nPt]; for (int ipt=0; ipt<nPt; ipt++) { g_cross_fwrap_pp->GetPoint(ipt+4, pxtmp[ipt], pytmp_pp[ipt]); g_cross_fwrap_pA->GetPoint(ipt+4, pxtmp[ipt], pytmp_pA[ipt]); eytmp_pp[ipt] = g_cross_fwrap_pp->GetErrorY(ipt+4); eytmp_pA[ipt] = g_cross_fwrap_pA->GetErrorY(ipt+4); eysystmp_pp[ipt] = g_cross_sys_fwrap_pp->GetErrorY(ipt+4); eysystmp_pA[ipt] = g_cross_sys_fwrap_pA->GetErrorY(ipt+4); } for (int ipt=0; ipt<nPt; ipt++) { DivideValue(pytmp_pA[ipt],eytmp_pA[ipt],pytmp_pp[ipt],eytmp_pp[ipt],&rppb[ipt],&ey_rppb[ipt]); //actual values DivideValue(pytmp_pA[ipt],eysystmp_pA[ipt],pytmp_pp[ipt],eysystmp_pp[ipt],&dummy1,&eysys_rppb[ipt]); //syst. rppb[ipt]/=A_pb; ey_rppb[ipt]/=A_pb; eysys_rppb[ipt]/=A_pb; cout << " "<<endl; cout << "rppb["<<ipt<<"] =" << rppb[ipt] << endl; cout << "stat.["<<ipt<<"] =" << ey_rppb[ipt] << endl; cout << "syst.["<<ipt<<"] =" << eysys_rppb[ipt] << endl; } Double_t exsys[nPt] = {0.4,0.4,0.4,0.4,0.4}; Double_t exlow[nPt]; Double_t exhigh[nPt]; Double_t ptArrNum[nPt+1] = {6.5, 7.5, 8.5, 10., 14., 30.}; //// ex calculation for (Int_t ipt=0; ipt<nPt; ipt++) { exlow[ipt] = pxtmp[ipt]-ptArrNum[ipt]; exhigh[ipt] = ptArrNum[ipt+1]-pxtmp[ipt]; } /////////////////////////////////////////////////// ///////////////////// ATLAS //////////////////////// /////////////////////////////////////////////////// TFile *inFileATLAS; if (isPrompt) inFileATLAS = new TFile("ATLAS_Jpsi_RpPb/RpPb_PromptJpsi_dpT.root"); else inFileATLAS= new TFile("ATLAS_Jpsi_RpPb/RpPb_NonPromptJpsi_dpT.root"); cout << "inFileATLAS = " << inFileATLAS << endl; TGraphAsymmErrors* g_RpPb_ATLAS_sys; TGraphAsymmErrors* g_RpPb_ATLAS; if (isPrompt) { g_RpPb_ATLAS_sys = (TGraphAsymmErrors*)inFileATLAS->Get("RpPb_p_syst"); g_RpPb_ATLAS = (TGraphAsymmErrors*)inFileATLAS->Get("RpPb_p"); }else { g_RpPb_ATLAS_sys = (TGraphAsymmErrors*)inFileATLAS->Get("RpPb_np_syst"); g_RpPb_ATLAS = (TGraphAsymmErrors*)inFileATLAS->Get("RpPb_np"); } cout << "g_RpPb_ATLAS_sys = " << g_RpPb_ATLAS_sys << endl; cout << "g_RpPb_ATLAS = " << g_RpPb_ATLAS << endl; ////////////////////////////////////////////////////////////// TLatex* globtex = new TLatex(); globtex->SetNDC(); globtex->SetTextAlign(12); //1:left, 2:vertical center //globtex->SetTextAlign(32); //3:right 2:vertical center globtex->SetTextFont(42); globtex->SetTextSize(0.04); TCanvas *c1 = new TCanvas("c1","c1",600,600); g_RpPb_ATLAS_sys->GetXaxis()->SetTitle("p_{T} (GeV/c)"); g_RpPb_ATLAS_sys->GetXaxis()->CenterTitle(); g_RpPb_ATLAS_sys->GetYaxis()->SetTitle("R_{pPb}"); g_RpPb_ATLAS_sys->GetYaxis()->CenterTitle(); g_RpPb_ATLAS_sys->GetXaxis()->SetTitleOffset(1.15); g_RpPb_ATLAS_sys->GetXaxis()->SetLimits(0.,32.); g_RpPb_ATLAS_sys->SetMinimum(0.0); g_RpPb_ATLAS_sys->SetMaximum(2.0); g_RpPb_ATLAS_sys->SetLineColor(kGray); g_RpPb_ATLAS_sys->SetFillColor(kWhite); g_RpPb_ATLAS_sys->SetFillStyle(4000); g_RpPb_ATLAS_sys->SetLineWidth(3); g_RpPb_ATLAS_sys->SetLineStyle(7); g_RpPb_ATLAS_sys->SetFillColor(kGray); SetGraphStyleFinal(g_RpPb_ATLAS, 9, 10); g_RpPb_ATLAS->SetMarkerSize(1.7); //TGraphAsymmErrors* g_RpPb_sys = new TGraphAsymmErrors(nPt, pxtmp, rppb, exsys, exsys, eysys_rppb, eysys_rppb); TGraphAsymmErrors* g_RpPb_sys = new TGraphAsymmErrors(nPt, pxtmp, rppb, exlow, exhigh, eysys_rppb, eysys_rppb); TGraphAsymmErrors* g_RpPb = new TGraphAsymmErrors(nPt, pxtmp, rppb, exsys, exsys, ey_rppb, ey_rppb); g_RpPb_sys->GetXaxis()->SetTitle("p_{T} (GeV/c)"); g_RpPb_sys->GetXaxis()->CenterTitle(); g_RpPb_sys->GetYaxis()->SetTitle("R_{pPb}"); g_RpPb_sys->GetYaxis()->CenterTitle(); g_RpPb_sys->GetXaxis()->SetLimits(0.,30.0); g_RpPb_sys->SetMinimum(0.0); g_RpPb_sys->SetMaximum(2.0); g_RpPb_sys->SetFillColorAlpha(kRed-10,0.5); g_RpPb_sys->SetLineColor(kPink-6); SetGraphStyleFinal(g_RpPb, 1, 0); //g_RpPb->SetMarkerSize(2.1); g_RpPb->SetMarkerSize(1.7); ////// actual draw g_RpPb_ATLAS_sys->Draw("A5"); g_RpPb_sys->Draw("5"); solidLine(0.,1.,32.,1.,1,1); g_RpPb_ATLAS->Draw("p"); g_RpPb->Draw("p"); //TLegend *legBL = new TLegend(0.19,0.18,0.54,0.25); TLegend *legBL = new TLegend(0.18,0.18,0.77,0.32); SetLegendStyle(legBL); legBL->SetTextSize(0.043); legBL->SetTextFont(42); legBL -> AddEntry(g_RpPb,"-1.5 < y_{CM} < 1.5","lp"); legBL -> AddEntry(g_RpPb_ATLAS,"ATLAS: -1.5 < y_{CM} < 1.5","lp"); legBL -> Draw(); globtex->SetTextSize(0.055); globtex->SetTextFont(42); if (isPrompt) globtex->DrawLatex(0.21, 0.84, "Prompt J/#psi"); else globtex->DrawLatex(0.21, 0.84, "Nonprompt J/#psi"); CMS_lumi( c1, isPA, iPos ); c1->Update(); c1->SaveAs(Form("plot_otherExp/comp_RpPb_pt_ATLAS_isPrompt%d.pdf",(int)isPrompt)); c1->SaveAs(Form("plot_otherExp/comp_RpPb_pt_ATLAS_isPrompt%d.png",(int)isPrompt)); return; }