Re: [ROOT] Saving Pads to File

From: Jan Erik Sundermann (jsunderm@pktw01.phy.tu-dresden.de)
Date: Tue May 13 2003 - 15:14:11 MEST


	Hi Rene,

I followed the instructions in wp() line by line in the interpreter:

root [0] .L wp.C
root [1] TFile f("test.root")
root [2] TCanvas* c = (TCanvas*) f.Get("testcanvas")
root [3] c
(class TCanvas*)0x89f7b40
root [4] c->Draw()
root [5] wp1(c, "junk3.ps", 1, 3)
Info in <TCanvas::Print>: PostScript file junk3.ps has been created
Info in <TCanvas::Print>: Current canvas added to PostScript file junk3.ps
Info in <TCanvas::Print>: Current canvas added to PostScript file junk3.ps


But calling wp1(...) in the interpreter does not work on my system. The 
created PS file shows only empty pages.


	Best reards,

		Jan Erik.




On Tuesday 13 May 2003 15:04, you wrote:
> Jan Erik,
>
> You cannot call wp1 directly. You must draw the canvas first.
>
> Rene Brun
>
> Jan Erik Sundermann wrote:
> >         Hi Rene,
> >
> > I tested your code and it works fine for me. On the other hand, the
> > described problem persists when opening and drawing the testcanvas and
> > calling the function wp1() directly from the root interpreter.
> >
> >         Best regards,
> >
> >                 Jan Erik.
> >
> > On Monday 12 May 2003 22:11, Rene Brun wrote:
> > > Hi Jan Erik,
> > >
> > > I do not know in which way you call your function.
> > > In attachement see a script using your code that produces
> > > what you expect.
> > >
> > > Rene Brun
> > >
> > > On Mon, 12 May
> > > 2003, Jan
> > >
> > > Erik Sundermann wrote:
> > > >     Hello,
> > > >
> > > > I've problems executing the following script:
> > > > >-------
> > > >
> > > > #include "TCanvas.h"
> > > > #include "TString.h"
> > > >
> > > >
> > > > void
> > > > writePadsToPs(TCanvas* canvas, char* filename, int nbPadLow = 1, int
> > > > nbPadHigh = 1) {
> > > >
> > > >   for (int index = nbPadLow; index <= nbPadHigh; index++) {
> > > >
> > > >     canvas->cd(index);
> > > >     TPad* thispad = (TPad*) gPad;
> > > >     TCanvas *tempcanvas = new TCanvas();
> > > >     tempcanvas->cd();
> > > >     TPad *clonepad = (TPad*) thispad->DrawClone();
> > > >     clonepad->SetPad(0,0,1,1);
> > > >     TString tempfilename(filename);
> > > >     if (index == nbPadLow)
> > > >       tempfilename += "(";
> > > >     if (index == nbPadHigh)
> > > >       tempfilename += ")";
> > > >     tempcanvas->SaveAs(tempfilename);
> > > >     delete tempcanvas;
> > > >
> > > >   }
> > > > }
> > > >
> > > > ---------<
> > > >
> > > > When using the above code on the attached canvas the DrawClone does
> > > > not write to the temporary canvas but to the original canvas. The
> > > > same code works when executed line by line on the interpreter prompt.
> > > >
> > > > I'm using root version 3.05/03 on RedHat 7.3.
> > > >
> > > >
> > > >     Best regards,
> > > >
> > > >             Jan Erik.



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET