Re: [ROOT] Varible in cut.

From: Daniel CUSSOL (cussol@in2p3.fr)
Date: Thu Jun 05 2003 - 15:26:22 MEST


"Dmitry A. Shtol" wrote:

> What is the simplest way to use a varible or a user-defined function in a
> cut?
>
> Example: in PAW I have:
>
> cut $1 abs(90-tet1)<9*[t]
> How it will be in ROOT?
>
> In another case I use user-defined function in cut as a weight. And again,
> I don't know, how to do it. In roottalk I found an advice to use ClassMake
> function. But maybe it is not a simplest way?
>
> ==============================================================
> Dmitry A. Shtol                        (SND group)
> Budker Institute of Nuclear Physics

Hi Dmitry,
 You can use the TCut class. For example, you can do:

TCut cut1("abs(90-tet1)<9*t") ;

and when Drawing a variable in a TNtuple or in a TTree (assuming that mytree
is a pointer to a TTree), you can type:

mytree->Draw("tet1",cut1);

You can also combine cuts:

TCut cut2("sqrt(t) > 3.6");
mytree->Draw("tet1",cut1 && cut2);

In this example, the histogram of te1 is drawn for events which fulfill the
cut cut1 AND the cut cut2.

I hope this helps

--
Daniel CUSSOL

LPC Caen
Boulevard du Marechal Juin
14050 CAEN CEDEX

e-mail : cussol@in2p3.fr
Tel    : +33-(0)2-31-45-29-73
FAX    : +33-(0)2-31-45-25-49



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET