Hello all,
I took this guide https://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#storing-root-objects and tried 7.1 Storing ROOT Objects.
When try this macros using .x read_from_file.C:
void read_from_file(){
// Let's open the TFile
TFile in_file("my_rootfile.root");
// Get the Histogram out
TH1F* h;
in_file.GetObject("my_histogram",h);
// Draw it
auto myCanvas = new TCanvas();
h->DrawClone();
}
it gives canvas without histogram.
If use “online” method
> root my_rootfile.root
root [0]
Attaching file my_rootfile.root as _file0...
root [1] _file0->ls()
TFile** my_rootfile.root
TFile* my_rootfile.root
KEY: TH1F my_histogram;1 My Title
root [2] my_histogram->Draw()
everything is fine.
What I do wrong? I use Ubuntu 18.04.1 LTS with ROOT 6.10.04