I’m wondering how I can make the following script work:
void testPs()
{
gROOT->SetStyle("Plain");
TH1F* h = new TH1F("h","ht",100,-5,5);
TPostScript* ps = new TPostScript("testPs.ps",114);
TCanvas* c = new TCanvas;
ps->NewPage();
c->Clear();
c->Divide(2,1);
TVirtualPad* pad = c->cd(2);
h->FillRandom("gaus",10000);
h->Draw();
c->Update();
ps->NewPage();
c->Clear();
c->Divide(2,1);
pad = c->cd(1);
h->Draw();
pad->Print("myTest.eps");
ps->On();
pad = c->cd(2);
h->Draw();
c->Update();
ps->NewPage();
c->Clear();
c->Divide(1);
c->cd(1);
h->Draw();
ps->Close();
c->Close();
}
What I want to happen is that the first pad in the second page is going to be written to the main .ps file (testPs.ps) and also to a separate eps file (myTest.eps). What currently happens is that the .eps file is written, but the pad is empty in the main ps file.