Hi Rooters.
I have many TCanvases in my hard disk. They are stored as rootfiles.
Each canvas contains various objects, as histograms, functions, etc…
Now, I need a procedure to extract these objects from a given canvas and use them.
The way I usually do that (from CINT) is outlined in these 3 steps:
-
open the rootfile:
root[1] TFile* file= new TFile(“Canvas.root”) -
See the list of the pointers
root[2] Canvasname->ls()
A list like the following is provided:
OBJ: TH1F histo1 : 0x8879330
OBJ: TH2F histo2 : 0x8335023
…etcetc…
- Get each single object by means of its pointer, e.g.:
root[3] TH1F* aaa1 = (TH1F*)0x8879330
root[4] TH2F* aaa2 = (TH2F*)0x8335023
…etc.etc.
This is not a very smart procedure. For instance, I would like to use a more automatic way for getting these objects (e.g. using their names instead of their pointers).
Note that command file->Get(“histo1”) does not work in this case, as “file” does not see “histo1”…