Segmentation violation when using snapshot to save tree

I am trying to use RDataFrame to manipulate TTrees opened from file, and save the result to file using snapshot. My attempts lead to segmentation violation crashes. I tried a simplified code where the tree is simply opened and saved again, and that is still the result. What’s going wrong?

_ROOT Version: 6.28/00
Platform: Not Provided
Compiler: Not Provided

snapshot_test.C (7.4 KB)


Thanks for posting. To reproduce the crash and help further, we would need the input file.
Nevertheless, I had a look to your macro. It’s nice code, however I think it could be greatly slimmed down: with RDataFrame there is no need to explicitly manipulate branches, leafs and column types :slight_smile:
For example, if it is not possible for you to post somehow the input file, could you try if this minimal macro works for you?

auto df = ROOT::RDataFrame("LHEF", "pp_2j_LO_H_T_35GeV.root");
df.Snapshot("myTree", "myFile.root");

If that works, it means in between those two lines, you can add all the manipulations you need for carrying out the task you are up to - no need for other code, RDataFrame removes all the boilerplate.

I hope this helps.


Thanks for the reply.
The minimal macro does not work for me.
This is the error message:

Error in <TTree::Bronch>: TClonesArray with no dictionary defined in branch: Event
RDataFrame::Run: event loop was interrupted
Error in <TRint::HandleTermInput()>: std::logic_error caught: Trying to insert a null branch address.

The input file is too large to upload. It was generated from an .lhe file using the ExRootAnalysis tool available for this purpose.


You should make sure to load the library which contains the dictionaries which allow you to read the “Event” objects in the file. Incidentally, without dictionaries, it is not possible even to write to disk a specific C++ structure.


That solves the problem for the minimal macro. I’d already tried it before for the macro I posted and somehow it didn’t help, but I suppose I can modify my macros to be more inline with the minimal.

1 Like