Retrieving objects in TCanvas

Hi,

I have a root file with a TCanvas stored inside:

TFile* t = new TFile("myfile.root") .ls TFile** myfile.root TFile* myfile.root KEY: TCanvas mycanvas;1
mycanvas contains a TObject inheriting from (say) TH1. If I’d like to get this TH1, how would I go about doing so?

Thanks in advance for any help,
Peter.

TCanvas *mycanvas = (TCanvas*)myfile->Get("mycanvas"); TH1 *myhist = (TH1*)mycanvas->FindObject("myhistname");
Rene

Thanks Rene. Is there a method to list the objects in a canvas?

mycanvas->ls();

Thanks very much. :slight_smile: