TEventList questions

Hello,

In my application I am trying to write a wrapper around TEventLists to facilitate their usage with some domain specific events and I am a bit confused about the logic of how TEventLists interact with a TTree.

Can we construct a TEventList without using TTree::Draw? For example, is it possible to write code looking like
TEventList* evtlist = tree->createEventList("x<0 && y>0","name_of_the_event_list"); ?

What exactly happens when I use TTree::Draw?Is the TEventList owned by the TTree or would I need to delete it manually?

Leonid

Hi Leonid,

Beside TTree::Draw, a way to create the TEntryList is ‘by hand’, for example with a TSelector that does the selection and use member function of TEntryList to enter the entry information.

What exactly happens when I use TTree::Draw?Is the TEventList owned by the TTree or would I need to delete it manually?

TTree::Draw will create a TEntryList with the given name is none is found in the current (ROOT) directory. The TTree does not own the result and you ought to manager its lifetime yourself.

Cheers,
Philippe.

TTree::Draw will create a TEntryList with the given name is none is found in the current (ROOT) directory.

So what happens when the call to Draw is done in compiled code? In my case, I have a shared library that has a class that manages events and I would like to have explicit access to a TEventList, without using an interactive session.

Beside TTree::Draw, a way to create the TEntryList is ‘by hand’, for example with a TSelector that does the selection and use member function of TEntryList to enter the entry information.

Are there some examples that I can find online?

By the way, TEventList has been superseded by TEntryList (but in first approximation they behave similarly).

See ROOT: TEntryList Class Reference for all the details.

So what happens when the call to Draw is done in compiled code?

It works as well … (and when requesting a TEventList or TEntryList, nothing is actually drawn in either case).

The simplest example is:

tree->Draw(">>elist", "x<0 && y>0", "entrylist");
TEntryList *elist = (TEntryList*)gDirectory->Get("elist");

Cheers,
Philippe.

See also: ROOT: TEventList Class Reference