I am reading a gzip’ed ascii file into a root tree. I am using the gzifstream implementation from zlib contribs ( github.com/madler/zlib/tree/mas … /iostream3 ), which is derived from std::istream but does not implement seeking. calling seekg() on a gzifstream sets the error flag.
I had written my own code to do this. Then I found ReadStream(), which would remove the need for a large chunk of my code. But when I try to use it no data gets read in.
It looks like TTree::ReadStream calls TTree::GetNewlineValue which scans to find the first newline, and then seeks back to the start of the file. For the gzifstream, it is now in an error state, so the while(in.good()) loop that reads the data from the file, stops straight away.
I think other istreams may hit similar issues, so maybe it should be possible to inform ReadStream() about the line endings, to remove the need for calling GetNewlineValue(). but perhaps there are better solutions.