Draw of tree with std:map<string,float>

Hello,
I am filling a Tree with a map<string,Float_t> the branch is called “Integrals”.
This seems to work properly.
If I use pyroot and accessing a single Event with

tree.GetEntry(x)
tree.Integrals.size()
for i in tree.Integrals:
     print i.first,i.second

I can see that the map is properly filled and I can access all variables.
I would now create some histograms with this map by using the tree.Draw function.
It seems that

In principle works, the number of entries agrees with the size of the tree times the size of the map.

If I use

I can only see the first entry of the map, but all others are not there. e.g. the number of entries of the histogram is only equal to the number of entries of the tree.
So here I cannot see the different keys I used for filling the tree.

I also would like to do something like:

but if I try that I get the Errror

Is there an option to get that working?
I played around with a loader.c file which contains the definitions of map<string,float> but did not help.

Would be glad for any advises or other ways to save the data in the tree to make it easier to access.
Best,
Felix

Hi,

Unfortunately when handling strings stored as a data member on object stored in a collection, TTreeFormula (and thus TTree::Draw and TTree::Scan) incorrectly determine the cardinality of the implied set and plot only the first string. See the new report: sft.its.cern.ch/jira/browse/ROOT-7745

To work around the problem you could store a sorted pair of vector. I.e. instead of map<string,float>
you would use two vector: vector and vector. Once filled, to improve the search you can sort (both of them synchronously). Note that map are actually the slowest container in term of I/O as they must be rebuild (i.e. each element reinserted) when being read. A sorted vector of pairs is a better replacement in general (except in your case, it suffers from the same problem :frowning: ).

Cheers,
Philippe.