Typical analysis: add leaves to existing tree. Efficient ? Doable ?

From: David Rousseau, CERN (David.Rousseau@cern.ch)
Date: Wed Sep 02 1998 - 16:52:59 MEST


Hi Rooters, 
  
  Browsing the documentation, it's not clear to me how I should do the 
following (not unusual) thing:
Starting from a TTree (a converted Ntuple) with lots of events and variables, 
 I want to compute a few complex variables for each of a few selected events, 
and store them to be able to  use them many times (for example 
to do an unbinned maximum likelihood fit). 
  With Fortran/Hbook I would read the ntuple, select the events, and put 
the few complex variables for each of a few selected events in a common. Then 
my MINUIT FCN would use this common.
  With Root, I imagine I can do exactly the same thing, create a new 
TTree with only the variables I need and the events I need. Then my MINUIT
FCN would use this TTree. But I would have lost all links to the original 
event data.
  But since I was told in C++ course that I have to think completely different,
 I thought I could do the following: add a selection flag as a leaf 
to all events (not even sure if and how it is doable), add my complex 
variables as new leaves to the event which are selected. Then my MINUIT FCN 
would read first the event flag, then the complex variables only for the good 
events (as explained in the web pages).   
  So, what is the right way ? 

Note: the examples on the web are in the style: I loop once on the events and 
fill histograms. I would like to do (but maybe I shouldn't): 
I loop on the events, and add information to be used later.   

Thanks a lot

David Rousseau



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