Root Tree Draw With Ternary Operators

Hello Everyone,
EDIT: It looks like the problem was actually somewhere deeper in the framework I was using, and this expression actually works as intended. Thank you for the help.
I am working on producing some scale factors, and part of the framework requires using TTreeFormula to create the cuts for which we want to compute the desired selection.
This selection has a conditional expression. As a minimal example, suppose we have 2 branches X,Y. We want to draw with a selection where X<3 if Y < 10 and X < 2 if Y >= 10.

Draw("X<(((Y < 10)*3) + ((Y>=10)*2))")

This results in the following error

Error in <TRegexp::Index>: Bad Regular Expression
Error in <TTree::SetBranchStatus>: unknown branch -> +

I have also attempted with using a proper ternary operator “(Y<10)?3:2” with similar results.
Perhaps I am simply making an error with the syntax, or perhaps I have misunderstood what is possible.
I appreciate any advice, thank you.

The first parameter of TTree::Draw is the variable(s) you want to draw and the second one the selection. You might do something like:

Draw("X","... selection ...");

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.