root
root copied to clipboard
[TNDArrayT] Backward incompatibility: Error reading from ROOT Files created with earlier versions - Streamer bug
Describe the bug
It is currently impossible to read TNDArrayT objects from ROOT Files created with earlier ROOT Versions than v6.26. This affects primarily THn Objects which have this class as a data member. The problem is caused by this commit: https://github.com/root-project/root/commit/afb95216eeec9dea2d4aab35231b64e067c8af57 where a datamemember of TNDArrayT was changed, but the Streamer generation information were not updated appropriately.
The following error messages are displayed if one attepts to read a TNDArrayT from an earlier ROOT version:
Warning in <TStreamerInfo::BuildOld>: Cannot convert TNDArray::fSizes from type: Long64_t* to type: vector<Long64_t>, skip element Warning in <TStreamerInfo::Compile>: Counter fNdimPlusOne should not be skipped from class TNDArray Warning in <TStreamerInfo::BuildOld>: Cannot convert TNDArrayT<double>::fData from type: double* to type: vector<double>, skip element Warning in <TStreamerInfo::Compile>: Counter fNumData should not be skipped from class TNDArrayT<double> Error in <TBufferFile::CheckByteCount>: object of class TNDArray read too few bytes: 17 instead of 57 Error in <TBufferFile::CheckByteCount>: object of class TNDArrayT<double> read too few bytes: 68 instead of 200866628 Warning in <TStreamerInfo::BuildOld>: Cannot convert TNDArrayT<float>::fData from type: float* to type: vector<float>, skip element Warning in <TStreamerInfo::Compile>: Counter fNumData should not be skipped from class TNDArrayT<float> Error in <TBufferFile::CheckByteCount>: object of class TNDArray read too many bytes: 2057 instead of 57 Warning in <TBufferFile::CheckByteCount>: TNDArray::Streamer() not in sync with data on file XXX, fix Streamer() Error in <TBufferFile::CheckByteCount>: object of class TNDArrayT<float> read too few bytes: 1088 instead of 100433348 Error in <TBufferFile::CheckByteCount>: object of class TNDArray read too few bytes: 17 instead of 57 Error in <TBufferFile::CheckByteCount>: object of class TNDArrayT<double> read too few bytes: 68 instead of 200866628 Error in <TBufferFile::CheckByteCount>: object of class TNDArray read too many bytes: 100369 instead of 57 Warning in <TBufferFile::CheckByteCount>: TNDArray::Streamer() not in sync with data on file XXX, fix Streamer() Error in <TBufferFile::CheckByteCount>: object of class TNDArrayT<float> read too few bytes: 50244 instead of 100433348
Expected behavior
Expected behavior is that the object is read properly and the Streamer takes care of all required conversions from the old to the new data format.
To Reproduce
- Create a ROOT-File containing a THn with an earlier ROOT version. e.g. v6.24.06
- Try to read the object from the created ROOT-File with ROOT version v6.26.00.
We are probably missing an I/O rule along the line of
#pragma read sourceClass="TNDArrayT<float>" targetClass="TNDArrayT<float>" source="Int_t fNumData; float *fData;" target="fData" versions="1" code="{ fData.clear(); for(int i = 0; i < onfile.fNumData; ++i) fData.push_back(onfile.fData[i]); }"
If it is useful to know, this bug persists with v6.26.02 as well as v6.26.04.
Warning in <TStreamerInfo::BuildOld>: Cannot convert TNDArray::fSizes from type: Long64_t* to type: vector<Long64_t>, skip element
Warning in <TStreamerInfo::Compile>: Counter fNdimPlusOne should not be skipped from class TNDArray
Warning in <TStreamerInfo::BuildOld>: Cannot convert TNDArrayT<double>::fData from type: double* to type: vector<double>, skip element
Warning in <TStreamerInfo::Compile>: Counter fNumData should not be skipped from class TNDArrayT<double>
Error in <TBufferFile::CheckByteCount>: object of class TNDArray read too few bytes: 17 instead of 57
Error in <TBufferFile::CheckByteCount>: object of class TNDArrayT<double> read too few bytes: 68 instead of 76880068
Warning in <TStreamerInfo::BuildOld>: Cannot convert TNDArrayT<float>::fData from type: float* to type: vector<float>, skip element
Warning in <TStreamerInfo::Compile>: Counter fNumData should not be skipped from class TNDArrayT<float>
Error in <TBufferFile::CheckByteCount>: object of class TNDArray read too few bytes: 17 instead of 57
Error in <TBufferFile::CheckByteCount>: object of class TNDArrayT<float> read too few bytes: 68 instead of 38440068
Error in <TBufferFile::CheckByteCount>: object of class TNDArray read too few bytes: 17 instead of 57
Error in <TBufferFile::CheckByteCount>: object of class TNDArrayT<double> read too few bytes: 68 instead of 76880068
I tried the patch above and it seems to solve the problem.
ok, I'll make a PR using that patch. Thank you !
Hi @lmoneta,
It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.
Sincerely, :robot:
Hi @lmoneta,
It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.
Sincerely, :robot:
Hi @lmoneta,
It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.
Sincerely, :robot:
Hi @lmoneta,
It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.
Sincerely, :robot: