Making dictionary for a std::vector<std::pair<std::string,TH1F>>

ROOT Version: 6.26/06
Platform: Ubuntu Linux 20.04
Compiler: GCC 9.4.0

Hi folks, thanks in advance for your help with this,

I’ve been trying to follow the available information on the forums and in the documentation for creating a dictionary for STL types in order to save them in .root files. But I haven’t been successful.

In order to create a dictionary for a std::vector<std::pair<std::string, TH1F>> I’ve been using the command:

gInterpreter->GenerateDictionary("vector<pair<string,TH1F> >", "string;utility;vector");

I’ve also included the std:: namespace specifier in front of each of the classes, with no success. Each time I’m met with the error:

The class requested (vector<pair<string,TH1F> >) for the key name “Spectrum_Library” is an instance of an stl collection and does not have a compiled CollectionProxy. Please generate the dictionary for this collection (vector<pair<string,TH1F> >). No data will be written.

I appreciate your help and advice on this,


I have no problem generating the dictionary for the type above.
Can you please post the code reproducing your error ?

Thank you



gInterpreter->GenerateDictionary("vector<pair<string,TH1F> >", "string;utility;vector;TH1.h");

Before running “root”, execute: rm -rf AutoDict_*
Then try:
gInterpreter->GenerateDictionary("pair<string,TH1F>;vector<pair<string,TH1F> >", "TH1.h;string;utility;vector");

This worked perfectly for me. Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.