#include "TFile.h" #include "TGraphAsymmErrors.h" #include "TLegend.h" #include "TCanvas.h" #include "TAxis.h" #include #include #include #include "AtlasUtils.h" #include "AtlasStyle.C" #include "AtlasLabels.C" #include "ComputeTotalCrossSection.C" #define saveAsRoot true void addMPI4amcnlo(std::string hname="j_bjet_Pt_binned") { if (hname=="XXX"){ std::cout<<"No histogram selected - possible choices are: \n"; std::cout<<"\"j_bjet_Pt_binned\""<Get(hname.c_str()); std::string hnameMPI="XXX"; if (hname=="j_bjet_Pt_binned") hnameMPI="zb_jet_pT_MPI"; else if (hname=="j_bjet_Y_binned") { hnameMPI="zb_jet_y_MPI"; scaleF = 2.*scaleF; } else if (hname=="j_bjet_Yboost_binned") hnameMPI="zb_yboost_MPI"; // else if (hname=="j_bjet_DY20_binned") hnameMPI="zb_dy_MPI"; else if (hname=="j_bjet_ZdPhiF20_binned") { hnameMPI="zb_dphi_MPI"; scaleF = 2.*scaleF; } else if (hname=="j_bjet_ZdR620_binned") hnameMPI="zb_dR_MPI"; // else if (hname=="j_bjet_ZPt_binned") hnameMPI="zb_Z_pT_MPI"; else if (hname=="j_bjet_ZY_binned") { scaleF = 2.*scaleF; hnameMPI="zb_Z_y_MPI"; } // else if (hname=="j_2bjet_ZPtv3_binned") hnameMPI="zbb_Z_pT_MPI"; //else if (hname=="j_2bjet_ZPt_binned") hnameMPI="zbb_Z_pT_MPI"; else if (hname=="j_2bjet_ZY_binned") { scaleF = 2.*scaleF; hnameMPI="zbb_Z_y_MPI"; } else if (hname=="j_2bjet_dR_binned") hnameMPI="zbb_dR_MPI"; else if (hname=="j_2bjet_Mbb_binned") hnameMPI="zbb_M_MPI"; std::cout<<"**************************** Trying to add "<Get(hnameMPI.c_str()); if (htmp != NULL) gr1 = new TGraphAsymmErrors(htmp); else gr1=NULL; if (gr0==NULL || gr1==NULL) { std::cout<<" some histogram / graph not found for hname=<"< hnameMPI=<"<"<ls(); return; } Double_t yn[100]; Double_t eupyn[100]; Double_t edwyn[100]; int Npoints=gr0->GetN(); for (int k=0; kGetX()[k]); yn[k] = gr0->GetY()[k]; yn[k] += scaleF*gr1->GetY()[k]; Double_t ey0=gr0->GetEYhigh()[k]; Double_t ey1=scaleF*gr1->GetEYhigh()[k]; eupyn[k]=sqrt(ey0*ey0+ey1*ey1); ey0=gr0->GetEYlow()[k]; ey1=scaleF*gr1->GetEYlow()[k]; edwyn[k]=sqrt(ey0*ey0+ey1*ey1); } TFile* foutRoot; if (saveAsRoot) { std::string fn = "MergedHistos.root"; foutRoot = new TFile(fn.c_str(),"UPDATE"); } TGraphAsymmErrors* mergedGr = new TGraphAsymmErrors(Npoints, gr0->GetX(), yn, gr0->GetEXlow(), gr0->GetEXhigh(), edwyn, eupyn); std::cout<<"Merged "<Draw("APEC"); gr0->Draw("PECSAME"); gr1->Draw("PESAME"); if (saveAsRoot) { mergedGr->Write(hname.c_str()); } if (saveAsRoot) { foutRoot->Close(); } }