How to get data points from a .root file?

Can someone help me with this?
I need to get, read and display on the screen data (point, error). I tried to do it, but couldn’t.
I upload the file that I need to obtain the data points:
The fitexample.C file has the code that reads the lines2.root file. I need to get the points from the .root file.

fitexample.C (1.7 KB) lines2.root (8.6 KB)
_ROOT Version: 6.20/00


It looks like you’re loading the file into your TFile object, but you never access the data inside it. The histograms contained in it aren’t automatically available; you’ll have to do something like:

TH1F *h0 = (TH1F*)inFile->Get("h0");

The method TFile::Get() returns a TObject* so you’ll have to cast it to a TH1F*.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.