Re: [ROOT] Cuts on the Ntuple entries

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue May 02 2000 - 13:43:17 MEST


Hi Vitaliy,
Yes, this should be straightforward.
Follow the following steps;
 1- connect the original file "first.root" with TTree T1
 2- Set branch addresses for T1
 3- Create new file "second.root"
 4- Create new TTree T2
 5- Create branches pointing to the old variables
 6- Create new variables
 7- Execute event loop
    - for each entry T1->GetEntry(i); 
    - modify old variables in memory, compute new variable
    - T2->Fill()

You can simplify steps 4 and 5 by using TTree::cloneTree or TTree::CopyTree.

See examples of use in $ROOTSYS/test/stress.cxx
See also examples in $ROOTSYS/tutorials/copytree.C and copytree2.C

Rene Brun



Vitaliy Ziskin wrote:
> 
>         Hello,
> Is there a way to take an ntuple and apply specific cuts on some entries
> and modify/calibrate other and print a set of midified collumns into a new
> ntuple.  It sounds easy but (at least the way I see it) the ntuples are
> written row-wise and read collumn-wise.
> 
>                         Thanks, Vitaliy
> 
> =====================================================================
> Vitaliy Ziskin                                Tel: (617)253-7065
> MIT 26-547                          http://www.lns.mit.edu/people/vziskin/
> 77 Massachusetts Ave
> Cambridge, Ma
> 02139
> ======================================================================
>         "The memories of a man in his old age
>          Are the deeds of a man in his prime"--Pink Floyd



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:24 MET