RE: [ROOT] Drawing in a TEventList

From: Sebastian Boeser (sboeser@ifh.de)
Date: Tue Feb 19 2002 - 17:10:49 MET


Hi Phillipe,
A seperate event list for each tree is exactly what i want (It is
different data sets, i.e. simulations an experimental data).

Sel is a TCut Object and I tried using Sel and Sel.GetTitle() which
doesnt change anything. ( As far as i see from the source code, calling
TTree::Draw with Sel will just call TTree::Draw with Sel.GetTitle(), right
?).

I think that it perhaps has something to do with loading the trees. I have
a global variable TTree * Trees[4]; which stores the pointers to the
trees. At the beginning of the script i open my file and do
Trees[i]=myFile->Get("treename"). Afterwards i have the Tree as an object
in my gDirectory, but maybe it is not "loaded" somehow.

The result of running my procedure is an empty list if i have not drawn
any variable from the tree before.
What is really peculiar is that the script takes the same time if i do
draw or if i don't, which indicates that in both cases, it will actually
loop over the entries.

I attached my script, if you are interested. The Function where i do the
selection is called Select(). To load the files and get the Trees i call
Init() before. Common.h holds some global variables. e.g. the array of
TTree pointers.

	Thanks a lot

		Sebastian


On Tue, 19 Feb 2002, Philippe Canal wrote:

> Hi Sebastian,
>
> Your example should work without having to draw anything before hand.
> (I would need to know more about your trees and Sel.GetTitle() to be
> able to investigate more).
>
> Note that a TEventList only keep information about the entry number and
> the cut and do NOT keep any information about the tree it self.
>
> Thus your strategy would yield a TEventList that is only valid for
> one tree at a time (i.e. it is not cumulative).
>
> If you are looking for a cumulative TEventList, you may want to consider
> building a TChain of the trees in your array and running Draw only once
> on the chain.
>
> Cheers,
> Philippe.
>
> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
> [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Sebastian Boeser
> Sent: Tuesday, February 19, 2002 8:13 AM
> To: RootTalk
> Subject: [ROOT] Drawing in a TEventList
>
>
> Hello ROOTs,
> i tried to generate TEventLists using TTree:Draw() on an array of TTrees
> (Trees[])
>
> for (int ds = min; ds <  max; ds++){
>
>   //Reseting Tree-EventList
>   Trees[ds]->SetEventList(0);
>
>   // Draw into list
>   cout << ((TTree*)Trees[ds])->Draw(">> list",Sel.GetTitle());
>
>   // Get the list
>   TEventList * list = (TEventList*)gDirectory->Get("list");
>
>   cout << "\t " << list->GetN() << " Events\n";
>
> }
>
> As this would only work if i did a TTree::Draw() in a histogram before, i
> tried to circumvent this by accesing the TTreePlayer
>
>   // Print the events in a list
>   TEventList * list = new TEventList("list",Sel.GetTitle());
>
>   list->SetDirectory(0);
>
>   //Lets play with this tree
>   TTreePlayer * tPlay = ((TTree*)Trees[ds])->GetPlayer();
>
>   //Assign selection to tree
>   tPlay->CompileVariables("",Sel.GetTitle());
>
>   //Now run the TreePlayer loop (5 means assign to elist)
>   tPlay->EntryLoop(5,list);
>
> Unfortunatley this would not work either. If i specify a variable in
> addition to the selection in TTreePlayer::CompileVariables I would just
> get the last event of the tree in the list, otherwise i got an empty list
> as before.
>
> Now my question is if there is a way to generate a TEventList from a Tree
> w/o drawing something from the Tree before ?
>
> 	Thanks
>
> 		Sebastian
>
>
> ---------------------------------------------------
>
>     \|/     Sebastian Böser
>    /  ~~
>    @--OO    Rinkartstr. 3
>    \   ?    12437 Berlin
>     \  v    Tel: 030 / 532 19 008
>      ||     sboeser@ph.tum.de
>
>
>
>

---------------------------------------------------

    \|/     Sebastian Böser
   /  ~~
   @--OO    Rinkartstr. 3
   \   ?    12437 Berlin
    \  v    Tel: 030 / 532 19 008
     ||     sboeser@ph.tum.de






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