Tom,
To hide the errors, you can set ROOT's global print threshold with the line "gErrorIgnoreLevel = LEVEL;", where LEVEL is kVerbose, kDebug, kInfo, kWarning, kError, or kFatal. In this case, you'd want to set gErrorIgnoreLevel to kFatal. This trick worked for me for suppressing useless warnings about a full TSpectrum peak buffer.
Since you typically want errors reported, it would be good practice to set this back to warning when you're done TTreeFormula'ing.
Hope this works for you.
Cheers,
Andy Mastbaum
P-23 Weak Interactions Team
Los Alamos National Laboratory
TA-53 Building 1, D115
Phone: (505) 665-6040
Email: mastbaum_at_lanl.gov
> To check an expression for validity with a given TNtuple, I construct a
> temporary TTreeFormula and check whether it succeeded. For invalid
> expressions I get the error message: Error in <TTreeFormula::Compile>:
> Bad numerical expression : "in_Px"
>
> This looks bad to my users (there can be dozens in a row). It is
> legitimate for these expressions to be invalid for the TNtuple that is
> currently selected -- that's why I am checking them before trying to use
> them. So I don't want the error message. Zeroing stderr and stdout do
> not suppress it. How can I suppress it? Alternatively, is there some
> other way to check whether a given expression is valid for a given
> TNtuple?
>
> At present I'm printing a notice to ignore the errors -- this workable,
> but looks silly....
>
>
> Tom Roberts
>
>
Received on Tue Dec 16 2008 - 05:19:28 CET
This archive was generated by hypermail 2.2.0 : Wed Dec 17 2008 - 23:50:02 CET