#include "TFile.h" #include "TGraphAsymmErrors.h" grAdd4MCNLO(std::string hname="XXX") { if (hname=="XXX"){ std::cout<<"No histogram selected - possible choices are: \n"; std::cout<<"\"j_bjet_Pt_binned\""<GetN(); std::cout<<" ////////////////////////////// averaging distribution <"<"<GetEYlow()[k]*g0->GetEYlow()[k]); Ygr[k] = Ygr[k] + weight * (g0->GetY()[k]); sum_weight = sum_weight + weight; std::cout<<"sameple j=0 ---- y, ey = "<GetY()[k]<<" - "<GetEYlow()[k]<<" + "<GetEYhigh()[k]<GetEYlow()[k]*g1->GetEYlow()[k]); Ygr[k] = Ygr[k] + weight * (g1->GetY()[k]); sum_weight = sum_weight + weight; std::cout<<"sameple j=1 ---- y, ey = "<GetY()[k]<<" - "<GetEYlow()[k]<<" + "<GetEYhigh()[k]<GetEYlow()[k]*g2->GetEYlow()[k]); Ygr[k] = Ygr[k] + weight * (g2->GetY()[k]); sum_weight = sum_weight + weight; std::cout<<"sameple j=2 ---- y, ey = "<GetY()[k]<<" - "<GetEYlow()[k]<<" + "<GetEYhigh()[k]<GetEYlow()[k]*g3->GetEYlow()[k]); Ygr[k] = Ygr[k] + weight * (g3->GetY()[k]); sum_weight = sum_weight + weight; std::cout<<"sameple j=3 ---- y, ey = "<GetY()[k]<<" - "<GetEYlow()[k]<<" + "<GetEYhigh()[k]<GetEYlow()[k]*g4->GetEYlow()[k]); Ygr[k] = Ygr[k] + weight * (g4->GetY()[k]); sum_weight = sum_weight + weight; std::cout<<"sameple j=4 ---- y, ey = "<GetY()[k]<<" - "<GetEYlow()[k]<<" + "<GetEYhigh()[k]<GetEYlow()[k]*g5->GetEYlow()[k]); Ygr[k] = Ygr[k] + weight * (g5->GetY()[k]); sum_weight = sum_weight + weight; std::cout<<"sameple j=5 ---- y, ey = "<GetY()[k]<<" - "<GetEYlow()[k]<<" + "<GetEYhigh()[k]<GetEYlow()[k]*g6->GetEYlow()[k]); Ygr[k] = Ygr[k] + weight * (g6->GetY()[k]); sum_weight = sum_weight + weight; std::cout<<"sameple j=6 ---- y, ey = "<GetY()[k]<<" - "<GetEYlow()[k]<<" + "<GetEYhigh()[k]<GetEYlow()[k]*g7->GetEYlow()[k]); Ygr[k] = Ygr[k] + weight * (g7->GetY()[k]); sum_weight = sum_weight + weight; std::cout<<"sameple j=7 ---- y, ey = "<GetY()[k]<<" - "<GetEYlow()[k]<<" + "<GetEYhigh()[k]<GetEYlow()[k]*g8->GetEYlow()[k]); Ygr[k] = Ygr[k] + weight * (g8->GetY()[k]); sum_weight = sum_weight + weight; std::cout<<"sameple j=8 ---- y, ey = "<GetY()[k]<<" - "<GetEYlow()[k]<<" + "<GetEYhigh()[k]<GetEYlow()[k]*g9->GetEYlow()[k]); Ygr[k] = Ygr[k] + weight * (g9->GetY()[k]); sum_weight = sum_weight + weight; std::cout<<"sameple j=9 ---- y, ey = "<GetY()[k]<<" - "<GetEYlow()[k]<<" + "<GetEYhigh()[k]<GetX(), Ygr, g0->GetEXhigh(), g0->GetEXlow(), EYgr, EYgr); gNew->SetLineColor(2); gNew->Draw("APE"); g0->Draw("PESAME"); g1->Draw("PESAME"); g2->Draw("PESAME"); g3->Draw("PESAME"); g4->Draw("PESAME"); gNew->Draw("PESAME"); TFile *f = new TFile("hTotal.root","UPDATE"); gNew->Write(hname.c_str()); f->Close(); }