I would like to store some label-value pairs, where labels are exclusively text and values are either numbers or character strings, in my ROOT files so that I keep parameters of an analysis together with its result; unfortunately the most obvious candidate, TMap, doesn’t seem to be useful here because it requires two TObjects. What would you recommend for this purpose?
You can use any combination of STL std::map, pair.
Note that std::map is not a very efficient container, in particular when reading. I cannot tell you more without knowing the problem you are trying to solve.
See examples of I/O with STL in #ROOTSYS/test/bench.cxx
Well, I’d like the ROOT file containing the output of my analysis to contain parameters which I used then - like minimum and maximum transverse momentum, the rapidity range, the name of the dataset I used and so on. I’d rather not use TVector for that because it would require me to remember the order in which I put the values in it (not to mention it wouldn’t work for strings), that’s why I am looking for something like an associative array, that would allow me to access those parameters by name.
Regarding STL objects: I thought it’s not possible to store them in ROOT files because all writable objects must inherit TObject?
Since a long time ROOT supports I/O of non-TObjects.
STL collections may be I/O since ROOT version 5.