Re: [ROOT] Saving Pads to File

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon May 12 2003 - 22:11:51 MEST


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