diff --git a/Framework/Core/include/Framework/Expressions.h b/Framework/Core/include/Framework/Expressions.h index 9d6c3cfb7c66e..4163a73f83983 100644 --- a/Framework/Core/include/Framework/Expressions.h +++ b/Framework/Core/include/Framework/Expressions.h @@ -17,6 +17,7 @@ #include "Framework/Variant.h" #include "Framework/InitContext.h" #include "Framework/ConfigParamRegistry.h" +#include "CommonConstants/MathConstants.h" #include #include #include @@ -554,6 +555,13 @@ inline Node clamp(Node&& expr, T low, T hi) return ifnode(Node{copy} < LiteralNode{low}, LiteralNode{low}, ifnode(Node{copy} > LiteralNode{hi}, LiteralNode{hi}, Node{copy})); } +/// division by 0 protector +inline Node protect0(Node&& expr) +{ + auto copy = expr; + return ifnode(nabs(Node{copy}) < o2::constants::math::Almost0, o2::constants::math::Almost0, Node{copy}); +} + /// A struct, containing the root of the expression tree struct Filter { Filter() = default;