Re: [ROOT] How do I disable reading of a leaf in a TChain

From: Thomas Bretz (tbretz@uni-sw.gwdg.de)
Date: Tue Oct 16 2001 - 15:34:35 MEST


Hi Rene,

mhh... when I understand you correctly, this means, that also TTree:Draw
cannot read only one leaf. I thought this is the reason for the
following, seems that it isn't. So let me ask a different question:
I have two branches in our tree. One of this branches earnes the leafes
'fImpact' and 'fEnergy', the other one 'fNumFirstLevel'.
If I open the tree with the help of TChain I have two possibilities to
get what I want (fill the TH2D objects All_showers and Trigger_effi):
1) calling
chain.Draw("fImpact/100.:log10(fEnergy)>>All_showers");
chain.Draw("fImpact/100.:log10(fEnergy)>>Trigger_effi","fNumFirstLevel>0");

2) Enable the branches by TBranch::SetBranchAddress
Loop over all Events in the trees using TChain::GetEntry(num++) and
filling two histograms using TH2D::Fill

The first method is more than 10 times faster than the second one.
Because of some reasons I would like to use the second one (calling
TH2D::Fill event by event). What is the reason for this huge difference
in speed? What makes chain.Draw _so_ fast?

Thanks for your help,
Thomas.

Rene Brun wrote:
> You cannot do this. I/O is at the branch level not the leaf.
> There is one buffer (basket) per branch.
> Recipee: make a leaf a branch

> Thomas Bretz wrote:
> > I enabled a branch of my TCHain object by TChain::SetBranchAddress. Now
> > I'm trying to disable some of its leafs, so that only the variables I
> > need are read in. How do I do this correctly? I tried using
> > TChain::GetLeaf->SetAddress(0) but this failed.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:03 MET