We are giving several examples in the tutorials. See for example:
http://root.cern.ch/root/html/examples/hsimple.C.html
This example creates a file with histograms, profiles and a Tree.
Many other examples read objects from this file:
http://root.cern.ch/root/html/examples/h1draw.C.html
http://root.cern.ch/root/html/examples/ntuple1.C.html
A summary from these examples. If you have a file (say hsimple.root).
TFile *f = new TFile("hsimple.root"); // connect file in read mode
f->ls(); // list contents of this file
You can use the Root browser to browse this file:
TBrowser b;
and click on the item "Root files". Select the file you want
to browse. This will show icons corresponding to the objects
in the file. If you double click on an histogram icon, this will
automatically display the histogram.
If you click with the right mouse button on the histogram icon,
you will get a context menu where you can choose various actions,
like fits, etc on this histogram.
In a macro, you can get an object from a file in memory.
Example, if you have an histogram (TH1F) on a file with the key "hpx"
you can get this histogram in memory with:
TH1F *hpx = (TH1F*)f->Get("hpx")
Rene Brun