Re: [ROOT] TLeaf->GetName() gets title ?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jun 20 2003 - 06:57:24 MEST


Hi Markus,

Looking at your Tree, via TTree::Print, I see:

*Br    0 :costhetasph : cos theta sphericity/F
*Entries :       30 : Total  Size=      12605 bytes  One basket in 
memory
*Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00
*.........................................................................
*Br    1 :cleofisher : the cleo cones fisher/F
*Entries :       30 : Total  Size=      12605 bytes  One basket in 
memory
*Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00
*.........................................................................
etc...


then doing GetListOfLeaves->ls():

OBJ: TLeafF     cos theta sphericity    cos theta sphericity :
OBJ: TLeafF     the cleo cones fisher   the cleo cones fisher
OBJ: TLeafF     the legendre fisher     the legendre fisher :
etc...

I do not understand how you have built this Tree. In your case
the branch name (seen in TTree::Print) should be the same
as the leaf name. Did you reset the leaf name yourself?

Anyhow, the solution to your problem is to loop on the list
of branches. 
root [1] selectedtree.GetListOfBranches()->ls()
OBJ: TBranch    costhetasph     cos theta sphericity/F
OBJ: TBranch    cleofisher      the cleo cones fisher/F
OBJ: TBranch    legendrefisher  the legendre fisher/F :
etc...

or in your iterator on the list of leaves, instead of
  tree.Draw(leaf->GetName());
do
  tree.Draw(leaf->GetBranch()->GetName());

Rene Brun


On 
Thu, 19 Jun 2003, Markus 
Cristinziani wrote:

> Hi Rene,
> 
> please have a look at
> 
> http://www.slac.stanford.edu/~markus/reduced.root
> the tree name is "selectedtree".
> 
> The definition of the tree is
> 
> ...
> TBranch * cossph  = tree->Branch("costhetasph",  &Csbtr,"cos theta sphericity/F");
> ...
> 
> Philipp Canal's posting suggests that I should book the tree differently
> in the first place ?!
> 
> Thanks
> Markus
> 
>    ____________________________________________
>   /  Markus Cristinziani, Research Associate  /
>  /    Stanford Linear Accelerator Center     /
> / ++1(650)926-3886 markus@slac.stanford.edu /
> --------------------------------------------
> 
> On Thu, 19 Jun 2003, Rene Brun wrote:
> 
> > Hi Markus,
> >
> > Could you send me a mini Tree file that I can use
> > to understand your problem?
> > give me the AFS address (making sure it is world public readable)
> > or put it on a web server.
> >
> > Rene Brun
> >
> > On Thu,
> > 19 Jun 2003,
> > Markus Cristinziani wrote:
> >
> > > Hi Rene,
> > >
> > > yes I forgot to copy and paste the line
> > > leaf = (TLeaf*)next().
> > >
> > > when I do
> > > tree->GetListOfLeaves()->ls();
> > >
> > > I get
> > > root [8] selectedtree->GetListOfLeaves()->ls()
> > > OBJ: TLeafF    this is its description    this is its description : 0 at:
> > > 0x8b9eb78
> > > ...
> > >
> > > instead of the (expected?)
> > > OBJ: TLeafF    variablename   this is its description : 0 at:
> > > 0x8b9eb78
> > > ...
> > >
> > > regards
> > > Markus
> > >
> > >
> > >    ____________________________________________
> > >   /  Markus Cristinziani, Research Associate  /
> > >  /    Stanford Linear Accelerator Center     /
> > > / ++1(650)926-3886 markus@slac.stanford.edu /
> > > --------------------------------------------
> > >
> > > On Thu, 19 Jun 2003, Rene Brun wrote:
> > >
> > > > Hi Markus,
> > > >
> > > > In your example, you have omitted the most critical part: how you get
> > > > the leaf pointer?
> > > > The following should work:
> > > >
> > > > TLeaf *leaf;
> > > > TIter next (tree->GetListOfLeaves());
> > > > while ((leaf = (TLeaf*)next())) {
> > > >    tree->Draw(leaf->GetName());
> > > > }
> > > >
> > > > I would need your code to figure out the problem.
> > > > What is the ouput of:
> > > >   tree->GetListOfLeaves()->ls(); ?
> > > >
> > > > Rene Brun
> > > >
> > > > Markus Cristinziani wrote:
> > > > >
> > > > > Hello,
> > > > >
> > > > > I have a simple tree and I would like to histogram all variables in an
> > > > > automatic way. I do the following in 3.03/09
> > > > >
> > > > > TFile f("myfile.root");
> > > > > tree->Print;
> > > > >
> > > > > ...
> > > > > ******************************************************************************
> > > > > *Br    0 :varname   : this is its description/F
> > > > > *
> > > > > *Entries :     8877 : Total  Size=      48065 bytes  File Size  =      28030 *
> > > > > *Baskets :        1 : Basket Size=      32000 bytes  Compression=   1.14
> > > > > *
> > > > > *............................................................................*
> > > > > ...
> > > > >
> > > > > TLeaf *leaf;
> > > > > TIter next (tree->GetListOfLeaves());
> > > > > leaf->GetTitle(); -> "this is its description"
> > > > > leaf->GetName();  -> "this is its description"
> > > > >
> > > > > i.e. I don't get its name, so I can't do tree->Draw(leaf->GetName());
> > > > >
> > > > > *ERROR 26 :
> > > > >  Unknown name : "thisisitsdescription"
> > > > >
> > > > > Any suggestions ?
> > > > >
> > > > >                                         Thanks,
> > > > >                                         Markus
> > > > >
> > > > >    ____________________________________________
> > > > >   /  Markus Cristinziani, Research Associate  /
> > > > >  /    Stanford Linear Accelerator Center     /
> > > > > / ++1(650)926-3886 markus@slac.stanford.edu /
> > > > > --------------------------------------------
> > > >
> > >
> >
> >
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET