Re: [ROOT] Using Chains

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Apr 09 2002 - 18:39:10 MEST


Hi Bernard,

Bernard Andrieu wrote:
> 
> Hello,
> 
> I have several questions about Chains. I use e.g. 2 files each
> containing the Tree "Global":
> TChain mychain("Global")
> mychain.Add("file1.root")
> mychain.Add("file2.root")
> 
> 1)
> When I do:
> Global.Print()
> I get a description of all Branches of the Tree, which is nice, but for
> each File, which is very unconvenient. Is this normal? How to avoid it?
> 

This is normal. If you use TChain::Print, you get the equivalent of TTree::Print
for each element of the chain. One could add an option to cumulate the
statistics
of all Trees in one single sheet: to be implemented.

> 2)
> Where can I find the description of the options of Print()? If I go on
> the "Root Clas Categories" web page -> "Tree and Ntuple Classes"
> ->"TChain" ->"Print", or directly to the following adress:
> http://root.cern.ch/root/html/TChain.html#TChain:Print
> I get this:
> void Print(Option_t *option) const
> but I don't see what options can be given, and what do they mean.
> 
see http://root.cern.ch/root/htmldoc/TChain.html#TChain:Print
    http://root.cern.ch/root/htmldoc/TTree.html#TTree:Print

> 3)
> Is there a way of printing only the Branches which have been selected by
> using Global->SetBranchStatus("*",0)
> Global->SetBranchStatus("branchname",1)?
> 

This should work. Only active branches are printed, unless you use an old
version.

> 4)
> Last remark about what can be called not a bug, but an "unconvenient
> feature", of SetBranchStatus. If I do:
> Global->SetBranchStatus("*",0)
> Global->SetBranchStatus("cal",1)
> Global->SetBranchStatus("cal",0)
> //Correct misspelling: the name of the Branch is CAL in capital letters
> Global->SetBranchStatus("CAL",1)
> Global.Draw("ncal")
> 
> I get the following error messages
> Error in <TTree::SetBranchStatus>: unknown branch -> cal
> Error in <TTree::SetBranchStatus>: unknown branch -> cal
> 
I disagree. An error should be reported in this case.

Rene Brun

> and I cannot get rid of these messages even if I do:
> Global->SetBranchStatus("*",0)
> Is there a way to turnaround this problem?
> 
>                        Thank you,
>                               Bernard Andrieu



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:48 MET