The popular GENIE Generator product is used by nearly all accelerator neutrino experiments and it plays a key role in the exploitation of neutrino data. The Generator implements a modern software framework and it includes state-of-the-art physics modules. It captures the latest results of the GENIE global analysis of neutrino scattering data and includes several tunes that were produced using the proprietary Comparisons and Tuning products. The GENIE physics model is universal and comprehensive: It handles all neutrinos and targets, and all processes relevant from MeV to PeV energy scales. The Generator includes several tools (flux drivers, detector geometry navigators, specialized event generation apps, event reweighting engines) to simulate complex experimental setups in full detail and to support generator-related analysis tasks.
This is related to a long existing bug in ROOT, with related workaround in GENIE traced back to this commit from Apr 2006. But such workaround by manually calling the Clean method after each entry of event being processed is not possible with working with the latest ROOT's RDataFrame analysis framework like I did in the reweighting testing code.
The bug is that a class is being read from a ROOT file and:
the class contains a pointer to another object
the root dict for the class is generated without a "+" in #pragma link C++ class ClassName+;.
Since the bug is related to the old IO implementation in ROOT they are not going to fix it. But there are 2 approaches to fix or workaround this:
move to new IO implementation, always specify "+" in LinkDef.h
Use user defined Streamer to free the memory before the pointer is overwritten by TBuffer.
The first one seemd to be feasible, but the fatal issue is that the old and new IO don't compatible. The root file generated with new IO method won't be recognized by old dictionaty and vice versa. Developers from ROOT did provide an example to show how to partially workaround the incompatibility with the version number tricks to keep old files readable, but it would still break the compatibility from the other side.
So this PR is the conservative approach, the second one, the IO and file format is kept the same. This should not be breaking anything, the only difficulty it would introduce is when we change the defination of NtpMCEventRecord we would have to update the definition of NtpMCEventRecord::Streamer here accordingly. (But at that time we can really move to the new IO from ROOT since change the definition of a class will introduce incompatibility)
This is related to a long existing bug in ROOT, with related workaround in GENIE traced back to this commit from Apr 2006. But such workaround by manually calling the
Clean
method after each entry of event being processed is not possible with working with the latest ROOT's RDataFrame analysis framework like I did in the reweighting testing code.The bug is that a class is being read from a ROOT file and:
#pragma link C++ class ClassName+;
.Since the bug is related to the old IO implementation in ROOT they are not going to fix it. But there are 2 approaches to fix or workaround this:
LinkDef.h
Streamer
to free the memory before the pointer is overwritten by TBuffer.The first one seemd to be feasible, but the fatal issue is that the old and new IO don't compatible. The root file generated with new IO method won't be recognized by old dictionaty and vice versa. Developers from ROOT did provide an example to show how to partially workaround the incompatibility with the version number tricks to keep old files readable, but it would still break the compatibility from the other side.
So this PR is the conservative approach, the second one, the IO and file format is kept the same. This should not be breaking anything, the only difficulty it would introduce is when we change the defination of
NtpMCEventRecord
we would have to update the definition ofNtpMCEventRecord::Streamer
here accordingly. (But at that time we can really move to the new IO from ROOT since change the definition of a class will introduce incompatibility)