#include #include "TBox.h" #include "TCanvas.h" #include "TH1.h" int testPadCoord() { TH1D* h1= new TH1D("h1","h1",100,-5.,5.); h1->FillRandom("gaus"); TH1D* h2= new TH1D("h2","h2",100,-5.,5.); h2->FillRandom("gaus"); TCanvas *canv = new TCanvas("canv","canv",500,500); // canv->Divide(2); canv->cd(); h1->Draw("e"); // canv->cd(2); h2->SetLineColor(2); h2->SetMarkerColor(2); h2->Draw("same,e"); double boxMin = canv->GetUymin(); double boxMax = canv->GetUymax(); std::cout << "\n boxMin = " << boxMin << "; boxMax = " << boxMax << std::endl; TBox *band = new TBox(-1.,boxMin,1.,boxMax); band->SetFillStyle(3013); band->SetFillColor(16); band->Draw(); canv->Print("testPadCoord.gif"); return 0; }