Using a Conditional Cut

Dear root experts,

I am trying to use a 3rd order polynomial function with certain parameters as a cut for a 2D histogram. However, I just need to use a certain range of this function for the cut, and not the whole thing. How can I have a condition on my cut, such as:

if (x<0.85) TCut c = “y>3.13458e+01xxx-2.65564e+01xx-2.04973e+01x+1.74850e+01”

Is such a thing possible in root?

Thanks in advance for your help.


It depends on how you use the cut and what should be done if x >= 0.85 …

One of the possible answer is: TCut c = "(x<0.85)*(y>3.13458e+01*x*x*x-2.65564e+01*x*x-2.04973e+01*x+1.74850e+01)";


Hi Philippe,

Thank you so much for your reply. I tried the method you suggested. This, however, cuts out everything where x >= 0.85. I actually wanted to keep those events unchanged and not cut them out. Is there another method for that?

Best regards,

How about this?

TCut c = “(x<0.85)(y>3.13458e+01xxx-2.65564e+01xx-2.04973e+01*x+1.74850e+01)+(x>=0.85)”;

The value of conditional expression in each parentheses is one or zero depending if the condition is correct or not, the multiplication/addition of two conditional expression is equivalent to AND/OR, and these allow one to build more complex condition.