Re: [ROOT] Reading a pad

From: Martin Turner (martin@hep.ph.liv.ac.uk)
Date: Tue Nov 04 2003 - 15:05:22 MET


I'm afraid that  didn't work. My exact script is:

{
TFile f("~/the_script/jpsi_mass_data_trial.root");
TCanvas *c1 = (TCanvas*)f.Get("jpsi mass");

TPad *pad = (TPad*)c1->FindObject("c1_2");
TCanvas *c2 = new TCanvas("c2");

pad->Draw();
pad->SetPad(0,0,1,1);
}

This complains that the pointer TPad is illegal.
TFile and c1 definately exist because I can recover the canvas as a whole
but not individual plots. 

What could be wrong?


Martin

On Tue, 4 Nov 2003, Rene Brun wrote:

> Hi Martin,
> 
> Assuming a canvas c1 divided into 4 pads c1_1, c1_2, etc and saved in c1.root
> In a new session you can do, eg:
> 
> TFile f("c1.root")
> TCanvas *c1 = (TCanvas*)f.Get("c1");
> TPad *pad = (TPad*)c1->FindObject("c1_2");
> TCanvas *c2 = new TCanvas("c2");
> pad->Draw();
> pad->SetPad(0,0,1,1);
> 
> Rene Brun
> 
> Martin Turner wrote:
> > 
> > Hello Root experts.
> > 
> > I have a Canvas, split into numerous pads, each containing a TH1F*
> > histogram. The Pads will have a default name since I created them using
> > TCanvas::Divide().
> > I now save this plot as a root file, and start a new session.
> > How do I open up this root file again, grab the third plot, for example
> > and Draw it on it's own?
> > 
> > Has anyone any ideas?
> > 
> > Martin
> 



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