We have an issue that we have not been able to solve, nor understand. We hope you can provide some help.
We have a class written into a TTree with one of its Base class having been modified. We have udpated the class version during the modification. In the ROOT file, we have version 1 of the class (TVHit) while in the current software, we have version 2 of the class. We wrote in the LinkDef file a #pragma instruction on how to transform v1 into v2. When this #pragma line is omitted, we obviously read the wrong information from the input file, because the definition in the code does not correspond to the definition on file (as expected). But when using the #pragma line, we simply get a segfault while trying to read the TTree.
I have prepared a self-contained minimal working example attached to this topic: mwe.tgz (224.3 KB)
The archive contains the following README.md with more details on how to reproduce the issue, and on the exact content of the archive:
Steps to reproduce issue on Minimal Working Example (MWE)
- Set the ROOT_INCLUDE_PATH and LD_LIBRARY_PATH
- Compile the minimal persistency library
- Run test code on new persistency (opens pluto_newpers.root and reads the tree successfully)
- Run test code on old persistency (opens pluto_oldpers.root and crashes when trying to read the tree)
The crash is traced back to line 109 of PersistencyDICT.cxx
static Long_t offset_Onfile_TVHit_fMCTrackID = oldObj->GetClass()->GetDataMemberOffset("fMCTrackID");
where GetClass returns a nullptr.
Content of the archive
- The header files in include contain the current definition of the minimal persistency necessary to
read the input files (TVHit version 2).
- The source files in src are there for the sake of compilation but should not
have an influence on reading the input file (right?).
- The header files in include_oldpers are included for documentation and correspond to the difference
between the old persistency (TVHit version 1) and the new persistency (TVHit version 2).
- PersistencyLinkDef.hh is the current linkdef file. The “#pragma” line at the end is our attempts
to make the previous persistency compatible with the current one. Essentially the field
fMCTrackIDis replaced with the field
fKinePartIndexand the field
exists, but with a different purpose. So
fMCTrackIDin version 1 should be forwarded to
fKinePartIndexin version 2.
- pluto_oldpers.root is the input ROOT file containing a tree with 10 entries using TVHit version 1
- pluto_newpers.root is the input ROOT file containing a tree with 10 entries using TVHit version 2
_ROOT Version: 6.22/00
_Platform: CentOS7 (lxplus)
_Compiler: gcc 8.3.0 (LCG_98python3)