Adding data to leafs

Hi,

I am trying to add data to the leafs of a Branch, without success. Part of my code is the following:

TTree *tree = new TTree(“T”,“bla bla”);
tree->Branch(“ch”,&ch,“chan1/F:chan2:chan3”);

for(int j = 0; j<N; j++){
for(int i = 0; i<M; i++){

data[i];

} // ends i loop
ch.chan1 = data[0];
tree->Fill();
} // ends j loop

I get the correct num of events (lets say j) but all values are at zero.

Thank you in advance for your suggestions.

Loukas

Hi,

The portion of code you gave seems correct assuming that you respected the assumption of the leaslist method for creating branches (see User Guide and reference guide for details). In particular, the data member chan1, chan2 and chan3 must be the first 3 consecutive members of you struct chan (and must all be float) in order to match the description you gave. (“chan1/F:chan2:chan3”)

Cheers,
Philippe

Thanx Philippe,

I’ll check it again.