hi,
I am trying to add to a TTree a branch which is a vector of string names.
say, i have
TTree* T = new TTree(“T”,“T”);
int N;
T->Branch(“N”,&N,“N/I”);
double E[10];
T->Branch(“E”,E,“E[N]/D”);
std::string S[10];
T->Branch(“S”,S,“S[N][256]/C”);
then in a root session
T->Scan(“S”);
does not seem to behave properly. thus my question, how can i add an array of strings to a TTree?
many thanks in advance
[quote]std::string S[10];
T->Branch(“S”,S,“S[N][256]/C”);[/quote]is not consistent as the 2nd line is expecting the address to be pointing to a char [][256]). You will be better off (i.e. more likely to work) to use:std::vector<std::string> > S;
T->Branch("S",S);