# Make a Tree cut using user-defined function

**URL:** <https://root-forum.cern.ch/t/make-a-tree-cut-using-user-defined-function/10737>\
**Category:** General Chat\
**Created:** [August 10, 2010, 8:15am UTC](https://root-forum.cern.ch/t/make-a-tree-cut-using-user-defined-function/10737 "2010-08-10T08:15:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hicho81](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/8e8cbc/32.png) [@hicho81](https://root-forum.cern.ch/u/hicho81)\
**Post date:** [August 10, 2010, 8:15am UTC](https://root-forum.cern.ch/t/make-a-tree-cut-using-user-defined-function/10737/1 "2010-08-10T08:15:42Z")

</div>

Hello,

To clarify what I need, I’ll illustrate through the following example:

I have a tree that has two Branches: x and y.  
I would like to select the events where y is less than func(x)  
I prefer to do it in .C macro program, is it possible to have the command below or similar ?

tree-\>Draw(“y:x”,“y\<func(x)”);

Regards,  
hicho

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [August 12, 2010, 1:55pm UTC](https://root-forum.cern.ch/t/make-a-tree-cut-using-user-defined-function/10737/2 "2010-08-12T13:55:28Z")

</div>

Hi,

Yes. You need to make sure to load into CINT either the definition (if you want it to be interpreted) or the library and dictionary for your function.

Cheers,  
Philippe.
