ROOT Version: All version Platform: Mac & Linux Compiler: Not Provided
Attached is a simple test root file. I post the code which produces it at the end. My problem is that I want to access some entry in the vector<string>, e.g. tree->Draw("br2[3]"); always giving the result tree->Draw("br2[0]"); but I check tree->Scan("br2[3]") is correct. Is this a bug? Or there is any other way to accomplish this?
perhaps a way to tackle this is via RDataFrame (to be modeled according to what you want to do with the strings):
ROOT::RDataFrame rdf("tree","testTree.root");
auto rdf2 = rdf.Define("br2_at3","br2[3]");
auto strings = rdf2.Take("br2_at3"); // extract the vector of all strings at position 3 in the vector stored in column br2
rdf2.Foreach([](const std::string & s){ std::cout << s << std::endl;}, {"br2_at3"}); // For each string at position 3 of the vector stored in column br2 execute a lambda that prints the string to string
That may be one way to do this, or read the tree branches, but they are much more complicated compared to just tree->Draw() method. I think it’s a bug cause tree->Scan() gives the correct contents while tree->Draw() not.
Since all the numerical array or vector slice work correctly, I figure an indirect way to accomplish the requirement, tree->Draw(“br2[3]”,“br1==br1[3]”).