Cannot open histogram created with older ROOT version

Dear experts,

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

|>echo $ROOTSYS
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/lcg/root/6.02.12-kpegke4

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

|>echo $ROOTSYS
/cvmfs/cms.cern.ch/slc6_amd64_gcc530/lcg/root/6.06.00-ikhhed5/

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?

Cheers,
Alexandros

Hi Alexandros,

can you post the file?

Cheers,
D

Hi D,

the file is way too large to post it here.

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.

Cheers,
Alexandros

Hi Alexandros,

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.

Danilo

Hi Alexandros,

If I understand correctly the steps to reproduce this are:

  • write a file with an old version of ROOT (was it v6.02/12 ?)
  • open the file and update it with new version of ROOT, v6.06/00
  • attempt to read the file with an old version of ROOT, v6.02/12.

In which case, it would seem the subject should have “can not open histogram created with newer ROOT version”.

Nevertheless, this ought to have worked.

Can you reproduce this problem with a smaller files, with just a few histograms?

One possible problem might that the file was not properly closed/updated in the same step.

Cheers,
Philippe.

Hi,

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.

Cheers,
D

Hi,

I guess an already positive outcome of this post is me learning about these new ROOT tools:
root.cern.ch/how/how-quickly-in … ntent-file

Ok, I have attached the ROOT file with the histogram in question.

Cheers,
Alexandros
debug.root (4.63 KB)

Hi,

I tried with 6.02.12 and I cannot reproduce the issue:

$ source /cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.02.12/x86_64-slc6-gcc49-opt/root/bin/thisroot.sh 
$ source /cvmfs/sft.cern.ch/lcg/external/gcc/4.9.1/x86_64-slc6/setup.sh
$ root debug.root 
   ------------------------------------------------------------
  | Welcome to ROOT 6.02/12                http://root.cern.ch |
  |                               (c) 1995-2014, The ROOT Team |
  | Built for linuxx8664gcc                                    |
  | From tag v6-02-12, 24 June 2015                            |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------

root [0] 
Attaching file debug.root as _file0...
(class TFile *) 0x2838f60
root [1] pileup->Print()
TH1.Print Name  = pileup, Entries= 1737800, Total sum= 2.6326e+09

The same for 6.8 and master.
I see you are using CMSSW: what is the version that you are using to trigger the bug?

Cheers,
Danilo

Hi Danilo,

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

Cheers,
Alexandros

Hi Alexandros,

I am confused. You say

but in your first post you have

|>echo $ROOTSYS
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/lcg/root/6.02.12-kpegke4

but perhaps there is a misunderstanding.

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.

Cheers,
D