I woud like to fill strings to a tree, that is something like:
mytree->Branch(“text”, &text, “text/C”);
where ‘text’ would be some string (?).
Would you give a small example how to do that? And then how to read the strings back from the tree, because somehow this doesn’t work for me.
I can create a branch like above and fill it with something but when I am about to read it back it crashes…
See an example in $ROOTSYS/tutorials/tree/cernbuild.C and $ROOTSYS/tutorials/tree/cernstaff.C
it works, or at least I can create a TTree which contains the strings but I still cannot read it back.
tree->Branch(“var_name”, var_name, “var_name/C”);
string s = “something”;
this works, because then if I make tree->Scan(“var_name”) everything looks okay.
Read back (doesn’t work):
cout << myvar << endl;
this compiles, but all I get is just empty strings…
Thanks for help,
Ahh…sorry, it works…I forgot the tree->GetEntry(i)…