> Dear root team,
> I have a couple of questions about using TTree:Draw().
> First, I am wondering if it possible to produce a TTree containing
> a TClonesArray branch, with some events having this array filled,
> and others with an empty TClonesArray, and still use the TTree::Draw()
> command for data contained in the TClonesArray. I have a tree with
these
> characteristics, and can retrieve events with TTree::GetEvent(), but
> using TTree::Draw() for data in the TClonesArray causes root to hang.
Yes, you can use TTree::Fill with an empty TClonesArray.
When processing the Tree with TTree::Draw, you can exclude events
with 0 entries in the array.
In case of TClonesArray, a special branch is created (the branchcount).
This branch contains one single integer per event:the number of entries
in the array. This branch has the name of the TClonesArray data member
followed by underscore (see with TTree::Print).
For example, if the data member pointing to the array is called fTracks,
the name of the branchcount is fTracks_
You can draw fPx for all tracks excluding events with 0 tracks with
tree->Draw("fPx","fTracks_>0")
> The second (unrelated) question I have is about the autoscaling
> of axies for TTree::Draw(). Is is possible to have the entire range
> of the data in the tree scanned before choosing the axis scaling? It
> now seems that a small number of events are sampled to choose the
scale.
>
By default, TTree::Draw estimates the axis scale by buffering the
first 10000 events. However, in case your data is not randomly
distributed across events or time dependent data, you can change
this default via TTree::SetEstimate.
For example, you could do
tree->SetEstimate(tree->GetEntries);
Rene Brun