RE: [ROOT] Drawing in a TEventList

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue Feb 19 2002 - 16:47:55 MET


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



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