I am trying to get the information of a list of strings into a tree branch, and I am having trouble…
If I define the branch as a TString array, I get a type mismatch (“RuntimeError: property type mismatch or assignment not allowed”).
Then, I try defining it as a vector of strings and the actual branch as follows:
event_info_tree.Branch(‘L1TriggerAV’, AddressOf(Event_Info,‘L1TriggerAV’))
rather than something that looks like that:
event_info_tree.Branch(‘L1TriggerAV’, AddressOf(Event_Info,‘L1TriggerAV’), ‘lvl1TriggerAV/S’)
and in that case, I get the definition of the branch wrong:
“Error in TBranch::TLeaf: Illegal data type…”
and also a type mismatch at the end.
Could you please tell me which would be the way to have my list of strings into a tree branch?
an std::vector< std::string > (that is, an ROOT.std.vector(‘std::string’)) isn’t an option? Otherwise, could you please sent a code sample (i.e. the types of Event_Info etc.)?
Attached is a very simple sample code that is working with an integer branch, and that is giving me trouble with a vector (in comments in the python file).
Best regards,
– Anna.
[quote=“wlav”]Hi,
an std::vector< std::string > (that is, an ROOT.std.vector(‘std::string’)) isn’t an option? Otherwise, could you please sent a code sample (i.e. the types of Event_Info etc.)?
Hello,
Super, this works!
However, if you wanted to put these vectors in a structure and work from there, what would be the syntax for the vector defintion inside the structure, as well as the branch definition (t.Branch( ‘mystrings’, v )? My guesses don’t seem to work…
the reason that it won’t work is b/c CINT will not properly initialize the struct when it is interpreted (it won’t work in a root.exe session either). You’ll have to use ACLiC and a separate file. For example, file EventInfoTree.h:[code]#include #include