-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Given a tree with a branch of type map<string, bool>, like the one in this forum post, reading it with TTreeReader just yields a crash, while reading it with TTree first prints an error about the missing dictionary, then crashes.
TTreeReader
void repro_treereader() {
TFile f("flatntuple_MC_.root");
auto *t = f.Get<TTree>("ntuplizer/tree");
R__ASSERT(t != nullptr);
TTreeReader r(t);
TTreeReaderValue<std::map<std::string, bool>> rv(r, "HLT_BPH_isFired");
r.Next();
*rv;
}$ root -l repro_treereader.C
root [0]
Processing repro_treereader.C...
*** Break *** segmentation violation
Root > .qqqqq
Info in <TRint::ProcessLine>: Bye... (try '.qqqqqqq' if still running)
*** Break *** segmentation violation
Root > .qqqqqqqTTree
void repro_tree() {
TFile f("flatntuple_MC_.root");
auto *t = f.Get<TTree>("ntuplizer/tree");
R__ASSERT(t != nullptr);
std::map<std::string, bool> *m = nullptr;
t->SetBranchAddress("HLT_BPH_isFired", &m);
t->GetEntry(0);
}$ root -l -b -q repro_tree.C
Processing repro_tree.C...
Error in <TTree::SetBranchAddress>: The class requested (map<string,bool>) for the branch "HLT_BPH_isFired" is an instance of an stl collection and does not have a compiled CollectionProxy. Please generate the dictionary for this collection (map<string,bool>) to avoid to write corrupted data.
*** Break *** segmentation violation
Root >
*** Break *** segmentation violation
The TTreeReader version should also print the error, so users don't get confused.
Reactions are currently unavailable