# How to cut on variables

I need to make a graph in one variable wich is the difference of two varables form a tree, I but I need to cut this two variables on a third variable before I make the difference between them.

e.g.

I have var a that is from 1 to 100
and var b that is trom 200 to 300

and they are linked by a var c

I need to plot b-a only if c[a] = c[b]

I hope that it’s clear.

If I understood your request correctly, the following should work:

`tree->Draw("a-b","c[a]==c[b]");`This would do the equivalent of

```for( i = 0 to min( sizeof(a),sizeof(b) ) ) { if (c[a[i]] == c[b[i]]) plot ( a[i] - b[i] ); } ```Philippe

Ok, only now I can see that I wasn’t so clear, I mean… I need to do

a[b]-a[c]
if a[b] > x and a[c]<y

a[b] and a[c] have tha same espression, they are only distinguished by that cut!
but I tryed with your cut and always it gives me 0 as result!!!

Unfortunately, I am even more confused! What are x and y in this expression? Can you write a small snipet of pseudo code that would plot what you need (similar to what I provided but with your correct algorithm).

Philippe