Building a TEventList from a TCut containing a float array

Hi Rooters,

I want to build a TEventList from a TCut containing an array of floats. Starting from a TTree called analysis, I do:

analysis->Draw(">>evtl", “Lept_2[3]>10”);

The result is an empty list.

There was already such a mail in 2000 ( … /3324.html)
but it’s quite old. On the other hand, the TTree documentation seems to says the opposite:
“If arrays are used in the selection critera, the entry entered in the list are all the entries that have at least one element of the array that satisfy the selection. (…) To select only the elements that did match the original selection use TEventList::SetReapplyCut.”

Using SetReapplyCut would not be a problem for me, since I want to select events were “the second lepton has energy larger than 10 GeV”.

Is it possible to achieve this without using MakeSelector or MakeClass ?

Thanks a lot,

P.S.: I tested it with both ROOT 3.05.07 and ROOT CVS.


Could you send the strict minimum to reproduce the problem ?



You wrote

analysis->Draw(">>evtl", "Lept_2[3]>10"); and

Is is possible that the result is correct (but different from what you were looking for). I mean: is it possible that there is NO event where the 4th lepton has energy larger than 10 GeV.
To grab the event you requested in your text, you should use:

Also to debug this type of problem, you may want to do:

analysis->Draw("Lept_2[3]>10"); or




Here is the simplest example I found…

If I do :

TFile *ggss207 = TFile::Open("ggss207.root")

I obtain the canvas attached to this message. On the other hand, again,

TFile *ggss207 = TFile::Open("ggss207.root")

returns an empty list:

[delaere@cmslapb example]$ root ggss207.root 
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   3.10/01   8 December 2003   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *            *
  *                                         *

FreeType Engine v2.1.3 used to render TrueType fonts.
Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.112, Nov 19 2003
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] 
Attaching file ggss207.root...
root [1] analysis->Draw(">>evtl","Lept_1[3]>10")     
root [2] analysis->Draw("Lept_1[3]")                 
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
root [3] analysis->Draw("Lept_1[3]","Lept_1[3]>10")
root [4] .q

I also noticed than I cannot draw and then directly project to an eventlist:

root [1] analysis->Draw("Lept_1[3]")                               
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
root [2] Info in <TCanvas::Print>: GIF file c1.gif has been created

 *** Break *** segmentation violation

Again, this is both observed with ROOT 3.05/07 and 3.10/01 (CVS 8/12/03)

ggss207.root (63.9 KB)

HI Christophe,

Thanks for the simple example. I was able to reproduce and fix the failure. The fix has been uploaded in the CVS repository.


Hi Philippe,

First of all, thanks for your quick answer. Indeed, it works fine now.

Fixing my script, I also noticed a “bad” interference between EventLists and TTree::Draw when a weight is applied during the Draw. Using the TFile I send you, you can do:

TFile f("ggss207.root")
TTree* analysis = (TTree*)f.Get("analysis")
TEventList* evtl = f.Get("evtl")

The first call to Integral() returns 61, which is also the number of events. The second call to Integral() return 30.5, which is the expected answer. I don’t know if this is a feature or a bug, but it seems to me it’s important to mention it in the TTree and/or TEventList documentation.


Hi Christophe,

Thank you for reporting this unexpected behavior.
The fix has been uploaded in the CVS repository.