Storing STL maps in a Tree


I have created a container class called MyEvent, which I will used to store a variety of things, but currently it stores a map like this:

where MyParticle is another container class that stores generic particle data.

Anyway, into this map I store 3 or so particles (gamma1, gamma2, etc), and this is is then written to a ROOT file via a simple class called MyRootTree (see MyRootTree.h and I compile a library of the above-mentioned code, and load that into ROOT. I then load the ROOT file, and extract the tree, and perform the command:

and it correctly makes the code with the the map as one of the leaves. However, when I try and access this map, it appears empty, and the m_mcParticles.empty() function returns true, which confirms it.

Can anyone think of anything that I might be missing that is preventing ROOT from writing/reading this map properly? I’m using ROOT version 3.10.02 (as is compatible with ORCA) on lxplus.

Many thanks in advance!


Hi Rob,

std::maps were implemented about one year ago in version 4.
This was not possible with version 3.10.