{ TCanvas *c1 = new TCanvas("c1", "transparent pad",179,30,698,498); gStyle->SetOptStat(0); gStyle->SetPadGridX(3); gStyle->SetPadGridY(3); gStyle->SetGridStyle(3); c1->Range(0,0,1,1); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetFrameFillStyle(0); c1->SetFrameBorderMode(0); // ------------>Primitives in pad: pad1 TPad *pad1 = new TPad("pad1", "",0,0,1,1); pad1->Draw(); pad1->cd(); pad1->Range(-12.5,-1271.556,112.5,3814.668); pad1->SetFillColor(0); pad1->SetBorderMode(0); pad1->SetBorderSize(2); pad1->SetBottomMargin(0.25); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); TFile f1("madgraph_zeejets.root","read"); TGraphAsymmErrors *ae = (TGraphAsymmErrors*)f1->Get("jet_ee_eta2jetcase"); TFile f2("sherpa_zeejets.root","read"); TGraphAsymmErrors *aa = (TGraphAsymmErrors*)f2->Get("jet_ee_eta2jetcase"); TFile f3("jet2eta.root","read"); TCanvas *c3 = (TCanvas*)f3.Get("c1"); TH1D *h1; TList* l = c3->GetListOfPrimitives(); TIter next(l); TObject *found, *obj; while ((obj=next())) { if (obj->InheritsFrom(TH1D::Class())) { h1 = (TH1D*)obj; } } pad1->cd(); h1->Draw("E"); h1->SetLineColor(kBlack); h1->SetLineWidth(2); ae->Draw("E"); ae->SetLineColor(kRed); ae->SetLineWidth(2); aa->Draw("E"); aa->SetLineColor(kBlue); aa->SetLineWidth(2); pad1->Modified(); c1->cd(); // ------------>Primitives in pad: pad2 pad2 = new TPad("pad2", "",0,0,1,1); pad2->Draw(); pad2->cd(); pad2->Range(-12.5,-0.1666668,112.5,6.500001); pad2->SetFillColor(0); pad2->SetFillStyle(4000); pad2->SetBorderMode(0); pad2->SetBorderSize(2); pad2->SetTicky(); pad2->SetTopMargin(0.75); pad2->SetFrameFillStyle(0); pad2->SetFrameBorderMode(0); pad2->SetFrameFillStyle(0); pad2->SetFrameBorderMode(0); TGraphErrors* gr5; const int nmx = 5000; double bincenter[nmx]; double ratio[nmx]; double errorinx[nmx]; double errorinratio[nmx]; for (int kl=0; kl< h1->GetNbinsX(); kl++) { bincenter[kl] = h1->GetBinCenter(kl+1); ratio[kl] = h1->GetBinContent(kl+1)/(TMath::Max(0.01,ae->GetPoint(kl+1))); errorinx[kl] = 0.0001; errorinratio[kl] = 0.0001; errorinratio[kl] = ratio[kl]*(pow(1/TMath::Max(0.01,h1->GetBinContent(kl+1)) + 1/TMath::Max(0.01,ae->GetPoint(kl+1)),0.5)); // gr5 = new TGraphErrors(h1->GetNbinsX(),bincenter,ratio, errorinx,errorinratio); } gr5 = new TGraphErrors(h1->GetNbinsX(),bincenter,ratio, errorinx,errorinratio); gr5->Draw("AP"); gr5->SetMinimum(0.2); gr5->SetMaximum(2.2); gr5->SetMarkerColor(2); gr5->SetMarkerStyle(20); gr5->SetMarkerSize(0.7); gr5->GetXaxis()->SetRangeUser(0.,40.); gr5->GetXaxis()->SetLabelOffset(0.03); gr5->GetYaxis()->SetNdivisions(5); gr5->GetYaxis()->SetLabelOffset(0.02); c1->SetLogy(); TLine *line = new TLine(0,1,11,1); line->SetLineColor(2); line->Draw(); pad2->Modified(); c1->cd(); c1->Modified(); c1->cd(); c1->SetSelected(c1); }