Re: TCuts for custom Classes

Ye Shuwei (yesw@ihp.phys.ethz.ch)
Sat, 22 Aug 1998 13:47:12 +0200 (CEST)


Hi, Norbert,

I have an experience of using cuts to select event to display which uses
ROOT. The events in our case are stored as TTree, so TTreeFormula can be used
to impose cuts on it, e.g.

char *cut = "npart==1 && abs(pmom[0])<1.";
TTree *t = ...;
TTreeFormula *f_cut=new TTreeFormula("cut",cut,t);
t->GetEvent(evt);
if (f_cut->EvalInstance(0) != 0) {
// code to handle survived events
} else {
// code to handle failed events
}

Hope it helps.

Best regards --Shuwei


On Fri, 21 Aug 1998, Danneberg Norbert wrote:

> Hi rooters,
>
> we made a pretty impressive (at least we think so :-) Online analysis
> and display program based on root wich is based on a custom event
> class.
>
> I tried to figure out how to use the TCut and TFormula objects to make
> cuts on our class. The point is we want to display only such events in
> our online display that fullfill certain criteria. The idea is to have
> a cut function that gets an event and a TCut Object as paramter and
> returns TRUE or FALSE depending whether the event has to be further
> processed or not. Does anybody had a simialr problem ? Any sample source
> code ? Actually TTree.Draw(Expr., Select.) does nothing else.
>
>
> Hicks,
>
> Norbert
>