Filling TCanvas with TFile


I have a histogram in a TFile object, and am curious how I can display the histogram in a TCanvas object?


ROOT Primer -> File I/O and Parallel Analysis -> Storing ROOT Objects

Let say you histogram is “h” and your toot file “file.root”. The very simple way is:

$ root file.root
root [0] h->Draw()

you can also start root and then open the file:

$ root
root [0] TFile f("file.root");
root [1] h->Draw();