/* void formatCanvas(TCanvas *c){ c->Divide(1,2,0.01,0.01); c->cd(1); c->GetPad(1)->SetLogy(); c->GetPad(1)->SetPad(0.,0.425,1.,1.); c->GetPad(2)->SetPad(0.,0.0,1.,0.425); c->GetPad(2)->SetBottomMargin(0.3); c->GetPad(2)->SetGridy(1); } // divide by bin width void divideBinWidth(TH1 *h) { h->Sumw2(); for (int i=0;i<=h->GetNbinsX();i++) { Float_t val = h->GetBinContent(i); Float_t valErr = h->GetBinError(i); val/=h->GetBinWidth(i); valErr/=h->GetBinWidth(i); h->SetBinContent(i,val); h->SetBinError(i,valErr); } h->GetXaxis()->CenterTitle(); h->GetYaxis()->CenterTitle(); } void cleanup(TH1F *h) { for (int i=1;i<=h->GetNbinsX();i++) { double val1 = h->GetBinContent(i); double valErr1 = h->GetBinError(i); if (valErr1>=val1) { h->SetBinContent(i,0); h->SetBinError(i,0); } } } // rebin the spectra TH1F *rebin(TH1F *h, char *histName) { TH1F *hRebin = new TH1F(Form("%s_rebin",h->GetName()),Form("rebin %s",h->GetTitle()),nbins_recrebin,boundaries_recrebin); for (int i=1;i<=h->GetNbinsX();i++) { double val=h->GetBinContent(i); double valErr=h->GetBinError(i); int binNum = hRebin->FindBin(h->GetBinCenter(i)); double val1 = hRebin->GetBinContent(binNum); double valErr1 = hRebin->GetBinError(binNum); hRebin->SetBinContent(binNum,val+val1); hRebin->SetBinError(binNum,sqrt(valErr1*valErr1+valErr*valErr)); } cleanup(hRebin); hRebin->SetName(histName); return hRebin; } TH1F *rebin2(TH1F *h, char *histName) { TH1F *hRebin = new TH1F(Form("%s_rebin",h->GetName()),Form("rebin %s",h->GetTitle()),nbins_recrebin_2,boundaries_recrebin_2); for (int i=1;i<=h->GetNbinsX();i++) { double val=h->GetBinContent(i); double valErr=h->GetBinError(i); int binNum = hRebin->FindBin(h->GetBinCenter(i)); double val1 = hRebin->GetBinContent(binNum); double valErr1 = hRebin->GetBinError(binNum); hRebin->SetBinContent(binNum,val+val1); hRebin->SetBinError(binNum,sqrt(valErr1*valErr1+valErr*valErr)); } cleanup(hRebin); hRebin->SetName(histName); return hRebin; } void drawText(const char *text, float xp, float yp, int size){ TLatex *tex = new TLatex(xp,yp,text); tex->SetTextFont(63); tex->SetTextSize(size); tex->SetTextColor(kBlack); tex->SetLineWidth(1); //tex->SetTextFont(42); tex->SetNDC(); tex->Draw(); } void putCMSPrel(double x, double y, double size){ TLatex *tex=0; tex = new TLatex(x,y,"CMS Preliminary"); tex->SetTextSize(size); tex->SetLineWidth(2); tex->SetNDC(); tex->Draw(); } void putCMSSim(double x, double y, double size){ TLatex *tex=0; tex = new TLatex(x,y,"CMS Simulation"); tex->SetTextSize(size); tex->SetLineWidth(2); tex->SetNDC(); tex->Draw(); } TLegend *myLegend(double x1,double y1,double x2, double y2) { TLegend *leg = new TLegend(x1,y1,x2,y2); leg->SetBorderSize(0); leg->SetFillStyle(0); return leg; } */ void nlo_comp_macro(int radius = 3){ TH1::SetDefaultSumw2(); gStyle->SetOptStat(0); TFile *fPP = TFile::Open("/net/hisrv0001/home/rkunnawa/WORK/CMSSW_6_0_0/src/result-2013-akVs3PF-cent-1-isFineBin-0/pbpb_pp_merged_chmx_pt_isMC_0_Unfo_2013_akVs3PF_cent_1_isFineBin_0.root"); //TFile *fNLO_err = TFile::Open("fnl4350a_cteq"); TFile *fNLO_nnpdf = TFile::Open("/net/hisrv0001/home/rkunnawa/WORK/CMSSW_6_0_0/src/fnl4350a_nnpdf21-nlo_aspdf_new.root"); TFile *fNLO_cteq = TFile::Open("/net/hisrv0001/home/rkunnawa/WORK/CMSSW_6_0_0/src/fnl4350a_cteq66-nlo_aspdf_all_new.root"); TFile *fNLO_ct10n = TFile::Open("/net/hisrv0001/home/rkunnawa/WORK/CMSSW_6_0_0/src/fnl4350a_ct10n-nlo_aspdf_new.root"); TFile *fNLO_hera = TFile::Open("/net/hisrv0001/home/rkunnawa/WORK/CMSSW_6_0_0/src/fnl4350a_hera15all-nlo_aspdf_new.root"); //alright lets get the unfolded data here: remember we need it for eta range -2 to +2 //TFile* fPP_unfo_R3 = TFile::Open("pp_2013_2760_abs_eta_2_mc_ak3PF.root"); TFile* fPP_unfo_R4 = TFile::Open("/net/hisrv0001/home/rkunnawa/WORK/CMSSW_6_0_0/src/pp_2013_2760_abs_eta_2_mc_ak4PF.root"); TFile* fPP_unfo_R5 = TFile::Open("/net/hisrv0001/home/rkunnawa/WORK/CMSSW_6_0_0/src/pp_2013_2760_abs_eta_2_mc_ak5PF.root"); //TFile *f_unfold_R2 = TFile::Open("/net/hisrv0001/home/rkunnawa/WORK/RAA/CMSSW_5_3_20/src/Output/PbPb_pp_unfold_marguerite_jet80_chMaxjtpt_norawptcut_test_65GeVCut_akPu2PF_20150205_test.root"); TFile *f_unfold_R3 = TFile::Open(Form("Pawan_ntuple_PbPb_pp_calopfpt_ppNoJetidcut_nlobins_R0p%d_without80FakeRemoval_unfold_mcclosure_oppside_trgMC_noSmear_20_eta_20_%dGeVCut_akPF_20150522.root",3,40)); //TFile *f_unfold_R4 = TFile::Open("/net/hisrv0001/home/rkunnawa/WORK/RAA/CMSSW_5_3_20/src/Output/PbPb_pp_unfold_marguerite_jet80_chMaxjtpt_norawptcut_test_65GeVCut_akPu4PF_20150205_test.root"); TH1F* hPP_data_R_3 = (TH1F*)f_unfold_R3->Get("PP_bayesian_unfolded_spectra"); hPP_data_R_3->Print("base"); hPP_data_R_3 = (TH1F*)hPP_data_R_3->Rebin(nbins_yaxian, "PP_bayesian_unfolded_spectra", boundaries_yaxian); divideBinWidth(hPP_data_R_3); hPP_data_R_3->Print("base"); //PP_measured[0] = (TH1F*)f_unfold_R2->Get("PP_measured_unfolded_spectra"); //PP_binbybin[0] = (TH1F*)f_unfold_R2->Get("PP_binbybin_unfolded_spectra"); //TH1F* PP_bayesian[1] = (TH1F*)f_unfold_R4->Get("PP_bayesian_unfolded_spectra"); //PP_measured[1] = (TH1F*)f_unfold_R3->Get("PP_measured_unfolded_spectra"); //PP_binbybin[1] = (TH1F*)f_unfold_R3->Get("PP_binbybin_unfolded_spectra"); TFile fout("pp_2760GeV_nlo_histos.root","RECREATE"); fout.cd(); TH1F* hPP_nnpdf_NLO = (TH1F*)fNLO_nnpdf->Get(Form("h100%d00",radius-1)); TH1F* hPP_cteq_NLO = (TH1F*)fNLO_cteq->Get(Form("h100%d00",radius-1)); TH1F* hPP_ct10n_NLO = (TH1F*)fNLO_ct10n->Get(Form("h100%d00",radius-1)); TH1F* hPP_hera_NLO = (TH1F*)fNLO_hera->Get(Form("h100%d00",radius-1)); //TH1F* hPP_data_R_3 = (TH1F*)fPP_unfo_R3->Get("Unfolded_cent1"); TH1F* hPP_data_R_4 = (TH1F*)fPP_unfo_R4->Get("Unfolded_cent1"); TH1F* hPP_data_R_5 = (TH1F*)fPP_unfo_R5->Get("Unfolded_cent1"); hPP_data_R_3->Scale(5.3*1e3); hPP_data_R_3->Scale(1./5300e6); //hPP_data_R_3->Scale(1./4); //divideBinWidth(hPP_data_R_3); hPP_data_R_4->Scale(1./5300e6); hPP_data_R_4->Scale(1./4); divideBinWidth(hPP_data_R_4); hPP_data_R_5->Scale(1./5300e6); hPP_data_R_5->Scale(1./4); divideBinWidth(hPP_data_R_5); // NLO histograms without any R# at the end correspond to R=0.3 the standard. others are named accordingly TH1F* hPP_nnpdf_NLO_R4 = (TH1F*)fNLO_nnpdf->Get("h100300"); TH1F* hPP_nnpdf_NLO_R2 = (TH1F*)fNLO_nnpdf->Get("h100100"); TH1F* hPP_cteq_NLO_R4 = (TH1F*)fNLO_cteq->Get("h100300"); TH1F* hPP_ct10n_NLO_R4 = (TH1F*)fNLO_ct10n->Get("h100300"); TH1F* hPP_hera_NLO_R4 = (TH1F*)fNLO_hera->Get("h100300"); TH1F* hPP_cteq_NLO_R2 = (TH1F*)fNLO_cteq->Get("h100100"); TH1F* hPP_ct10n_NLO_R2 = (TH1F*)fNLO_ct10n->Get("h100100"); TH1F* hPP_hera_NLO_R2 = (TH1F*)fNLO_hera->Get("h100100"); TH1F* hPP_err = (TH1F*)fNLO_cteq->Get("h100203"); TH1F* hPP_err_R4 = (TH1F*)fNLO_cteq->Get("h100303"); TH1F* hPP_err_R2 = (TH1F*)fNLO_cteq->Get("h100103"); for(int i = 0;i<hPP_nnpdf_NLO->GetNbinsX();i++){ Float_t valErr = hPP_err->GetBinError(i); hPP_nnpdf_NLO->SetBinError(i,valErr); hPP_cteq_NLO->SetBinError(i,valErr); hPP_hera_NLO->SetBinError(i,valErr); hPP_ct10n_NLO->SetBinError(i,valErr); Float_t valErr_R4 = hPP_err_R4->GetBinError(i); hPP_nnpdf_NLO_R4->SetBinError(i,valErr_R4); hPP_cteq_NLO_R4->SetBinError(i,valErr_R4); hPP_ct10n_NLO_R4->SetBinError(i,valErr_R4); hPP_hera_NLO_R4->SetBinError(i,valErr_R4); Float_t valErr_R2 = hPP_err_R2->GetBinError(i); hPP_nnpdf_NLO_R2->SetBinError(i,valErr_R2); hPP_cteq_NLO_R2->SetBinError(i,valErr_R2); hPP_ct10n_NLO_R2->SetBinError(i,valErr_R2); hPP_hera_NLO_R2->SetBinError(i,valErr_R2); } //add the NPC factors char etaWidth[dir][256] = { "n10_eta_p10","n20_eta_p20","n25_eta_n20","n20_eta_n15", "n15_eta_n10","n10_eta_n05","n05_eta_p05","p05_eta_p10", "p10_eta_p15","p15_eta_p20", "n10_eta_p10","n20_eta_p20","n25_eta_n20","n20_eta_n15", "n15_eta_n10","n10_eta_n05","n05_eta_p05","p05_eta_p10", "p10_eta_p15","p15_eta_p20", "n10_eta_p10","n20_eta_p20","n25_eta_n20","n20_eta_n15", "n15_eta_n10","n10_eta_n05","n05_eta_p05","p05_eta_p10", "p10_eta_p15","p15_eta_p20", "n10_eta_p10","n20_eta_p20","n25_eta_n20","n20_eta_n15", "n15_eta_n10","n10_eta_n05","n05_eta_p05","p05_eta_p10", "p10_eta_p15","p15_eta_p20", "n10_eta_p10","n20_eta_p20","n25_eta_n20","n20_eta_n15", "n15_eta_n10","n10_eta_n05","n05_eta_p05","p05_eta_p10", "p10_eta_p15","p15_eta_p20" }; char radius_lable[dir][256] = { "R2","R2","R2","R2","R2","R2","R2","R2","R2","R2", "R3","R3","R3","R3","R3","R3","R3","R3","R3","R3", "R4","R4","R4","R4","R4","R4","R4","R4","R4","R4", "R5","R5","R5","R5","R5","R5","R5","R5","R5","R5", "R7","R7","R7","R7","R7","R7","R7","R7","R7","R7" }; ifstream fin_txt[dir]; int energy = 2760; for(int i = 0;i<dir;i++){ //ostringstream filename; //filename<<"/net/hisrv0001/home/rkunnawa/WORK/RAA/CMSSW_5_3_8_HI_patch2/src/Macros/RAA/nlo_files/input_np_txtfiles/NPC_ak_"<<radius_lable[i]<<etaWidth[i]<<"_energy"<<energy<<".txt"; fin_txt[i].open(Form("/net/hisrv0001/home/rkunnawa/WORK/RAA/CMSSW_5_3_8_HI_patch2_old/src/Macros/RAA/nlo_files/input_np_txtfiles/NPC_ak_%s_%s_energy%d.txt",radius_lable[i],etaWidth[i],energy)); } //apply the correction factors to the NLO histograms Float_t npc = 0; Float_t bin = 0; //before applying the corrections, lets get a clone of the uncorrected histogram. TH1F* hPP_nnpdf_NLO_noNPC = (TH1F*)hPP_nnpdf_NLO->Clone("hPP_nnpdf_NLO_noNPC"); int counter = 0; while(1){ fin_txt[11]>>bin>>npc; cout<<bin<<" "<<npc<<endl; if(!fin_txt[11].good())break; int bin_no = hPP_nnpdf_NLO->FindBin(bin); //cout<<"bin no = "<<bin_no<<endl; //cout<<"boundaries_pt of bin no"<<boundaries_yaxian_large[bin_no]<<endl; cout<<"value before applying = "<<hPP_nnpdf_NLO->GetBinContent(bin_no)<<endl; hPP_nnpdf_NLO->SetBinContent(bin_no,npc*hPP_nnpdf_NLO->GetBinContent(bin_no)); cout<<"value after applying = "<<hPP_nnpdf_NLO->GetBinContent(bin_no)<<endl; hPP_cteq_NLO->SetBinContent(bin_no,npc*hPP_cteq_NLO->GetBinContent(bin_no)); hPP_ct10n_NLO->SetBinContent(bin_no,npc*hPP_ct10n_NLO->GetBinContent(bin_no)); hPP_hera_NLO->SetBinContent(bin_no,npc*hPP_hera_NLO->GetBinContent(bin_no)); fin_txt[1]>>bin>>npc; if(!fin_txt[1].good())break; bin_no = hPP_nnpdf_NLO_R2->FindBin(bin); hPP_nnpdf_NLO_R2->SetBinContent(bin_no,npc*hPP_nnpdf_NLO_R2->GetBinContent(bin_no)); hPP_cteq_NLO_R2->SetBinContent(bin_no,npc*hPP_cteq_NLO_R2->GetBinContent(bin_no)); hPP_ct10n_NLO_R2->SetBinContent(bin_no,npc*hPP_ct10n_NLO_R2->GetBinContent(bin_no)); hPP_hera_NLO_R2->SetBinContent(bin_no,npc*hPP_hera_NLO_R2->GetBinContent(bin_no)); fin_txt[21]>>bin>>npc; if(!fin_txt[21].good())break; bin_no = hPP_nnpdf_NLO_R4->FindBin(bin); hPP_nnpdf_NLO_R4->SetBinContent(bin_no,npc*hPP_nnpdf_NLO_R4->GetBinContent(bin_no)); hPP_cteq_NLO_R4->SetBinContent(bin_no,npc*hPP_cteq_NLO_R4->GetBinContent(bin_no)); hPP_ct10n_NLO_R4->SetBinContent(bin_no,npc*hPP_ct10n_NLO_R4->GetBinContent(bin_no)); hPP_hera_NLO_R4->SetBinContent(bin_no,npc*hPP_hera_NLO_R4->GetBinContent(bin_no)); counter++; } cout<<"counter = "<<counter<<endl; //get a clone after applying the corrections, TH1F* hPP_nnpdf_NLO_NPC = (TH1F*)hPP_nnpdf_NLO->Clone("hPP_nnpdf_NLO_NPC"); TH1F* hPP_NPC_ratio = (TH1F*)hPP_nnpdf_NLO_NPC->Clone("hPP_NPC_ratio"); hPP_NPC_ratio->Divide(hPP_nnpdf_NLO_noNPC); /* TCanvas *cnpc = new TCanvas("cnpc","",800,600); //cnpc->SetLogy(); hPP_NPC_ratio->SetTitle("NPC 2.76 TeV R=0.3"); hPP_NPC_ratio->SetXTitle("Jet p_{T} (GeV/c)"); hPP_NPC_ratio->SetYTitle("NP factors"); hPP_NPC_ratio->SetAxisRange(0.7,1.3,"Y"); hPP_NPC_ratio->Draw(); cnpc->SaveAs("pp_2760_npc_R3.pdf","RECREATE"); */ hPP_nnpdf_NLO->SetName("hPP_nnpdf_NLO"); hPP_cteq_NLO->SetName("hPP_cteq_NLO"); hPP_ct10n_NLO->SetName("hPP_ct10n_NLO"); hPP_hera_NLO->SetName("hPP_hera_NLO"); hPP_nnpdf_NLO_R2->SetName("hPP_nnpdf_NLO_R2"); hPP_nnpdf_NLO_R2->Print("base"); hPP_cteq_NLO_R2->SetName("hPP_cteq_NLO_R2"); hPP_cteq_NLO_R2->Print("base"); hPP_ct10n_NLO_R2->SetName("hPP_ct10n_NLO_R2"); hPP_ct10n_NLO_R2->Print("base"); hPP_hera_NLO_R2->SetName("hPP_hera_NLO_R2"); hPP_nnpdf_NLO_R4->SetName("hPP_nnpdf_NLO_R4"); hPP_cteq_NLO_R4->SetName("hPP_cteq_NLO_R4"); hPP_ct10n_NLO_R4->SetName("hPP_ct10n_NLO_R4"); hPP_hera_NLO_R4->SetName("hPP_hera_NLO_R4"); hPP_nnpdf_NLO->Write(); hPP_cteq_NLO->Write(); hPP_ct10n_NLO->Write(); hPP_hera_NLO->Write(); hPP_nnpdf_NLO_R2->Write(); hPP_cteq_NLO_R2->Write(); hPP_ct10n_NLO_R2->Write(); hPP_hera_NLO_R2->Write(); hPP_nnpdf_NLO_R4->Write(); hPP_cteq_NLO_R4->Write(); hPP_ct10n_NLO_R4->Write(); hPP_hera_NLO_R4->Write(); TH1F* hPPrebin = (TH1F*)hPP_data_R_3->Clone("hPPrebin"); //TH1F* hPPrebin_test = (TH1F*)faditya->Get("Corrected Jet Spectrum Aditya"); //TH1F* hPPrebin = (TH1F*)hPPrebin_test->Rebin(nbins_yaxian_large,"hPPrebin",boundaries_yaxian_large); //TH1F* hPPunfo = (TH1F*)fPP->Get("Unfolded_cent6"); TH1F* hPPgen = (TH1F*)fPP->Get("hGen_cent1"); //hPPrebin->Scale(64);//remove the sigma scaling from the previous macros //dont need this now since we are taking it from a dedicated macro which gives us diff cross section hPP_data_R_3->Scale(1e9); hPP_data_R_4->Scale(1e9); hPP_data_R_5->Scale(1e9); //hPP_nnpdf_NLO->Scale(1./4); //hPP_cteq_NLO->Scale(1./4); //hPP_hera_NLO->Scale(1./4); hPPrebin->Scale(1e9); //hPPrebin->Scale(1./5300e6); //hPPrebin->Scale(1./4); //divideBinWidth(hPPrebin); hPPgen->Scale(1./4); hPPgen->Scale(1e9); fout.Write(); hPP_nnpdf_NLO = (TH1F*)hPP_nnpdf_NLO->Rebin(nbins_yaxian,"nnpdf_pp", boundaries_yaxian); hPP_nnpdf_NLO->Print("base"); hPP_cteq_NLO = (TH1F*)hPP_cteq_NLO->Rebin(nbins_yaxian,"cteq_pp", boundaries_yaxian); hPP_cteq_NLO->Print("base"); hPP_hera_NLO = (TH1F*)hPP_hera_NLO->Rebin(nbins_yaxian,"hera_pp", boundaries_yaxian); hPP_hera_NLO->Print("base"); hPP_ct10n_NLO = (TH1F*)hPP_ct10n_NLO->Rebin(nbins_yaxian,"ct10n_pp", boundaries_yaxian); hPP_ct10n_NLO->Print("base"); TH1F* hRatio_nnpdf_mc = (TH1F*)hPPgen->Rebin(nbins_yaxian,"hRatio_nnpdf_mc",boundaries_yaxian); hRatio_nnpdf_mc->Divide(hPP_nnpdf_NLO); TH1F* hRatio_cteq_mc = (TH1F*)hPPgen->Rebin(nbins_yaxian,"hRatio_cteq_mc",boundaries_yaxian); hRatio_cteq_mc->Divide(hPP_cteq_NLO); TH1F* hRatio_hera_mc = (TH1F*)hPPgen->Rebin(nbins_yaxian,"hRatio_hera_mc",boundaries_yaxian); hRatio_hera_mc->Divide(hPP_hera_NLO); TH1F* hRatio_ct10n_mc = (TH1F*)hPPgen->Rebin(nbins_yaxian,"hRatio_ct10n_mc",boundaries_yaxian); hRatio_ct10n_mc->Divide(hPP_ct10n_NLO); TH1F* hRatio_nnpdf = (TH1F*)hPP_nnpdf_NLO->Rebin(nbins_yaxian,"hRatio_nnpdf",boundaries_yaxian); hRatio_nnpdf->Divide(hPPrebin); TH1F* hRatio_cteq = (TH1F*)hPP_cteq_NLO->Rebin(nbins_yaxian,"hRatio_cteq",boundaries_yaxian); hRatio_cteq->Divide(hPPrebin); TH1F* hRatio_ct10n = (TH1F*)hPP_ct10n_NLO->Rebin(nbins_yaxian,"hRatio_ct10n",boundaries_yaxian); hRatio_ct10n->Divide(hPPrebin); TH1F* hRatio_hera = (TH1F*)hPP_hera_NLO->Rebin(nbins_yaxian,"hRatio_hera",boundaries_yaxian); hRatio_hera->Divide(hPPrebin); TH1F* hRatio_ppgen = (TH1F*)hPPgen->Rebin(nbins_yaxian,"hRatio_ppgen",boundaries_yaxian); hRatio_ppgen->Divide(hPPrebin); TH1F* hRatio_nnpdf_R_2_4 = (TH1F*)hPP_nnpdf_NLO_R2->Rebin(nbins_yaxian,"hRatio_nnpdf_R_2_4",boundaries_yaxian); hRatio_nnpdf_R_2_4->Divide(hPP_nnpdf_NLO_R4); TH1F* hRatio_nnpdf_R_3_4 = (TH1F*)hPP_nnpdf_NLO->Rebin(nbins_yaxian,"hRatio_nnpdf_R_3_4",boundaries_yaxian); hRatio_nnpdf_R_3_4->Divide(hPP_nnpdf_NLO_R4); TH1F* hRatio_cteq_R_2_4 = (TH1F*)hPP_cteq_NLO_R2->Rebin(nbins_yaxian,"hRatio_cteq_R_2_4",boundaries_yaxian); hRatio_cteq_R_2_4->Divide(hPP_cteq_NLO_R4); TH1F* hRatio_cteq_R_3_4 = (TH1F*)hPP_cteq_NLO->Rebin(nbins_yaxian,"hRatio_cteq_R_3_4",boundaries_yaxian); hRatio_cteq_R_3_4->Divide(hPP_cteq_NLO_R4); TH1F* hRatio_ct10n_R_2_4 = (TH1F*)hPP_ct10n_NLO_R2->Rebin(nbins_yaxian,"hRatio_ct10n_R_2_4",boundaries_yaxian); hRatio_ct10n_R_2_4->Divide(hPP_ct10n_NLO_R4); TH1F* hRatio_ct10n_R_3_4 = (TH1F*)hPP_ct10n_NLO->Rebin(nbins_yaxian,"hRatio_ct10n_R_3_4",boundaries_yaxian); hRatio_ct10n_R_3_4->Divide(hPP_ct10n_NLO_R4); TH1F* hRatio_hera_R_2_4 = (TH1F*)hPP_hera_NLO_R2->Rebin(nbins_yaxian,"hRatio_hera_R_2_4",boundaries_yaxian); hRatio_hera_R_2_4->Divide(hPP_hera_NLO_R4); TH1F* hRatio_hera_R_3_4 = (TH1F*)hPP_hera_NLO->Rebin(nbins_yaxian,"hRatio_hera_R_3_4",boundaries_yaxian); hRatio_hera_R_3_4->Divide(hPP_hera_NLO_R4); TH1F* hRatio_data_nnpdf_R_3 = (TH1F*)hPP_nnpdf_NLO->Rebin(nbins_yaxian,"hRatio_data_nnpdf_R_3",boundaries_yaxian); hRatio_data_nnpdf_R_3->Divide(hPP_data_R_3); TH1F* hRatio_data_nnpdf_R_4 = (TH1F*)hPP_nnpdf_NLO_R4->Rebin(nbins_yaxian,"hRatio_data_nnpdf_R_4",boundaries_yaxian); hRatio_data_nnpdf_R_4->Divide(hPP_data_R_4); TH1F* hRatio_data_R_3_4 = (TH1F*)hPP_data_R_3->Clone("hRatio_data_R_3_4"); hRatio_data_R_3_4->Divide(hPP_data_R_4); TH1F* hRatio_data_R_3_5 = (TH1F*)hPP_data_R_3->Clone("hRatio_data_R_3_5"); hRatio_data_R_3_5->Divide(hPP_data_R_5); TH1F* hRatio_data_R_4_5 = (TH1F*)hPP_data_R_4->Clone("hRatio_data_R_4_5"); hRatio_data_R_4_5->Divide(hPP_data_R_5); /* TCanvas *cnlo_mc = new TCanvas("cnlo_mc","",800,600); hRatio_nnpdf_mc->SetMarkerColor(kRed); hRatio_nnpdf_mc->SetMarkerStyle(20); hRatio_nnpdf_mc->SetXTitle("Jet p_{T} (GeV/c)"); hRatio_nnpdf_mc->SetYTitle("MC/NLO"); hRatio_nnpdf_mc->SetTitle(" "); hRatio_nnpdf_mc->SetAxisRange(0,1.5,"Y"); hRatio_nnpdf_mc->Draw(); hRatio_cteq_mc->SetMarkerColor(kBlue); hRatio_cteq_mc->SetMarkerStyle(20); hRatio_cteq_mc->Draw("same"); hRatio_ct10n_mc->SetMarkerColor(9); hRatio_ct10n_mc->SetMarkerStyle(20); hRatio_ct10n_mc->Draw("same"); hRatio_hera_mc->SetMarkerColor(kGreen); hRatio_hera_mc->SetMarkerStyle(20); hRatio_hera_mc->Draw("same"); TLegend *titlenlomc = myLegend(0.10,0.10,0.30,0.30); titlenlomc->AddEntry(hRatio_nnpdf_mc,"nnpdf","pl"); titlenlomc->AddEntry(hRatio_cteq_mc,"cteq","pl"); titlenlomc->AddEntry(hRatio_ct10n_mc,"ct10n","pl"); titlenlomc->AddEntry(hRatio_hera_mc,"hera","pl"); titlenlomc->SetTextSize(0.04); titlenlomc->Draw(); putCMSSim(0.1,0.92,0.06); drawText("pp #sqrt{s}=2.76(TeV)",0.65,0.92,16); drawText(Form("anti k_{T} R = 0.%d, NP corrections added to NLO",radius),0.15,0.83,16); cnlo_mc->SaveAs(Form("Ratio_mc_with_nlo_with_np_R%d.pdf",radius),"RECREATE"); */ TCanvas *c1 = new TCanvas("c1","",800,600); formatCanvas(c1); c1->cd(1); c1->cd(1)->SetLogy(); hPP_nnpdf_NLO->SetMarkerColor(kRed); hPP_nnpdf_NLO->SetMarkerStyle(33); hPP_cteq_NLO->SetMarkerColor(kBlue); hPP_cteq_NLO->SetMarkerStyle(33); hPP_ct10n_NLO->SetMarkerColor(9);//purple hPP_ct10n_NLO->SetMarkerStyle(33); hPP_hera_NLO->SetMarkerColor(kGreen); hPP_hera_NLO->SetMarkerStyle(33); hPPrebin->SetMarkerColor(kBlack); hPPrebin->SetMarkerStyle(8); hPPgen->SetMarkerColor(kOrange); hPPgen->SetMarkerStyle(8); //hPPgen->SetMarkerColor(kRed); //hPPgen->SetMarkerStyle(8); makeHistTitle(hPP_nnpdf_NLO,"","p_{T} (GeV/c)","#frac{d^{2} #sigma}{d p_{T} d #eta} (pb#frac{GeV}{c})"); //hPP_nnpdf_NLO->SetYTitle("#frac{d^{2} #sigma}{d p_{T} d #eta} (pb#frac{GeV}{c})"); //hPP_nnpdf_NLO->SetXTitle("p_{T} (GeV/c)"); hPP_nnpdf_NLO->SetAxisRange(22,500,"X"); hPP_nnpdf_NLO->SetTitle(" "); hPP_nnpdf_NLO->Draw("p"); hPP_cteq_NLO->Draw("same p"); hPP_ct10n_NLO->Draw("same p"); hPP_hera_NLO->Draw("same p"); hPPrebin->Draw("same p"); //hPPgen->Draw("same p"); TLegend * title = myLegend(0.47, 0.50,0.67, 0.8); title->AddEntry(hPP_nnpdf_NLO,"NLO nnpdf","pl"); title->AddEntry(hPP_cteq_NLO,"NLO cteq","pl"); title->AddEntry(hPP_ct10n_NLO,"NLO ct10n","pl"); title->AddEntry(hPP_hera_NLO,"NLO hera","pl"); //title->AddEntry(hPPgen,"pp MC spectra","pl"); title->AddEntry(hPPrebin,"pp unfolded 2013 data","pl"); title->SetTextSize(0.04); title->Draw(); putCMSPrel(0.1,0.92,0.06); drawText("pp 2013, #sqrt{s}=2.76(TeV), #int L dt = 5.3 (pb)^{-1}",0.35,0.92,16); drawText(Form("anti k_{T} R = 0.3, NP corrections added to NLO",radius),0.35,0.83,16); c1->cd(2); makeHistTitle(hRatio_nnpdf,"","p_{T} (GeV/c)","NLO / pp data"); //hRatio_nnpdf->SetYTitle(" X / pp data"); //hRatio_nnpdf->SetXTitle("p_{T} (GeV/c)"); hRatio_nnpdf->SetTitle(" "); hRatio_nnpdf->SetAxisRange(0.8,2,"Y"); hRatio_nnpdf->SetMarkerColor(kRed); hRatio_nnpdf->SetMarkerStyle(33); hRatio_hera->SetMarkerColor(kGreen); hRatio_hera->SetMarkerStyle(33); hRatio_cteq->SetMarkerColor(kBlue); hRatio_cteq->SetMarkerStyle(33); hRatio_ct10n->SetMarkerColor(9); hRatio_ct10n->SetMarkerStyle(33); hRatio_ppgen->SetMarkerColor(kOrange); hRatio_ppgen->SetMarkerStyle(33); hRatio_nnpdf->Draw("p"); hRatio_nnpdf->SetAxisRange(22,500,"X"); hRatio_hera->Draw("same p"); hRatio_cteq->Draw("same p"); hRatio_ct10n->Draw("same p"); //hRatio_ppgen->Draw("same p"); c1->SaveAs(Form("May22/pp_2760GeV_NLO_NPadded_ak%dPF_spectra.pdf",radius),"RECREATE"); /* //get the information from the ratio per bins - to use to scale down the NLO in 5.02 TeV. ofstream R_nnpdf,R_hera,R_cteq; R_nnpdf.open(Form("ratio_nnpdf_vs_pp_data_2760_ak%d.txt",radius)); R_hera.open(Form("ratio_hera_vs_pp_data_2760_ak%d.txt",radius)); R_cteq.open(Form("ratio_cteq_vs_pp_data_2760_ak%d.txt",radius)); for(int i = 0;i<hRatio_nnpdf->GetNbinsX();i++){ R_nnpdf<<i<<"\t"<<hRatio_nnpdf->GetBinContent(i)<<endl; R_hera<<i<<"\t"<<hRatio_hera->GetBinContent(i)<<endl; R_cteq<<i<<"\t"<<hRatio_cteq->GetBinContent(i)<<endl; } R_nnpdf.close(); R_hera.close(); R_cteq.close(); //draw the results for NLO comparison within different radius at the same energy TCanvas *c2 = new TCanvas("c2","",800,600); formatCanvas(c2); c2->cd(1); hPP_nnpdf_NLO->SetMarkerStyle(22); hPP_nnpdf_NLO->SetMarkerColor(3); hPP_nnpdf_NLO->Draw("p"); hPP_nnpdf_NLO_R2->SetMarkerStyle(22); hPP_nnpdf_NLO_R2->SetMarkerColor(2); hPP_nnpdf_NLO_R2->Draw("same p"); hPP_nnpdf_NLO_R4->SetMarkerStyle(22); hPP_nnpdf_NLO_R4->SetMarkerColor(4); hPP_nnpdf_NLO_R4->Draw("same p"); hPP_data_R_4->SetMarkerStyle(23); hPP_data_R_4->SetMarkerColor(4); hPP_data_R_4->Draw("same p"); hPP_data_R_3->SetMarkerStyle(23); hPP_data_R_3->SetMarkerColor(3); hPP_data_R_3->Draw("same p"); hPP_data_R_5->SetMarkerStyle(23); hPP_data_R_5->SetMarkerColor(9); hPP_data_R_5->Draw("same p"); TLegend * title2 = myLegend(0.47, 0.50,0.67, 0.8); title2->AddEntry(hPP_nnpdf_NLO_R2,"NNPDF21 R=0.2","pl"); title2->AddEntry(hPP_nnpdf_NLO,"NNPDF21 R=0.3","pl"); title2->AddEntry(hPP_nnpdf_NLO_R4,"NNPDF21 R=0.4","pl"); title2->AddEntry(hPP_data_R_3,"Data R=0.3","pl"); title2->AddEntry(hPP_data_R_4,"Data R=0.4","pl"); title2->AddEntry(hPP_data_R_5,"Data R=0.5","pl"); title2->SetTextSize(0.04); title2->Draw(); putCMSPrel(0.1,0.92,0.06); drawText("pp 2013, #sqrt{s}=2.76(TeV), #int L dt = 5.3 (pb)^{-1}",0.35,0.92,16); drawText(Form("anti k_{T}, Data vs Theory",radius),0.47,0.83,16); c2->cd(2); hRatio_nnpdf_R_2_4->SetMarkerStyle(29); hRatio_nnpdf_R_2_4->SetMarkerColor(2); hRatio_nnpdf_R_2_4->SetAxisRange(0.6,1.6,"Y"); hRatio_nnpdf_R_2_4->SetAxisRange(22,500,"X"); hRatio_nnpdf_R_2_4->SetTitle(" "); hRatio_nnpdf_R_2_4->SetYTitle("Ratios"); hRatio_nnpdf_R_2_4->SetXTitle("p_{T}(GeV/c)"); hRatio_nnpdf_R_2_4->Draw("p"); hRatio_nnpdf_R_3_4->SetMarkerStyle(29); hRatio_nnpdf_R_3_4->SetMarkerColor(3); hRatio_nnpdf_R_3_4->Draw("same p"); hRatio_data_nnpdf_R_3->SetMarkerStyle(33); hRatio_data_nnpdf_R_3->SetMarkerColor(4); hRatio_data_nnpdf_R_3->Draw("same p"); hRatio_data_nnpdf_R_4->SetMarkerStyle(33); hRatio_data_nnpdf_R_4->SetMarkerColor(7); hRatio_data_nnpdf_R_4->Draw("same p"); hRatio_data_R_3_4->SetMarkerStyle(34); hRatio_data_R_3_4->SetMarkerColor(6); hRatio_data_R_3_4->Draw("same p"); hRatio_data_R_3_5->SetMarkerStyle(34); hRatio_data_R_3_5->SetMarkerColor(7); hRatio_data_R_3_5->Draw("same p"); hRatio_data_R_4_5->SetMarkerStyle(34); hRatio_data_R_4_5->SetMarkerColor(8); hRatio_data_R_4_5->Draw("same p"); c2->cd(1); TLegend * title3 = myLegend(0.67, 0.40,0.77, 0.8); title3->AddEntry(hRatio_nnpdf_R_2_4,"NLO R=0.2/R=0.4","pl"); title3->AddEntry(hRatio_nnpdf_R_3_4,"NLO R=0.3/R=0.4","pl"); title3->AddEntry(hRatio_data_nnpdf_R_3,"R=0.3 NNPDF21/Data","pl"); title3->AddEntry(hRatio_data_nnpdf_R_4,"R=0.4 NNPDF21/Data","pl"); title3->AddEntry(hRatio_data_R_3_4,"Data R=0.3/R=0.4","pl"); title3->AddEntry(hRatio_data_R_3_5,"Data R=0.3/R=0.5","pl"); title3->AddEntry(hRatio_data_R_4_5,"Data R=0.4/R=0.5","pl"); title3->SetTextSize(0.04); title3->Draw(); c2->SaveAs("pp_2760GeV_data_NLO_NPCadded_radius_comparison.pdf","RECREATE"); fout.Write(); fout.Close(); */ /* TCanvas *c2 = new TCanvas("c2","",1000,800); c2->Divide(2,1); c2->cd(1); c2->cd(1)->SetLogy(); hPPunfo->SetTitle("PP 2013 2.76 TeV Merged, Unfolded p_{T} Spectra"); hPPunfo->SetYTitle("#frac{dN}{N_{MB} d p_{T} d #eta}"); hPPunfo->GetYaxis()->SetTitleOffset(1.4); hPPunfo->SetXTitle("Jet p_{T} GeV/c"); hPPunfo->GetXaxis()->SetRangeUser(50,500); hPPunfo->Draw(); hPPmeas->GetXaxis()->SetRangeUser(50,500); hPPmeas->SetMarkerStyle(22); hPPmeas->SetMarkerColor(kBlack); hPPmeas->Draw("same"); TLegend *titl = myLegend(0.54,0.65,0.85,0.9); titl->AddEntry(hPPmeas,"PP2013 Meas ak3PF","pl"); titl->AddEntry(hPPunfo,"PP2013 Unfo Bayesian","pl"); titl->SetTextSize(0.03); titl->Draw(); drawText("Anti-k_{T}PF R = 0.3",0.43,0.6,22); drawText("|#eta|<2, |vz|<15",0.47,0.5,22); c2->cd(2); TH1F* hPPRatio = (TH1F*)hPPmeas->Clone("hPPRatio"); hPPRatio->Divide(hPPunfo); hPPRatio->SetXTitle("Jet p_{T} GeV/c"); hPPRatio->SetYTitle("Ratio Measured/Unfolded"); hPPRatio->SetTitle("PP2013 ak3PF merged"); hPPRatio->GetYaxis()->SetRangeUser(0,2); hPPRatio->Draw(); c2->SaveAs("pp_2013_ak3_merged_unfolded_pt.pdf","RECREATE"); */ /* TH1F *hNLO_err = (TH1F*)fNLO->Get("h100203"); for(int i = 0;i<hNLO_err->GetNbinsX();i++){ Float_T valErr = hNLO_Err->GetBinError(i); hNLO->SetBinError(i,valErr); } */ /* //h100300 - ak4PF, h100200 - ak3PF TH1F* hNLO_2 = (TH1F*)hNLO->Clone("hNLO_2"); hNLO->Print("base"); TCanvas *cComp = new TCanvas("cComp","",800,600); cComp->Divide(2,1); cComp->cd(1); cComp->cd(1)->SetLogy(); hPPrebin->SetMarkerStyle(22); hPPrebin->SetMarkerColor(kRed); hNLO->SetMarkerStyle(20); hNLO->SetMarkerColor(kBlack); hNLO->SetTitle("PP 2.76 TeV"); hNLO->SetYTitle("#sigma pb"); hNLO->SetXTitle("Jet p_{T} GeV/c"); hNLO->Draw("pl"); hPPMCrebin->SetMarkerStyle(21); hPPMCrebin->SetMarkerColor(kBlue); hPPMCrebin->Draw("same"); hPPrebin->Draw("same"); TLegend *title = myLegend(0.34,0.65,0.54,0.75); title->AddEntry(hNLO,"NLO nnpdf21","pl"); title->AddEntry(hPPrebin,"PP ak3PF unfo","pl"); title->AddEntry(hPPMCrebin,"PP ak3PF MC Gen","pl"); title->SetTextSize(0.06); title->Draw(); cComp->cd(2); TH1F *hPP = (TH1F*)hPPrebin->Clone("hPP"); TH1F* hPPMC_v2 = (TH1F*)hPPMCrebin->Clone("hPPMC_v2"); hPP->Print("base"); hPPMC_v2->Print("base"); hPP->Divide(hNLO); hPPMC_v2->Divide(hNLO); hPP->SetTitle("Ratio of PP ak3PF unfolded and MC Gen to NLO"); //hPP->SetTitle("Ratio of PP ak4PF measured to NLO"); hPP->SetYTitle("#frac{#sigma_{PP}}{#sigma_{NLO}}"); hPP->SetXTitle("Jet p_{T} GeV/c"); hPP->Draw(); hPPMC_v2->Draw("same"); cComp->SaveAs("fastNLO_comparison/ratio_pp_ak3_merged_NLO_nnpdf21nlo.pdf","RECREATE"); TCanvas c1; c1.SetLogy(); hPPrebin->SetAxisRange(50,500,"X"); hPPrebin->SetYTitle("#sigma (pb)"); hPPrebin->SetXTitle("Jet p_{T} GeV/c"); hPPrebin->SetTitle("PP ak3PF unfolded"); hPPrebin->Draw(); c1.SaveAs("fastNLO_comparison/PP_2013_ak3_merged_Unfolded_crosssection.pdf","RECREATE"); c1.SaveAs("fastNLO_comparison/PP_2013_ak3_merged_Unfolded_crosssection.C","RECREATE"); TCanvas *c3 = new TCanvas("c3","",800,600); c3->SetGrid(); c3->SetLogy(); //TGraphErrors graph_Expected("./fastNLO_comparison/files/s2760_R0.3fine.tex","%lg %lg"); //graph_Expected.SetTitle("Non Perturbative corrections (extrapolation from Atlas) s2760;p_{T} GeV/c;#sigma nb"); //graph_Expected.DrawClone("E3AL"); TFile *fNPC = TFile::Open("fastNLO_comparison/files/npc_extrapolation_ivan.root"); TH1F* hNPC = (TH1F*)fNPC->Get("hNPC"); hNPC->Scale(1000);// 1000 for the pb from nb //hNPC->Print("base"); //TH1F* hNPC_rebin1 = rebin2(hNPC,"hNPC_rebin1"); //divideBinWidth(hNPC_rebin1); hNPC->SetTitle("Non Perturbative corrections (extrapolation from Atlas) s2760"); hNPC->SetXTitle("p_{T} GeV/c"); hNPC->SetYTitle("#sigma (pb)"); hNPC->Draw(); hPPrebin->Draw("same"); c3->SaveAs("fastNLO_comparison/NPC_atlas_ak3.pdf","RECREATE"); TCanvas *c4 = new TCanvas("c4","",800,600); c4->SetLogy(); //TH1F* hNPC_rebin = (TH1F*)hNPC->Clone("hNPC_rebin"); TH1F* hNPC_rebin = rebin2(hNPC,"hNPC_rebin"); divideBinWidth(hNPC_rebin); hPPrebin_2->SetTitle("PP Cross sections Data and Theory comparisons"); hPPrebin_2->SetYTitle("#sigma (pb)"); hPPrebin_2->SetXTitle("p_{T} GeV/c"); //hNPC_rebin->SetAxisRange(1e4,1e-2,"Y"); hPPrebin_2->SetMarkerStyle(23); hPPrebin_2->SetMarkerColor(kBlack); hPPrebin_2->SetAxisRange(50,450,"X"); hPPrebin_2->Draw("E"); //hPPrebin_2->SetAxisRange(50,450,"X"); hNPC_rebin->SetMarkerStyle(21); hNPC_rebin->SetMarkerColor(kRed); hNPC_rebin->Draw("same"); hNLO_2->SetMarkerStyle(25); hNLO_2->SetMarkerColor(kBlue); hNLO_2->Draw("same"); TLegend *title2 = myLegend(0.54,0.65,0.85,0.9); title2->AddEntry(hNPC_rebin,"Ivan NPC - Atlas R=0.3","pl"); title2->AddEntry(hPPrebin_2,"PP2013 ak3PF unfolded","pl"); title2->AddEntry(hNLO_2,"CMS NLO nnpdf21 R=0.3","l"); title2->SetTextSize(0.04); title2->Draw(); gStyle->SetOptStat(0); c4->SaveAs("fastNLO_comparison/pp_ak3_nlo_overlay_hist.pdf","RECREATE"); TCanvas *c6 = new TCanvas("c6","",800,600); TH1F* hPPratio = (TH1F*)hPPrebin_2->Clone("hPPratio"); //add the error bars directly before dividing them and then set that as the error. //FLoat_t delta_PP = 0; //Float_t delta_NPC = 0; //Float_t delta hPPratio->Divide(hNPC_rebin); hPPratio->SetTitle("Ratio of PP 2013 ak3 unfolded w/ Ivan's NPC Atlas"); hPPratio->SetYTitle(" "); hPPratio->SetXTitle("p_{T} GeV/c"); hPPratio->Draw(); c6->SaveAs("pp_ak3_npc_ratio.pdf","RECREATE"); TCanvas *c5 = new TCanvas("c5","",800,600); hNPC->Draw(); hNPC_rebin->Draw("same"); c5->SetLogy(); c5->SaveAs("Ivan_plot_rebin_ak3.pdf","RECREATE"); */ }
void RAA_dataDrivenUnfoldingErrorCheck_new(int radius = 3, bool isATLASCut = true) { TStopwatch timer; timer.Start(); TH1::SetDefaultSumw2(); TH2::SetDefaultSumw2(); bool printDebug = true; bool dofakeremove = false; bool do10GeVBins = true; char * scale = (char*)"NeqScale"; // 944Scale // NeqScale // NeqScalePerCent int unfoldingCut = 20; char * outLocation = (char*) "July20/"; if(isATLASCut) outLocation = (char*)"July20/ATLASCut/"; // get the data and mc histograms from the output of the read macro. TDatime date;//this is just here to get them to run optimized. // Pawan's files: //TFile * fPbPb_in = TFile::Open(Form("Pawan_TTree_PbPb_Data_MC_subid0_spectra_JetID_CutA_finebins_%s_R0p%d.root", etaWidth, radius)); //TFile * fPbPb_in = TFile::Open(Form("Pawan_TTree_PbPb_Data_MC_subid0_spectra_JetID_CutA_muMaxOverSumcandMaxLT0p975_finebins_%s_R0p%d.root", etaWidth, radius)); //TFile * fPbPb_in = TFile::Open(Form("Pawan_TTree_PbPb_Data_MC_subid0_spectra_JetID_CutA_trkMaxOverpfptGT0p02_finebins_%s_R0p%d.root", etaWidth, radius)); //TFile * fPbPb_in = TFile::Open(Form("Pawan_TTree_PbPb_Data_noPrescl_MC_subid0_spectra_JetID_CutA_finebins_%s_R0p%d.root", etaWidth, radius)); //TFile * fPbPb_in = TFile::Open(Form("Pawan_TTree_PbPb_Data_noPrescl_MC_subid0_spectra_JetID_CutA_7GeVTrackCut_finebinscut_%s_R0p%d.root", etaWidth, radius)); // get the files to perform MC closure from the fixed ntuples TFile * fPbPb_in, *fMinBias, *fPbPb_MC_in, * fTrig; if(isATLASCut) fPbPb_in = new TFile(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/PbPb_Data_histograms_FromForest_trkMax7OrNeMax8GeVCut_akPu%d_20_eta_20.root",radius),"r"); if(!isATLASCut) fPbPb_in = new TFile(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/PbPb_Data_histograms_FromForest_akPu%d_20_eta_20.root",radius),"r"); if(isATLASCut) fMinBias = TFile::Open(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/PbPb_MB_Data_histograms_FromForest_trkMax7OrNeMax8GeVCut_fix_pt15GeVCut_akPu%d_20_eta_20.root",radius)); if(!isATLASCut) fMinBias = TFile::Open(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/PbPb_MB_Data_histograms_FromForest_fix_pt15GeVCut_akPu%d_20_eta_20.root",radius)); //TFile * fPbPb_MC_in = TFile::Open(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/PbPb_MC_histograms_FromForest_pthat50andabove_akPu%d_20_eta_20.root",radius)); if(isATLASCut) fPbPb_MC_in = new TFile(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/PbPb_MC_histograms_FromForest_trkMax7OrNeMax8GeVCut_akPu%d_20_eta_20.root",radius),"r"); if(!isATLASCut) fPbPb_MC_in = new TFile(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/PbPb_MC_histograms_FromForest_akPu%d_20_eta_20.root",radius),"r"); TFile * fPP_in = new TFile(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/pp_Data_histograms_FromForest_ak%d_20_eta_20.root",radius),"r"); TFile * fPP_MC_in = new TFile(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/pp_MC_histograms_FromForest_ak%d_20_eta_20.root",radius),"r"); if(isATLASCut) fTrig = new TFile(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/PbPb_Data_nofkSub_trkMax7OrNeMax8GeVCut_new_MC_turnonCurves_R%d_20_eta_20_20150715.root",radius),"r"); if(!isATLASCut) fTrig = new TFile(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/PbPb_Data_nofkSub_new_MC_turnonCurves_R%d_20_eta_20_20150715.root",radius),"r"); TFile * fTrig_pp = new TFile(Form("/afs/cern.ch/work/r/rkunnawa/WORK/RAA/Jun29/pp_MC_turnonCurves_R%d_20_eta_20_20150702.root", radius),"r"); // TFile * fPPMCTrig = new TFile(Form("PP_Data_MC_turnonCurves_R%d_20_eta_20_20150618.root",radius),"r"); TH1F * hMC_turnon[nbins_cent+1], * hData_turnon[nbins_cent+1]; cout<<"after input file declaration"<<endl; // histogram declarations with the following initial appendage: d - Data, m - MC, u- Unfolded // for the MC closure test, ive kept separate TH1F *dPbPb_TrgComb[nbins_cent+1], *dPbPb_TrgCombInput[nbins_cent+1], *dPbPb_Comb[nbins_cent+1], *dPbPb_Trg80[nbins_cent+1], *dPbPb_Trg65[nbins_cent+1], *dPbPb_Trg55[nbins_cent+1], *dPbPb_1[nbins_cent+1], *dPbPb_2[nbins_cent+1], *dPbPb_3[nbins_cent+1], *dPbPb_80[nbins_cent+1], *dPbPb_65[nbins_cent+1], *dPbPb_55[nbins_cent+1]; TH1F *mPbPb_GenInput[nbins_cent+1], *mPbPb_RecoInput[nbins_cent+1]; TH1F *mPbPb_Gen[nbins_cent+1], *mPbPb_Reco[nbins_cent+1]; TH2F *mPbPb_Matrix[nbins_cent+1], * mPbPb_MatrixInput[nbins_cent+1], *mPbPb_Response[nbins_cent+1], *mPbPb_ResponseNorm[nbins_cent+1]; TH1F *mPbPb_mcclosure_data[nbins_cent+1]; TH2F *mPbPb_mcclosure_Matrix[nbins_cent+1],*mPbPb_mcclosure_Response[nbins_cent+1], *mPbPb_mcclosure_ResponseNorm[nbins_cent+1]; TH1F *mPbPb_mcclosure_gen[nbins_cent+1]; const int Iterations = 20; //for unfolding systematics. const int BayesIter = 4; TH1F *uPbPb_Bayes[nbins_cent+1], *uPbPb_BinByBin[nbins_cent+1], *uPbPb_SVD[nbins_cent+1]; TH1F *uPbPb_BayesianIter[nbins_cent+1][Iterations]; TH1F *dPbPb_MinBias[nbins_cent]; TH1F *hMinBias[nbins_cent]; TH1F *dPP_1, *dPP_2, *dPP_3, *dPP_Comb, * dPP_CombInput; TH1F *mPP_Gen, *mPP_Reco, *mPP_GenInput, *mPP_RecoInput; TH2F *mPP_Matrix, *mPP_MatrixInput, *mPP_Response,*mPP_ResponseNorm; TH1F *mPP_mcclosure_data; TH2F *mPP_mcclosure_Matrix, *mPP_mcclosure_Response,*mPP_mcclosure_ResponseNorm; TH1F *mPP_mcclosure_Gen; TH1F *uPP_Bayes, *uPP_BinByBin, *uPP_SVD; TH1F *uPP_BayesianIter[Iterations]; TH1F * hData_FaketoSub_fullbin[nbins_cent+1]; // would be better to read in the histograms and rebin them. come to think of it, it would be better to have them already rebinned (and properly scaled - to the level of differential cross section in what ever barns (inverse micro barns) but keep it consistent) from the read macro. if(radius == 2) unfoldingCut = unfoldingCut_R2; if(radius == 3) unfoldingCut = unfoldingCut_R3; if(radius == 4) unfoldingCut = unfoldingCut_R4; // TH1F * htest = new TH1F("htest","",nbins, ptbins_long); // Int_t unfoldingCutBin = htest->FindBin(unfoldingCut); //Float_t cutarray[6]={50,50,40,35,35,35}; float cutarray[nbins_cent] = {0.0,0.0,0.0,0.0,0.0,0.0}; if(radius == 2){ cutarray[0] = 50; cutarray[1] = 40; cutarray[2] = 40; cutarray[3] = 40; cutarray[4] = 30; cutarray[5] = 30; } if(radius == 3){ cutarray[0] = 55; cutarray[1] = 50; cutarray[2] = 50; cutarray[3] = 40; cutarray[4] = 35; cutarray[5] = 40; } if(radius == 4){ cutarray[0] = 70; cutarray[1] = 60; cutarray[2] = 60; cutarray[3] = 45; cutarray[4] = 40; cutarray[5] = 30; } TH1F * hDataBeforeSub[nbins_cent], * hDataAfterSub[nbins_cent]; // get PbPb data for(int i = 0;i<nbins_cent;++i){ if(printDebug) cout<<"cent_"<<i<<endl; hData_turnon[i] = (TH1F*)fTrig->Get(Form("hHist_Data_Turnon_cent%d",i)); hData_turnon[i] = (TH1F*)hData_turnon[i]->Rebin(nbins_short, Form("hData_turnon_cent%d",i), boundaries_short); //hData_turnon[i] = (TH1F*)hData_turnon[i]->Rebin(10); divideBinWidth(hData_turnon[i]); // hMinBias[i] = (TH1F*)fMinBias->Get(Form("hpbpb_noTrg_R%d_%s_cent%d",radius,etaWidth,i)); //MinBias Histo hMinBias[i] = (TH1F*)fMinBias->Get(Form("hpbpb_HLTMBwoLJSbJ_R%d_%s_cent%d",radius,etaWidth,i)); //MinBias Histo hMinBias[i]->Print("base"); dPbPb_TrgComb[i] = (TH1F*)fPbPb_in->Get(Form("hpbpb_HLTComb_%s_R%d_%s_cent%d",scale, radius,etaWidth,i)); //dPbPb_TrgComb[i] = (TH1F*)fPbPb_in->Get(Form("hpbpb_HLT80_R%d_%s_cent%d",radius,etaWidth,i)); //dPbPb_TrgComb[i] = (TH1F*)fPbPb_in->Get(Form("hpbpb_HLT65_R%d_%s_cent%d",radius,etaWidth,i)); //dPbPb_TrgComb[i] = (TH1F*)fPbPb_in->Get(Form("hpbpb_HLT55_R%d_%s_cent%d",radius,etaWidth,i)); // dPbPb_TrgComb[i]->Scale(1./(1+0.898+0.494)/1e16); // //dPbPb_TrgComb[i]->Scale(4*145.156*1e6); dPbPb_TrgComb[i]->Print("base"); hDataBeforeSub[i] = (TH1F*)dPbPb_TrgComb[i]->Clone(Form("hData_Before_Sub_cent%d",i)); //dPbPb_TrgComb[i] = (TH1F*)fPbPb_DataCorr_in->Get(Form("Data_TrigEffCorrected_FakeSub_cent%d",i)); //dPbPb_TrgComb[i]->Print("base"); // dPbPb_JEC_TrgComb[i] = (TH1F*)fPbPb_in->Get(Form("hpbpb_JEC_HLTComb_R%d_%s_cent%d",radius,etaWidth,i)); // // //dPbPb_TrgComb[i]->Scale(4*145.156*1e6); // dPbPb_JEC_TrgComb[i]->Print("base"); // dPbPb_Smear_TrgComb[i] = (TH1F*)fPbPb_in->Get(Form("hpbpb_Smear_HLTComb_R%d_%s_cent%d",radius,etaWidth,i)); // // //dPbPb_TrgComb[i]->Scale(4*145.156*1e6); // dPbPb_Smear_TrgComb[i]->Print("base"); // dPbPb_Trg80[i] = (TH1F*)fPbPb_in->Get(Form("hpbpb_HLT80_R%d_%s_cent%d",radius,etaWidth,i)); // //dPbPb_Trg80[i]->Scale(4*145.156*1e6); // dPbPb_Trg80[i]->Print("base"); // dPbPb_Trg65[i] = (TH1F*)fPbPb_in->Get(Form("hpbpb_HLT65_R%d_%s_cent%d",radius,etaWidth,i)); // //dPbPb_Trg65[i]->Scale(4*145.156*1e6); // dPbPb_Trg65[i]->Print("base"); // dPbPb_Trg55[i] = (TH1F*)fPbPb_in->Get(Form("hpbpb_HLT55_R%d_%s_cent%d",radius,etaWidth,i)); // //dPbPb_Trg55[i]->Scale(4*145.156*1e6); // dPbPb_Trg55[i]->Print("base"); // if(dotrigcor){ // doTrigCorr(dPbPb_TrgComb[i], hData_turnon[i]); // doTrigCorr(dPbPb_JEC_TrgComb[i], hData_turnon[i]); // doTrigCorr(dPbPb_Smear_TrgComb[i], hData_turnon[i]); // } //Lets do the subtraction here _Sevil // Float_t bincon=cutarray[i]; // Int_t bincut= hMinBias[i]->FindBin(bincon); // for(int k = bincut;k<=hMinBias[i]->GetNbinsX();k++) { // hMinBias[i]->SetBinContent(k,0); // hMinBias[i]->SetBinError(k,0); // } // for(int k = 1;k<=15;k++) { // hMinBias[i]->SetBinContent(k,0); // hMinBias[i]->SetBinError(k,0); // } Float_t bin_no = dPbPb_TrgComb[i]->FindBin(15); Float_t bin_end=dPbPb_TrgComb[i]->FindBin(25); Float_t bin_nomb = hMinBias[i]->FindBin(15); Float_t bin_endmb=hMinBias[i]->FindBin(25); float scalerangeweight=dPbPb_TrgComb[i]->Integral(bin_no,bin_end)/hMinBias[i]->Integral(bin_nomb,bin_endmb); // for(int j = 0; j<hMinBias[i]->GetNbinsX(); ++j) // hMinBias[i]->SetBinError(j+1, (Float_t)hMinBias[i]->GetBinError(j+1)/scalerangeweight); hMinBias[i]->Scale(scalerangeweight); if(dofakeremove) dPbPb_TrgComb[i]->Add(hMinBias[i], -1); hDataAfterSub[i] = (TH1F*)dPbPb_TrgComb[i]->Clone(Form("hData_After_Sub_cent%d",i)); // dPbPb_JEC_TrgComb[i]->Add(hMinBias[i], -1); // dPbPb_Smear_TrgComb[i]->Add(hMinBias[i], -1); // for(int j = 1; j<dPbPb_TrgComb[i]->GetNbinsX(); ++j){ // if(dPbPb_TrgComb[i]->GetBinContent(j) <= 0 ||dPbPb_JEC_TrgComb[i]->GetBinContent(j) <= 0||dPbPb_Smear_TrgComb[i]->GetBinContent(j) <= 0){ // dPbPb_TrgComb[i]->SetBinContent(j, 0); // dPbPb_JEC_TrgComb[i]->SetBinContent(j, 0); // dPbPb_Smear_TrgComb[i]->SetBinContent(j, 0); // dPbPb_TrgComb[i]->SetBinError(j, 0); // dPbPb_JEC_TrgComb[i]->SetBinError(j, 0); // dPbPb_Smear_TrgComb[i]->SetBinError(j, 0); // } // } // // lets truncate the histograms here: // cout<<" going to truncate Data histogram here cent "<<i<<endl; // dPbPb_TrgCombInput[i]->Print("base"); // dPbPb_TrgComb[i] = new TH1F(Form("PbPb_data_minbiasSub_cent%d",i),"",365, 30, 395); // Truncate1D(dPbPb_TrgCombInput[i], dPbPb_TrgComb[i]); // // dPbPb_TrgComb[i] = (TH1F*)Truncate1D(dPbPb_TrgComb[i], 340, unfoldingCutBin, 395); // // dPbPb_TrgComb[i]->Print("base"); //dPbPb_TrgComb[i] = (TH1F*)dPbPb_TrgComb[i]->Rebin(nbins, Form("PbPb_data_minbiasSub_cent%d",i), ptbins_long); dPbPb_TrgComb[i] = (TH1F*)dPbPb_TrgComb[i]->Rebin(10); dPbPb_TrgComb[i]->SetName(Form("PbPb_data_minbiasSub_cent%d",i)); divideBinWidth(dPbPb_TrgComb[i]); hMinBias[i] = (TH1F*)hMinBias[i]->Rebin(10); hDataAfterSub[i] = (TH1F*)hDataAfterSub[i]->Rebin(10); hDataBeforeSub[i] = (TH1F*)hDataBeforeSub[i]->Rebin(10); divideBinWidth(hMinBias[i]); divideBinWidth(hDataAfterSub[i]); divideBinWidth(hDataBeforeSub[i]); dPbPb_TrgComb[i]->Scale(1./(166 * 1e9)); // dPbPb_TrgComb[i]->Print("base"); } if(printDebug)cout<<"loaded the data histograms PbPb"<<endl; // get PbPb MC for(int i = 0;i<nbins_cent;i++){ // mPbPb_GenInput[i] = (TH1F*)fPbPb_MC_in->Get(Form("hpbpb_anaBin_JetComb_gen_R%d_%s_cent%d",radius,etaWidth,i)); // mPbPb_GenInput[i]->Print("base"); // mPbPb_RecoInput[i] = (TH1F*)fPbPb_MC_in->Get(Form("hpbpb_anaBin_JetComb_reco_R%d_%s_cent%d",radius,etaWidth,i)); // mPbPb_RecoInput[i]->Print("base"); // mPbPb_MatrixInput[i] = (TH2F*)fPbPb_MC_in->Get(Form("hpbpb_anaBin_matrix_HLT_R%d_%s_cent%d",radius,etaWidth,i)); // mPbPb_MatrixInput[i]->Print("base"); mPbPb_Gen[i] = (TH1F*)fPbPb_MC_in->Get(Form("hpbpb_JetComb_gen_R%d_%s_cent%d",radius,etaWidth,i)); //mPbPb_Gen[i]->Rebin(nbins, Form("mPbPb_Gen_cent%d",i), ptbins_long); mPbPb_Gen[i]->Rebin(10); divideBinWidth(mPbPb_Gen[i]); mPbPb_Gen[i]->Print("base"); mPbPb_Reco[i] = (TH1F*)fPbPb_MC_in->Get(Form("hpbpb_JetComb_reco_R%d_%s_cent%d",radius,etaWidth,i)); //mPbPb_Reco[i]->Rebin(nbins, Form("mPbPb_Reco_cent%d",i), ptbins_long); mPbPb_Reco[i]->Rebin(10); divideBinWidth(mPbPb_Reco[i]); mPbPb_Reco[i]->Print("base"); mPbPb_Matrix[i] = (TH2F*)fPbPb_MC_in->Get(Form("hpbpb_matrix_HLT_R%d_%s_cent%d",radius,etaWidth,i)); //mPbPb_Matrix[i] = (TH2F*)fPbPb_MC_in->Get(Form("hpbpb_anaBin_matrix_HLT_R%d_%s_cent%d",radius,etaWidth,i)); mPbPb_Matrix[i]->Rebin2D(10, 10); mPbPb_Matrix[i]->Print("base"); // if(etaWidth == "10_eta_10"){ // if(i == 0 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 1 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 2 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 3 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 4 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 5 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 0 && radius==3) unfoldingCutBin = htest->FindBin(40); // if(i == 1 && radius==3) unfoldingCutBin = htest->FindBin(40); // if(i == 2 && radius==3) unfoldingCutBin = htest->FindBin(30); // if(i == 3 && radius==3) unfoldingCutBin = htest->FindBin(30); // if(i == 4 && radius==3) unfoldingCutBin = htest->FindBin(30); // if(i == 5 && radius==3) unfoldingCutBin = htest->FindBin(30); // if(i == 0 && radius==4) unfoldingCutBin = htest->FindBin(50); // if(i == 1 && radius==4) unfoldingCutBin = htest->FindBin(50); // if(i == 2 && radius==4) unfoldingCutBin = htest->FindBin(40); // if(i == 3 && radius==4) unfoldingCutBin = htest->FindBin(40); // if(i == 4 && radius==4) unfoldingCutBin = htest->FindBin(30); // if(i == 5 && radius==4) unfoldingCutBin = htest->FindBin(30); // } // if(etaWidth == "10_eta_18"){ // if(i == 0 && radius==2) unfoldingCutBin = htest->FindBin(50); // if(i == 1 && radius==2) unfoldingCutBin = htest->FindBin(50); // if(i == 2 && radius==2) unfoldingCutBin = htest->FindBin(40); // if(i == 3 && radius==2) unfoldingCutBin = htest->FindBin(40); // if(i == 4 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 5 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 0 && radius==3) unfoldingCutBin = htest->FindBin(60); // if(i == 1 && radius==3) unfoldingCutBin = htest->FindBin(50); // if(i == 2 && radius==3) unfoldingCutBin = htest->FindBin(40); // if(i == 3 && radius==3) unfoldingCutBin = htest->FindBin(40); // if(i == 4 && radius==3) unfoldingCutBin = htest->FindBin(30); // if(i == 5 && radius==3) unfoldingCutBin = htest->FindBin(30); // if(i == 0 && radius==4) unfoldingCutBin = htest->FindBin(70); // if(i == 1 && radius==4) unfoldingCutBin = htest->FindBin(60); // if(i == 2 && radius==4) unfoldingCutBin = htest->FindBin(50); // if(i == 3 && radius==4) unfoldingCutBin = htest->FindBin(50); // if(i == 4 && radius==4) unfoldingCutBin = htest->FindBin(30); // if(i == 5 && radius==4) unfoldingCutBin = htest->FindBin(30); // } // if(etaWidth == "20_eta_20"){ // if(i == 0 && radius==2) unfoldingCutBin = htest->FindBin(70); // if(i == 1 && radius==2) unfoldingCutBin = htest->FindBin(60); // if(i == 2 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 3 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 4 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 5 && radius==2) unfoldingCutBin = htest->FindBin(30); // if(i == 0 && radius==3) unfoldingCutBin = htest->FindBin(70); // if(i == 1 && radius==3) unfoldingCutBin = htest->FindBin(60); // if(i == 2 && radius==3) unfoldingCutBin = htest->FindBin(50); // if(i == 3 && radius==3) unfoldingCutBin = htest->FindBin(30); // if(i == 4 && radius==3) unfoldingCutBin = htest->FindBin(30); // if(i == 5 && radius==3) unfoldingCutBin = htest->FindBin(30); // if(i == 0 && radius==4) unfoldingCutBin = htest->FindBin(80); // if(i == 1 && radius==4) unfoldingCutBin = htest->FindBin(60); // if(i == 2 && radius==4) unfoldingCutBin = htest->FindBin(50); // if(i == 3 && radius==4) unfoldingCutBin = htest->FindBin(30); // if(i == 4 && radius==4) unfoldingCutBin = htest->FindBin(30); // if(i == 5 && radius==4) unfoldingCutBin = htest->FindBin(30); // } int bincut = mPbPb_Gen[i]->FindBin(50); for(int k = 1;k<=bincut;k++){ // mPbPb_Gen[i]->SetBinContent(k,0); // mPbPb_Reco[i]->SetBinContent(k,0); // mPbPb_Gen[i]->SetBinError(k,0); // mPbPb_Reco[i]->SetBinError(k,0); // // set bin content matrix l,k works for(int l = 1;l<=mPbPb_Gen[i]->GetNbinsX();l++){ mPbPb_Matrix[i]->SetBinContent(l,k,0); mPbPb_Matrix[i]->SetBinError(l,k,0); } } SetUnfoldBins1D(dPbPb_TrgComb[i], 50, 350); // cout<<"going to truncate the MC histograms here."<<endl; // // mPbPb_Reco[i]->Print("base"); // // mPbPb_Reco[i] = (TH1F*)Truncate1D_anaBin(mPbPb_Reco[i], nbins, ptbins_long); // // mPbPb_Reco[i]->Print("base"); // mPbPb_GenInput[i]->Print("base"); // mPbPb_Gen[i] = new TH1F(Form("mPbPb_Gen_spectra_cent%d",i),"",nbins, ptbins_long); // Truncate1D(mPbPb_GenInput[i], mPbPb_Gen[i]); // mPbPb_Gen[i]->Print("base"); // mPbPb_RecoInput[i]->Print("base"); // mPbPb_Reco[i] = new TH1F(Form("mPbPb_REco_spectra_cent%d",i),"",nbins, ptbins_long); // Truncate1D(mPbPb_RecoInput[i], mPbPb_Reco[i]); // mPbPb_Reco[i]->Print("base"); // mPbPb_MatrixInput[i]->Print("base"); // mPbPb_Matrix[i] = new TH2F(Form("mPbPb_Response_Matrix_cent%d",i),"",nbins_truncated, ptbins_long_truncated, nbins_truncated, ptbins_long_truncated); // Truncate2D(mPbPb_MatrixInput[i], mPbPb_Matrix[i]); // mPbPb_Matrix[i]->Print("base"); } if(printDebug) cout<<"loaded the data and mc PbPb histograms from the files"<<endl; // get PP data if(printDebug) cout<<"Getting PP data and MC"<<endl; //fPP_in->ls(); // dPP_1 = (TH1F*)fPP_in->Get(Form("hpp_HLT80_R%d_%s",radius,etaWidth)); // dPP_1->Print("base"); // dPP_2 = (TH1F*)fPP_in->Get(Form("hpp_HLT60_R%d_%s",radius,etaWidth)); // dPP_2->Print("base"); // dPP_3 = (TH1F*)fPP_in->Get(Form("hpp_HLT40_R%d_%s",radius,etaWidth)); // dPP_3->Print("base"); dPP_Comb = (TH1F*)fPP_in->Get(Form("hpp_HLTComb_R%d_%s",radius,etaWidth)); //dPP_Comb = (TH1F*)dPP_1->Clone(Form("hpp_TrgComb_R%d_n20_eta_p20",radius,etaWidth)); //dPP_CombInput->Print("base"); dPP_Comb->Scale(1./(5.3 * 1e9)); // dPP_Comb = new TH1F("PP_MeasuredSpectra","",365, 30, 395); // Truncate1D(dPP_CombInput, dPP_Comb); //dPP_Comb = (TH1F*)dPP_Comb->Rebin(nbins, "PP_MeasuredSpectra", ptbins_long); dPP_Comb = (TH1F*)dPP_Comb->Rebin(10); dPP_Comb->SetName("PP_MeasuredSpectra"); divideBinWidth(dPP_Comb); dPP_Comb->Print("base"); // get PP MC // mPP_GenInput = (TH1F*)fPP_MC_in->Get(Form("hpp_anaBin_JetComb_gen_R%d_%s",radius,etaWidth)); // mPP_GenInput->Print("base"); // mPP_Gen = new TH1F("mPP_Gen_spectra","",nbins, ptbins_long); // Truncate1D(mPP_GenInput, mPP_Gen); // mPP_Gen->Print("base"); // mPP_RecoInput = (TH1F*)fPP_MC_in->Get(Form("hpp_anaBin_JetComb_reco_R%d_%s",radius,etaWidth)); // mPP_RecoInput->Print("base"); // mPP_Reco = new TH1F("mPP_Reco_spectra","",nbins, ptbins_long); // Truncate1D(mPP_RecoInput, mPP_Reco); // mPP_Reco->Print("base"); // mPP_MatrixInput = (TH2F*)fPP_MC_in->Get(Form("hpp_anaBin_matrix_HLT_R%d_%s",radius,etaWidth)); // mPP_MatrixInput->Print("base"); // mPP_Matrix = new TH2F("mPP_response_Matrix","",nbins_truncated, ptbins_long_truncated, nbins_truncated, ptbins_long_truncated); // Truncate2D(mPP_MatrixInput, mPP_Matrix); // mPP_Matrix->Print("base"); // get PP MC // change from fPP_MC_in to fPP_in to run finebinscut //mPP_Gen = (TH1F*)fPP_MC_in->Get(Form("hpp_anaBin_JetComb_gen_R%d_20_eta_20",radius)); mPP_Gen = (TH1F*)fPP_MC_in->Get(Form("hpp_JetComb_gen_R%d_20_eta_20",radius)); //mPP_Gen->Rebin(nbins, "mPP_Gen", ptbins_long); mPP_Gen->Rebin(10); divideBinWidth(mPP_Gen); mPP_Gen->Print("base"); //mPP_Reco = (TH1F*)fPP_MC_in->Get(Form("hpp_anaBin_JetComb_reco_R%d_20_eta_20",radius)); mPP_Reco = (TH1F*)fPP_MC_in->Get(Form("hpp_JetComb_reco_R%d_20_eta_20",radius)); //mPP_Gen->Rebin(nbins, "mPP_Gen", ptbins_long); mPP_Reco->Rebin(10); divideBinWidth(mPP_Reco); mPP_Reco->Print("base"); //mPP_Matrix = (TH2F*)fPP_MC_in->Get(Form("hpp_anaBin_matrix_HLT_R%d_20_eta_20",radius)); mPP_Matrix = (TH2F*)fPP_MC_in->Get(Form("hpp_matrix_HLT_R%d_20_eta_20",radius)); mPP_Matrix->Rebin2D(10, 10); mPP_Matrix->Print("base"); if(printDebug) cout<<"Filling the PbPb response Matrix"<<endl; // response matrix and unfolding for PbPb // going to try it the way kurt has its. for(int i = 0;i<nbins_cent;i++){ if(printDebug) cout<<"centrality bin iteration = "<<i<<endl; TF1 *f = new TF1("f","[0]*pow(x+[2],[1])"); f->SetParameters(1e10,-8.8,40); // TH1F *hGenSpectraCorr = (TH1F*)mPbPb_Matrix[i]->ProjectionX()->Clone(Form("hGenSpectraCorr_cent%d",i)); // hGenSpectraCorr->Fit("f"," "); // hGenSpectraCorr->Fit("f","",""); // hGenSpectraCorr->Fit("f","LL"); // TH1F *fHist = functionHist(f,hGenSpectraCorr,Form("fHist_cent%d",i));// function that you get from the fitting // hGenSpectraCorr->Divide(fHist); for (int y=1;y<=mPbPb_Matrix[i]->GetNbinsY();y++) { double sum=0; for (int x=1;x<=mPbPb_Matrix[i]->GetNbinsX();x++) { if (mPbPb_Matrix[i]->GetBinContent(x,y)<=1*mPbPb_Matrix[i]->GetBinError(x,y)) { //in the above line mine had 0*getbinerror while Kurt's had 1*. mPbPb_Matrix[i]->SetBinContent(x,y,0); mPbPb_Matrix[i]->SetBinError(x,y,0); } sum+=mPbPb_Matrix[i]->GetBinContent(x,y); } for (int x=1;x<=mPbPb_Matrix[i]->GetNbinsX();x++) { double ratio = 1; // if (hGenSpectraCorr->GetBinContent(x)!=0) ratio = 1e5/hGenSpectraCorr->GetBinContent(x); mPbPb_Matrix[i]->SetBinContent(x,y,mPbPb_Matrix[i]->GetBinContent(x,y)*ratio); mPbPb_Matrix[i]->SetBinError(x,y,mPbPb_Matrix[i]->GetBinError(x,y)*ratio); } } //mPbPb_Matrix[i]->Smooth(0); // Ok major differences here between my code and Kurt in b-jet Tools under Unfold - lines 469 and above. mPbPb_Response[i] = (TH2F*)mPbPb_Matrix[i]->Clone(Form("mPbPb_Response_cent%d",i)); TH1F *hProj = (TH1F*)mPbPb_Response[i]->ProjectionY()->Clone(Form("hProj_cent%d",i)); for (int y=1;y<=mPbPb_Response[i]->GetNbinsY();y++) { double sum=0; for (int x=1;x<=mPbPb_Response[i]->GetNbinsX();x++) { if (mPbPb_Response[i]->GetBinContent(x,y)<=1*mPbPb_Response[i]->GetBinError(x,y)) { // in the above if loop, kurt has 1*error and my old had 0*error mPbPb_Response[i]->SetBinContent(x,y,0); mPbPb_Response[i]->SetBinError(x,y,0); } sum+=mPbPb_Response[i]->GetBinContent(x,y); } for (int x=1;x<=mPbPb_Response[i]->GetNbinsX();x++) { if (sum==0) continue; double ratio = 1; //if(dPbPb_TrgComb[i]->GetBinContent(y)==0) ratio = 1e-100/sum; // else ratio = dPbPb_TrgComb[i]->GetBinContent(y)/sum ratio = 1./sum; if (hProj->GetBinContent(y)==0) ratio = 1e-100/sum; else ratio = hProj->GetBinContent(y)/sum; mPbPb_Response[i]->SetBinContent(x,y,mPbPb_Response[i]->GetBinContent(x,y)*ratio); mPbPb_Response[i]->SetBinError(x,y,mPbPb_Response[i]->GetBinError(x,y)*ratio); } } mPbPb_ResponseNorm[i] = (TH2F*)mPbPb_Matrix[i]->Clone(Form("mPbPb_ResponseNorm_cent%d",i)); for (int x=1;x<=mPbPb_ResponseNorm[i]->GetNbinsX();x++) { double sum=0; for (int y=1;y<=mPbPb_ResponseNorm[i]->GetNbinsY();y++) { if (mPbPb_ResponseNorm[i]->GetBinContent(x,y)<=1*mPbPb_ResponseNorm[i]->GetBinError(x,y)) { mPbPb_ResponseNorm[i]->SetBinContent(x,y,0); mPbPb_ResponseNorm[i]->SetBinError(x,y,0); } sum+=mPbPb_ResponseNorm[i]->GetBinContent(x,y); } for (int y=1;y<=mPbPb_ResponseNorm[i]->GetNbinsY();y++) { if (sum==0) continue; double ratio = 1./sum; mPbPb_ResponseNorm[i]->SetBinContent(x,y,mPbPb_ResponseNorm[i]->GetBinContent(x,y)*ratio); mPbPb_ResponseNorm[i]->SetBinError(x,y,mPbPb_ResponseNorm[i]->GetBinError(x,y)*ratio); } } } if(printDebug) cout<<"Filling PP response Matrix"<<endl; // response matrix for pp. // Kurt doesnt have this whole hGenSpectraCorr thing in his macro. need to check why the difference exists between out codes TF1 *fpp = new TF1("fpp","[0]*pow(x+[2],[1])"); fpp->SetParameters(1e10,-8.8,40); // if(printDebug) cout<<"before getting the gen spectra corr matrix"<<endl; // TH1F *hGenSpectraCorrPP = (TH1F*)mPP_Matrix->ProjectionX()->Clone("hGenSpectraCorrPP"); // if(printDebug) cout<<"after gettign the gen spectra corr matrix"<<endl; // hGenSpectraCorrPP->Fit("f"," "); // hGenSpectraCorrPP->Fit("f","",""); // hGenSpectraCorrPP->Fit("f","LL"); // TH1F *fHistPP = functionHist(fpp,hGenSpectraCorrPP,"fHistPP");// that the function that you get from the fitting // hGenSpectraCorrPP->Divide(fHistPP); for (int y=1;y<=mPP_Matrix->GetNbinsY();y++) { double sum=0; for (int x=1;x<=mPP_Matrix->GetNbinsX();x++) { if (mPP_Matrix->GetBinContent(x,y)<=1*mPP_Matrix->GetBinError(x,y)) { mPP_Matrix->SetBinContent(x,y,0); mPP_Matrix->SetBinError(x,y,0); } sum+=mPP_Matrix->GetBinContent(x,y); } for (int x=1;x<=mPP_Matrix->GetNbinsX();x++) { double ratio = 1; // if (hGenSpectraCorrPP->GetBinContent(x)!=0) ratio = 1e5/hGenSpectraCorrPP->GetBinContent(x); mPP_Matrix->SetBinContent(x,y,mPP_Matrix->GetBinContent(x,y)*ratio); mPP_Matrix->SetBinError(x,y,mPP_Matrix->GetBinError(x,y)*ratio); } } // mPbPb_Matrix[i]->Smooth(0); // Ok major differences here between my code and Kurt in b-jet Tools under Unfold - lines 469 and above. if(printDebug) cout<<"getting the response matrix"<<endl; mPP_Response = (TH2F*)mPP_Matrix->Clone("mPP_Response"); TH1F *hProjPP = (TH1F*)mPP_Response->ProjectionY()->Clone("hProjPP"); for (int y=1;y<=mPP_Response->GetNbinsY();y++) { double sum=0; for (int x=1;x<=mPP_Response->GetNbinsX();x++) { if (mPP_Response->GetBinContent(x,y)<=1*mPP_Response->GetBinError(x,y)) { // in the above if statement, kurt has 1*error and my old has 0*error mPP_Response->SetBinContent(x,y,0); mPP_Response->SetBinError(x,y,0); } sum+=mPP_Response->GetBinContent(x,y); } for (int x=1;x<=mPP_Response->GetNbinsX();x++) { if (sum==0) continue; double ratio = 1; //if(dPbPb_TrgComb[i]->GetBinContent(y)==0) ratio = 1e-100/sum; // else ratio = dPbPb_TrgComb[i]->GetBinContent(y)/sum ratio = 1./sum; if (hProjPP->GetBinContent(y)==0) ratio = 1e-100/sum; else ratio = hProjPP->GetBinContent(y)/sum; mPP_Response->SetBinContent(x,y,mPP_Response->GetBinContent(x,y)*ratio); mPP_Response->SetBinError(x,y,mPP_Response->GetBinError(x,y)*ratio); } } if(printDebug) cout<<"getting the normalized response matrix"<<endl; mPP_ResponseNorm = (TH2F*)mPP_Matrix->Clone("mPP_ResponseNorm"); for (int x=1;x<=mPP_ResponseNorm->GetNbinsX();x++) { double sum=0; for (int y=1;y<=mPP_ResponseNorm->GetNbinsY();y++) { if (mPP_ResponseNorm->GetBinContent(x,y)<=1*mPP_ResponseNorm->GetBinError(x,y)) { mPP_ResponseNorm->SetBinContent(x,y,0); mPP_ResponseNorm->SetBinError(x,y,0); } sum+=mPP_ResponseNorm->GetBinContent(x,y); } for (int y=1;y<=mPP_ResponseNorm->GetNbinsY();y++) { if (sum==0) continue; double ratio = 1./sum; mPP_ResponseNorm->SetBinContent(x,y,mPP_ResponseNorm->GetBinContent(x,y)*ratio); mPP_ResponseNorm->SetBinError(x,y,mPP_ResponseNorm->GetBinError(x,y)*ratio); } } // scale the spectra to the respective units // for(int i = 0;i<nbins_cent;++i){ // dPbPb_TrgComb[i] = (TH1F*)dPbPb_TrgComb[i]->Rebin(nbins,Form("PbPb_measured_spectra_combined_cent%d",i),ptbins_long); // divideBinWidth(dPbPb_TrgComb[i]); // } // dPP_Comb = (TH1F*)dPP_Comb->Rebin(nbins,"pp_measured_spectra_combined",ptbins_long); // divideBinWidth(dPP_Comb); // dPP_Comb->Scale(1./ dPP_Comb->GetBinContent(nbins)); // Now that we have all the response matrix for the 6 centralities in PbPb and one pp spectra lets start doing the steps: // we have 39 pt bins, so we need 1000 gaussian functions for each pt bin. Int_t unfoldingTrials = 1000; Double_t meanMeasPbPb[nbins][nbins_cent], sigmaMeasPbPb[nbins][nbins_cent]; Double_t meanMeasPP[nbins], sigmaMeasPP[nbins]; Double_t meanUnfoldPbPb[nbins][nbins_cent][unfoldingTrials], sigmaUnfoldPbPb[nbins][nbins_cent][unfoldingTrials]; Double_t meanUnfoldPP[nbins][unfoldingTrials], sigmaUnfoldPP[nbins][unfoldingTrials]; TRandom3 *random = new TRandom3(0); TH1F * hPbPb_beforeUnfold_Gaussian_pt150[nbins_cent]; TH1F * hPP_beforeUnfold_Gaussian_pt150; hPP_beforeUnfold_Gaussian_pt150 = new TH1F("hPP_beforeUnfold_Gaussian_pt150","",1000, 0.1 * dPP_Comb->GetBinContent(dPP_Comb->FindBin(150)) , 1.9 * dPP_Comb->GetBinContent(dPP_Comb->FindBin(150))); for(int i = 0; i<nbins_cent; ++i) hPbPb_beforeUnfold_Gaussian_pt150[i] = new TH1F(Form("hPbPb_beforeUnfold_Gaussian_pt150_cent%d",i),"Before Unfolding pt bin at 150 value spectra",1000, 0.1 * dPbPb_TrgComb[i]->GetBinContent(dPbPb_TrgComb[i]->FindBin(150)), 1.9 * dPbPb_TrgComb[i]->GetBinContent(dPbPb_TrgComb[i]->FindBin(150))); for(int u = 0;u<unfoldingTrials;++u){ cout<<"unfolding trial no = "<<u+1<<endl; for(int j = 0;j<nbins;++j){ for(int i = 0;i<nbins_cent;++i){ meanMeasPbPb[j][i] = dPbPb_TrgComb[i]->GetBinContent(j+1); sigmaMeasPbPb[j][i] = dPbPb_TrgComb[i]->GetBinError(j+1); }// centrality loop meanMeasPP[j] = dPP_Comb->GetBinContent(j+1); sigmaMeasPP[j] = dPP_Comb->GetBinError(j+1); }// nbins loop // now proceed to unfolding for each trial. for(int i = 0;i<nbins_cent;++i){ TH1F * hPreUnfoldingSpectra = new TH1F("hPreUnfoldingSpectra","",nbins,0, 1000); TH1F * hAfterUnfoldingSpectra; for(int j = 0;j<nbins;++j){ hPreUnfoldingSpectra->SetBinContent(j+1, random->Gaus(meanMeasPbPb[j][i], sigmaMeasPbPb[j][i])); hPreUnfoldingSpectra->SetBinError(j+1, sigmaMeasPbPb[j][i]/sqrt(unfoldingTrials)); if(j+1 == dPbPb_TrgComb[i]->FindBin(150)) hPbPb_beforeUnfold_Gaussian_pt150[i]->Fill(random->Gaus(meanMeasPbPb[j][i], sigmaMeasPbPb[j][i])); }// nbins loop TH1F* hMCGen = (TH1F*)mPbPb_Response[i]->ProjectionX(); removeZero(hMCGen); bayesianUnfold myUnfoldingMulti(mPbPb_Matrix[i], hMCGen, 0); myUnfoldingMulti.unfold(hPreUnfoldingSpectra, BayesIter); hAfterUnfoldingSpectra = (TH1F*) myUnfoldingMulti.hPrior->Clone("hAfterUnfoldingSpectra"); for(int j = 0;j<nbins;++j){ meanUnfoldPbPb[j][i][u] = hAfterUnfoldingSpectra->GetBinContent(j+1); sigmaUnfoldPbPb[j][i][u] = hAfterUnfoldingSpectra->GetBinError(j+1); }// nbins loop delete hPreUnfoldingSpectra; delete hAfterUnfoldingSpectra; delete hMCGen; }// centrality loop cout<<"pp "<<endl; // now do it for the pp: TH1F * hPreUnfoldingSpectraPP = new TH1F("hPreUnfoldingSpectraPP","",nbins,0, 1000); TH1F * hAfterUnfoldingSpectraPP; for(int j = 0;j<nbins;++j){ hPreUnfoldingSpectraPP->SetBinContent(j+1, random->Gaus(meanMeasPP[j], sigmaMeasPP[j])); hPreUnfoldingSpectraPP->SetBinError(j+1, sigmaMeasPP[j]/sqrt(unfoldingTrials)); if(j+1 == dPP_Comb->FindBin(150)) hPP_beforeUnfold_Gaussian_pt150->Fill(random->Gaus(meanMeasPP[j], sigmaMeasPP[j])); }// nbins loop TH1F* hMCGenPP = (TH1F*)mPP_Response->ProjectionX(); removeZero(hMCGenPP); bayesianUnfold myUnfoldingMultiPP(mPP_Matrix, hMCGenPP, 0); myUnfoldingMultiPP.unfold(hPreUnfoldingSpectraPP, BayesIter); hAfterUnfoldingSpectraPP = (TH1F*) myUnfoldingMultiPP.hPrior->Clone("hAfterUnfoldingSpectraPP"); for(int j = 0;j<nbins;++j){ meanUnfoldPP[j][u] = hAfterUnfoldingSpectraPP->GetBinContent(j+1); sigmaUnfoldPP[j][u] = hAfterUnfoldingSpectraPP->GetBinError(j+1); }// nbins loop delete hPreUnfoldingSpectraPP; delete hAfterUnfoldingSpectraPP; delete hMCGenPP; }// unfolding trials loop // Now that we have all the necesary values we need, lets proceed to fill a histogram with the mean values for each ptbin and get the corrected values. TH1F * hAfterUnfoldingptBinDistribution[nbins]; TH1F * hCorrUnfoldingPbPb[nbins_cent]; // we need to store one gaussian histogram in the root file which we can plot TH1F * hPbPb_Gaussian_pt150[nbins_cent]; TH1F * hPP_Gaussian_pt150; for(int i = 0;i<nbins_cent;++i){ hCorrUnfoldingPbPb[i] = new TH1F(Form("PbPb_BayesianUnfolded_cent%d",i),"Spectra after correction", nbins,0, 1000); hPbPb_Gaussian_pt150[i] = new TH1F(Form("PbPb_Gaussian_pt150_cent%d",i),"gaussian distribution of values at pt bin at 150",1000, 0.1 * dPbPb_TrgComb[i]->GetBinContent(dPbPb_TrgComb[i]->FindBin(150)), 1.9 * dPbPb_TrgComb[i]->GetBinContent(dPbPb_TrgComb[i]->FindBin(150))); for(int j = 0;j<nbins;++j){ hAfterUnfoldingptBinDistribution[j] = new TH1F(Form("hAfterUnfoldingptBinDistribution_ptBin%d",j),"",100, 0, 1); for(int u = 0;u<unfoldingTrials;++u){ hAfterUnfoldingptBinDistribution[j]->Fill(meanUnfoldPbPb[j][i][u]); if(j+1 == dPbPb_TrgComb[i]->FindBin(150)) hPbPb_Gaussian_pt150[i]->Fill(meanUnfoldPbPb[j][i][u]); }// unfolding trials loop hCorrUnfoldingPbPb[i]->SetBinContent(j+1, hAfterUnfoldingptBinDistribution[j]->GetMean()); hCorrUnfoldingPbPb[i]->SetBinError(j+1, hAfterUnfoldingptBinDistribution[j]->GetRMS()); delete hAfterUnfoldingptBinDistribution[j]; }// nbins loop }// centrality loop // similar for the pp: TH1F * hAfterUnfoldingptBinDistributionPP[nbins]; TH1F * hCorrUnfoldingPP; hCorrUnfoldingPP = new TH1F("PP_BayesianUnfolded","Spectra after unfolding error correction",nbins,0, 1000); hPP_Gaussian_pt150 = new TH1F("PP_Gaussian_pt100","gaussian distribution of values at pt bin at 150",1000, 0.1 * dPP_Comb->GetBinContent(dPP_Comb->FindBin(150)) , 1.9 * dPP_Comb->GetBinContent(dPP_Comb->FindBin(150))); for(int j = 0;j<nbins;++j){ hAfterUnfoldingptBinDistributionPP[j] = new TH1F(Form("hAfterUnfoldingptBinDistributionPP_ptBin%d",j),"",100, 0, 1); for(int u = 0;u<unfoldingTrials;++u){ hAfterUnfoldingptBinDistributionPP[j]->Fill(meanUnfoldPP[j][u]); if(j+1 == dPP_Comb->FindBin(150)) hPP_Gaussian_pt150->Fill(meanUnfoldPP[j][u]); }// unfolding trials loop hCorrUnfoldingPP->SetBinContent(j+1, hAfterUnfoldingptBinDistributionPP[j]->GetMean()); hCorrUnfoldingPP->SetBinError(j+1, hAfterUnfoldingptBinDistributionPP[j]->GetRMS()); delete hAfterUnfoldingptBinDistributionPP[j]; }// nbins loop TFile f(Form("July20/HiForest_%disATLASCut_%ddo10GeVBins_data_driven_correction_ak%d.root" , isATLASCut, do10GeVBins, radius),"RECREATE"); f.cd(); for(int i = 0;i<nbins_cent;i++) { //hCorrUnfoldingPbPb[i] = (TH1F*)hCorrUnfoldingPbPb[i]->Rebin(nbins_coarse, Form("PbPb_BayesianUnfolded_cent%d",i), ptbins_long_coarse); //divideBinWidth(hCorrUnfoldingPbPb[i]); //dPbPb_TrgComb[i] = (TH1F*)dPbPb_TrgComb[i]->Rebin(nbins_coarse, Form("PbPb_measured_cent%d",i), ptbins_long_coarse); //divideBinWidth(dPbPb_TrgComb[i]); hMinBias[i]->Write(); hDataBeforeSub[i]->Write(); hDataAfterSub[i]->Write(); hCorrUnfoldingPbPb[i]->Scale(166 * 1e9); hCorrUnfoldingPbPb[i]->Write(); hCorrUnfoldingPbPb[i]->Print("base"); dPbPb_TrgComb[i]->Scale(166 * 1e9); dPbPb_TrgComb[i]->SetName(Form("PbPb_data_minbiasSub_cent%d",i)); //dPbPb_TrgComb[i]->Scale(145.156 * 1e9); dPbPb_TrgComb[i]->Write(); dPbPb_TrgComb[i]->Print("base"); hPbPb_beforeUnfold_Gaussian_pt150[i]->Write(); hPbPb_beforeUnfold_Gaussian_pt150[i]->Print("base"); hPbPb_Gaussian_pt150[i]->Write(); hPbPb_Gaussian_pt150[i]->Print("base"); mPbPb_Matrix[i]->Write(); } //hCorrUnfoldingPP = (TH1F*)hCorrUnfoldingPP->Rebin(nbins_coarse, "PP_BayesianUnfolded", ptbins_long_coarse); //divideBinWidth(hCorrUnfoldingPP); //dPP_Comb = (TH1F*)dPP_Comb->Rebin(nbins_coarse, "PP_measured", ptbins_long_coarse); //divideBinWidth(dPP_Comb); hCorrUnfoldingPP->Scale(5.3 * 1e9); hCorrUnfoldingPP->Write(); hCorrUnfoldingPP->Print("base"); dPP_Comb->Scale(5.3 * 1e9); dPP_Comb->Write(); dPP_Comb->Print("base"); hPP_beforeUnfold_Gaussian_pt150->Write(); hPP_beforeUnfold_Gaussian_pt150->Print("base"); hPP_Gaussian_pt150->Write(); hPP_Gaussian_pt150->Print("base"); mPP_Matrix->Write(); f.Write(); f.Close(); // make the data driven Error correction histograms and plots here: TH1F * hError_Meas[nbins_cent+1], * hError_Fixed[nbins_cent+1]; for(int i = 0; i<nbins_cent+1; ++i){ cout<<"centrality "<<i<<endl; if(i < nbins_cent){ hError_Meas[i] = new TH1F(Form("hError_Meas_cent%d",i),"",nbins, 0, 1000); hError_Fixed[i] = new TH1F(Form("hError_Fixed_cent%d",i),"",nbins, 0, 1000); } if(i == nbins_cent){ hError_Meas[i] = new TH1F(Form("hError_PP_Meas_cent%d",i),"",nbins, 0, 1000); hError_Fixed[i] = new TH1F(Form("hError_PP_Fixed_cent%d",i),"",nbins, 0, 1000); } for(int j = 1; j<=nbins; ++j){ //cout<<"ptbins "<<j<<endl; if(i < nbins_cent){ if(dPbPb_TrgComb[i]->GetBinContent(j)!=0) hError_Meas[i]->SetBinContent(j, (float)dPbPb_TrgComb[i]->GetBinError(j)/dPbPb_TrgComb[i]->GetBinContent(j)); //hError_Meas[i]->SetBinContent(j, (float)dPbPb_TrgComb[i]->GetBinError(j)); if(hCorrUnfoldingPbPb[i]->GetBinContent(j)!=0)hError_Fixed[i]->SetBinContent(j, (float)hCorrUnfoldingPbPb[i]->GetBinError(j)/hCorrUnfoldingPbPb[i]->GetBinContent(j)); cout<<j<<" "<<hError_Fixed[i]->GetBinContent(j)<<endl; //hError_Fixed[i]->SetBinContent(j, (float)hCorrUnfoldingPbPb[i]->GetBinError(j)); } if(i == nbins_cent){ hError_Meas[i]->SetBinContent(j, (float)dPP_Comb->GetBinError(j)/dPP_Comb->GetBinContent(j)); //hError_Meas[i]->SetBinContent(j, (float)dPP_Comb->GetBinError(j)); hError_Fixed[i]->SetBinContent(j, (float)hCorrUnfoldingPP->GetBinError(j)/hCorrUnfoldingPP->GetBinContent(j)); //hError_Fixed[i]->SetBinContent(j, (float)hCorrUnfoldingPP->GetBinError(j)); } } hError_Meas[i]->SetAxisRange(50, 299, "X"); //hError_Meas[i]->Print("base"); //hError_Fixed[i]->Print("base"); //hError_Meas[i]->SetAxisRange(1e-12, 1, "Y"); } //cout<<" passed the loop"<<endl; TCanvas * cSpectra = new TCanvas("cSpectra","",1200,1000); makeMultiPanelCanvas(cSpectra,3,2,0.0,0.0,0.2,0.15,0.07); for(int i = 0; i<nbins_cent; ++i){ //cout<<i<<endl; cSpectra->cd(nbins_cent-i); cSpectra->cd(nbins_cent-i)->SetLogy(); dPbPb_TrgComb[i]->SetMarkerStyle(24); dPbPb_TrgComb[i]->SetMarkerColor(kBlack); makeHistTitle(dPbPb_TrgComb[i]," ","jet pT","dN/dpT"); dPbPb_TrgComb[i]->SetAxisRange(50, 299, "X"); dPbPb_TrgComb[i]->Draw("p"); hCorrUnfoldingPbPb[i]->SetMarkerStyle(33); hCorrUnfoldingPbPb[i]->SetMarkerColor(kRed); hCorrUnfoldingPbPb[i]->Draw("psame"); } TLegend * Spec = myLegend(0.55,0.55,0.75,0.75); cSpectra->cd(1); putCMSPrel(); Spec->AddEntry(dPbPb_TrgComb[0],"Measured","pl"); Spec->AddEntry(hCorrUnfoldingPbPb[0],"Data Driven Correction","pl"); Spec->SetTextSize(0.04); Spec->Draw(); cSpectra->SaveAs(Form("%sUnfoldingSpectra_fromDataDrivenMacro_PbPb_%s_R%d_%d_hiForest_%dGeVCut.pdf",outLocation,etaWidth,radius,date.GetDate(),unfoldingCut),"RECREATE"); TCanvas * cErrorFix = new TCanvas("cErrorFix","",1200,1000); makeMultiPanelCanvas(cErrorFix,3,2,0.0,0.0,0.2,0.15,0.07); for(int i = 0; i<nbins_cent; ++i){ //cout<<i<<endl; cErrorFix->cd(nbins_cent-i); cErrorFix->cd(nbins_cent-i)->SetLogy(); makeHistTitle(hError_Meas[i]," ","jet pT","Error/Content"); hError_Meas[i]->SetMarkerStyle(24); hError_Meas[i]->SetMarkerColor(kBlack); hError_Meas[i]->Draw("p"); hError_Fixed[i]->SetMarkerStyle(33); hError_Fixed[i]->SetMarkerColor(kRed); hError_Fixed[i]->Draw("psame"); } TLegend * err = myLegend(0.55,0.55,0.75,0.75); cErrorFix->cd(1); putCMSPrel(); err->AddEntry(hError_Meas[0],"Measured","pl"); err->AddEntry(hError_Fixed[0],"Data Driven Correction","pl"); err->SetTextSize(0.04); err->Draw(); cErrorFix->SaveAs(Form("%sUnfoldingErrorFix_fromDataDrivenMacro_PbPb_%s_R%d_%d_hiForest_%dGeVCut.pdf",outLocation,etaWidth,radius,date.GetDate(),unfoldingCut),"RECREATE"); TCanvas * cErrorFixPP = new TCanvas("cErrorFixPP","",800,600); cErrorFixPP->SetLogy(); hError_Meas[nbins_cent]->SetMarkerStyle(24); hError_Meas[nbins_cent]->SetMarkerColor(kBlack); hError_Meas[nbins_cent]->Draw("p"); hError_Fixed[nbins_cent]->SetMarkerStyle(33); hError_Fixed[nbins_cent]->SetMarkerColor(kRed); hError_Fixed[nbins_cent]->Draw("psame"); TLegend * errPP = myLegend(0.55,0.55,0.75,0.75); putCMSPrel(); errPP->AddEntry(hError_Meas[nbins_cent],"Measured","pl"); errPP->AddEntry(hError_Fixed[nbins_cent],"Data Driven Correction","pl"); errPP->SetTextSize(0.04); errPP->Draw(); cErrorFixPP->SaveAs(Form("%sUnfoldingErrorFix_fromDataDrivenMacro_PP_%s_R%d_%d_hiForest_%dGeVCut.pdf",outLocation,etaWidth,radius,date.GetDate(),unfoldingCut),"RECREATE"); timer.Stop(); if(printDebug) cout<<"CPU time (mins) = "<<(Float_t)timer.CpuTime()/60<<endl; if(printDebug) cout<<"Real tile (mins) = "<<(Float_t)timer.RealTime()/60<<endl; }