Writing to tree

Hi Guys,

Being not really good at coding, I am stuck with a problem of filling a tree.

I have a tree to be filled with a few branches as,

for(Int_t i=0; i<nentries; i++){

a few branches;

  do {

     some more branches here;        

  } while(condition)

}

My question is if I fill the tree inside the do loop it re-writes other branches as many times as the do-loop iteration. Outside that do-loop it fills only last value for branches inside the do-loop.

It may be really trivial but I am not getting it.

Thanks for any possible help.

Hardev.

[quote]It may be really trivial but I am not getting it.[/quote]Actually it is not a supported mode. All the branches in a TTree must be evenly filled otherwise none of the automatic tools will be able to make sense of your TTree. However the content of each branch can be of varying size.

Typically, you would fill all the branches at once by calling tree->Fill() and for the branches that may or may not have content for a given entry, you would make sure that their data content is actually a collection of value (i.e. for example a std::vector with 0 or 1 values depending on the entry).

Cheers,
Philippe.