HepMC objects in root file (or any complex class )

Hello,

Has anyone been successful in storing HepMC objects (for instance HepMC::GenParticle instances) in root files?

I know there are wrapper classes or one can create their own simpler class that can store a copy of the GenParticle properties. I was wondering though if anybody had been successful in creating a dictionary for that particular class (or even better the whole package). The idea is (of course) to grab the useful objects from big pool files and store them in skimmed root files as they are (without copying the objects property by property, variable by variable).

I tried to follow the 2-3 older posts without success. I did create a LinkDef.h and Classes.h file and used rootcint. The root file and resulting branches are created without problem by running my compiled analysis code, compiled together with the result of rootcint on the above files (HepMCDict.cxx/h)

I then try to open the root file, using the root cint interface. I load the big shared object file for my analysis code (libMyAnalysis.so) which contains the dictionary. Then I open the root file which does not complain (no missing dictionary errors).

In the TBrowser the branches are created (a Vector of GenParticles) and the sub branches appear to have all the interesting variable names. (in fact the classes that I do not mention in the LinkDef files, have a little exclamation mark but the ones I added have the usual icons).

Clicking at any one of the proper icons (without the exclamation mark) triggers a segmentation fault.

I did not try to compile a standalone code to read the tree. But, as a general question, how to I load a precompiled dictionary to the root interpreter? Assume that the standalone application (compiled) that created the root file worked without complain. Then one needs to quickly view the output and wants to run root directly without a standalone reader compiled application. Which library do we load to have the dictionary?

Again a general question, how do I know the minimal number of dependency classes to include in the creation of the dictionary? Here specifically, I chose to omit the particle_iterator which might as well have been the cause of the issue.

I attach my Classes and LinkDed files. This is now a question specific to HepMC but this is such a widely used package that I hope somebody has already figured it out.

Thanks!
Classes.h (237 Bytes)
LinkDef.h (331 Bytes)

Hi,

For HepMC, your best bet is to use v5.28 and you also must not split those classes.

Cheers,
Philippe.