I have am experiencing an error when reading ROOT files. More specifically,
when I attempt to read a certain histogram from a ROOT file I get:
root [0] TFile *a = TFile::Open(“fileName.root”)
(class TFile *) 0x2789e70
root [1] a->Get(“configInfo/pileup”)->Print()
Error in TBufferFile::ReadClassBuffer: Could not find the StreamerInfo for version 2 of the class TH1D, object skipped at offset 51
Error in TBufferFile::CheckByteCount: object of class TH1D read too few bytes: 2 instead of 2148
TH1.Print Name = , Entries= 0, Total sum= 0
However, I have no problem reading the same histogram with a different ROOT version:
root [0] TFile *a = TFile::Open(“fileName.root”)
(TFile *) 0x40eb910
root [1] a->Get(“configInfo/pileup”)->Print()
TH1.Print Name = pileup, Entries= 1737800, Total sum= 2.6326e+09
I should mention that the given histogram was written by the second ROOT version (6.06.00)
to a pre-existing ROOT file with the “UPDATE” mode. Also, the remaining ROOT histograms
are fully accessible in both ROOT versions, without any problem.
Does the above indicate that writing with a later version of ROOT is not readable by a previous ROOT
version. Is there a way around this?
Even-though the problem persists, I have chosen to by-pass the problem
by changing ROOT version. However, it would be nice to know if it is a known issue,
and if a warning message can be printed to avoid the trouble of debugging.
the issue is not known. ROOT guarantees backward compatibility when it comes to persistified objects. It would be interesting to debug this on our side. I see you are using cvmfs: if you are at cern you could put the file on eos so that we can download and study it.
as discussed privately, a first step is to use the rootcp utitlity and produce a trivial file with the unreadable histogram inside in order to be able to reproduce, if possible, the issue.
In general I am using CMSSW_8_0_24, but when I run on these files I setup a standalone environment (without cmsenv).
I should mention that after various changes in env variables
and changing to /cvmfs/cms.cern.ch/slc6_amd64_gcc493/lcg/root/6.06.00 (instead of /cvmfs/cms.cern.ch/slc6_amd64_gcc493/lcg/root/6.02.12-kpegke4) the ROOT files are read successfully.
However, in the spirit of completeness, the only remaining issue I have is that some warning messages are printed when the ROOT files are opened which might be unrelated.
TFile::Init:0: RuntimeWarning: no StreamerInfo found in
work/FrameworkDict_rdict.pcm therefore preventing schema evolution when reading this file.
Error in TUnixSystem::Load: version mismatch, libHPlusAnalysis.so = 60601, ROOT = 60503
Before considering the first issue solved and jumping to the next one you mention (which is not hard at all to clarify), I’d like to ask a question: are you now sure that you can read the file written with 6.06 with 6.02? If not, what are the steps you took to configure the 6.02 environment?
For your last question: in ROOT we record the version of the framework in the libraries to avoid issues linked to the loading of shared objects created against a root version which is not the one being actually used.
In your specific case, libHPlusAnalysis.so has been built with ROOT 6.06.01 and you are loading it (opening a file, explicitly or thanks to autoloading when interpreting a macro/prompt line) with ROOT 6.05.03.