Problems with TTree::Draw() and cuts

Dear all,

I have some troubles with the behaviour of TTree::Draw() and cuts.

The problem is:
I have a tree with two variables per event.

One is a number the other is a vector. This means I have something like this per event (or per entry in the tree):
var1: 3.
var2: 0.45, 0.56, 0.88

Now I want to draw var2 only if var1 has a certain value (say 3.) and I do:
m_tree->Draw(var2>>var2(10, 0., 10.),“var1==3.”, “goff”);

When I do this I observe that somehow instead of plotting all values of var2 (if var1 is 3.) it always only plots one (the first one I guess).

What am I doing wrong here?
I want ALL values of the vector var2 plotted if var1 has a certain value not only the first one…

Cheers
Andi

[quote]I want ALL values of the vector var2 plotted if var1 has a certain value not only the first one… [/quote]If var1 is defined to the TTree as a simple variable (as opposed to an array), this is exactly the behavior you have.
If var1 is an array that happens to always have one elements, you can get what you need by doing:

Cheers,
Philippe.

thanks that was the problem.

var1 is also an array …

I just realized that the situation is far more complex than I thought :frowning:

Now I am looking for an example which really loops over ntuple entries and does not use these TTree::Draw() methods. The cuts I need to apply are too complex for this mechanism …

Thanks for your help again!