Re: Questions about TTree.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jul 10 1998 - 10:22:18 MEST


Maurik Holtrop wrote:
> 
> Dear Root Experts,
> 
> I am in the process of designing the layout of an event structure using
> TTree that has a large amount of data in various sub-groups. (This is for
> the CLAS detector, right now CLAS uses BOS banks.) I would ideally like most
> of this data to be directly accessible from a TBrowser. I get quite close to
> what I want using the Event.cxx example, however, I stumble upon the
> following questions:
> 
> 1) Is there any way in which the branches can be split deeper that 1 level,
> so that the data of sub objects are stored in their own baskets ?
>   (Tree->Branch(....,split=1) only splits object one level deep, I'd like 3
> deep which would allow for a much more clear organization of the data.)
> 
> 2) How can I call a member function of a class from one of the objects in
> the tree, using TTree::Draw() ?
>   (T->Draw("fTrack.GetPx()") of the example does not work, even when the
> libEvent.so is loaded.)
> 
> Thank you very much,
> 

Maurik,
Sorry for this late answer. I see your mail just now in an attempt
to clear my mail folders before leaving for some holidays.

You can have as many levels as you want if you create the branches
yourself by hand.
The automatic split algorithm can split automatically when
the pointer specified to TTree::Branch is of a type deriving from
TObject. In this case
 - Each data member of a basic type becomes a new branch
 - Each data member being an object (not a pointer) is also split.
 - a pointer to a type derived from TObject will be in one branch
    (in this case the object::Streamer function is called to fill
    the branch buffer).
 - a pointer to a TClonesArray generates as many branches as you have
   data members in the class referenced by the TClonesArary.
   Note that in this case, this class must really contain objects
   of the same length.

In case one of the branches is in case 3 above (pointer to an object),
you can specify a member function in the TTree::Draw query.
In the case of the $ROOTSYS/test/Event example, I have included
the example of a pointer to an histogram (TH1F) in the event object.
The name of the branch is "fH".
You can do:
  tree->Draw("fH.GetMean()")
  tree->Draw("fH.GetMean():fH.GetRMS()"")
  tree->Draw("fH.GetBinContent(50):)

I have been working on a more general class TOak for sometime.
This new class should be more flexible in complex cases
and in particular, it will provide support for schema evolution in split
mode. Unfortunately, due to holidays, foreseen trips and more work
than expected with the mail, I have to postpone the availability
of this class to later this Autumn.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:34 MET