void Factorization_eta_mc() { const int nfiles = 24; TString filename[nfiles]; filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent020_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent2040_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent4060_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent020_pttrg033_ptassallweight_etaass34_pixel_eff0_v42.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent2040_pttrg033_ptassallweight_etaass34_pixel_eff0_v42.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent4060_pttrg033_ptassallweight_etaass34_pixel_eff0_v42.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent5060_pttrg053_ptassallweight_etaass45_eff0_v42.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_mc_cent5060_pttrg053_ptassallweight_etaass45_eff0_v42.root"); // filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent020_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n2500_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n5001200_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n0160_pttrg033_ptassallweight_etaass445_eff0_v42.root"); /* filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent2040_pttrg033_ptassallweight_etaass445_eff0_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent4060_pttrg033_ptassallweight_etaass445_eff0_v42.root"); */ filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n2500_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n5001200_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HijingReco_Minbias_2760GeV/merged/epetadeco_gen_n0160_pttrg033_ptassallweight_etaass34_eff0_v42.root"); /* filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent020_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent2040_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent4060_pttrg033_ptassallweight_etaass34_eff0_v42.root"); */ filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent5060_pttrg053_ptassallweight_etaass34_eff0_v42.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HydjetReco_Minbias_2760GeV/merged/epetadeco_gen_cent5060_pttrg053_ptassallweight_etaass34_eff0_v42.root"); filename[16] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent020_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[17] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2040_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[18] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4060_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[19] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent020_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[20] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2040_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[21] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4060_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[22] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass34_eff0_v42.root"); filename[23] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass34_eff0_v42.root"); /* filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg053_ptassallweight_etaass45_eff0_v18.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg053_ptassallweight_etaass45_eff0_v18.root"); */ const int ntrgbins = 16; const int ntrgbins1 = ntrgbins; const int ntrgbins2 = ntrgbins/2; TGraphErrors* gr[nfiles][6]; TGraphErrors* gr0[nfiles][6]; TGraphErrors* gr1[nfiles][6]; TGraphErrors* gr_ratio[nfiles][6]; TGraphErrors* gr_total[nfiles][6]; TGraph* gr_band[nfiles][6]; TGraph* gr1_band[nfiles][6]; TF1* fit[nfiles][6]; TF1* fit_aver[nfiles][6]; TF1* fit1_aver[nfiles][6]; double slope[6][nfiles]; double slope_err[6][nfiles]; double slope1[6][nfiles]; double slope1_err[6][nfiles]; // double eta[ntrgbins2] = {0.12,0.36,0.6,0.84,1.08,1.32,1.56,1.8,2.04,2.28}; // double eta[ntrgbins2] = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3}; double eta[ntrgbins2] = {0.15,0.45,0.75,1.05,1.35,1.65,1.95,2.25}; // double eta[ntrgbins2] = {0.2,0.6,1.0,1.4,1.8,2.2}; double eta_err[ntrgbins2] = {0.0}; Color_t color[6] = {1,kBlue, kBlue, kBlue,1,1}; TFile* fdiff[nfiles]; for(int jj=0;jj<nfiles;jj++) { fdiff[jj] = new TFile(filename[jj].Data()); TH2D* hsignal[ntrgbins]; TH2D* hbackground[ntrgbins]; TH2D* hsignal0[ntrgbins]; TH2D* hbackground0[ntrgbins]; TH2D* hsignal1[ntrgbins]; TH2D* hbackground1[ntrgbins]; TH1D* hsignal_1D[ntrgbins][6]; TH1D* hbackground_1D[ntrgbins][6]; TH1D* hsignal0_1D[ntrgbins][6]; TH1D* hbackground0_1D[ntrgbins][6]; TH1D* hsignal1_1D[ntrgbins][6]; TH1D* hbackground1_1D[ntrgbins][6]; double Vn[ntrgbins1][6]; double VnError[ntrgbins1][6]; double rn[ntrgbins2]; double rn_err[ntrgbins2]; double Vn0[ntrgbins1][6]; double Vn0Error[ntrgbins1][6]; double rn0[ntrgbins2]; double rn0_err[ntrgbins2]; double Vn1[ntrgbins1][6]; double Vn1Error[ntrgbins1][6]; double rn1[ntrgbins2]; double rn1_err[ntrgbins2]; double rn_ratio[ntrgbins2]; double rn_ratio_err[ntrgbins2]; double rn_total[ntrgbins2]; double rn_total_err[ntrgbins2]; for(int i=0;i<ntrgbins;i++) { hsignal0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/signalcosn_trg%d",i)); hbackground0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/backgroundcosn_trg%d",i)); hsignal[i] = (TH2D*)hsignal0[i]->Clone(Form("signalcosn_trg%d",i)); hbackground[i] = (TH2D*)hbackground0[i]->Clone(Form("backgroundcosn_trg%d",i)); hsignal[i]->Add(hsignal1[i]); hbackground[i]->Add(hbackground1[i]); for(int nbin=1;nbin<4;nbin++) { hsignal_1D[i][nbin] = (TH1D*)hsignal[i]->ProjectionX(Form("signal_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal0_1D[i][nbin] = (TH1D*)hsignal0[i]->ProjectionX(Form("signal0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal1_1D[i][nbin] = (TH1D*)hsignal1[i]->ProjectionX(Form("signal1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground_1D[i][nbin] = (TH1D*)hbackground[i]->ProjectionX(Form("background_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground0_1D[i][nbin] = (TH1D*)hbackground0[i]->ProjectionX(Form("background0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground1_1D[i][nbin] = (TH1D*)hbackground1[i]->ProjectionX(Form("background1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); Vn[i][nbin]=hsignal_1D[i][nbin]->GetMean()-hbackground_1D[i][nbin]->GetMean(); VnError[i][nbin]=sqrt(hsignal_1D[i][nbin]->GetMeanError()*hsignal_1D[i][nbin]->GetMeanError()+hbackground_1D[i][nbin]->GetMeanError()*hbackground_1D[i][nbin]->GetMeanError()); Vn0[i][nbin]=hsignal0_1D[i][nbin]->GetMean()-hbackground0_1D[i][nbin]->GetMean(); Vn0Error[i][nbin]=sqrt(hsignal0_1D[i][nbin]->GetMeanError()*hsignal0_1D[i][nbin]->GetMeanError()+hbackground0_1D[i][nbin]->GetMeanError()*hbackground0_1D[i][nbin]->GetMeanError()); Vn1[i][nbin]=hsignal1_1D[i][nbin]->GetMean()-hbackground1_1D[i][nbin]->GetMean(); Vn1Error[i][nbin]=sqrt(hsignal1_1D[i][nbin]->GetMeanError()*hsignal1_1D[i][nbin]->GetMeanError()+hbackground1_1D[i][nbin]->GetMeanError()*hbackground1_1D[i][nbin]->GetMeanError()); if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<hsignal0_1D[i][nbin]->GetMean()<<" "<<hbackground0_1D[i][nbin]->GetMean()<<" "<<Vn0[i][nbin]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<hsignal1_1D[i][nbin]->GetMean()<<" "<<hbackground1_1D[i][nbin]->GetMean()<<" "<<Vn1[i][nbin]<<endl; delete hsignal_1D[i][nbin]; delete hsignal0_1D[i][nbin]; delete hsignal1_1D[i][nbin]; delete hbackground_1D[i][nbin]; delete hbackground0_1D[i][nbin]; delete hbackground1_1D[i][nbin]; } delete hsignal0[i]; delete hsignal1[i]; delete hsignal[i]; delete hbackground0[i]; delete hbackground1[i]; delete hbackground[i]; } for(int nbin=1;nbin<4;nbin++) { for(int i=0;i<ntrgbins2;i++) { rn[ntrgbins2-i-1]=Vn[i][nbin]/Vn[ntrgbins1-i-1][nbin]; rn_err[ntrgbins2-i-1]=sqrt((VnError[ntrgbins1-i-1][nbin]/Vn[ntrgbins1-i-1][nbin])**2+(VnError[i][nbin]/Vn[i][nbin])**2); rn0[ntrgbins2-i-1]=Vn0[i][nbin]/Vn0[ntrgbins1-i-1][nbin]; rn0_err[ntrgbins2-i-1]=sqrt((Vn0Error[ntrgbins1-i-1][nbin]/Vn0[ntrgbins1-i-1][nbin])**2+(Vn0Error[i][nbin]/Vn0[i][nbin])**2); rn1[ntrgbins2-i-1]=Vn1[i][nbin]/Vn1[ntrgbins1-i-1][nbin]; rn1_err[ntrgbins2-i-1]=sqrt((Vn1Error[ntrgbins1-i-1][nbin]/Vn1[ntrgbins1-i-1][nbin])**2+(Vn1Error[i][nbin]/Vn1[i][nbin])**2); rn_ratio[ntrgbins2-i-1] = rn0[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]; rn_ratio_err[ntrgbins2-i-1] = sqrt(rn0_err[ntrgbins2-i-1]*rn0_err[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]); rn_total[ntrgbins2-i-1] = sqrt(rn0[ntrgbins2-i-1]*rn1[ntrgbins2-i-1]); rn_total_err[ntrgbins2-i-1] = sqrt(rn0_err[ntrgbins2-i-1]*rn0_err[ntrgbins2-i-1]/rn0[ntrgbins2-i-1]/rn0[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]/rn1[ntrgbins2-i-1])*0.5*rn_total[ntrgbins2-i-1]; if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<Vn0[i][nbin]<<" "<<Vn0[ntrgbins1-i-1][nbin]<<" "<<rn0[ntrgbins2-i-1]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<Vn1[i][nbin]<<" "<<Vn1[ntrgbins1-i-1][nbin]<<" "<<rn1[ntrgbins2-i-1]<<endl; } gr[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn,eta_err,rn_err); gr[jj][nbin]->SetMarkerColor(color[nbin]); gr0[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn0,eta_err,rn0_err); gr0[jj][nbin]->SetMarkerColor(color[nbin]); gr1[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn1,eta_err,rn1_err); gr1[jj][nbin]->SetMarkerColor(color[nbin]); gr_ratio[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_ratio,eta_err,rn_ratio_err); gr_ratio[jj][nbin]->SetMarkerColor(color[nbin]); gr_total[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_total,eta_err,rn_total_err); gr_total[jj][nbin]->SetMarkerColor(color[nbin]); /* gr[jj][nbin]->SetMarkerSize(gr[jj][1]->GetMarkerSize()*0.8); gr0[jj][nbin]->SetMarkerSize(gr0[jj][1]->GetMarkerSize()*0.8); gr1[jj][nbin]->SetMarkerSize(gr1[jj][1]->GetMarkerSize()*0.8); gr_ratio[jj][nbin]->SetMarkerSize(gr_ratio[jj][1]->GetMarkerSize()*0.8); */ // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5)*(-x-4.5))/(1+[0]*(x-4.5)*(x-4.5))",0,3.0); // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1+[0]*(x-4.5))",0,3.0); if(jj<8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-4.6))/exp([0]*(x-4.6))",0.0,2.5); else fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-3.5))/exp([0]*(x-3.5))",0.0,1.1); fit[jj][nbin]->SetParameter(0,0.01); gr[jj][nbin]->Fit(Form("fit_%d_%d",nbin,jj),"RNO"); fit[jj][nbin]->SetLineColor(color[nbin]); fit[jj][nbin]->SetLineStyle(9); fit[jj][nbin]->SetLineWidth(1); if(jj<8) { slope[nbin][jj] = fit[jj][nbin]->GetParameter(0); slope_err[nbin][jj] = fit[jj][nbin]->GetParError(0); } else { slope1[nbin][jj-8] = fit[jj][nbin]->GetParameter(0); slope1_err[nbin][jj-8] = fit[jj][nbin]->GetParError(0); } // fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1-4.5*[0])",0,4.5); fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"exp(-[0]*x)",0,5); fit1_aver[jj][nbin]->SetParameter(0,fit[jj][nbin]->GetParameter(0)); fit1_aver[jj][nbin]->SetParError(0,fit[jj][nbin]->GetParError(0)); fit1_aver[jj][nbin]->SetLineStyle(1); fit1_aver[jj][nbin]->SetLineColor(color[nbin]); gr1_band[jj][nbin] = new TGraph(53); for(int mm=0;mm<26;mm++) { gr1_band[jj][nbin]->SetPoint(mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)+fit1_aver[jj][nbin]->GetParError(0)))); gr1_band[jj][nbin]->SetPoint(51-mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)-fit1_aver[jj][nbin]->GetParError(0)))); } gr1_band[jj][nbin]->SetPoint(52,0,1); gr1_band[jj][nbin]->SetFillColor(color[nbin]-10); } } ofstream ff("r2r3_eta_mc.txt"); double cent[8]={0.01,0.025,0.075,0.15,0.25,0.35,0.45,0.55}; double cent_err[8]={0}; TGraphErrors* gr_slope[6]; TGraphErrors* gr1_slope[6]; for(int nbin=1;nbin<4;nbin++) { gr_slope[nbin] = new TGraphErrors(8,cent,slope[nbin],cent_err,slope_err[nbin]); gr_slope[nbin]->SetName(Form("gr_slope_%d",nbin)); cout<<"i="<<nbin+1<<endl; ff<<"i="<<nbin+1<<endl; for(int j=0;j<8;j++) { cout<<slope[nbin][j]<<" "; ff<<slope[nbin][j]<<", ";} cout<<endl; ff<<endl; for(int j=0;j<8;j++) { cout<<slope_err[nbin][j]<<" "; ff<<slope_err[nbin][j]<<", ";} cout<<endl; ff<<endl; } for(int nbin=1;nbin<4;nbin++) { gr1_slope[nbin] = new TGraphErrors(8,cent,slope1[nbin],cent_err,slope1_err[nbin]); gr1_slope[nbin]->SetName(Form("gr1_slope_%d",nbin)); } ff.close(); TString histtitle[8] = {"0-0.2%","0-5%","5-10%","10-20%","20-30%","30-40%","40-50%","50-60%"}; TLine* ll = new TLine(0,1.,5.0,1.); TCanvas* c = new TCanvas("c","c",850,500); makeMultiPanelCanvas(c,3,2,0.01,0.0,0.2,0.2,0.02); // TH2D* htmp = new TH2D("htmp",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.905,1.019); TH2D* htmp = new TH2D("htmp",";#eta^{a};#sqrt{r_{2}(#eta^{a},#eta^{b}) #times r_{2}(-#eta^{a},-#eta^{b})}",100,-0.1,2.5,100,0.905-0.8,1.019+0.5); fixedFontHist(htmp,1.8,2.2); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<6;jj++) { c->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); /* gr_total[jj][1]->SetMarkerStyle(34); gr_total[jj][1]->SetMarkerColor(1); gr_total[jj][1]->Draw("Psame"); gr[jj][1]->SetMarkerStyle(28); gr[jj][1]->SetMarkerColor(1); gr[jj][1]->Draw("Psame"); */ gr_total[jj+8][1]->SetMarkerStyle(21); gr_total[jj+8][1]->SetMarkerColor(4); gr_total[jj+8][1]->Draw("Psame"); } TLatex* latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(1.5*latex2->GetTextSize()); c->cd(1); latex2->DrawLatex(0.26,0.05,"0-20%"); latex2->DrawLatex(0.24,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); latex2->DrawLatex(0.6,0.1,"4.4 < #eta^{b} < 5"); c->cd(2); latex2->DrawLatex(0.08,0.05,"20-40%"); latex2->DrawLatex(0.07,0.3,"0.3 < p_{T}^{a} < 3 GeV/c"); latex2->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); c->cd(3); latex2->DrawLatex(0.08,0.05,"40-60%"); c->cd(6); latex2->SetTextSize(0.92*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,"40-60%"); c->cd(5); latex2->SetTextSize(0.95*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,"20-40%"); c->cd(4); latex2->SetTextSize(latex2->GetTextSize()); latex2->DrawLatex(0.26,0.24,"0-20%"); latex2->DrawLatex(0.6,0.3,"3 < #eta^{b} < 4"); TLegend* legend2 = new TLegend(0.2,0.24,0.7,0.54); legend2->SetFillStyle(0); legend2->AddEntry(gr_total[16][1],"Data","P"); legend2->AddEntry(gr_total[8][1],"Hydjet, gen-level","P"); legend2->AddEntry(gr_total[0][1],"Hydjet, reco-level","P"); c->cd(1); legend2->Draw("same"); // SaveCanvas(c,"HI/FactBreak","epetadeco_HI_MCcompareTotal_r2"); return; TCanvas* ccaa = new TCanvas("ccaa","ccaa",900,500); makeMultiPanelCanvas(ccaa,4,2,0.01,0.0,0.2,0.2,0.02); for(int jj=0;jj<8;jj++) { ccaa->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr0[jj][1]->SetMarkerStyle(21); gr0[jj][1]->Draw("Psame"); gr1[jj][1]->SetMarkerStyle(25); gr1[jj][1]->Draw("Psame"); } TCanvas* ccbb = new TCanvas("ccbb","ccbb",900,500); makeMultiPanelCanvas(ccbb,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmpaa = new TH2D("htmpaa",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.97,1.03); for(int jj=0;jj<8;jj++) { ccbb->cd(jj+1); htmpaa->Draw(); ll->Draw("Lsame"); gr_ratio[jj][1]->SetMarkerStyle(21); gr_ratio[jj][1]->Draw("Psame"); } TCanvas* cc = new TCanvas("cc","cc",900,500); makeMultiPanelCanvas(cc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp1 = new TH2D("htmp1",";#eta^{a};r_{3}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.831,1.06); fixedFontHist(htmp1,1.8,2.2); htmp1->GetXaxis()->CenterTitle(); htmp1->GetYaxis()->CenterTitle(); htmp1->GetYaxis()->SetTitleSize(htmp1->GetYaxis()->GetTitleSize()*1.2); htmp1->GetXaxis()->SetTitleSize(htmp1->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { cc->cd(jj+1); htmp1->Draw(); ll->Draw("Lsame"); gr[jj][2]->SetMarkerStyle(21); gr[jj][2]->Draw("Psame"); fit[jj][2]->Draw("Lsame"); gr[jj+8][2]->SetMarkerStyle(25); // fit[jj+8][2]->SetLineStyle(5); gr[jj+8][2]->Draw("Psame"); // fit[jj+8][2]->Draw("Lsame"); } TLatex* latex3 = new TLatex(); latex3->SetNDC(); latex3->SetTextSize(1.5*latex3->GetTextSize()); cc->cd(1); latex3->DrawLatex(0.26,0.05,histtitle[0]); latex3->DrawLatex(0.24,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cc->cd(2); latex3->DrawLatex(0.08,0.05,histtitle[1]); latex3->DrawLatex(0.07,0.28,"0.3 < p_{T}^{a} < 3 GeV/c"); latex3->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); cc->cd(4); latex3->DrawLatex(0.08,0.05,histtitle[3]); cc->cd(3); latex3->DrawLatex(0.08,0.05,histtitle[2]); cc->cd(8); latex3->DrawLatex(0.08,0.24,histtitle[7]); cc->cd(7); latex3->DrawLatex(0.08,0.24,histtitle[6]); cc->cd(6); latex3->SetTextSize(0.96*latex3->GetTextSize()); latex3->DrawLatex(0.08,0.24,histtitle[5]); cc->cd(5); latex3->SetTextSize(0.85*latex3->GetTextSize()); latex3->DrawLatex(0.26,0.24,histtitle[4]); TLegend* legend3 = new TLegend(0.24,0.14,0.51,0.38); legend3->SetFillStyle(0); legend3->AddEntry(gr[0][1],"4.4<#eta^{b}<5","P"); legend3->AddEntry(gr[8][1],"3<#eta^{b}<4","P"); cc->cd(1); legend3->Draw("same"); /* TCanvas* ccc = new TCanvas("ccc","ccc",900,500); makeMultiPanelCanvas(ccc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp2 = new TH2D("htmp2",";#eta^{a};r_{4}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp2,1.8,2.2); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); htmp2->GetYaxis()->SetTitleSize(htmp2->GetYaxis()->GetTitleSize()*1.2); htmp2->GetXaxis()->SetTitleSize(htmp2->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { ccc->cd(jj+1); htmp2->Draw(); ll->Draw("Lsame"); gr[jj][3]->Draw("Psame"); fit[jj][3]->Draw("Lsame"); gr[jj+8][3]->Set_arkerStyle(25); fit[jj+8][3]->SetLineStyle(5); gr[jj+8][3]->Draw("Psame"); fit[jj+8][3]->Draw("Lsame"); } */ TCanvas* c1 = new TCanvas("c1","c1",500,500); TH2D* htmp2 = new TH2D("htmp2",";Centrality;C",100,0,1.0,100,0.0,0.06); htmp2->Draw(); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); gr_slope[1]->SetMarkerColor(1); gr_slope[2]->SetMarkerColor(1); gr_slope[1]->SetMarkerStyle(21); gr_slope[2]->SetMarkerStyle(22); gr_slope[1]->Draw("PESAME"); gr_slope[2]->Draw("PESAME"); gr1_slope[1]->SetMarkerColor(1); gr1_slope[2]->SetMarkerColor(1); gr1_slope[1]->SetMarkerStyle(25); gr1_slope[2]->SetMarkerStyle(26); gr1_slope[1]->Draw("PESAME"); gr1_slope[2]->Draw("PESAME"); return; TFile* f_slope_out = new TFile("gr_slope_v2v3.root","recreate"); gr_slope[1]->Write(); gr_slope[2]->Write(); gr1_slope[1]->Write(); gr1_slope[2]->Write(); f_slope_out->Close(); return; SaveCanvas(c,"HI/FactBreak","epetadeco_HI_r2"); SaveCanvas(cc,"HI/FactBreak","epetadeco_HI_r3"); SaveCanvas(ccaa,"HI/FactBreak","epetadeco_HI_r2ratio"); // SaveCanvas(c1,"HI/FactBreak","epetadeco_HI_C"); // SaveCanvas(cc2,"HI/FactBreak","epetadeco_HI_cos"); }
void Corr2D(){ gStyle->SetOptStat(kFALSE); TCanvas *c1 = new TCanvas("c1a", "c1",0,0,600,600); gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetErrorX(0); c1->Range(0,0,1,1); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetTickx(1); c1->SetTicky(1); c1->SetLeftMargin(0.13); c1->SetRightMargin(0.13); c1->SetTopMargin(0.05); c1->SetBottomMargin(0.1); c1->SetFrameFillStyle(0); c1->SetFrameBorderMode(0); gStyle->SetOptStat(0); gStyle->SetPadBottomMargin(0.04); gStyle->SetPadTopMargin (0.025); gStyle->SetPadLeftMargin (0.04); gStyle->SetPadRightMargin (0.025); gStyle->SetPadTickX (1); gStyle->SetPadTickY (1); TCanvas *c2=(TCanvas*)c1->Clone("c2");c2->SetName("c2"); TCanvas *c3=(TCanvas*)c1->Clone("c3");c2->SetName("c3"); TString namelist[3]={"Etaphi","ptEta","ptphi"}; TString histonameID; TH2D* hFrame=new TH2D("","",20000,-1000,1000,800,-4,4); for(int i=0;i<3;i++){ TString name=namelist[i]; if(i==0) c1->cd(); else if(i==1) c2->cd(); else c3->cd(); if(name=="Etaphi") histonameID="jetEtaphi_0-100%"; else if(name=="ptEta") histonameID="jetptEta_0-100%"; else histonameID="jetptphi_0-100%"; TH2F* hdata2F=(TH2F*)fdata->Get(histonameID); if(name.Contains("pt")){ hFrame->GetXaxis()->SetTitle("p_{T}^{jet} (GeV/c)"); hFrame->GetXaxis()->SetRangeUser(50,600); hdata2F->SetMaximum(1e-5); hdata2F->SetMinimum(1e-11); //hFrame->SetAxisRange(0,1e-6,"Z"); } if(name.Contains("phi")){ hFrame->GetYaxis()->SetTitle("jet #phi"); hFrame->GetYaxis()->SetRangeUser(-3.2,3.2); } if(name.Contains("Eta")) if(name.Contains("pt")){ hFrame->GetYaxis()->SetTitle("jet #eta"); hFrame->GetYaxis()->SetRangeUser(-3.1,3.1); } else{ hFrame->GetXaxis()->SetTitle("jet #eta"); hFrame->GetXaxis()->SetRangeUser(-3.2,3.2); hdata2F->SetMaximum(1e-6); hdata2F->SetMinimum(1e-9); } fixedFontHist(hFrame,1,1); hFrame->DrawCopy(); c1->SetLogz(); hdata2F->DrawCopy("colz same"); gPad->RedrawAxis(); c1->Print(Form("pic/DataMC/Corr2D_%s.png",name.Data())); c1->Print(Form("pic/DataMC/Corr2D_%s.pdf",name.Data())); } }
void recopthatdis(){ TCanvas *c1 = new TCanvas("c1a", "c1",0,0,600,600); gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetErrorX(0); c1->Range(0,0,1,1); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetTickx(1); c1->SetTicky(1); c1->SetLeftMargin(0.13); c1->SetRightMargin(0.06); c1->SetTopMargin(0.05); c1->SetBottomMargin(0.12); //double binbound_pt[]={30,40,50,60,70,80,90,100,110,120,140,160,180,200,220,260,300,350,500}; //const double binbound_pt[]={0,5,10,15,20,30,45,60,75,90,105,120,140,160,180,200,220,260,300,400,600,1000}; const double binbound_pt[]={ 3, 4, 5, 7, 9, 12, 15, 18, 22, 27, 33, 39, 47, 55, 64,74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 429, 692, 1000}; int Nbin_pt=sizeof(binbound_pt)/sizeof(double)-1; int pts=18,ptl=22; const int N=8; const TString etabinname[N]={"12_22","7_12","3_7","-3_3","-7_-3","-12_-7","-22_-12",""}; const double etabin[N]={1.0,0.5,0.4,0.6,0.4,0.5,1,2}; const TString etastring[N]={"-2.2<#eta_{CM}<-1.2","-1.2<#eta_{CM}<-0.7","-0.7<#eta_{CM}<-0.3","-0.3<#eta_{CM}<0.3","0.3<#eta_{CM}<0.7","0.7<#eta_{CM}<1.2","1.2<#eta_{CM}<2.2","-1.0<#eta_{CM}<1.0"}; TH1F* hFrame=new TH1F("","",1000,0,1000); fixedFontHist(hFrame,1.2,1.6); hFrame->SetTitle(""); //hFrame->GetXaxis()->SetTitle("p_{T}^{gen} (GeV/c)"); hFrame->GetXaxis()->SetTitle("p_{T}^{jet} (GeV/c)"); //hFrame->GetYaxis()->SetTitle("Event Fraction"); hFrame->GetYaxis()->SetTitle("Event Probability"); hFrame->GetXaxis()->SetLimits(10,60); hFrame->GetYaxis()->SetRangeUser(0,6e-3); hFrame->DrawCopy(); TLegend* leg1=new TLegend(0.6,0.5,0.78,0.6); leg1->SetBorderSize(0); leg1->SetFillColor(0); leg1->SetTextSize(0.04); TLatex *T1=new TLatex(); T1->SetNDC(); T1->SetTextAlign(12); T1->SetTextSize(0.04); T1->SetTextColor(1); T1->SetTextFont(42); T1->DrawLatex(0.2,0.88,"p_{T}^{hat}=15(GeV/c) PYTHIA+HIJING"); T1->DrawLatex(0.2,0.83,"CMS simulation"); T1->DrawLatex(0.55,0.25,Form("%d<=p_{T}^{ref}<%d (GeV/c)",pts,ptl)); TH2F* histo2F[N]; TH1F* histo[N]; TH2F* histo2Fnocut; TH1F* histonocut; for(int i=0;i<1;i++){ if(i==0) histo2F[i]=(TH2F*)fPPb->Get(Form("refptpt_0-100%%")); else histo2F[i]=(TH2F*)fPPb->Get(Form("refptptEtaBin%s_Cen0-100%%",etabinname[i].Data())); histo2Fnocut=(TH2F*)fPPb->Get(Form("refptptnocut_0-100%%")); histo[i]=(TH1F*)histo2F[i]->ProjectionY(Form("histo_%d",i),histo2F[i]->GetXaxis()->FindBin(pts),histo2F[i]->GetXaxis()->FindBin(ptl)); histonocut=(TH1F*)histo2Fnocut->ProjectionY(Form("histonocut"),histo2Fnocut->GetXaxis()->FindBin(pts),histo2Fnocut->GetXaxis()->FindBin(ptl)); //histo[i]->Scale(1./histo[i]->Integral()); histo[i]->SetMarkerColor(colorCode[7]); histonocut->SetMarkerColor(colorCode[6]); histo[i]->SetLineColor(colorCode[7]); histonocut->SetLineColor(colorCode[6]); histo[i]->SetMarkerSize(1.2); histonocut->SetMarkerSize(1.2); histo[i]->SetMarkerStyle(markerCode[7]); histonocut->SetMarkerStyle(markerCode[6]); histo[i]->Draw("same"); histonocut->Draw("same"); //leg1->AddEntry(histo[i],"|#eta| < 3","lp"); leg1->AddEntry(histo[i],"rawpt cut >22","lp"); leg1->AddEntry(histonocut,"no cut","lp"); } leg1->Draw("same"); //for(int i=0;i<1;i++) if(i!=3) histo[i]->Draw("same"); T1->Draw("same"); gPad->RedrawAxis(); TString outname="recopthatdis"; c1->Print(Form("%sPPb.png",outname.Data())); c1->Print(Form("%sPPb.pdf",outname.Data())); }
void DrawRealProf() { gStyle->SetOptStat(kFALSE); gStyle->SetErrorX(0); TH1F* hFrame=new TH1F("","",1000,0,1000); c1 = new TCanvas("c1","",600,600); makeMultiPanelCanvas(c1,1,1,-0.12,0,0.17,0.12,0.03); fixedFontHist(hFrame,1.5,1.8); hFrame->SetTitle(""); hFrame->GetYaxis()->SetTitleSize(0.035); hFrame->GetXaxis()->SetRangeUser(29,600); hFrame->GetYaxis()->SetRangeUser(0.18,0.32); TLegend *leg1=new TLegend(0.18,0.70,0.40,0.95); leg1->SetBorderSize(0); leg1->SetFillColor(0); leg1->SetTextSize(0.04); leg1->Draw("same"); TLatex *T=new TLatex(); T->SetNDC(); T->SetTextAlign(12); T->SetTextSize(0.05); T->SetTextColor(1); T->SetTextFont(42); TLine *l = new TLine(0,1,2,1); l->SetLineStyle(2); TProfile* histo0[Neta]; for(int i=0; i<Neta; i++) { histo0[i] = makehisto(ilist,i); } //TH1D* histo0 = makehisto(ilist2,i,0.975); //TH1D* histo0 = makehisto(ilist1,i,0.05); c1->cd(1); hFrame->GetYaxis()->SetTitle(histo0[0]->GetTitle()); hFrame->GetXaxis()->SetTitle("p_{T} [GeV/c]"); hFrame->DrawCopy(); //leg1->SetHeader(Form("ratio of %s",etastring[Neta-1].Data())); for(int i=0; i<Neta; i++) { histo0[i]->SetMarkerStyle(markerCode[i]); histo0[i]->SetMarkerColor(colorCode[i]); histo0[i]->SetLineColor(colorCode[i]); /* ratio[i][j]=(TH1D*)histo0[i][j]->Clone(Form("ratio_%d_%d",i,j)); if(i!=Neta-1){ ratio[i][j]->Divide(histo0[Neta-1][j]); ratio[i][j]->Draw("E1same"); if(j==0) leg1->AddEntry(ratio[i][j],Form("%s",etastring[i].Data()),"lp"); } */ histo0[i]->Draw("same"); leg1->AddEntry(histo0[i],etastring[i],"lp"); } T->DrawLatex(0.65,0.85,"Real jet"); leg1->Draw("same"); //l->Draw("same"); c1->Print(Form("RealProfPPb%s.pdf",JetIDNameList[ilist].Data())); c1->Print(Form("RealProfPPb%s.png",JetIDNameList[ilist].Data())); }
void Factorization_eta_pPb() { const int nfiles = 15; TString filename[nfiles]; filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n150185_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n185220_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n220260_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n260_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n120150_pttrg033_ptassallweight_etaass445_eff1_all_v42.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n150185_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n185220_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n220260_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n260_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n120150_pttrg033_ptassallweight_etaass34_eff1_all_v42.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n150185_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n185220_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n220260_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n260_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/PAData_Minbias_5TeV/merged/epetadeco_n120150_pttrg033_ptassallweight_etaass45_eff1_all_v42.root"); const int ntrgbins = 16; const int ntrgbins1 = ntrgbins; const int ntrgbins2 = ntrgbins/2; TGraphErrors* gr[nfiles][6]; TGraphErrors* gr1[nfiles][6]; TGraphErrors* gr_tot[nfiles][6]; TGraphErrors* gr_ratio[nfiles][6]; TGraph* gr_band[nfiles][6]; TGraph* gr1_band[nfiles][6]; TF1* fit[nfiles][6]; TF1* fit_aver[nfiles][6]; TF1* fit1_aver[nfiles][6]; double slope[6][nfiles]; double slope_err[6][nfiles]; double slope1[6][nfiles]; double slope1_err[6][nfiles]; // double eta[ntrgbins2] = {0.12,0.36,0.6,0.84,1.08,1.32,1.56,1.8,2.04,2.28}; // double eta[ntrgbins2] = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3}; double eta[ntrgbins2] = {0.15,0.45,0.75,1.05,1.35,1.65,1.95,2.25}; // double eta[ntrgbins2] = {0.2,0.6,1.0,1.4,1.8,2.2}; double eta_err[ntrgbins2] = {0.0}; Color_t color[6] = {1,kRed, kBlue, kGreen+2,1,1}; TFile* fdiff[nfiles]; for(int jj=0;jj<nfiles;jj++) { fdiff[jj] = new TFile(filename[jj].Data()); TH2D* hsignal[ntrgbins]; TH2D* hbackground[ntrgbins]; TH2D* hsignal1[ntrgbins]; TH2D* hbackground1[ntrgbins]; TH1D* hsignal_1D[ntrgbins][6]; TH1D* hbackground_1D[ntrgbins][6]; TH1D* hsignal1_1D[ntrgbins][6]; TH1D* hbackground1_1D[ntrgbins][6]; for(int i=0;i<ntrgbins;i++) { hsignal[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/signalcosn_trg%d",i)); hbackground[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/backgroundcosn_trg%d",i)); /* hsignal_1D[i] = (TH1D*)hsignal[i]->ProfileY(Form("signal_1D_trg%d",i),-1,-1,"e"); hsignal1_1D[i] = (TH1D*)hsignal1[i]->ProfileY(Form("signal1_1D_trg%d",i),-1,-1,"e"); hbackground_1D[i] = (TH1D*)hbackground[i]->ProfileY(Form("background_1D_trg%d",i),-1,-1,"e"); hbackground1_1D[i] = (TH1D*)hbackground1[i]->ProfileY(Form("background1_1D_trg%d",i),-1,-1,"e"); */ for(int nbin=1;nbin<2;nbin++) { hsignal_1D[i][nbin] = (TH1D*)hsignal[i]->ProjectionX(Form("signal_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); hbackground_1D[i][nbin] = (TH1D*)hbackground[i]->ProjectionX(Form("background_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); hsignal1_1D[i][nbin] = (TH1D*)hsignal1[i]->ProjectionX(Form("signal1_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); hbackground1_1D[i][nbin] = (TH1D*)hbackground1[i]->ProjectionX(Form("background1_1D_trg%d_%d",i,nbin),nbin,nbin,"i"); } } for(int nbin=1;nbin<2;nbin++) { double Vn[ntrgbins1]; double VnError[ntrgbins1]; double rn[ntrgbins2]; double rn_err[ntrgbins2]; double Vn1[ntrgbins1]; double VnError1[ntrgbins1]; double rn1[ntrgbins2]; double rn1_err[ntrgbins2]; double rn_tot[ntrgbins2]; double rn_tot_err[ntrgbins2]; double rn_ratio[ntrgbins2]; double rn_ratio_err[ntrgbins2]; for(int i=0;i<ntrgbins1;i++) { if(nbin==1 && jj==3 ) cout<<nbin<<" "<<i<<" "<<hsignal1_1D[i][nbin]->GetMean()<<" "<<hsignal1_1D[i][nbin]->GetMeanError()<<" "<<hbackground1_1D[i][nbin]->GetMean()<<" "<<hbackground1_1D[i][nbin]->GetMeanError()<<endl; /* Vn[i]=hsignal_1D[i]->GetBinContent(nbin)-hbackground_1D[i]->GetBinContent(nbin); VnError[i]=sqrt(hsignal_1D[i]->GetBinError(nbin)*hsignal_1D[i]->GetBinError(nbin)+hbackground_1D[i]->GetBinError(nbin)*hbackground_1D[i]->GetBinError(nbin)); Vn1[i]=hsignal1_1D[i]->GetBinContent(nbin)-hbackground1_1D[i]->GetBinContent(nbin); VnError1[i]=sqrt(hsignal1_1D[i]->GetBinError(nbin)*hsignal1_1D[i]->GetBinError(nbin)+hbackground1_1D[i]->GetBinError(nbin)*hbackground1_1D[i]->GetBinError(nbin)); */ Vn[i]=hsignal_1D[i][nbin]->GetMean()-hbackground_1D[i][nbin]->GetMean(); VnError[i]=sqrt(hsignal_1D[i][nbin]->GetMeanError()*hsignal_1D[i][nbin]->GetMeanError()+hbackground_1D[i][nbin]->GetMeanError()*hbackground_1D[i][nbin]->GetMeanError()); Vn1[i]=hsignal1_1D[i][nbin]->GetMean()-hbackground1_1D[i][nbin]->GetMean(); VnError1[i]=sqrt(hsignal1_1D[i][nbin]->GetMeanError()*hsignal1_1D[i][nbin]->GetMeanError()+hbackground1_1D[i][nbin]->GetMeanError()*hbackground1_1D[i][nbin]->GetMeanError()); } for(int i=0;i<ntrgbins2;i++) { rn[ntrgbins2-i-1]=Vn[i]/Vn[ntrgbins1-i-1]; rn_err[ntrgbins2-i-1]=sqrt((VnError[ntrgbins1-i-1]/Vn[ntrgbins1-i-1])**2+(VnError[i]/Vn[i])**2); rn1[ntrgbins2-i-1]=Vn1[i]/Vn1[ntrgbins1-i-1]; rn1_err[ntrgbins2-i-1]=sqrt((VnError1[ntrgbins1-i-1]/Vn1[ntrgbins1-i-1])**2+(VnError1[i]/Vn1[i])**2); if(nbin==1 && jj==3 ) cout<<rn1[ntrgbins2-i-1]<<" "<<rn1_err[ntrgbins2-i-1]<<endl; rn_tot[ntrgbins2-i-1] = sqrt(rn[ntrgbins2-i-1]*rn1[ntrgbins2-i-1]); rn_tot_err[ntrgbins2-i-1] = rn_tot[ntrgbins2-i-1]*0.5*sqrt(rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]*rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]); rn_ratio[ntrgbins2-i-1] = sqrt(rn[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]); rn_ratio_err[ntrgbins2-i-1] = rn_ratio[ntrgbins2-i-1]*sqrt(rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]*rn_err[ntrgbins2-i-1]/rn[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]/rn1[ntrgbins2-i-1])*0.5; } gr[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn,eta_err,rn_err); gr[jj][nbin]->SetMarkerColor(color[nbin]); gr1[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn1,eta_err,rn1_err); gr1[jj][nbin]->SetMarkerColor(color[nbin]); gr_tot[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_tot,eta_err,rn_tot_err); gr_tot[jj][nbin]->SetMarkerColor(color[nbin]); // gr_tot[jj][nbin]->SetMarkerSize(0.9*gr_tot[jj][nbin]->GetMarkerSize()); gr_ratio[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_ratio,eta_err,rn_ratio_err); gr_ratio[jj][nbin]->SetMarkerColor(color[nbin]); if(jj<5) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp(2*[0]*(-x-4.6))/exp(2*[0]*(x-4.6))",0.0,2.5); else if(jj>=5 && jj<10) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp(2*[0]*(-x-3.5))/exp(2*[0]*(x-3.5))",0.0,1.1); else if(jj>=10) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp(2*[0]*(-x-4.6))/exp(2*[0]*(x-4.6))",0.0,2.06); /* if(jj<4) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1-[1]+[1]*exp([0]*(-x-4.5)))/(1-[1]+[1]*exp([0]*(x-4.5)))",0.0,2.5); else if(jj>=4 && jj<8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1-[1]+[1]*exp([0]*(-x-3.5)))/(1-[1]+[1]*exp([0]*(x-3.5)))",0.0,1.4); else if(jj>=8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1-[1]+[1]*exp([0]*(-x-4.7)))/(1-[1]+[1]*exp([0]*(x-4.7)))",0.0,2.5); */ fit[jj][nbin]->SetParameter(0,0.01); fit[jj][nbin]->SetParameter(1,0.1); fit[jj][nbin]->SetParLimits(1,0,0.2); gr_tot[jj][nbin]->Fit(Form("fit_%d_%d",nbin,jj),"RNO"); fit[jj][nbin]->SetLineColor(color[nbin]); fit[jj][nbin]->SetLineStyle(9); fit[jj][nbin]->SetLineWidth(1); if(jj<5) { slope[nbin][jj] = fit[jj][nbin]->GetParameter(0); slope_err[nbin][jj] = fit[jj][nbin]->GetParError(0); } else { slope1[nbin][jj-10] = fit[jj][nbin]->GetParameter(0); slope1_err[nbin][jj-10] = fit[jj][nbin]->GetParError(0); } // fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"[1]*exp(-[0]*x)+1-[1]",0,5.0); fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"exp(-[0]*x)",0,5.0); fit1_aver[jj][nbin]->SetParameter(0,fit[jj][nbin]->GetParameter(0)); fit1_aver[jj][nbin]->SetParError(0,fit[jj][nbin]->GetParError(0)); // fit1_aver[jj][nbin]->SetParameter(1,fit[jj][nbin]->GetParameter(1)); // fit1_aver[jj][nbin]->SetParError(1,fit[jj][nbin]->GetParError(1)); fit1_aver[jj][nbin]->SetLineStyle(1); fit1_aver[jj][nbin]->SetLineColor(color[nbin]); gr1_band[jj][nbin] = new TGraph(53); for(int mm=0;mm<26;mm++) { gr1_band[jj][nbin]->SetPoint(mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)+fit1_aver[jj][nbin]->GetParError(0)))); gr1_band[jj][nbin]->SetPoint(51-mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)-fit1_aver[jj][nbin]->GetParError(0)))); } gr1_band[jj][nbin]->SetPoint(52,0,1); gr1_band[jj][nbin]->SetFillColor(color[nbin]-10); } } ofstream ff("r2_eta_pPb.txt"); for(int nbin=1;nbin<2;nbin++) { cout<<"i="<<nbin+1<<endl; ff<<"i="<<nbin+1<<endl; for(int j=0;j<5;j++) { cout<<slope[nbin][j]<<" "; ff<<slope[nbin][j]<<", ";} cout<<endl; ff<<endl; for(int j=0;j<5;j++) { cout<<slope_err[nbin][j]<<" "; ff<<slope_err[nbin][j]<<", ";} cout<<endl; ff<<endl; } TString histtitle[5] = {"120 #leq N_{trk}^{offline} < 150", "150 #leq N_{trk}^{offline} < 185", "185 #leq N_{trk}^{offline} < 220", "220 #leq N_{trk}^{offline} < 260", "N_{trk}^{offline} #geq 260"}; TLine* ll = new TLine(0,1.,2.65,1.); TCanvas* c = new TCanvas("c","c",530,500); makeMultiPanelCanvas(c,2,2,0.01,0.0,0.2,0.18,0.02); TH2D* htmp = new TH2D("htmp",";#eta^{a};#sqrt{r_{2}(-#eta^{a},-#eta^{b}) #times r_{2}(#eta^{a},#eta^{b})}",100,-0.1,2.5,100,0.601,1.06); fixedFontHist(htmp,1.8,2.1); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<4;jj++) { c->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr_tot[jj][1]->SetMarkerStyle(25); gr_tot[jj][1]->Draw("Psame"); fit[jj][1]->Draw("Lsame"); gr_tot[jj+5][1]->SetMarkerStyle(24); gr_tot[jj+5][1]->Draw("Psame"); gr_tot[jj+10][1]->SetMarkerStyle(28); gr_tot[jj+10][1]->SetMarkerColor(1); gr_tot[jj+10][1]->Draw("Psame"); /* gr_tot[jj+8][1]->SetMarkerStyle(28); fit[jj+8][1]->SetLineStyle(9); gr_tot[jj+8][1]->Draw("Psame"); fit[jj+8][1]->Draw("Lsame"); */ } TLatex* latex = new TLatex(); latex->SetNDC(); latex->SetTextSize(1.3*latex->GetTextSize()); c->cd(1); latex->DrawLatex(0.27,0.05,histtitle[0]); // latex->DrawLatex(0.58,0.74,"0.3 < p_{T}^{a} < 3 GeV/c"); // latex->DrawLatex(0.58,0.65,"p_{T}^{b} > 0 GeV/c"); latex->DrawLatex(0.24,0.885,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); latex->DrawLatex(0.68,0.7,"L_{int} = 35 nb^{-1}"); c->cd(2); latex->DrawLatex(0.12,0.27,"0.3 < p_{T}^{a} < 3 GeV/c"); latex->DrawLatex(0.12,0.18,"p_{T}^{b} > 0 GeV/c"); latex->DrawLatex(0.09,0.05,histtitle[1]); c->cd(4); latex->SetTextSize(0.9*latex->GetTextSize()); latex->DrawLatex(0.09,0.22,histtitle[3]); latex->SetTextSize(latex->GetTextSize()/0.9); c->cd(3); latex->SetTextSize(0.85*latex->GetTextSize()); latex->DrawLatex(0.27,0.22,histtitle[2]); TLegend* legend = new TLegend(0.25,0.18,0.62,0.39); legend->SetFillStyle(0); // legend->AddEntry(gr_tot[8][1],"4.4<#eta^{b}<5","P"); legend->AddEntry(gr_tot[0][1],"4.4<#eta^{b}<5","P"); // legend->AddEntry(fit[0][1],"Exponential fit","L"); legend->AddEntry(gr_tot[10][1],"4<#eta^{b}<5","P"); legend->AddEntry(gr_tot[5][1],"3<#eta^{b}<4","P"); // legend->AddEntry(fit[4][1],"Exponential fit","L"); c->cd(1); legend->Draw(); TLine* ll = new TLine(0,1.,5.0,1.); TCanvas* ca = new TCanvas("ca","ca",560,500); makeMultiPanelCanvas(ca,2,2,0.02,0.0,0.27,0.18,0.02); TH2D* htmpa = new TH2D("htmpa",";#eta^{a};#frac{v_{2}(#eta^{a})}{v_{2}(-#eta^{a})} = #sqrt{#frac{r_{2}(#eta^{a},#eta^{b})}{r_{2}(-#eta^{a},-#eta^{b})}}",100,-0.1,2.5,100,0.91,1.045); fixedFontHist(htmpa,1.8,2.7); htmpa->GetXaxis()->CenterTitle(); htmpa->GetYaxis()->CenterTitle(); htmpa->GetYaxis()->SetTitleSize(htmpa->GetYaxis()->GetTitleSize()*1.15); htmpa->GetXaxis()->SetTitleSize(htmpa->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<4;jj++) { ca->cd(jj+1); htmpa->Draw(); ll->Draw("Lsame"); gr_ratio[jj][1]->Draw("Psame"); gr_ratio[jj+5][1]->SetMarkerStyle(24); gr_ratio[jj+5][1]->Draw("Psame"); } TLatex* latex1 = new TLatex(); latex1->SetNDC(); latex1->SetTextSize(1.3*latex1->GetTextSize()); ca->cd(1); latex1->DrawLatex(0.33,0.05,histtitle[0]); latex1->DrawLatex(0.31,0.88,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); latex1->DrawLatex(0.31,0.77,"L_{int} = 35 nb^{-1}"); ca->cd(2); latex1->DrawLatex(0.075,0.05,histtitle[1]); latex1->DrawLatex(0.08,0.29,"0.3 < p_{T}^{a} < 3 GeV/c"); latex1->DrawLatex(0.08,0.19,"p_{T}^{b} > 0 GeV/c"); ca->cd(4); latex1->SetTextSize(0.9*latex1->GetTextSize()); latex1->DrawLatex(0.075,0.22,histtitle[3]); latex1->SetTextSize(latex1->GetTextSize()/0.9); ca->cd(3); latex1->SetTextSize(0.85*latex1->GetTextSize()); latex1->DrawLatex(0.33,0.22,histtitle[2]); TLegend* legend1 = new TLegend(0.34,0.15,0.57,0.35); legend1->SetFillStyle(0); legend1->AddEntry(gr_ratio[0][1],"4.4<#eta^{b}<5","P"); legend1->AddEntry(gr_ratio[5][1],"3<#eta^{b}<4","P"); ca->cd(1); legend1->Draw(); TCanvas* c2 = new TCanvas("c2","c2",810,400); makeMultiPanelCanvas(c2,4,2,0.016,0.0,0.24,0.2,0.02); TH2D* htmp2 = new TH2D("htmp2",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.61,1.06); fixedFontHist(htmp2,1.6,1.8); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); htmp2->GetYaxis()->SetTitleSize(htmp2->GetYaxis()->GetTitleSize()*1.3); htmp2->GetXaxis()->SetTitleSize(htmp2->GetXaxis()->GetTitleSize()*1.); TH2D* htmp2a = (TH2D*)htmp2->Clone("tmp2a"); htmp2a->SetTitle(";#eta^{a};r_{2}(-#eta^{a},-#eta^{b})"); for(int jj=0;jj<4;jj++) { c2->cd(jj+1); htmp2->Draw(); ll->Draw("Lsame"); gr[jj][1]->Draw("Psame"); gr[jj+5][1]->SetMarkerStyle(24); gr[jj+5][1]->Draw("Psame"); c2->cd(jj+5); htmp2a->Draw(); ll->Draw("Lsame"); gr1[jj][1]->Draw("Psame"); gr1[jj+5][1]->SetMarkerStyle(24); gr1[jj+5][1]->Draw("Psame"); } TLatex* latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(1.5*latex2->GetTextSize()); c2->cd(1); latex2->DrawLatex(0.30,0.05,histtitle[0]); latex2->DrawLatex(0.28,0.865,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); c2->cd(2); latex2->DrawLatex(0.08,0.05,histtitle[1]); latex2->DrawLatex(0.07,0.3,"0.3 < p_{T}^{a} < 3 GeV/c"); latex2->DrawLatex(0.07,0.18,"p_{T}^{b} > 0 GeV/c"); c2->cd(4); latex2->DrawLatex(0.08,0.05,histtitle[3]); c2->cd(3); latex2->DrawLatex(0.08,0.05,histtitle[2]); c2->cd(6); latex2->SetTextSize(0.96*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,histtitle[1]); c2->cd(8); latex2->DrawLatex(0.08,0.24,histtitle[3]); c2->cd(7); latex2->DrawLatex(0.08,0.24,histtitle[2]); c2->cd(5); latex2->SetTextSize(0.9*latex2->GetTextSize()); latex2->DrawLatex(0.3,0.24,histtitle[0]); TLegend* legend2 = new TLegend(0.3,0.18,0.6,0.44); legend2->SetFillStyle(0); legend2->AddEntry(gr_ratio[0][1],"4.4<#eta^{b}<5","P"); legend2->AddEntry(gr_ratio[5][1],"3<#eta^{b}<4","P"); c2->cd(1); legend2->Draw(); /* TCanvas* cc2 = new TCanvas("cc2","cc2",530,500); makeMultiPanelCanvas(cc2,2,2,0.01,0.0,0.2,0.18,0.02); TH2D* htmp22 = new TH2D("htmp22",";|#eta^{a}-#eta^{b}|;cos[n(#Psi_{n}(#eta^{a})-#Psi_{n}(#eta^{b}))]",100,0,5,100,0.731,1.06); fixedFontHist(htmp22,1.8,2.2); htmp22->GetXaxis()->CenterTitle(); htmp22->GetYaxis()->CenterTitle(); htmp22->GetYaxis()->SetTitleSize(htmp22->GetYaxis()->GetTitleSize()*1.1); htmp22->GetXaxis()->SetTitleSize(htmp22->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<4;jj++) { cc2->cd(jj+1); htmp22->Draw(); ll->Draw("Lsame"); gr1_band[jj][1]->Draw("Fsame"); fit1_aver[jj][1]->Draw("Lsame"); } TLatex* latex3 = new TLatex(); latex3->SetNDC(); latex3->SetTextSize(1.4*latex3->GetTextSize()); cc2->cd(1); latex3->DrawLatex(0.26,0.05,histtitle[0]); latex3->DrawLatex(0.24,0.865,"CMS pPb #sqrt{s_{NN}} = 5.02 TeV"); cc2->cd(2); latex3->DrawLatex(0.075,0.05,histtitle[1]); cc2->cd(4); latex3->DrawLatex(0.075,0.22,histtitle[3]); cc2->cd(3); latex3->SetTextSize(0.85*latex3->GetTextSize()); latex3->DrawLatex(0.24,0.22,histtitle[2]); */ SaveCanvas(c,"HI/FactBreak","epetadeco_pPb_alletab_r2tot"); SaveCanvas(c2,"HI/FactBreak","epetadeco_pPb_alletab_r2sep"); SaveCanvas(ca,"HI/FactBreak","epetadeco_pPb_alletab_r2ratio"); // SaveCanvas(cc2,"HI/FactBreak","epetadeco_pPb_cos"); }
void plotqfit(int fixv2=0,int fixg2=0){ const int nbin24 = 12; const double avgtrkbin[nbin24]={44.36,54.33,68.63,88.39,108.2,131.3,162.1,196.6,227.5,247.2,269.2,301.2}; const double V24[nbin24]={0.02965,0.03913,0.04832,0.04941,0.04822,0.04955,0.049,0.04805,0.04709,0.04665,0.04772,0.04797}; int xtheta=0; gStyle->SetOptStat(1011); gStyle->SetOptFit(1111); TFile *f = TFile::Open("mergedV_Sum.root"); TFile *fout = TFile::Open("qfitV.root","Update"); TVectorD *vecDNevent = (TVectorD*)f->Get(Form("Nevent")); TVectorD *vecDavgmult = (TVectorD*)f->Get(Form("avgmultall")); TVectorD *vecDtotmult = (TVectorD*)f->Get(Form("totmultall")); TVectorD *vecDavgpt = (TVectorD*)f->Get(Form("avgpt")); TVectorD *vecDavgpt2 = (TVectorD*)f->Get(Form("avgpt2")); TVectorD *vecDavgtrk = (TVectorD*)f->Get(Form("avgtrk")); TVectorD *vecDq22 = (TVectorD*)f->Get(Form("q22")); TVectorD *vecDq24 = (TVectorD*)f->Get(Form("q24")); double avgmultall = vecDtotmult->Sum()/vecDNevent->Sum(); cout<<avgmultall<<endl; double *avgmult = vecDavgmult->GetMatrixArray(); double *avgtrk = vecDavgtrk->GetMatrixArray(); double *avgpt = vecDavgpt->GetMatrixArray(); double *avgpt2 = vecDavgpt2->GetMatrixArray(); double *q22 = vecDq22->GetMatrixArray(); double *q24 = vecDq24->GetMatrixArray(); TLatex *t= new TLatex(); t->SetNDC(); t->SetTextSize(0.04); t->SetTextFont(42); if(fixg2){ TH1D* hq2all = new TH1D("hq2all","hq2all",1000,0,10); for(int ibin=0;ibin<nbin;ibin++){ //ibin<1 TH1D* hq2 = (TH1D*)f->Get(Form("D_%d/hq2",ibin)); hq2all->Add(hq2); } TF1 *ffit = new TF1(Form("ffit"),"1./(0.5*(1+[0]))*TMath::Exp(-([1]*[1]*[2]+x*x)/(1+[0]))*TMath::BesselI0(x*[1]*TMath::Sqrt([2])/(0.5*(1+[0])))",0,10); TF1* f1fit = new TF1(Form("f1fit"),"x/(0.5*(1+[0]))*TMath::Exp(-([1]*[1]*[2]+x*x)/(1+[0]))*TMath::BesselI0(x*[1]*TMath::Sqrt([2])/(0.5*(1+[0])))",0,10); TH1D* hq2all_cp = (TH1D*)hq2all->Clone("hq2all_cp"); hq2all->Scale(1./hq2all->Integral(0,-1,"width")); hq2all->Draw(); divideByBinCenter(hq2all_cp); ffit->SetParameters(1,0.05,avgmultall); f1fit->SetParameters(1,0.05,avgmultall); ffit->FixParameter(2,avgmultall); f1fit->FixParameter(2,avgmultall); hq2all->Fit(Form("f1fit"),"R","",0,10); double g2all = f1fit->GetParameter(0); } for(int ibin=0;ibin<nbin;ibin++){ //ibin<1 // if(ibin!=100) continue; TH1D* hq = (TH1D*)f->Get(Form("D_%d/D_%d/hq",ibin,xtheta)); TH1D* hqx = (TH1D*)f->Get(Form("D_%d/hqx",ibin)); TH1D* hqy = (TH1D*)f->Get(Form("D_%d/hqy",ibin)); TH1D* hq2 = (TH1D*)f->Get(Form("D_%d/hq2",ibin)); TH1D* hq2nonf = (TH1D*)f->Get(Form("D_%d/hq2nonf",ibin)); int k; for(k=0;k<nbin24;k++){ if(avgtrk[ibin]>avgtrkbin[k]&& avgtrk[ibin]<=avgtrkbin[k+1]) break; } //multiplyByBinCenter(hq); hq->Scale(1./hq->Integral(0,-1,"width")); //normalizeByBinWidth(hq); //multiplyByBinCenter(hqx); hqx->Scale(1./hqx->Integral(0,-1,"width")); //normalizeByBinWidth(hqx); //multiplyByBinCenter(hqy); hqy->Scale(1./hqy->Integral(0,-1,"width")); //normalizeByBinWidth(hqy); hq2->Scale(1./hq2->Integral(0,-1,"width")); hq2nonf->Scale(1./hq2nonf->Integral(0,-1,"width")); TF1 *ffit = new TF1(Form("ffit"),"1./(0.5*(1+[0]))*TMath::Exp(-([1]*[1]*[2]+x*x)/(1+[0]))*TMath::BesselI0(x*[1]*TMath::Sqrt([2])/(0.5*(1+[0])))",0,10); TF1* f1fit = new TF1(Form("f1fit"),"x/(0.5*(1+[0]))*TMath::Exp(-([1]*[1]*[2]+x*x)/(1+[0]))*TMath::BesselI0(x*[1]*TMath::Sqrt([2])/(0.5*(1+[0])))",0,10); //ffit = new TF1(Form("ffit"),"1./([0])*TMath::Exp(-([1]*[1]*[2]+x*x)/(2*[0]))*TMath::BesselI0(x*[1]*TMath::Sqrt([2])/([0]))",0,10); //f1fit = new TF1(Form("f1fit"),"x/([0])*TMath::Exp(-([1]*[1]*[2]+x*x)/(2*[0]))*TMath::BesselI0(x*[1]*TMath::Sqrt([2])/([0]))",0,10); ffit->SetParNames("g2","v2","M"); f1fit->SetParNames("g2","v2","M"); //ffit->SetParNames("#sigma2","v2","M"); //f1fit->SetParNames("sigma2","v2","M"); ffit->SetParameters(0.1,0.05,avgmult[ibin]); f1fit->SetParameters(0.1,0.05,avgmult[ibin]); if(fixv2){ ffit->FixParameter(1,V24[k]); f1fit->FixParameter(1,V24[k]); } if(fixg2){ double sigma2 = avgpt2[ibin]/2./avgpt[ibin]/avgpt[ibin]; double g2all = 2*sigma2-1; ffit->FixParameter(0,g2all); f1fit->FixParameter(0,g2all); } //f1fit->FixParameter(0,0); //f1fit->FixParameter(0,0); ffit->FixParameter(2,avgmult[ibin]); f1fit->FixParameter(2,avgmult[ibin]); /* hq->Fit(Form("f1fit"),"R","P",0,10); TCanvas *c2 = new TCanvas("c2","c2",1000,500); c2->Divide(2,1); c2->cd(1)->SetLogy(); fixedFontHist(hqx,1.0,2.0); hqx->SetTitle(""); hqx->GetXaxis()->SetTitle("q_{x}"); hqx->GetYaxis()->SetTitle("#frac{dN}{dq_{x}}"); hqx->GetYaxis()->SetRangeUser(1e-10,1); hqx->Fit(Form("f1fit"),"R","",0,10); c2->cd(2)->SetLogy(); TH1D* hqx_cp = (TH1D*)hqx->Clone("hqx_cp"); fixedFontHist(hqx_cp,1.0,2.0); divideByBinCenter(hqx_cp); hqx_cp->GetYaxis()->SetTitle("#frac{dN}{q_{x}dq_{x}}"); hqx_cp->GetYaxis()->SetRangeUser(1e-10,10); hqx_cp->Fit(Form("ffit"),"R","",0,10); t->DrawLatex(0.5,0.2,Form("N_{trk}^{offline} = %.2f", avgtrk[ibin])); TCanvas *c3 = new TCanvas("c3","c3",1000,500); c3->Divide(2,1); c3->cd(1); fixedFontHist(hqy,1.0,2.0); hqy->SetTitle(""); hqy->GetXaxis()->SetTitle("q_{y}"); hqy->GetYaxis()->SetTitle("#frac{dN}{dq_{y}}"); hqy->GetYaxis()->SetRangeUser(0,1); hqy->SetMarkerStyle(24); hqy->SetMarkerSize(0.5); hqy->Fit(Form("f1fit"),"R","",0,10); hqy->Draw("Psame"); c3->cd(2)->SetLogy(); TH1D* hqy_cp = (TH1D*)hqy->Clone("hqy_cp"); fixedFontHist(hqy_cp,1.0,2.0); divideByBinCenter(hqy_cp); hqy_cp->GetYaxis()->SetTitle("#frac{dN}{q_{y}dq_{y}}"); hqy_cp->GetYaxis()->SetRangeUser(1e-10,10); hqy_cp->SetMarkerStyle(24); hqy_cp->SetMarkerSize(0.5); hqy_cp->Fit(Form("ffit"),"R","",0,10); hqy_cp->Draw("Psame"); t->DrawLatex(0.5,0.2,Form("N_{trk}^{offline} = %.2f",avgtrk[ibin])); */ TCanvas *c4 = new TCanvas("c4","c4",1000,500); c4->Divide(2,1); c4->cd(1)->SetLeftMargin(0.18); fixedFontHist(hq2,1.0,2.0); hq2->SetTitle(""); hq2->GetXaxis()->SetTitle("q_{2}"); hq2->GetYaxis()->SetTitle("#frac{dN}{dq_{2}}"); hq2->GetYaxis()->SetRangeUser(0,1); hq2->SetMarkerStyle(24); hq2->SetMarkerColor(4); hq2->SetLineColor(4); hq2->SetMarkerSize(0.5); hq2->Fit(Form("f1fit"),"R","",0,10); TVectorD vecr; vecr.ResizeTo(8); vecr[0]=f1fit->GetParameter(0); vecr[1]=f1fit->GetParError(0); vecr[2]=f1fit->GetParameter(1); vecr[3]=f1fit->GetParError(1); vecr[4]=avgmult[ibin]; vecr[5]=avgtrk[ibin]; hq2->Draw("Psame"); c4->cd(2)->SetLogy(); c4->cd(2)->SetLeftMargin(0.2); TH1D* hq2_cp = (TH1D*)hq2->Clone("hq2_cp"); fixedFontHist(hq2_cp,1.0,2.0); divideByBinCenter(hq2_cp); hq2_cp->GetYaxis()->SetTitle("#frac{dN}{q_{2}dq_{2}}"); hq2_cp->GetYaxis()->SetRangeUser(1e-10,10); hq2_cp->SetMarkerStyle(24); hq2_cp->SetMarkerColor(4); hq2_cp->SetLineColor(4); hq2_cp->SetMarkerSize(0.5); hq2_cp->Fit(Form("ffit"),"R","",0,10); hq2_cp->Draw("Psame"); t->DrawLatex(0.5,0.2,Form("N_{trk}^{offline} = %.2f", avgtrk[ibin])); TCanvas *c5 = new TCanvas("c5","c5",1000,500); c5->Divide(2,1); c5->cd(1); fixedFontHist(hq2nonf,1.0,2.0); hq2nonf->SetTitle(""); hq2nonf->GetXaxis()->SetTitle("q_{2}"); hq2nonf->GetYaxis()->SetTitle("#frac{dN}{dq_{2}}"); hq2nonf->GetYaxis()->SetRangeUser(0,1); hq2nonf->SetMarkerStyle(24); hq2nonf->SetMarkerColor(4); hq2nonf->SetLineColor(4); hq2nonf->SetMarkerSize(0.5); ffit->SetParameters(1.5,0.05,avgmult[ibin]*2); f1fit->SetParameters(1.5,0.05,avgmult[ibin]*2); ffit->FixParameter(2,avgmult[ibin]*2); f1fit->FixParameter(2,avgmult[ibin]*2); if(fixv2){ ffit->FixParameter(1,V24[k]); f1fit->FixParameter(1,V24[k]); } if(fixg2){ ffit->FixParameter(0,g2all); f1fit->FixParameter(0,g2all); } //ffit->FixParameter(0,1); //f1fit->FixParameter(0,1); hq2nonf->Fit(Form("f1fit"),"R","",0,10); TVectorD vecrnonf; vecrnonf.ResizeTo(8); vecrnonf[0]=f1fit->GetParameter(0); vecrnonf[1]=f1fit->GetParError(0); vecrnonf[2]=f1fit->GetParameter(1); vecrnonf[3]=f1fit->GetParError(1); vecrnonf[4]=avgmult[ibin]; vecrnonf[5]=avgtrk[ibin]; hq2nonf->Draw("Psame"); c5->cd(2)->SetLogy(); TH1D* hq2nonf_cp = (TH1D*)hq2nonf->Clone("hq2nonf_cp"); fixedFontHist(hq2nonf_cp,1.0,2.0); divideByBinCenter(hq2nonf_cp); hq2nonf_cp->GetYaxis()->SetTitle("#frac{dN}{q_{2}dq_{2}}"); hq2nonf_cp->GetYaxis()->SetRangeUser(1e-10,10); hq2nonf_cp->SetMarkerStyle(24); hq2nonf_cp->SetMarkerColor(4); hq2nonf_cp->SetLineColor(4); hq2nonf_cp->SetMarkerSize(0.5); hq2nonf_cp->Fit(Form("ffit"),"R","",0,10); hq2nonf_cp->Draw("Psame"); t->DrawLatex(0.5,0.2,Form("N_{trk}^{offline} = %.2f", avgtrk[ibin]*2)); double v2calc = TMath::Sqrt(TMath::Sqrt(2*q22[ibin]*q22[ibin]-q24[ibin])/avgmult[ibin]); double g2calc = q22[ibin]-TMath::Sqrt(2*q22[ibin]*q22[ibin]-q24[ibin])-1; vecr[6]=v2calc; vecr[7]=g2calc; fout->cd(); vecr.Write(Form("r_%d_%d_%d",ibin,fixv2,fixg2),TObject::kOverwrite); vecrnonf.Write(Form("rnonf_%d_%d_%d",ibin,fixv2,fixg2),TObject::kOverwrite); if(ibin==15) c4->Print("hq2_fit_15.png"); } //c5->Print("hq2nonf_fit.png"); }
void CompareCentOldandNew(){ gStyle->SetOptStat(kFALSE); gStyle->SetErrorX(0); TString coll="PPb"; bool Save=kTRUE; TF1 * fCen = new TF1("fCen","[0]*exp([1]+[2]*x+[3]*x*x+[4]*x*x*x+[5]*x*x*x*x+[6]*x*x*x*x*x)", 0., 100.); if(coll=="PPb"){ //fCen->SetParameters(1.20916e-02, 5.02157e+00, -3.38300e-02, 1.87647e-03, -6.76442e-05, 9.08602e-07, -4.01536e-09);//parameterize on 05.03 after approval //fCen->SetParameters(7.92204e-03, 4.52005e+00, 9.77340e-02, -5.00362e-03, 9.74735e-05, -8.93897e-07, 3.39375e-09);//parameterize on new official MC after QM on 12/03/14 fCen->SetParameters(6.06918e-03, 4.84487e+00, 4.26255e-02, -1.30682e-03, 1.94753e-05, -2.53606e-07, 1.61323e-09); //! parameterize on new official MC using double side HF on 02/02/15 TH1F* histodata=(TH1F*)fDataPPb->Get("Cent"); TH1F* histo1=(TH1F*)fMCPPb->Get("Cent"); TH1F* histo2=(TH1F*)fMCPPbOld->Get("Cent"); TString data="Pb going positive side"; } //fCen->SetParameters(8.68073e-03, 5.09356e+00, -1.33053e-02, 1.46904e-03, -6.99681e-05, 1.06721e-06, -5.21398e-09); //original else if(coll=="PbP"){ //fCen->SetParameters(1.05408e-02, 5.27477e+00, -8.03382e-02, 3.51669e-03, -8.85332e-05, 1.08917e-06, -4.90091e-09); //fCen->SetParameters(1.14851e-02, 5.31172e+00, -8.52366e-02, 3.00268e-03, -6.04667e-05, 6.24105e-07, -2.43580e-09); //fCen->SetParameters(2.89263e-02, 3.43643e+00, 5.62562e-02, -1.86555e-03, 1.97924e-06, 3.15416e-07, -1.97946e-09);//parameterize on new official MC after QM on 12/03/14 fCen->SetParameters(5.10893e-03,4.88698e+00,8.37930e-02,-3.77127e-03, 7.90191e-05,-9.04877e-07, 4.26221e-09); //! parameterize on new official MC using double side HF on 02/02/15 TH1F* histodata=(TH1F*)fDataPbP->Get("Cent"); TH1F* histo1=(TH1F*)fMCPbP->Get("Cent"); //TH1F* histo2=(TH1F*)fNMCPbP->Get("Cent"); TH1F* histo2=(TH1F*)fMCPbPOld->Get("Cent"); TString data="Proton going positive side"; } histo1->SetName(Form("%sNewMC_unweighted",coll.Data())); histo2->SetName(Form("%sOldMC_unweighted",coll.Data())); histodata->SetName(Form("%sData",coll.Data())); //histo1=(TH1F*)histo1->Rebin(Nbin_vz,"histo1",binbound_vz); //histo2=(TH1F*)histo2->Rebin(Nbin_vz,"histo2",binbound_vz); histo1->Scale(1/histo1->Integral()); histo2->Scale(1/histo2->Integral()); histodata->Scale(1/histodata->Integral()); histo1->SetMarkerStyle(24); histo1->SetMarkerSize(1.2); histo1->SetMarkerColor(2); histo1->SetLineColor(2); histo2->SetMarkerStyle(30); histo2->SetMarkerSize(1.2); //histo2->SetFillStyle(3004); //histo2->SetFillColor(2); histo2->SetLineColor(4); histo2->SetMarkerColor(4); histodata->SetMarkerStyle(20); histodata->SetMarkerSize(1.2); histodata->SetMarkerColor(1); histodata->SetLineColor(1); TCanvas* c1 = new TCanvas("c1"," ",500,500); //TCanvas* c2 = new TCanvas("c2"," ",500,500); makeMultiPanelCanvas(c1,1,1,-0.16,0,0.16,0.14,0.03); //makeMultiPanelCanvas(c2,1,1,-0.16,0,0.16,0.14,0.03); TH1F* hFrame=new TH1F("","",100,0,100); fixedFontHist(hFrame,1.2,1.7); hFrame->SetTitle(""); hFrame->GetXaxis()->SetTitleSize(0.05); hFrame->GetYaxis()->SetTitleSize(0.05); hFrame->GetXaxis()->SetTitle("Centrality"); hFrame->GetYaxis()->SetTitle("Event Fraction"); hFrame->GetXaxis()->SetLimits(0,100); //hFrame->GetXaxis()->SetLimits(-3,3); hFrame->GetYaxis()->SetRangeUser(0,7.1e-2); c1->cd(1); hFrame->DrawCopy(); histodata->Draw("same"); histo1->Draw("same"); histo2->Draw("same"); TLegend *leg1=new TLegend(0.20,0.80,0.85,0.92); TLegend *leg2=new TLegend(0.20,0.80,0.85,0.92); leg1->SetBorderSize(0); leg2->SetBorderSize(0); leg1->SetFillColor(0); leg2->SetFillColor(0); leg1->SetTextSize(0.04); leg2->SetTextSize(0.04); leg1->AddEntry(histo1,"Before Centrality weighting New MC","lp"); leg1->AddEntry(histo2,"Before Centrality weighting Old MC","lp"); //leg1->AddEntry(histo2,"Before Centrality weighting Last 2 pthat","lfp"); leg1->AddEntry(histodata,data,"lp"); leg1->Draw("same"); TLatex *T1=new TLatex(0.25,0.92,""); T1->SetNDC(); T1->SetTextAlign(12); T1->SetTextSize(0.05); T1->SetTextColor(1); T1->SetTextFont(42); T1->Draw("same"); /*c2->cd(1); hFrame->GetYaxis()->SetTitle("Data/MC"); hFrame->GetXaxis()->SetLimits(0,100); hFrame->GetYaxis()->SetRangeUser(0,2); hFrame->DrawCopy(); TH1F* ratio = (TH1F*)histodata->Clone(Form("%sratio",coll.Data())); //ratio->SetName("ratio"); ratio->Divide(histo1);*/ /*ratio->Fit(fCen); cout<<fCen->GetNDF()<<endl; cout<<fCen->GetChisquare()<<endl; for(int icent=0;icent<=6;icent++) cout<<fCen->GetParameter(icent)<<","; cout<<endl;*/ /*ratio->DrawCopy("same"); fCen->SetLineColor(2); fCen->Draw("same"); leg2->AddEntry(ratio,data,"lp"); leg2->AddEntry(fCen,"reweighting function","lp"); leg2->Draw("same");*/ if(Save){ TFile *fout = new TFile("CentCompare.root","Update"); fout->cd(); //ratio->Write("",TObject::kOverwrite); histo1->Write("",TObject::kOverwrite); histo2->Write("",TObject::kOverwrite); histodata->Write("",TObject::kOverwrite); fout->Close(); //c2->Print(Form("ratio_Cent_%s.png",coll.Data())); c1->Print(Form("CentCompare_Data%s.pdf",coll.Data())); } c1->Print(Form("CentCompareOldvsNew_Data%s.gif",coll.Data())); }
void ComparePPPPbData(){ gStyle->SetOptStat(kFALSE); gStyle->SetErrorX(0); //double binbound_pt[]={30,40,50,60,70,80,90,100,110,120,140,160,180,200,220,260,300,350,500}; //const double binbound_pt[]={0,5,10,15,20,30,45,60,75,90,105,120,140,160,180,200,220,260,300,400,600,1000}; const double binbound_pt[]={ 3, 4, 5, 7, 9, 12, 15, 18, 22, 27, 33, 39, 47, 55, 64,74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 362, 429, 692, 1000}; int Nbin_pt=sizeof(binbound_pt)/sizeof(double)-1; TString filename1="MCPPbNoGplus_ak3PFDiJetMassJetNoResidualPt30GenChargeTrkEffHIN12017v5TrkCorr2DCut0EtaBin7_HFsumEta4Bin1_merged.root"; TString filename2="MCPPNoGplus_ak3PFDiJetMassJetNoResidualPt30GenChargeTrkEffHIN12017v5TrkCorr2DCut0EtaBin7_HFsumEta4Bin1_merged.root"; TString dir1="~/CMSSW_6_2_3_patch1/src/jetRpA/RpA/output/JetTrig/JetID/ak3PF/NoResidual/NoGplusNewpthat"; TString dir2="~/CMSSW_6_2_3_patch1/src/jetRpA/RpA/output/JetTrig/JetID/ak3PF/NoResidual/NoGplusNewpthat"; TString histoname="jetpt_0-100%"; TString histoname1="jetptEta_0-100%"; //TString histoname1=Form("jetpt%s_0-100%%",JetIDName.Data()); TFile *file1=TFile::Open(Form("%s/%s",dir1.Data(),filename1.Data())); TFile *file2=TFile::Open(Form("%s/%s",dir2.Data(),filename2.Data())); TH2F* histo12F=(TH2F*)file1->Get(histoname1); TH2F* histo22F=(TH2F*)file2->Get(histoname1); //TH1D* histo1=(TH1D*)histo12F->ProjectionY("histo1",histo12F->GetXaxis()->FindBin(binbound_pt[5]),histo12F->GetXaxis()->FindBin(binbound_pt[Nbin_pt]),"e"); //TH1D* histo2=(TH1D*)histo22F->ProjectionY("histo2",histo22F->GetXaxis()->FindBin(binbound_pt[5]),histo22F->GetXaxis()->FindBin(binbound_pt[Nbin_pt]),"e"); TH1D* histo1=(TH1D*)histo12F->ProjectionX("histo1"); TH1D* histo2=(TH1D*)histo22F->ProjectionX("histo2"); TH1D* histo1=(TH1D*)file1->Get(histoname); TH1D* histo2=(TH1D*)file2->Get(histoname); rehisto1=(TH1D*)histo1->Clone("rehisto1"); rehisto2=(TH1D*)histo2->Clone("rehisto2"); rehisto1=(TH1D*)rehisto1->Rebin(Nbin_pt,"rehisto1",binbound_pt); rehisto2=(TH1D*)rehisto2->Rebin(Nbin_pt,"rehisto2",binbound_pt); normalizeByBinWidth(rehisto1); normalizeByBinWidth(rehisto2); //rehisto1->Scale(1/rehisto1->Integral()); //rehisto2->Scale(1/rehisto2->Integral()); rehisto1->SetMarkerStyle(24); rehisto1->SetMarkerSize(1.2); rehisto1->SetMarkerColor(1); rehisto2->SetMarkerStyle(20); rehisto2->SetMarkerSize(1.2); rehisto2->SetMarkerColor(2); c1 = new TCanvas("c1"," ",500,800); makeMultiPanelCanvas(c1,1,2,-0.08,0,0.14,0.16,0.03); TH1F* hFrame=new TH1F("","",1000,0,1000); fixedFontHist(hFrame,2,2.2); hFrame->SetTitle(""); hFrame->GetXaxis()->SetTitle(""); hFrame->GetYaxis()->SetTitle("Event Probability"); hFrame->GetXaxis()->SetLimits(30,600); hFrame->GetYaxis()->SetRangeUser(1.01e-10,1e-1); c1->cd(1)->SetLogy(); hFrame->DrawCopy(); rehisto1->Draw("E1same"); rehisto2->Draw("E1same"); TLegend *leg1=new TLegend(0.60,0.75,0.85,0.90); leg1->SetBorderSize(0); leg1->SetFillColor(0); leg1->SetTextSize(0.05); leg1->AddEntry(rehisto1,"PYTHIA+HIJING","lp"); leg1->AddEntry(rehisto2,"PYTHIA","lp"); leg1->Draw("same"); c1->cd(2); TLatex *T1=new TLatex(0.5,0.92,"|#eta|<1"); T1->SetNDC(); T1->SetTextAlign(12); T1->SetTextSize(0.05); T1->SetTextColor(1); T1->SetTextFont(42); TH1D* ratio=(TH1D*)rehisto2->Clone("ratio"); hFrame->GetXaxis()->SetTitle("p_{T}^{jet} (GeV/c)"); hFrame->GetYaxis()->SetTitle("Ratio: PYTHIA+HIJING/PYTHIA"); hFrame->GetYaxis()->SetRangeUser(0.6,1.39); hFrame->DrawCopy(); ratio->Divide(rehisto1); ratio->SetMarkerStyle(20); ratio->SetMarkerSize(1.2); ratio->SetMarkerColor(1); ratio->SetTitle(""); ratio->Draw("E1same"); TLine *l =new TLine(30,1,600,1); l->SetLineStyle(2); l->SetLineColor(1); l->Draw("same"); T1->Draw("same"); c1->Print("PPPPbCompare.png"); }
void Factorization_eta_v2v3_paper() { const int nfiles = 24; TString filename[nfiles]; filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass445_eff1_v42.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass445_eff1_v42.root"); /* filename[0] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[1] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[2] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[3] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[4] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[5] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[6] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); filename[7] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg053_ptassallweight_etaass445_eff0_general_v45.root"); */ filename[8] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[9] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[10] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[11] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[12] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[13] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[14] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[15] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass34_eff1_v42.root"); filename[16] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent002_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[17] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent05_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[18] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent510_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[19] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent1020_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[20] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent2030_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[21] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent3040_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[22] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent4050_pttrg033_ptassallweight_etaass45_eff1_v42.root"); filename[23] = Form("/net/hisrv0001/home/davidlw/scratch1/DiHadronCorrelations/outputs_312/HIData_Minbias_2760GeV/merged/epetadeco_cent5060_pttrg033_ptassallweight_etaass45_eff1_v42.root"); const int ntrgbins = 16; const int ntrgbins1 = ntrgbins; const int ntrgbins2 = ntrgbins/2; TGraphErrors* gr[nfiles][6]; TGraphErrors* gr0[nfiles][6]; TGraphErrors* gr1[nfiles][6]; TGraphErrors* gr_ratio[nfiles][6]; TGraph* gr_band[nfiles][6]; TGraph* gr1_band[nfiles][6]; TF1* fit[nfiles][6]; TF1* fit_aver[nfiles][6]; TF1* fit1_aver[nfiles][6]; double slope[6][nfiles]; double slope_err[6][nfiles]; double slope1[6][nfiles]; double slope1_err[6][nfiles]; // double eta[ntrgbins2] = {0.12,0.36,0.6,0.84,1.08,1.32,1.56,1.8,2.04,2.28}; // double eta[ntrgbins2] = {0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,2.1,2.3}; double eta[ntrgbins2] = {0.15,0.45,0.75,1.05,1.35,1.65,1.95,2.25}; // double eta[ntrgbins2] = {0.2,0.6,1.0,1.4,1.8,2.2}; double eta_err[ntrgbins2] = {0.0}; Color_t color[6] = {1,kBlue, kBlue, kBlue,1,1}; TFile* fdiff[nfiles]; for(int jj=0;jj<nfiles;jj++) { fdiff[jj] = new TFile(filename[jj].Data()); TH2D* hsignal[ntrgbins]; TH2D* hbackground[ntrgbins]; TH2D* hsignal0[ntrgbins]; TH2D* hbackground0[ntrgbins]; TH2D* hsignal1[ntrgbins]; TH2D* hbackground1[ntrgbins]; TH1D* hsignal_1D[ntrgbins][6]; TH1D* hbackground_1D[ntrgbins][6]; TH1D* hsignal0_1D[ntrgbins][6]; TH1D* hbackground0_1D[ntrgbins][6]; TH1D* hsignal1_1D[ntrgbins][6]; TH1D* hbackground1_1D[ntrgbins][6]; double Vn[ntrgbins1][6]; double VnError[ntrgbins1][6]; double rn[ntrgbins2]; double rn_err[ntrgbins2]; double Vn0[ntrgbins1][6]; double Vn0Error[ntrgbins1][6]; double rn0[ntrgbins2]; double rn0_err[ntrgbins2]; double Vn1[ntrgbins1][6]; double Vn1Error[ntrgbins1][6]; double rn1[ntrgbins2]; double rn1_err[ntrgbins2]; double rn_ratio[ntrgbins2]; double rn_ratio_err[ntrgbins2]; for(int i=0;i<ntrgbins;i++) { hsignal0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/signalcosn_trg%d",i)); hbackground0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_HI_hfm/backgroundcosn_trg%d",i)); /* if(jj==6 || jj==7) { hsignal0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/signalcosn_trg%d",i)); hbackground0[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfp/backgroundcosn_trg%d",i)); hsignal1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/signalcosn_trg%d",i)); hbackground1[i] = (TH2D*)fdiff[jj]->Get(Form("epetadeco_ana_pPb_hfm/backgroundcosn_trg%d",i)); } */ hsignal[i] = (TH2D*)hsignal0[i]->Clone(Form("signalcosn_trg%d",i)); hbackground[i] = (TH2D*)hbackground0[i]->Clone(Form("backgroundcosn_trg%d",i)); hsignal[i]->Add(hsignal1[i]); hbackground[i]->Add(hbackground1[i]); for(int nbin=1;nbin<4;nbin++) { hsignal_1D[i][nbin] = (TH1D*)hsignal[i]->ProjectionX(Form("signal_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal0_1D[i][nbin] = (TH1D*)hsignal0[i]->ProjectionX(Form("signal0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hsignal1_1D[i][nbin] = (TH1D*)hsignal1[i]->ProjectionX(Form("signal1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground_1D[i][nbin] = (TH1D*)hbackground[i]->ProjectionX(Form("background_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground0_1D[i][nbin] = (TH1D*)hbackground0[i]->ProjectionX(Form("background0_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); hbackground1_1D[i][nbin] = (TH1D*)hbackground1[i]->ProjectionX(Form("background1_1D_trg%d_%d",i,nbin),nbin,nbin,"e"); Vn[i][nbin]=hsignal_1D[i][nbin]->GetMean()-hbackground_1D[i][nbin]->GetMean(); VnError[i][nbin]=sqrt(hsignal_1D[i][nbin]->GetMeanError()*hsignal_1D[i][nbin]->GetMeanError()+hbackground_1D[i][nbin]->GetMeanError()*hbackground_1D[i][nbin]->GetMeanError()); Vn0[i][nbin]=hsignal0_1D[i][nbin]->GetMean()-hbackground0_1D[i][nbin]->GetMean(); Vn0Error[i][nbin]=sqrt(hsignal0_1D[i][nbin]->GetMeanError()*hsignal0_1D[i][nbin]->GetMeanError()+hbackground0_1D[i][nbin]->GetMeanError()*hbackground0_1D[i][nbin]->GetMeanError()); Vn1[i][nbin]=hsignal1_1D[i][nbin]->GetMean()-hbackground1_1D[i][nbin]->GetMean(); Vn1Error[i][nbin]=sqrt(hsignal1_1D[i][nbin]->GetMeanError()*hsignal1_1D[i][nbin]->GetMeanError()+hbackground1_1D[i][nbin]->GetMeanError()*hbackground1_1D[i][nbin]->GetMeanError()); if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<hsignal0_1D[i][nbin]->GetMean()<<" "<<hbackground0_1D[i][nbin]->GetMean()<<" "<<Vn0[i][nbin]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<hsignal1_1D[i][nbin]->GetMean()<<" "<<hbackground1_1D[i][nbin]->GetMean()<<" "<<Vn1[i][nbin]<<endl; delete hsignal_1D[i][nbin]; delete hsignal0_1D[i][nbin]; delete hsignal1_1D[i][nbin]; delete hbackground_1D[i][nbin]; delete hbackground0_1D[i][nbin]; delete hbackground1_1D[i][nbin]; } delete hsignal0[i]; delete hsignal1[i]; delete hsignal[i]; delete hbackground0[i]; delete hbackground1[i]; delete hbackground[i]; } for(int nbin=1;nbin<4;nbin++) { for(int i=0;i<ntrgbins2;i++) { rn[ntrgbins2-i-1]=Vn[i][nbin]/Vn[ntrgbins1-i-1][nbin]; rn_err[ntrgbins2-i-1]=sqrt((VnError[ntrgbins1-i-1][nbin]/Vn[ntrgbins1-i-1][nbin])**2+(VnError[i][nbin]/Vn[i][nbin])**2); rn0[ntrgbins2-i-1]=Vn0[i][nbin]/Vn0[ntrgbins1-i-1][nbin]; rn0_err[ntrgbins2-i-1]=sqrt((Vn0Error[ntrgbins1-i-1][nbin]/Vn0[ntrgbins1-i-1][nbin])**2+(Vn0Error[i][nbin]/Vn0[i][nbin])**2); rn1[ntrgbins2-i-1]=Vn1[i][nbin]/Vn1[ntrgbins1-i-1][nbin]; rn1_err[ntrgbins2-i-1]=sqrt((Vn1Error[ntrgbins1-i-1][nbin]/Vn1[ntrgbins1-i-1][nbin])**2+(Vn1Error[i][nbin]/Vn1[i][nbin])**2); rn_ratio[ntrgbins2-i-1] = rn0[ntrgbins2-i-1]/rn1[ntrgbins2-i-1]; rn_ratio_err[ntrgbins2-i-1] = sqrt(rn0_err[ntrgbins2-i-1]*rn0_err[ntrgbins2-i-1]+rn1_err[ntrgbins2-i-1]*rn1_err[ntrgbins2-i-1]); if(jj==7 && nbin==1) cout<<"pos nbin="<<nbin<<" i="<<i<<" "<<Vn0[i][nbin]<<" "<<Vn0[ntrgbins1-i-1][nbin]<<" "<<rn0[ntrgbins2-i-1]<<endl; if(jj==7 && nbin==1) cout<<"neg nbin="<<nbin<<" i="<<i<<" "<<Vn1[i][nbin]<<" "<<Vn1[ntrgbins1-i-1][nbin]<<" "<<rn1[ntrgbins2-i-1]<<endl; } gr[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn,eta_err,rn_err); gr[jj][nbin]->SetMarkerColor(color[nbin]); gr0[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn0,eta_err,rn0_err); gr0[jj][nbin]->SetMarkerColor(color[nbin]); gr1[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn1,eta_err,rn1_err); gr1[jj][nbin]->SetMarkerColor(color[nbin]); gr_ratio[jj][nbin] = new TGraphErrors(ntrgbins2,eta,rn_ratio,eta_err,rn_ratio_err); gr_ratio[jj][nbin]->SetMarkerColor(color[nbin]); /* gr[jj][nbin]->SetMarkerSize(gr[jj][1]->GetMarkerSize()*0.8); gr0[jj][nbin]->SetMarkerSize(gr0[jj][1]->GetMarkerSize()*0.8); gr1[jj][nbin]->SetMarkerSize(gr1[jj][1]->GetMarkerSize()*0.8); gr_ratio[jj][nbin]->SetMarkerSize(gr_ratio[jj][1]->GetMarkerSize()*0.8); */ // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5)*(-x-4.5))/(1+[0]*(x-4.5)*(x-4.5))",0,3.0); // fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1+[0]*(x-4.5))",0,3.0); if(jj<8) fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-4.6))/exp([0]*(x-4.6))",0.0,2.4); else fit[jj][nbin] = new TF1(Form("fit_%d_%d",nbin,jj),"exp([0]*(-x-3.5))/exp([0]*(x-3.5))",0.0,1.1); fit[jj][nbin]->SetParameter(0,0.01); gr[jj][nbin]->Fit(Form("fit_%d_%d",nbin,jj),"RNO"); fit[jj][nbin]->SetLineColor(color[nbin]); fit[jj][nbin]->SetLineStyle(7); fit[jj][nbin]->SetLineWidth(1); if(jj<8) { slope[nbin][jj] = fit[jj][nbin]->GetParameter(0); slope_err[nbin][jj] = fit[jj][nbin]->GetParError(0); } else { slope1[nbin][jj-8] = fit[jj][nbin]->GetParameter(0); slope1_err[nbin][jj-8] = fit[jj][nbin]->GetParError(0); } // fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"(1+[0]*(-x-4.5))/(1-4.5*[0])",0,4.5); fit1_aver[jj][nbin] = new TF1(Form("fit1_aver_%d_%d",nbin,jj),"exp(-[0]*x)",0,5); fit1_aver[jj][nbin]->SetParameter(0,fit[jj][nbin]->GetParameter(0)); fit1_aver[jj][nbin]->SetParError(0,fit[jj][nbin]->GetParError(0)); fit1_aver[jj][nbin]->SetLineStyle(1); fit1_aver[jj][nbin]->SetLineColor(color[nbin]); gr1_band[jj][nbin] = new TGraph(53); for(int mm=0;mm<26;mm++) { gr1_band[jj][nbin]->SetPoint(mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)+fit1_aver[jj][nbin]->GetParError(0)))); gr1_band[jj][nbin]->SetPoint(51-mm,0.2*mm,exp(-0.2*mm*(fit1_aver[jj][nbin]->GetParameter(0)-fit1_aver[jj][nbin]->GetParError(0)))); } gr1_band[jj][nbin]->SetPoint(52,0,1); gr1_band[jj][nbin]->SetFillColor(color[nbin]-10); } } ofstream ff("r2r3_eta.txt"); double cent[8]={0.01,0.025,0.075,0.15,0.25,0.35,0.45,0.55}; double cent_err[8]={0}; TGraphErrors* gr_slope[6]; TGraphErrors* gr1_slope[6]; for(int nbin=1;nbin<4;nbin++) { gr_slope[nbin] = new TGraphErrors(8,cent,slope[nbin],cent_err,slope_err[nbin]); gr_slope[nbin]->SetName(Form("gr_slope_%d",nbin)); cout<<"i="<<nbin+1<<endl; ff<<"i="<<nbin+1<<endl; for(int j=0;j<8;j++) { cout<<slope[nbin][j]<<" "; ff<<slope[nbin][j]<<", ";} cout<<endl; ff<<endl; for(int j=0;j<8;j++) { cout<<slope_err[nbin][j]<<" "; ff<<slope_err[nbin][j]<<", ";} cout<<endl; ff<<endl; } for(int nbin=1;nbin<4;nbin++) { gr1_slope[nbin] = new TGraphErrors(8,cent,slope1[nbin],cent_err,slope1_err[nbin]); gr1_slope[nbin]->SetName(Form("gr1_slope_%d",nbin)); } ff.close(); TString histtitle[8] = {"0-0.2% centrality","0-5%","5-10%","10-20%","20-30%","30-40%","40-50%","50-60%"}; TLine* ll = new TLine(-0.12,1.,2.49,1.); TCanvas* c = new TCanvas("c","c",920,500); makeMultiPanelCanvas(c,4,2,0.01,0.0,0.25,0.2,0.02); TH2D* htmp = new TH2D("htmp",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.12,2.49,100,0.831-0.02,1.06-0.02); fixedFontHist(htmp,1.8,2.8); htmp->GetXaxis()->CenterTitle(); htmp->GetYaxis()->CenterTitle(); htmp->GetYaxis()->SetTitleSize(htmp->GetYaxis()->GetTitleSize()*1.2); htmp->GetXaxis()->SetTitleSize(htmp->GetXaxis()->GetTitleSize()*1.); htmp->GetXaxis()->SetLabelSize(htmp->GetXaxis()->GetLabelSize()*0.95); htmp->GetXaxis()->SetNdivisions(510); for(int jj=0;jj<8;jj++) { c->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr[jj][1]->SetMarkerStyle(21); gr[jj][1]->Draw("Psame"); fit[jj][1]->Draw("Lsame"); cout<<fit[jj][1]->GetChisquare()/fit[jj][1]->GetNDF()<<endl; gr[jj+8][1]->SetMarkerStyle(25); // fit[jj+8][1]->SetLineStyle(5); gr[jj+8][1]->Draw("Psame"); // fit[jj+8][1]->Draw("Lsame"); /* gr[jj+16][1]->SetMarkerStyle(28); gr[jj+16][1]->SetMarkerColor(1); gr[jj+16][1]->Draw("Psame"); */ } TLatex* latex2 = new TLatex(); latex2->SetNDC(); latex2->SetTextSize(1.5*latex2->GetTextSize()); c->cd(1); latex2->DrawLatex(0.31,0.05,histtitle[0]); latex2->DrawLatex(0.29,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); c->cd(2); latex2->DrawLatex(0.08,0.05,histtitle[1]); latex2->SetTextSize(0.98*latex2->GetTextSize()); latex2->DrawLatex(0.1,0.285,"0.3 < p_{T}^{a} < 3.0 GeV/c"); latex2->DrawLatex(0.1,0.18,"p_{T}^{b} > 0 GeV/c"); latex2->SetTextSize(latex2->GetTextSize()/0.98); c->cd(4); latex2->DrawLatex(0.08,0.05,histtitle[3]); c->cd(3); latex2->DrawLatex(0.08,0.05,histtitle[2]); c->cd(8); latex2->DrawLatex(0.08,0.24,histtitle[7]); c->cd(7); latex2->DrawLatex(0.08,0.24,histtitle[6]); c->cd(6); latex2->SetTextSize(0.96*latex2->GetTextSize()); latex2->DrawLatex(0.08,0.24,histtitle[5]); c->cd(5); latex2->SetTextSize(0.85*latex2->GetTextSize()); latex2->DrawLatex(0.31,0.24,histtitle[4]); TLegend* legend2 = new TLegend(0.26,0.16,0.78,0.46); legend2->SetFillStyle(0); legend2->AddEntry(gr[0][1],"4.4 < #eta^{b} < 5.0","P"); legend2->AddEntry(gr[8][1],"3.0 < #eta^{b} < 4.0","P"); legend2->AddEntry(fit[0][1],"Exponential fits","L"); c->cd(1); legend2->Draw("same"); TCanvas* ccaa = new TCanvas("ccaa","ccaa",900,500); makeMultiPanelCanvas(ccaa,4,2,0.01,0.0,0.2,0.2,0.02); for(int jj=0;jj<8;jj++) { ccaa->cd(jj+1); htmp->Draw(); ll->Draw("Lsame"); gr0[jj][1]->SetMarkerStyle(21); gr0[jj][1]->Draw("Psame"); gr1[jj][1]->SetMarkerStyle(25); gr1[jj][1]->Draw("Psame"); } TCanvas* ccbb = new TCanvas("ccbb","ccbb",900,500); makeMultiPanelCanvas(ccbb,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmpaa = new TH2D("htmpaa",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.97,1.03); for(int jj=0;jj<8;jj++) { ccbb->cd(jj+1); htmpaa->Draw(); ll->Draw("Lsame"); gr_ratio[jj][1]->SetMarkerStyle(21); gr_ratio[jj][1]->Draw("Psame"); } TCanvas* cc = new TCanvas("cc","cc",920,500); makeMultiPanelCanvas(cc,4,2,0.01,0.0,0.25,0.2,0.02); TH2D* htmp1 = new TH2D("htmp1",";#eta^{a};r_{3}(#eta^{a},#eta^{b})",100,-0.12,2.49,100,0.831-0.02,1.06-0.02); fixedFontHist(htmp1,1.8,2.8); htmp1->GetXaxis()->CenterTitle(); htmp1->GetYaxis()->CenterTitle(); htmp1->GetYaxis()->SetTitleSize(htmp1->GetYaxis()->GetTitleSize()*1.2); htmp1->GetXaxis()->SetTitleSize(htmp1->GetXaxis()->GetTitleSize()*1.); htmp1->GetXaxis()->SetLabelSize(htmp1->GetXaxis()->GetLabelSize()*0.95); htmp1->GetXaxis()->SetNdivisions(510); for(int jj=0;jj<8;jj++) { cc->cd(jj+1); htmp1->Draw(); ll->Draw("Lsame"); gr[jj][2]->SetMarkerStyle(21); gr[jj][2]->Draw("Psame"); fit[jj][2]->Draw("Lsame"); cout<<fit[jj][2]->GetChisquare()/fit[jj][2]->GetNDF()<<endl; gr[jj+8][2]->SetMarkerStyle(25); // fit[jj+8][2]->SetLineStyle(5); gr[jj+8][2]->Draw("Psame"); // fit[jj+8][2]->Draw("Lsame"); /* gr[jj+16][2]->SetMarkerStyle(28); gr[jj+16][2]->SetMarkerColor(1); gr[jj+16][2]->Draw("Psame"); fit[jj+16][2]->Draw("Lsame"); */ } TLatex* latex3 = new TLatex(); latex3->SetNDC(); latex3->SetTextSize(1.5*latex3->GetTextSize()); cc->cd(1); latex3->DrawLatex(0.31,0.05,histtitle[0]); latex3->DrawLatex(0.29,0.865,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cc->cd(2); latex3->DrawLatex(0.08,0.05,histtitle[1]); latex3->SetTextSize(0.98*latex3->GetTextSize()); latex3->DrawLatex(0.1,0.285,"0.3 < p_{T}^{a} < 3.0 GeV/c"); latex3->DrawLatex(0.1,0.18,"p_{T}^{b} > 0 GeV/c"); latex3->SetTextSize(latex3->GetTextSize()/0.98); cc->cd(4); latex3->DrawLatex(0.08,0.05,histtitle[3]); cc->cd(3); latex3->DrawLatex(0.08,0.05,histtitle[2]); cc->cd(8); latex3->DrawLatex(0.08,0.24,histtitle[7]); cc->cd(7); latex3->DrawLatex(0.08,0.24,histtitle[6]); cc->cd(6); latex3->SetTextSize(0.96*latex3->GetTextSize()); latex3->DrawLatex(0.08,0.24,histtitle[5]); cc->cd(5); latex3->SetTextSize(0.85*latex3->GetTextSize()); latex3->DrawLatex(0.31,0.24,histtitle[4]); TLegend* legend3 = new TLegend(0.26,0.16,0.78,0.46); legend3->SetFillStyle(0); legend3->AddEntry(gr[0][1],"4.4 < #eta^{b} < 5.0","P"); // legend3->AddEntry(gr[16][1],"4<#eta^{b}<5","P"); legend3->AddEntry(gr[8][1],"3.0 < #eta^{b} < 4.0","P"); legend3->AddEntry(fit[0][1],"Exponential fits","L"); cc->cd(1); legend3->Draw("same"); /* TCanvas* ccc = new TCanvas("ccc","ccc",900,500); makeMultiPanelCanvas(ccc,4,2,0.01,0.0,0.2,0.2,0.02); TH2D* htmp2 = new TH2D("htmp2",";#eta^{a};r_{4}(#eta^{a},#eta^{b})",100,-0.1,2.23,100,0.801,1.06); fixedFontHist(htmp2,1.8,2.2); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); htmp2->GetYaxis()->SetTitleSize(htmp2->GetYaxis()->GetTitleSize()*1.2); htmp2->GetXaxis()->SetTitleSize(htmp2->GetXaxis()->GetTitleSize()*1.); for(int jj=0;jj<8;jj++) { ccc->cd(jj+1); htmp2->Draw(); ll->Draw("Lsame"); gr[jj][3]->Draw("Psame"); fit[jj][3]->Draw("Lsame"); gr[jj+8][3]->Set_arkerStyle(25); fit[jj+8][3]->SetLineStyle(5); gr[jj+8][3]->Draw("Psame"); fit[jj+8][3]->Draw("Lsame"); } */ SaveCanvas(c,"HI/FactBreak","epetadeco_HI_r2"); SaveCanvas(cc,"HI/FactBreak","epetadeco_HI_r3"); return; TCanvas* c1 = new TCanvas("c1","c1",500,500); TH2D* htmp2 = new TH2D("htmp2",";Centrality;C",100,0,1.0,100,0.0,0.06); htmp2->Draw(); htmp2->GetXaxis()->CenterTitle(); htmp2->GetYaxis()->CenterTitle(); gr_slope[1]->SetMarkerColor(1); gr_slope[2]->SetMarkerColor(1); gr_slope[1]->SetMarkerStyle(21); gr_slope[2]->SetMarkerStyle(22); gr_slope[1]->Draw("PESAME"); gr_slope[2]->Draw("PESAME"); gr1_slope[1]->SetMarkerColor(1); gr1_slope[2]->SetMarkerColor(1); gr1_slope[1]->SetMarkerStyle(25); gr1_slope[2]->SetMarkerStyle(26); gr1_slope[1]->Draw("PESAME"); gr1_slope[2]->Draw("PESAME"); TFile* f_slope_out = new TFile("gr_slope_v2v3.root","recreate"); gr_slope[1]->Write(); gr_slope[2]->Write(); gr1_slope[1]->Write(); gr1_slope[2]->Write(); f_slope_out->Close(); double c2th_05[4] = {1,0.961347696746,0.880663601763,0.754486161464}; double c2th_05_err[4] = {0,0.000356333410703,0.000338330912667,0.000274987058522}; double c2th_510[4] = {1,0.972713667246,0.915076778092,0.833525975859}; double c2th_510_err[4] = {0,0.000405999641418,0.000387338629763,0.000306789774481}; double c2th_2025[4] = {1,0.984223594381,0.952359517332,0.902163004038}; double c2th_2025_err[4] = {0,0.00034410202865,0.000327502849547,0.000264412975357}; double c3th_05[4] = {1,0.969266017011,0.906673110779,0.811457263278}; double c3th_05_err[4] = {0,0.000169783126377,0.000162733412441,0.000127976935994}; double c3th_510[4] = {1,0.967235903665,0.902375220756,0.794138304113}; double c3th_510_err[4] = {0,0.000140808705408,0.000136143144565,0.000110350606241}; double c3th_2025[4] = {1,0.969550353187,0.904351369862,0.80580447205}; double c3th_2025_err[4] = {0,9.57789409787e-05,9.14453396096e-05,7.07914090744e-05}; double etath[4] = {0,0.5,1,2}; double etath_err[4] = {0}; TGraphErrors* gr_c2th_05 = new TGraphErrors(4,etath,c2th_05,etath_err,c2th_05_err); TGraphErrors* gr_c2th_510 = new TGraphErrors(4,etath,c2th_510,etath_err,c2th_510_err); TGraphErrors* gr_c2th_2025 = new TGraphErrors(4,etath,c2th_2025,etath_err,c2th_2025_err); TGraphErrors* gr_c3th_05 = new TGraphErrors(4,etath,c3th_05,etath_err,c3th_05_err); TGraphErrors* gr_c3th_510 = new TGraphErrors(4,etath,c3th_510,etath_err,c3th_510_err); TGraphErrors* gr_c3th_2025 = new TGraphErrors(4,etath,c3th_2025,etath_err,c3th_2025_err); gr_c2th_05->SetMarkerStyle(31); gr_c2th_510->SetMarkerStyle(31); gr_c2th_2025->SetMarkerStyle(31); gr_c3th_05->SetMarkerStyle(31); gr_c3th_510->SetMarkerStyle(31); gr_c3th_2025->SetMarkerStyle(31); TCanvas* cth = new TCanvas("cth","",900,330); makeMultiPanelCanvas(cth,3,1,0.01,0.0,0.2,0.17,0.02); TH2D* htmp8 = new TH2D("htmp8",";#eta^{a};r_{2}(#eta^{a},#eta^{b})",100,-0.1,2.5,100,0.67,1.06); fixedFontHist(htmp8,0.9,1.3); htmp8->GetXaxis()->CenterTitle(); htmp8->GetYaxis()->CenterTitle(); htmp8->GetYaxis()->SetTitleSize(htmp8->GetYaxis()->GetTitleSize()*1.4); htmp8->GetXaxis()->SetTitleSize(htmp8->GetXaxis()->GetTitleSize()*1.2); cth->cd(1); htmp8->Draw(); ll->Draw("Lsame"); gr[1][1]->SetMarkerStyle(20); gr[1][1]->Draw("Psame"); gr_c2th_05->Draw("LPsame"); cth->cd(2); htmp8->Draw(); ll->Draw("Lsame"); gr[2][1]->SetMarkerStyle(20); gr[2][1]->Draw("Psame"); gr_c2th_510->Draw("LPsame"); cth->cd(3); htmp8->Draw(); ll->Draw("Lsame"); gr[4][1]->SetMarkerStyle(20); gr[4][1]->Draw("Psame"); gr_c2th_2025->Draw("LPsame"); TLegend* legend_cth = new TLegend(0.25,0.24,0.75,0.4); legend_cth->SetFillStyle(0); legend_cth->AddEntry(gr[1][1],"Data","P"); legend_cth->AddEntry(gr_c2th_05,"3D hydro. model","PL"); cth->cd(1); legend_cth->Draw("same"); TLatex* latex8 = new TLatex(); latex8->SetNDC(); latex8->SetTextSize(latex3->GetTextSize()); cth->cd(1); latex8->DrawLatex(0.8,0.25,histtitle[1]); latex8->DrawLatex(0.285,0.88,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cth->cd(2); latex8->DrawLatex(0.68,0.25,histtitle[2]); latex8->DrawLatex(0.07,0.45,"4.4 < #eta^{b} < 5"); latex8->DrawLatex(0.07,0.35,"0.3 < p_{T}^{a} < 3 GeV/c"); latex8->DrawLatex(0.07,0.25,"p_{T}^{b} > 0 GeV/c"); cth->cd(3); latex8->DrawLatex(0.68,0.25,histtitle[4]); TCanvas* cth3 = new TCanvas("cth3","",900,330); makeMultiPanelCanvas(cth3,3,1,0.01,0.0,0.2,0.17,0.02); TH2D* htmp9 = new TH2D("htmp9",";#eta^{a};r_{3}(#eta^{a},#eta^{b})",100,-0.12,2.49,100,0.7,1.06); fixedFontHist(htmp9,0.9,1.3); htmp9->GetXaxis()->CenterTitle(); htmp9->GetYaxis()->CenterTitle(); htmp9->GetYaxis()->SetTitleSize(htmp9->GetYaxis()->GetTitleSize()*1.4); htmp9->GetXaxis()->SetTitleSize(htmp9->GetXaxis()->GetTitleSize()*1.2); cth3->cd(1); htmp9->Draw(); ll->Draw("Lsame"); gr[1][2]->SetMarkerStyle(20); gr[1][2]->Draw("Psame"); gr_c3th_05->Draw("LPsame"); cth3->cd(2); htmp9->Draw(); ll->Draw("Lsame"); gr[2][2]->SetMarkerStyle(20); gr[2][2]->Draw("Psame"); gr_c3th_510->Draw("LPsame"); cth3->cd(3); htmp9->Draw(); ll->Draw("Lsame"); gr[4][2]->SetMarkerStyle(20); gr[4][2]->Draw("Psame"); gr_c3th_2025->Draw("LPsame"); cth3->cd(1); legend_cth->Draw("same"); cth3->cd(1); latex8->DrawLatex(0.8,0.25,histtitle[1]); latex8->DrawLatex(0.285,0.88,"CMS PbPb #sqrt{s_{NN}} = 2.76 TeV"); cth3->cd(2); latex8->DrawLatex(0.68,0.25,histtitle[2]); latex8->DrawLatex(0.07,0.45,"4.4 < #eta^{b} < 5"); latex8->DrawLatex(0.07,0.35,"0.3 < p_{T}^{a} < 3 GeV/c"); latex8->DrawLatex(0.07,0.25,"p_{T}^{b} > 0 GeV/c"); cth3->cd(3); latex8->DrawLatex(0.68,0.25,histtitle[4]); /* SaveCanvas(cth,"HI/FactBreak","epetadeco_HI_theory_r2"); SaveCanvas(cth3,"HI/FactBreak","epetadeco_HI_theory_r3"); */ SaveCanvas(c,"HI/FactBreak","epetadeco_HI_r2"); SaveCanvas(cc,"HI/FactBreak","epetadeco_HI_r3"); // SaveCanvas(ccaa,"HI/FactBreak","epetadeco_HI_r2ratio"); // SaveCanvas(c1,"HI/FactBreak","epetadeco_HI_C"); // SaveCanvas(cc2,"HI/FactBreak","epetadeco_HI_cos"); }
void overlayJetIDcut(){ gStyle->SetOptStat(kFALSE); gStyle->SetErrorX(0); const int Npoint=1000; TString JetIDNameList[18]={"chMax", "chSum", "neuMax", "neuSum", "phoMax", "phoSum", "chMaxpt", "chSumpt", "neuMaxpt", "neuSumpt", "phoMaxpt", "phoSumpt","SumSumpt","SumSumrawpt","neuMaxr","chN","neuN","phoN"}; const double binbound_pt[]={ 3, 4, 5, 7, 9, 12, 15, 18, 22, 27, 33, 39, 47, 55, 64,74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 429, 692, 1000}; double binbound_JetID[]; int Nbin_pt=sizeof(binbound_pt)/sizeof(double)-1; double xrange_pt[2]={30+1e-4,600-1e-4}; TString JetID; int ilist=14; TString JetIDName = JetIDNameList[ilist]; double cut; if(ilist== 6){ JetID = "chargedMax/p_{T}"; cut=0.3;} else if(ilist== 7){ JetID = "chargedSum/p_{T}"; cut=0.6;} else if(ilist== 8){ JetID = "neutralMax/p_{T}"; cut=0.08;} else if(ilist== 9){ JetID = "neutralSum/p_{T}"; cut=0.15;} //else if(ilist== 10){ JetID = "photonMax/p_{T}"; } else if(ilist== 11){ JetID = "photonSum/p_{T}"; cut=0.3;} else if(ilist== 12){ JetID = "(#Sigma h^{#pm}+#Sigma #gamma +#Sigma h^{0}+#Sigma #mu+#Sigma e)/p_{T}^{jet}";cut =1.01;} else if(ilist== 13){ JetID = "(#Sigma h^{#pm}+#Sigma #gamma +#Sigma h^{0}+#Sigma #mu+#Sigma e)/p_{T}^{raw}";cut =1.13;} else if(ilist== 14){ JetID = "neutralMax/Max(neutralSum,chargedSum)";cut =0.975;} else{ exit();} if(ilist==12 || ilist==13 || ilist==14 ){ double binbound_JetID[]={0,0.2,0.4,0.6,0.7,0.8,0.84,0.86,0.88,0.9,0.92,0.94,0.96,0.98,1.0,1.02,1.04,1.06,1.1,1.15,1.2,1.3,1.4,1.6,1.8,2.};} else{ double binbound_JetID[]={0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.};} //double binbound_JetID[]={0,0.025,0.05,0.075,0.1,0.125,0.15,0.175,0.2,0.225,0.25,0.275,0.3,0.325,0.35,0.375,0.4,0.425,0.45,0.475,0.5}; int Nbin_JetID=sizeof(binbound_JetID)/sizeof(double)-1; TString filename="/scratch/xuq7/RpA/TreeAna/Datacombined.root"; TString histoname=Form("jetpt%sCombinedSpectra",JetIDName.Data()); //TString histoname=Form("jetptEtaCombinedSpectra"); TFile *file=TFile::Open(filename); TH2F* histo2F=(TH2F*)file->Get(histoname); TH1D* histo1=(TH1D*)histo2F->ProjectionX("histo1",histo2F->GetYaxis()->FindBin(binbound_JetID[0]),histo2F->GetYaxis()->FindBin(cut)); //TH1D* histo1=(TH1D*)histo2F->ProjectionX("histo1"); TH1D* histo2=(TH1D*)histo2F->ProjectionX("histo2"); histo1=(TH1D*)histo1->Rebin(Nbin_pt,"histo1",binbound_pt); histo2=(TH1D*)histo2->Rebin(Nbin_pt,"histo2",binbound_pt); normalizeByBinWidth(histo1); normalizeByBinWidth(histo2); histo1->SetMarkerStyle(24); histo1->SetMarkerSize(1.4); histo1->SetMarkerColor(1); histo1->GetYaxis()->SetTitle("Number of Events"); histo2->SetMarkerStyle(20); histo2->SetMarkerSize(1.2); histo2->SetMarkerColor(2); fixedFontHist(histo1,1.8,2.0); fixedFontHist(histo2,1.8,2.0); cout<<histo1->GetBinCenter(9)<<'\t'<<histo1->GetBinContent(9)<<endl; TGraphAsymmErrors *g; TGraphAsymmErrors *g0; double x[Npoint],y[Npoint],xerrlow[Npoint],xerrhigh[Npoint],yerrlow[Npoint],yerrhigh[Npoint]; TH1F* hFrame=new TH1F("","",1000,0,1000); c1 = new TCanvas("c1","",600,1000); makeMultiPanelCanvas(c1,1,2,0.03,0.03,0.1,0.12,0.03); c1->cd(1)->SetLogy(); fixedFontHist(hFrame,1.2,1.4); hFrame->SetTitle(""); hFrame->GetXaxis()->SetTitle(""); hFrame->GetYaxis()->SetTitle("Number of Events"); hFrame->GetXaxis()->SetLimits(25,600); hFrame->GetYaxis()->SetRangeUser(2e-1,5e7); hFrame->DrawCopy(); histo1->Draw("E1same"); histo2->Draw("E1same"); TLegend *leg1=new TLegend(0.60,0.75,0.85,0.90); leg1->SetBorderSize(0); leg1->SetFillColor(0); leg1->SetTextSize(0.06); leg1->AddEntry(histo1,"After cut","lp"); leg1->AddEntry(histo2,"Before cut","lp"); leg1->Draw("same"); TLatex *T=new TLatex(0.25,0.30,Form("Cut: %s<%.2f",JetID.Data(),cut)); T->SetNDC(); T->SetTextAlign(12); T->SetTextSize(0.04); T->SetTextColor(1); T->SetTextFont(42); c1->cd(2); TH1D* ratio=(TH1D*)histo1->Clone("ratio"); hFrame->GetXaxis()->SetTitle("p_{T}^{jet} (GeV/c)"); hFrame->GetYaxis()->SetTitle("Ratio: After cut/Before cut"); hFrame->GetYaxis()->SetRangeUser(0.7,1.09); hFrame->DrawCopy(); ratio->Divide(histo2); ratio->SetMarkerStyle(20); ratio->SetMarkerSize(1.4); ratio->SetMarkerColor(1); ratio->SetMinimum(ratio->GetMinimum()/1.2); ratio->SetMaximum(1.09); ratio->SetTitle(""); //ratio->Draw("E1"); g=new TGraphAsymmErrors(); g->BayesDivide(histo1,histo2); for(int ipoint=0;ipoint<g->GetN();ipoint++){ x[ipoint]=g->GetX()[ipoint]; y[ipoint]=g->GetY()[ipoint]; yerrhigh[ipoint]=g->GetErrorYhigh(ipoint); yerrlow[ipoint]=g->GetErrorYlow(ipoint); xerrhigh[ipoint]=0; xerrlow[ipoint]=0; } g0=new TGraphAsymmErrors(g->GetN(),x,y,xerrlow,xerrhigh,yerrlow,yerrhigh); g0->SetMarkerColor(1); g0->SetMarkerStyle(20); g0->SetMarkerSize(1.2); g0->SetLineColor(1); g0->Draw("Psame"); TLine *l =new TLine(30,1,600,1); l->SetLineStyle(2); l->SetLineColor(1); l->Draw("same"); T->Draw("same"); c1->Print(Form("/home/xuq7/CMSSW_6_2_3_patch1/src/jetRpA/RpA/Quality/NoGplusNewpthat/newSample/pic/JetIDcut/akPu3PF/%s/overlay_JetIDcut.png",JetIDName.Data())); }
void CompareOldNew() { gStyle->SetOptStat(kFALSE); gStyle->SetErrorX(0); TString histoname="jetptEtaBin-10_10"; TString histoname1="jetpt"; TString histoname2F="jetptEta"; TFile *fMCPPbYX = new TFile("/home/xuq/Documents/HI/RpA/output/TreeAna/MCPPbakPu3PFJetSpectraCombineTriggerJetPtNoJetIDCutNoResidualTrkCorrFile0_8.root"); TFile *fDataPPbYX = new TFile("/home/xuq/Documents/HI/RpA/output/TreeAna/DATAPPbakPu3PFJetSpectraCombineTriggerJetPtNoJetIDCutNoResidualTrkCorrFile0_0.root"); TH2F* histo12F=(TH2F*)fMCPPb->Get(histoname2F); TH2F* histo22F=(TH2F*)fMCPPbYX->Get(histoname2F); //TH1D* histo1=(TH1D*)histo12F->ProjectionY("histo1",histo12F->GetXaxis()->FindBin(binbound_pt[5]),histo12F->GetXaxis()->FindBin(binbound_pt[Nbin_pt]),"e"); //TH1D* histo2=(TH1D*)histo22F->ProjectionY("histo2",histo22F->GetXaxis()->FindBin(binbound_pt[5]),histo22F->GetXaxis()->FindBin(binbound_pt[Nbin_pt]),"e"); //TH1D* histo1=(TH1D*)histo12F->ProjectionX("histo1"); //TH1D* histo2=(TH1D*)histo22F->ProjectionX("histo2"); TH1D* histo1=(TH1D*)fDataPPb->Get(histoname1); TH1D* histo2=(TH1D*)fDataPPbYX->Get(histoname); histo1=(TH1D*)histo1->Rebin(Nbin_pt,"histo1",binbound_pt); histo2=(TH1D*)histo2->Rebin(Nbin_pt,"histo2",binbound_pt); normalizeByBinWidth(histo1); normalizeByBinWidth(histo2); //histo1->Scale(1/histo1->Integral()); //histo2->Scale(1/histo2->Integral()); histo1->SetMarkerStyle(24); histo1->SetMarkerSize(1.2); histo1->SetMarkerColor(1); histo2->SetMarkerStyle(20); histo2->SetMarkerSize(1.2); histo2->SetMarkerColor(2); c1 = new TCanvas("c1"," ",500,800); makeMultiPanelCanvas(c1,1,2,-0.14,0,0.2,0.14,0.03); TLatex *T1 = new TLatex(); T1->SetNDC(); T1->SetTextAlign(12); T1->SetTextSize(0.05); T1->SetTextColor(1); T1->SetTextFont(42); TH1F* hFrame=new TH1F("","",20000,-1000,1000); fixedFontHist(hFrame,2,3.1); hFrame->SetTitle(""); hFrame->GetXaxis()->SetTitle(""); hFrame->GetYaxis()->SetTitle("#frac{d^{2}#sigma}{dp_{T}d#eta}"); hFrame->GetXaxis()->SetLimits(0,1000); //hFrame->GetYaxis()->SetRangeUser(1.01e-11,1e-1); hFrame->GetYaxis()->SetRangeUser(1.01e-1,1e6); c1->cd(1)->SetLogy(); hFrame->DrawCopy(); histo1->Draw("E1same"); histo2->Draw("E1same"); TLegend *leg1=new TLegend(0.70,0.75,0.9,0.90); leg1->SetBorderSize(0); leg1->SetFillColor(0); leg1->SetTextSize(0.06); leg1->AddEntry(histo1,"New","lp"); leg1->AddEntry(histo2,"Old","lp"); leg1->Draw("same"); T1->Draw("same"); for(int ibin=0; ibin<histo1->GetNbinsX(); ibin++) if(histo1->GetBinContent(ibin)!=0) cout<<(histo1->GetBinContent(ibin)-histo2->GetBinContent(ibin))/histo1->GetBinContent(ibin)<<endl; c1->cd(2); TLatex *T1=new TLatex(0.5,0.92,"|#eta|<1"); T1->SetNDC(); T1->SetTextAlign(12); T1->SetTextSize(0.05); T1->SetTextColor(1); T1->SetTextFont(42); TH1D* ratio=(TH1D*)histo2->Clone("ratio"); hFrame->GetXaxis()->SetTitle("p_{T}^{jet} (GeV/c)"); hFrame->GetYaxis()->SetTitle("Ratio: New/Old"); hFrame->GetYaxis()->SetRangeUser(0.6,1.39); hFrame->DrawCopy(); ratio->Divide(histo1); ratio->SetMarkerStyle(20); ratio->SetMarkerSize(1.2); ratio->SetMarkerColor(1); ratio->SetTitle(""); ratio->Draw("E1same"); TLine *l =new TLine(30,1,600,1); l->SetLineStyle(2); l->SetLineColor(1); l->Draw("same"); T1->Draw("same"); }
void DrawMatrix(){ TCanvas *c1 = new TCanvas("c1a", "c1",0,0,300,300); gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetErrorX(0); c1->Range(0,0,1,1); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetTickx(1); c1->SetTicky(1); c1->SetLeftMargin(0.12); c1->SetRightMargin(0.13); c1->SetTopMargin(0.05); c1->SetBottomMargin(0.12); c1->SetFrameFillStyle(0); c1->SetFrameBorderMode(0); gStyle->SetPadBottomMargin(0.12); gStyle->SetPadTopMargin (0.025); gStyle->SetPadLeftMargin (0.15); gStyle->SetPadRightMargin (0.025); gStyle->SetPadTickX (1); gStyle->SetPadTickY (1); TFile *f = TFile::Open("/cms/store/user/qixu/jetRpA/RpA/UnfoldedOutputs/PPb_UnfoPriorGen_akPu3PFKurtMCNoIDCut_MC_jtpt20_EtaBin-10_10_Inc_v8.root"); //const double binbound_pt[]={ 3, 4, 5, 7, 9, 12, 15, 18, 22, 27, 33, 39, 47, 55, 64,74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 429, 692, 1000}; const double binbound_pt[]={3, 4, 5, 7, 9, 12, 15, 18,21,24,28,32,37,43,49,56,64,74,84,97,114,133,153,174,196,220,245,272,300,330,362,395,430,468,507,548,592,638,686,1000}; int Nbin_pt=sizeof(binbound_pt)/sizeof(double)-1; bool isLog=kTRUE; c1->SetLogz(); if(isLog){c1->SetLogx();c1->SetLogy();} TH2F* hMatrix_PPb = (TH2F*)f->Get("hMatrixFit_cent0;2"); hMatrix_PPb->SetMaximum(2*1e-3); hMatrix_PPb->SetMinimum(1e-9); TH2F* hFrame=new TH2F("","",1000,0,1000,1000,0,1000); hFrame->GetXaxis()->SetRangeUser(24,650); hFrame->GetYaxis()->SetRangeUser(24,650); if(isLog){ hFrame->GetYaxis()->SetMoreLogLabels(); hFrame->GetYaxis()->SetNoExponent(); hFrame->GetXaxis()->SetMoreLogLabels(); hFrame->GetXaxis()->SetNoExponent(); //hFrame->GetYaxis()->SetNdivisions(510); } hFrame->GetXaxis()->SetTitle("Gen p_{T}^{jet} [GeV/c]"); hFrame->GetYaxis()->SetTitle("Reco p_{T}^{jet} [GeV/c]"); fixedFontHist(hFrame,1.3,1.3); hFrame->DrawCopy(); hMatrix_PPb->DrawCopy("colz same"); //drawCMS(0.20,0.85); TLatex *com0 = new TLatex(0.20,0.80,"PYTHIA+HIJING"); com0->SetTextFont(43); com0->SetTextSize(20); com0->SetNDC(); com0->Draw(); TLatex *com1 = new TLatex(0.20,0.86,"CMS simulation"); com1->SetTextFont(43); com1->SetTextSize(20); com1->SetNDC(); com1->Draw(); TLatex *com2 = new TLatex(0.20,0.74,"|#eta_{CM}|< 1.0"); com2->SetTextFont(43); com2->SetTextSize(20); com2->SetNDC(); com2->Draw(); gPad->RedrawAxis(); if(isLog){ c1->Print("Kurtfile_Matrix_Log.pdf"); c1->Print("Kurtfile_Matrix_Log.gif"); } else{ c1->Print("Kurtfile_Matrix.pdf"); c1->Print("Kurtfile_Matrix.gif"); } /*TLatex *com3 = new TLatex(0.4,0.24,"Anti-k_{T} Particle Flow Jets R=0.3"); com3->SetTextFont(63); com3->SetTextSize(17); com3->SetNDC(); com3->Draw();*/ }
void CompareVz(){ gStyle->SetOptStat(kFALSE); gStyle->SetErrorX(0); TString histoname1="pfjet_Vz"; TString histoname2="pfjet_VzWeighted"; TH1F* histo1=(TH1F*)fPPb->Get(histoname1); TH1F* histo2=(TH1F*)fPPb->Get(histoname2); TH1F* histodata=(TH1F*)fdata->Get("vz"); //histo1=(TH1F*)histo1->Rebin(Nbin_vz,"histo1",binbound_vz); //histo2=(TH1F*)histo2->Rebin(Nbin_vz,"histo2",binbound_vz); histo1->Rebin(5); histo2->Rebin(5); histodata->Rebin(5); histo1->GetXaxis()->SetRangeUser(-15,15); histo2->GetXaxis()->SetRangeUser(-15,15); histodata->GetXaxis()->SetRangeUser(-15,15); normalizeByBinWidth(histo1); normalizeByBinWidth(histo2); normalizeByBinWidth(histodata); histo1->Scale(1/histo1->Integral()); histo2->Scale(1/histo2->Integral()); histodata->Scale(1/histodata->Integral()); histo1->SetMarkerStyle(24); histo1->SetMarkerSize(1.2); histo1->SetMarkerColor(2); histo1->SetLineColor(2); histo2->SetMarkerStyle(0); histo2->SetMarkerSize(0); histo2->SetFillStyle(3004); histo2->SetFillColor(2); histo2->SetLineColor(2); histo2->SetMarkerColor(0); //histo2->SetMarkerColor(2); histodata->SetMarkerStyle(20); histodata->SetMarkerSize(1.2); histodata->SetMarkerColor(1); histodata->SetLineColor(1); c1 = new TCanvas("c1"," ",500,500); makeMultiPanelCanvas(c1,1,1,-0.1,0,0.16,0.14,0.03); TH1F* hFrame=new TH1F("","",20000,-1000,1000); fixedFontHist(hFrame,1.4,1.8); hFrame->SetTitle(""); hFrame->GetXaxis()->SetTitle("vz (cm)"); hFrame->GetYaxis()->SetTitle("Event Fraction"); hFrame->GetXaxis()->SetLimits(-15,15); //hFrame->GetXaxis()->SetLimits(-3,3); hFrame->GetYaxis()->SetRangeUser(0,5e-2); c1->cd(1); hFrame->DrawCopy(); histodata->Draw("same"); histo1->Draw("same"); histo2->Draw("HIST same"); TLegend *leg1=new TLegend(0.40,0.80,0.85,0.95); TLegend *leg2=new TLegend(0.50,0.9,0.80,0.98); leg1->SetBorderSize(0); leg2->SetBorderSize(0); leg1->SetFillColor(0); leg2->SetFillColor(0); leg1->SetTextSize(0.04); leg2->SetTextSize(0.04); leg1->AddEntry(histo1,"Before Vz weighting","lp"); leg1->AddEntry(histo2,"After Vz weighting","lfp"); leg1->AddEntry(histodata,"Data","lp"); leg1->Draw("same"); TLatex *T1=new TLatex(0.25,0.92,""); T1->SetNDC(); T1->SetTextAlign(12); T1->SetTextSize(0.05); T1->SetTextColor(1); T1->SetTextFont(42); T1->Draw("same"); //c1->Print("VzCompare_DataPPb.png"); //c1->Print("VzCompare_DataPPb.pdf"); }
void CompareVz(){ gStyle->SetOptStat(kFALSE); gStyle->SetErrorX(0); TString coll="PbP"; bool Save=kTRUE; TF1 * fVz = new TF1("fVx","[0]+[1]*x+[2]*TMath::Power(x,2)+[3]*TMath::Power(x,3)+[4]*TMath::Power(x,4)", -15., 15.); if(coll=="PPb"){ fVz->SetParameters(1.47442e+00, -2.83100e-03, -1.19295e-02, 1.10312e-05, 2.64814e-05); //! new official MC >QM14 //fVz->SetParameters(1.60182e+00,1.08425e-03,-1.29156e-02,-7.24899e-06,2.80750e-05); //fVz->SetParameters(1.66731e+00,-2.43367e-03,-1.42488e-02,7.40147e-06,3.22477e-05); TH1F* histodata=(TH1F*)fDataPPb->Get("Vz"); TH1F* histo1=(TH1F*)fMCPPb->Get("Vz"); TH1F* histo2=(TH1F*)fMCPPb->Get("VzW"); TString data="Pb going positive side"; } else if(coll=="PbP"){ //fVz->SetParameters(1.54398e+00, -8.56155e-03, -1.40026e-02, 4.01020e-05, 3.47683e-05); //latest parameterization fVz->SetParameters(1.49736e+00, -6.93060e-03, -1.26864e-02, 2.98693e-05, 2.89538e-05); //! new official MC after QM14 TH1F* histodata=(TH1F*)fDataPbP->Get("Vz"); TH1F* histo1=(TH1F*)fMCPbP->Get("Vz"); TH1F* histo2=(TH1F*)fMCPbP->Get("VzW"); //TH1F* histo2=(TH1F*)fNMCPbP->Get("Vz"); TString data="Proton going positive side"; } else fVz->SetParameters(1.,0,0,0,0); histo1->SetName(Form("%sNewMC_unweighted",coll.Data())); histo2->SetName(Form("%sNewMC_weighted",coll.Data())); histodata->SetName(Form("%sData",coll.Data())); histo1->Rebin(5); histo2->Rebin(5); histodata->Rebin(5); //histo1=(TH1F*)histo1->Rebin(Nbin_vz,"histo1",binbound_vz); //histo2=(TH1F*)histo2->Rebin(Nbin_vz,"histo2",binbound_vz); histo1->Scale(1/histo1->Integral()); histo2->Scale(1/histo2->Integral()); histodata->Scale(1/histodata->Integral()); histo1->SetMarkerStyle(24); histo1->SetMarkerSize(1.2); histo1->SetMarkerColor(4); histo1->SetLineColor(4); histo2->SetMarkerStyle(0); histo2->SetMarkerColor(0); histo2->SetMarkerSize(0); histo2->SetFillStyle(3004); histo2->SetFillColor(2); histo2->SetLineColor(2); //histo2->SetMarkerColor(0); //histo2->SetMarkerColor(4); histodata->SetMarkerStyle(20); histodata->SetMarkerSize(1.2); histodata->SetMarkerColor(1); histodata->SetLineColor(1); TCanvas* c1 = new TCanvas("c1"," ",500,500); TCanvas* c2 = new TCanvas("c2"," ",500,500); makeMultiPanelCanvas(c1,1,1,-0.16,0,0.16,0.14,0.03); makeMultiPanelCanvas(c2,1,1,-0.16,0,0.16,0.14,0.03); TH1F* hFrame=new TH1F("","",400,-20,20); fixedFontHist(hFrame,1.1,1.7); hFrame->SetTitle(""); hFrame->GetXaxis()->SetTitleSize(0.05); hFrame->GetYaxis()->SetTitleSize(0.05); hFrame->GetXaxis()->SetTitle("Vz (cm)"); hFrame->GetYaxis()->SetTitle("Event Fraction"); hFrame->GetXaxis()->SetLimits(-15,15); //hFrame->GetXaxis()->SetLimits(-3,3); hFrame->GetYaxis()->SetRangeUser(0,5e-2); c1->cd(1); hFrame->DrawCopy(); histodata->Draw("same"); histo1->Draw("same"); histo2->Draw("HIST same"); TLegend *leg1=new TLegend(0.30,0.80,0.85,0.92); TLegend *leg2=new TLegend(0.30,0.85,0.85,0.95); leg1->SetBorderSize(0); leg2->SetBorderSize(0); leg1->SetFillColor(0); leg2->SetFillColor(0); leg1->SetTextSize(0.04); leg2->SetTextSize(0.04); leg1->AddEntry(histo1,"Before Vz weighting","lp"); leg1->AddEntry(histo2,"After Vz weighting","lpf"); //leg1->AddEntry(histo2,"New MC Before Vz weighting","lp"); leg1->AddEntry(histodata,data,"lp"); leg1->Draw("same"); TLatex *T1=new TLatex(0.25,0.92,""); T1->SetNDC(); T1->SetTextAlign(12); T1->SetTextSize(0.05); T1->SetTextColor(1); T1->SetTextFont(42); T1->Draw("same"); c2->cd(1); hFrame->GetYaxis()->SetTitle("Data/MC"); hFrame->GetXaxis()->SetLimits(-15,15); hFrame->GetYaxis()->SetRangeUser(0,2); hFrame->DrawCopy(); TH1F* ratio = (TH1F*)histodata->Clone(Form("%sratio",coll.Data())); //ratio->SetName("ratio"); ratio->Divide(histo1); /*ratio->Fit(fCen); cout<<fCen->GetNDF()<<endl; cout<<fCen->GetChisquare()<<endl; for(int icent=0;icent<=6;icent++) cout<<fCen->GetParameter(icent)<<","; cout<<endl;*/ ratio->DrawCopy("same"); fVz->SetLineColor(2); fVz->Draw("same"); leg2->AddEntry(ratio,data,"lp"); leg2->AddEntry(fVz,"reweighting function","lp"); leg2->Draw("same"); if(Save){ TFile *fout = new TFile("VzandcentCompare.root","Update"); fout->cd(); ratio->Write("",TObject::kOverwrite); histo1->Write("",TObject::kOverwrite); histo2->Write("",TObject::kOverwrite); histodata->Write("",TObject::kOverwrite); fout->Close(); c2->Print(Form("ratio_Vz_%s.png",coll.Data())); c1->Print(Form("VzCompare_Data%s.gif",coll.Data())); c1->Print(Form("VzCompare_Data%s.pdf",coll.Data())); } }
void ComparePaperppcross(){ gStyle->SetOptStat(kFALSE); //gStyle->SetOptStat(100); gStyle->SetErrorX(0); gStyle->SetLabelFont(70); const double deta[]={0., 0.5, 1.0, 1.5, 2.0, 2.5} ; int nptpoint[]={33, 30, 27, 24, 19}; int netabin = sizeof(deta)/sizeof(Double_t)-1 ; const Double_t jetPtBin[]={56,64,74,84,97,114,133,153,174,196,220,245,272,300,330,362,395,430,468,507,548,592,638,686,737,790, 846}; const int nJetPtBin = sizeof(jetPtBin)/sizeof(Double_t)-1 ; const int N = netabin ; double RptCen[N][100], R7ptCen[N][100], xerrminus[N][100], xerrplus[N][100], Ryval[N][100],Rystatup[N][100], Rystatdown[N][100], Rysysup[N][100], Rysysdown[N][100],R7yval[N][100],R7ystatup[N][100], R7ystatdown[N][100], R7ysysup[N][100], R7ysysdown[N][100]; ifstream infile; std::string inname ; std::string inname2 ; bool Save=1; int conesize=7; if(conesize==5) TString ref1 = "QCD-10-011";// "PRL107(2011)132001" if(conesize==7) TString ref1 = "QCD-11-004";// "PRD87 (2012)112002" TString ref2 = "SMP-13-002"; //"PRD90 (2014)072006 TH1F *Rjet[N]; TH1F *Rjet1[N]; TH1F *Rratio[N]; for(int ieta=0; ieta<N; ieta++) { Rjet[ieta] = new TH1F(Form("RjetcsAbsEta%.f",deta[ieta+1]*10),Form("RjetcsAbsEta%.f",deta[ieta+1]*10), nJetPtBin,jetPtBin); Rjet[ieta]->Sumw2(); Rjet1[ieta] = new TH1F(Form("RjetcsAbsEta%.f_1",deta[ieta+1]*10),Form("RjetcsAbsEta%.f_1",deta[ieta+1]*10), nJetPtBin,jetPtBin); Rjet1[ieta]->Sumw2(); Rratio[ieta] = new TH1F(Form("RjetcsratioAbsEta%.f_1",deta[ieta+1]*10),Form("RjetcsratioAbsEta%.f_1",deta[ieta+1]*10), nJetPtBin,jetPtBin); Rratio[ieta]->Sumw2(); } inname = Form("InclusiveJets_Table_AK%d_new.txt",conesize); //cout <<"input = " <<inname.c_str() <<endl ; // FILE* infile = fopen(inname.c_str(), "r"); infile.open(inname.c_str()); std::string line; int np =0; // infile.open(inname.c_str()); // string line; Int_t row = 0; double v[1000][100]; // cout << "going to reading files !!!" << endl ; // cout << "infile = " << infile <<endl ; if(infile.fail()) { cerr << "unable to open file for reading" << endl; exit(1); } while(std::getline(infile, line) && row < 1000 ) { int column = 0; // cout << "inside loop now 2222222 !!!" << endl ; istringstream lineStream(line); while( lineStream >> v[row][column] && column < 100 ) column++; row++; // cout << "row =" << row << "column = " << column <<endl ; } infile.close(); Int_t ieta=0; for(int irow = 0 ; irow < row ; irow++){ if(v[irow][0]>1.5 || v[irow][3]> jetPtBin[nJetPtBin]) continue ; for(int ibin = 0 ; ibin < netabin ; ibin++){ if(v[irow][0]==deta[ibin] && v[irow][1]==deta[ibin+1]) ieta=ibin ; } if(v[irow][2]==56) np=0 ; //cout << " ieta = " << ieta << " np = " << np <<endl ; RptCen[ieta][np]=v[irow][2]+(v[irow][3]-v[irow][2])/2.; Ryval[ieta][np]=v[irow][4]; Rystatup[ieta][np]=(v[irow][5])*v[irow][4]; Rystatdown[ieta][np]=(v[irow][6])*v[irow][4]; Rysysup[ieta][np]=TMath::Sqrt(v[irow][7]*v[irow][7]+v[irow][10]*v[irow][10]+v[irow][12]*v[irow][12]+v[irow][14]*v[irow][14]+v[irow][16]*v[irow][16]+v[irow][18]*v[irow][18]+v[irow][20]*v[irow][20]+v[irow][22]*v[irow][22]+v[irow][24]*v[irow][24]+v[irow][26]*v[irow][26]+v[irow][28]*v[irow][28]+v[irow][30]*v[irow][30]+v[irow][32]*v[irow][32]+v[irow][34]*v[irow][34]+v[irow][36]*v[irow][36]+v[irow][38]*v[irow][38]+v[irow][40]*v[irow][40]+v[irow][42]*v[irow][42]+v[irow][44]*v[irow][44]); int point = -1 ; for(int ibin = 0 ; ibin < nJetPtBin ; ibin++){ if(v[irow][2]==jetPtBin[ibin] && v[irow][3]==jetPtBin[ibin+1]) point=ibin ; } if(point <0) continue ; int hbin = Rjet[ieta]->FindBin(RptCen[ieta][np]); // if(sys=="SysUp") // Rjet[ieta]->SetBinContent(hbin, Ryval[ieta][point]+Rysysup[ieta][point]*Ryval[ieta][point]); // else if(sys=="SysDown") // Rjet[ieta]->SetBinContent(hbin, Ryval[ieta][point]-Rysysdown[ieta][point]*Ryval[ieta][point]); // else Rjet[ieta]->SetBinContent(hbin, Ryval[ieta][point]); Rjet[ieta]->SetBinError(hbin, Rystatup[ieta][point]); // sys[np]=v2*TMath::Sqrt(2); np++; } //--------------------------------------------------------------------------------------------------------- for(int ieta=0; ieta<4; ieta++){ inname = Form("R%dY%.fp%.f_%.fp%.f.txt",conesize,TMath::Floor(deta[ieta]),(deta[ieta]-TMath::Floor(deta[ieta]))*10,TMath::Floor(deta[ieta+1]),(deta[ieta+1]-TMath::Floor(deta[ieta+1]))*10); //cout <<"input = " <<inname.c_str() <<endl ; // FILE* infile = fopen(inname.c_str(), "r"); infile.open(inname.c_str()); std::string line; int np =0; // infile.open(inname.c_str()); // string line; Int_t row = 0; double v[1000][100]; double RptCen[N][100], R7ptCen[N][100], xerrminus[N][100], xerrplus[N][100], Ryval[N][100],Rystatup[N][100], Rystatdown[N][100], Rysysup[N][100], Rysysdown[N][100],R7yval[N][100],R7ystatup[N][100], R7ystatdown[N][100], R7ysysup[N][100], R7ysysdown[N][100]; // cout << "going to reading files !!!" << endl ; // cout << "infile = " << infile <<endl ; if(infile.fail()) { cerr << "unable to open file for reading" << endl; exit(1); } while(std::getline(infile, line) && row < 1000 ) { int column = 0; // cout << "inside loop now 2222222 !!!" << endl ; istringstream lineStream(line); while( lineStream >> v[row][column] && column < 100 ) column++; row++; // cout << "row =" << row << "column = " << column <<endl ; } infile.close(); for(int irow = 0 ; irow < row ; irow++){ if(v[irow][2] > jetPtBin[nJetPtBin]) continue ; if(conesize == 5 && v[irow][1]==56) np=0 ; if(conesize == 7 && v[irow][1]==114) np=5 ; //cout << " ieta = " << ieta << " np = " << np <<endl ; RptCen[ieta][np]=v[irow][1]+(v[irow][2]-v[irow][1])/2.; Ryval[ieta][np]=v[irow][3]; Rystatup[ieta][np]=(v[irow][4]); Rystatdown[ieta][np]=(v[irow][5]); Rysysup[ieta][np]=TMath::Sqrt(v[irow][7]*v[irow][7]+v[irow][10]*v[irow][10]+v[irow][12]*v[irow][12]+v[irow][14]*v[irow][14]+v[irow][16]*v[irow][16]+v[irow][18]*v[irow][18]+v[irow][20]*v[irow][20]+v[irow][22]*v[irow][22]+v[irow][24]*v[irow][24]+v[irow][26]*v[irow][26]+v[irow][28]*v[irow][28]+v[irow][30]*v[irow][30]+v[irow][32]*v[irow][32]+v[irow][34]*v[irow][34]+v[irow][36]*v[irow][36]+v[irow][38]*v[irow][38]+v[irow][40]*v[irow][40]+v[irow][42]*v[irow][42]+v[irow][44]*v[irow][44]); int point = -1 ; for(int ibin = 0 ; ibin < nJetPtBin ; ibin++){ if(v[irow][1]==jetPtBin[ibin] && v[irow][2]==jetPtBin[ibin+1]) point=ibin ; } if(point <0) continue ; int hbin = Rjet1[ieta]->FindBin(RptCen[ieta][np]); // if(sys=="SysUp") // Rjet[ieta]->SetBinContent(hbin, Ryval[ieta][point]+Rysysup[ieta][point]*Ryval[ieta][point]); // else if(sys=="SysDown") // Rjet[ieta]->SetBinContent(hbin, Ryval[ieta][point]-Rysysdown[ieta][point]*Ryval[ieta][point]); // else Rjet1[ieta]->SetBinContent(hbin, Ryval[ieta][point]); Rjet1[ieta]->SetBinError(hbin, Rystatup[ieta][point]); // sys[np]=v2*TMath::Sqrt(2); np++; } // Rratio[ieta]=(TH1F*)Rjet[ieta]->Clone(Form("R_%d",ieta)); // Rratio[ieta]->Divide(Rjet1[ieta]); for(int ibin = Rjet[ieta]->FindBin(56); ibin < Rjet[ieta]->FindBin(569); ibin ++){ double bincenter = Rjet[ieta]->GetBinCenter(ibin); Rratio[ieta]->SetBinContent(ibin, Rjet1[ieta]->GetBinContent(Rjet1[ieta]->FindBin(bincenter))/Rjet[ieta]->GetBinContent(ibin)); Rratio[ieta]->SetBinError(ibin,0); } } c1 = new TCanvas("c1"," ",1200,400); c2 = new TCanvas("c2"," ",1200,400); makeMultiPanelCanvas(c1,4,1,0,0,0.22,0.18,0.03); makeMultiPanelCanvas(c2,4,1,0,0,0.22,0.18,0.03); TH1F* hFrame1=new TH1F("","",1000,0,1000); fixedFontHist(hFrame1,1.4,1.6); hFrame1->SetTitle(""); TLegend *leg1=new TLegend(0.26,0.26,0.60,0.45); leg1->SetBorderSize(0); leg1->SetFillColor(0); leg1->SetLineWidth(0); leg1->SetTextSize(0.045); TLatex T1; T1.SetNDC(); T1.SetTextSize(0.065); T1.SetTextFont(42); TLine *l = new TLine(hFrame1->GetXaxis()->GetXmin(),1,hFrame1->GetXaxis()->GetXmax(),1); l->SetLineStyle(2); for(int ieta=0;ieta<4;ieta++){ double ybase=0.15; double xbase=0.28; if(ieta==0){ hFrame1->GetYaxis()->SetTitle("d^{2}#sigma/dp_{T}dy"); hFrame1->SetLabelSize(18,"Y"); } else{ hFrame1->SetLabelSize(0,"Y"); hFrame1->GetYaxis()->SetTitle(""); } hFrame1->GetXaxis()->SetTitle("p_{T}^{jet} (GeV/c)"); c1->cd(ieta+1)->SetLogy(); hFrame1->GetXaxis()->SetNdivisions(510); hFrame1->GetXaxis()->SetRangeUser(32,597); hFrame1->SetMinimum(1e-4); hFrame1->SetMaximum(1e9); hFrame1->DrawCopy(); Rjet[ieta]->SetMarkerSize(1.5); Rjet[ieta]->SetMarkerStyle(20); Rjet[ieta]->SetMarkerColor(1); Rjet[ieta]->SetLineColor(1); Rjet1[ieta]->SetMarkerSize(1.5); Rjet1[ieta]->SetMarkerStyle(24); Rjet1[ieta]->SetMarkerColor(2); Rjet1[ieta]->SetLineColor(2); Rjet[ieta]->Draw("Psame"); Rjet1[ieta]->Draw("Psame"); if(ieta==0) T1.DrawLatex(0.3,0.85,Form("|y| < %.1f",deta[ieta+1])); else T1.DrawLatex(0.3,0.85,Form("%.1f < |y| < %.1f",deta[ieta],deta[ieta+1])); if(ieta==0){ leg1->AddEntry(Rjet[ieta],Form("%s",ref1.Data()),"lp"); leg1->AddEntry(Rjet1[ieta],Form("%s",ref2.Data()),"lp"); leg1->Draw("same"); T1.DrawLatex(0.7,0.25,Form("R = 0.%d",conesize)); } c2->cd(ieta+1); hFrame1->GetYaxis()->SetTitle("pp 7TeV measurement"); if(conesize==5){ hFrame1->SetMinimum(0.80); hFrame1->SetMaximum(1.20); } if(conesize==7){ hFrame1->SetMinimum(0.95); hFrame1->SetMaximum(1.05); } hFrame1->DrawCopy(); Rratio[ieta]->SetMarkerSize(1.5); Rratio[ieta]->SetMarkerStyle(20); Rratio[ieta]->SetMarkerColor(1); Rratio[ieta]->SetLineColor(1); //getRidYError(Rratio[ieta]); Rratio[ieta]->Draw("Psame"); TLegend *leg= new TLegend(*leg1); leg->Clear(); leg->AddEntry(Rratio[ieta],Form("#frac{%s}{%s}",ref1.Data(),ref2.Data()),"lp"); if(ieta==0) T1.DrawLatex(0.3,0.85,Form("|y| < %.1f",deta[ieta+1])); else T1.DrawLatex(0.3,0.85,Form("%.1f < |y| < %.1f",deta[ieta],deta[ieta+1])); if(ieta==0){ leg->Draw("same"); T1.DrawLatex(0.7,0.25,Form("R = 0.%d",conesize)); } l->Draw("same"); } if(Save){ c1->Print(Form("ppR%dcs.png",conesize)); c1->Print(Form("ppR%dcs.pdf",conesize)); c2->Print(Form("ppR%dcsratio.png",conesize)); c2->Print(Form("ppR%dcsratio.pdf",conesize)); } }