Reading from an ascii text file

I have a text file which contains the bincontents of a 2d histogram. Say, of the following format:

1 1 1 1 
2 1 1 1 

i.e. a 2x4 histogram. Is there a simple way of reading this text file into a ROOT histogram without
having to use ifstream?

Hi,

You can use root.cern.ch/root/html/tutorials … sic.C.html (also provide in binary distribution of ROOT) as an example.

Cheers,
Philippe.

Philippe, thank you, but that uses ifstream…I know how to use ifstream, I was just wondering whether there’s something built into ROOT…

Hi,

Not for TH1. For TTree you have TTree::ReadStream (or ReadFile).

Cheers,
Philippe.