[ROOT] Saving Pads to File

From: Jan Erik Sundermann (jsunderm@pktw01.phy.tu-dresden.de)
Date: Mon May 12 2003 - 19:20:50 MEST


	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