How to get a Canvas from TFile

Hello,

I have several root files, all of them containing one (or more) Canvas. I’d like to write a script, that prints out all those Canvas. I can open the Canvas with _file0->Get(“Canvasname”), but in my script I do not know the Name of each canvas.

I asume _file0->GetListOfKeys() might be helpful, but I couldn’t figure out, how to retrieve a pointor to the Canvas from there.

Thanks for help,
Thomas

Loop on the list of keys. For each key you can test the type of the object via TKey::GetClassName and for all TCanvas

TCanvas *mycanvas = (TCanvas*)key->ReadObj()
Rene