Re: [ROOT] Multiple cuts on a ntuple

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Mar 16 2002 - 11:06:06 MET


Hi Kevin,

I am not sure that I understand completly your request.
Could you give an example of a "long cut" that does not work?

You can use: TTree::CopyTree to create a new Tree from an original Tree
with selections.

You can fill one or more TEventList and use a combination of TEventList
to make a new selection, etc.
See :

http://root.cern.ch/root/htmldoc/TTreePlayer.html#TTreePlayer:DrawSelect
http://root.cern.ch/root/htmldoc/TEventList.html

Rene Brun


On Wed, 13 Mar 2002, Kevin Reil wrote:

> Hi,
> 
> I have an ntuple "x1:x2:x3:x4:x5:...:xn" and a list of cuts I wish to
> perform. I do not know in advance what n is but it is always larger than 
> some minimum. If I create a very long string with all the cuts it does not
> work. Is there a quick and easy way to do something like
> 
> TNtuple *nt;
> TNtuple *ntcut1;
> TNtuple *ntcut2;
> ...
> Open the file with nt
> ....
> ntcut1=nt->Clone("ntcut1","x1>5");
> ntcut2=ntcut1->Clone("ntcut2","x2<3");
> 
> or
> 
> nt->Draw(">>ntcut1","x1>5");
> ntcut1->Draw(">>ntcut2","x2<3");
> 
> Or best yet
> ntcut1=nt->PerformCut("x1>5");
> ntcut2=ntcut1->PerformCut("x1>5");
> 
> What I wish to avoid is having to code what is in the ntuple nt, create
> ntcut1 based on knowledge of nt.
> I am aware that I could SetAddress, GetEvent, decide, ntcut1->fill,
> etc. Of course, I need to form ntcut1-> to be fillable, create a structure
> to hold the proper x1:xn etc. I would prefer above methods.
> 
> 
> |---------------------------------|------------------------------------|
> | Campus Address                  | Office Location                    |
> | 115 S, 1400 E, Room 201         | 262 INSCC                          |
> | Salt Lake City, UT 84112-0830   | Just North of Park Building        |
> |---------------------------------|------------------------------------|
> | www.physics.utah.edu/~reil      | Office (801) 581-4306              |
> | reil@physics.utah.edu           | Home   (801) 969-6399              |
> | kevin@reil.net                  | Fax    (801) 581-6256 (via Frank)  |
> |----------------------------------------------------------------------|
> |                    And my father dwelt in a tent.                    |
> |----------------------------------------------------------------------|
> 



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