Re: [ROOT] A few question

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Mar 20 2002 - 09:04:17 MET


Hi Patrick,

Patrick Murray wrote:
> 
> I am trying to make a TTree DataBase. I have few very basic questions.
> 
> 1. Why use a TTree instead of a MYSQL Database? I am only expecting a few
> lines or maybe a ref where you all have explained this.
>

MySQL is good to store/query data organized in tables (ntuples), but not good
to store objects unless you do the job yourself of streaming a sub-branch
of your object into a column of the table.
MySQL is a good candidate for an Run/File catalog. Many people use MySQL
for a catalog and ROOT as an event store.
We are aware of several attempts to store ntuple-like data in a MySQL data base.
I am not aware of one single successful attempt to store and analyze a large
amount of data. The few comparisons between ROOT and MySQL show about
  - a factor 3 to 6 in favour of ROOT for the size of the data base.
  - a similar factor again in favour of ROOT for the time to process a query.
It would be nice if people who made such attempts could post their findings.
 
> 2. I want to make a run class which is a few simple variables and an array
> of event objects. So to do this I would make the event objects a derived
> class from TObjects and then use TObjArray to make to Array like thing.
> Right? Then should my run class also be derived from TObjects or can it
> just contain the Array of TObjects?
> 

I am not sure to understand what you want to do. In general you cannot have 
a Run object with the list of all events in memory. It is better to define
an Event class with one TTree::Fill per event as illustrated in our
test example $ROOTSYS/test/Event.cxx. This example shows one single 
TClonesArray, but you can extend it with
 - multiple TClonesArray
 - mixture of TObjArray and/or TClonesArray
 - a dynamic collection of TobjArray/TClonesArray

> 3. Then I want to fill a tree with the run class. so somthing like
> tree->Branch("RunBranch","TRun",&pointerToRun,4000,99); And the events
> will get there own braches because of the 99??
> 

Replace it by
tree->Branch("EventBranch","TEvent",&pointerToEvent,4000,99);

Your tree will be the collection of all events for one run.


Rene Brun

> Thank you for your time,
> 
> Pat



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