//Attempt to make a TGraph stacker macro //Ian Connelly //29 Feb 2012 tgraphstack(){ TFile* f = new TFile("f_hist.root", "OPEN"); TGraph* signal = (TGraph*)f->Get("scaled signal;1"); TGraph* background = (TGraph*)f->Get("scaled background;1"); TMultiGraph* multiG = new TMultiGraph("multiG", "multiG"); TCanvas* c = new TCanvas("c","c", 2000, 2000); c->SetLogy(); c->RangeAxis(-1,1,0,1000000); multiG->Add(background); multiG->Add(signal); //Interesting behaviour where TMultiGraph just sets the minimum y axis to 3 orders of magnitude less than the maximum point being plotted. //Using SetMinimum forces the minimum point to be fixed //Here use 1 because log(1) = 0 multiG->SetMinimum(1); //Use Draw("AL") to say plot axis and line multiG->Draw("AL"); //signal->Draw("AL"); return 0; }