Escaping Minus Signs


I have, in my youthful foolishness, decided to give some variables names that contain minus signs. When trying to plot in root, these minuses are parsed as mathematical operators. Is there a way to escape these signs so that they are recognized properly? - does not seem to work.

Thanks in advance


ROOT variable names should follow the c++ variable naming rule

Cheers, Bertrand.

As Bertrand said it is no a good idea to not follow C++ coding convention.

And yes, for sure, escaping with \ will not work (this kind of escape is meant to be used inside strings to define special characters).

Can you provide a small example showing how you (mis)used minus ?.. May be we will find a solution …

Of course. I will try to strip it down to the minimum. In principle it’s one line. I have a tree that contains to branches: “Ext-kaltes-Kreuz” and “t”.

When i do

Root searches for a Branch called Ext.

There is, however, a solution that was so simple it eluded me at first. When reading in the datafiles I use TString::rename to clear out the minus signs and this problem is solved.

I see … that’s not really in C++ itself because it is inside the TTree::Draw expression … but this expression follows also the C++ syntax … Good you found a solution.

I should have written that my BRANCHES have minuses in their names. You are correct, that was a mistake on my part. :confused: