Is it possible to nest trees?

not really sure if my query should come under support or discussion so posted it here too, my apologies if that is bad…

I’ve had a bit more of a think about my problem (reposted below) after reading some more of the documentation.

Basically I want to be able to have a set of trees - with identical structure. I want to be able to select any or all of the trees and then select any or all of the branches of the selected trees. I can think of the following possible ways to do this, but I’m not sure which will be the best (most efficient/fastest access). Maybe there are other ways I haven’t thought of…

  1. Is the best way to do this to nest trees ? Is this posssible ? (i.e. can a tree have an entry which is in turn a tree ?)

  2. Should I store the individual trees in a container ? If so which would be most suitable (TClonesArray, TObjArray) ?

  3. Could I store the trees in folders ? How would I go about doing this ?

  4. Should the trees be stored in seperate root files and chained ? (This seems to me at first sight to be inefficient - I will end up with a LOT of files)

Any help very much appreciated,


My previous post

I’m relatively new to root - using 3.10/01 WIN32GDK on XP

basically my data is a series of different runs (around 200 different setups), each identified by a string, and then many events in each run, each event is described by seven pieces of data.

I have structured my tree as eight branches - one for the run name and seven others for each event field, eg.


for the runs and e.g.


for one of the data fields.

I want to do the same analysis on each run, sometimes seperately for testing, sometimes for each run in turn in one batch job, and sometimes to look at some properties of all runs in one analysis.

I use something like

sprintf(query1, “dow > 5 && Run== “%s””, run);
tree->Draw(“swp>> tdg”,query1,"");

to fill histos for my analysis.

The problem is when i use the query above to look at the data for a particular run it takes a very long time as (I think) it scans all the runs. Can I make it read only one run ? Do i need to split the “Run” branch ?
If so how do i select a particular run name (subbranch) ? SetBranch ?

Would i have to put my runs in seperate root files ? I’d much rather not do this if possible.

I hope this makes sense, please let me know if not,

many thanks in advance,