|
EICrecon
JANA based reconstruction for the EPIC detector
|
Provides an interface to a compiler that converts string expressions to native std::function.
More...
#include <EvaluatorSvc.h>


Public Member Functions | |
| void | init () |
| template<class... Args> | |
| std::function< double(Args...)> | compile (const std::string &expr, std::function< std::unordered_map< std::string, double >(Args...)> transform) |
Compile expression expr to std::function. | |
| std::function< double(const std::unordered_map< std::string, double > &)> | _compile (const std::string &expr, const std::vector< std::string > ¶ms) |
Compile expression expr to std::function. | |
Provides an interface to a compiler that converts string expressions to native std::function.
The underlying implementation relies on ROOT's TInterpreter, but this may change in the future. User can inspect the full C++ code by setting -PEvaluatorSvc:LogLevel=debug, the list of provided variables is apparent from the same output.
Currently, return type is fixed to double, and all input parameters have to be convertible to double.
| std::function< double(const std::unordered_map< std::string, double > &)> eicrecon::EvaluatorSvc::_compile | ( | const std::string & | expr, |
| const std::vector< std::string > & | params | ||
| ) |
Compile expression expr to std::function.
| expr | String expression to compile (e.g. "a + b") |
| params | List of parameter names used in the expression (e.g. {"a", "b"}) |
The resulting function accepts a dictionary (std::unordered_map) of parameter values.
|
inline |
Compile expression expr to std::function.
| expr | String expression to compile (e.g. "0.998", "a + b") |
| Args | Types of arguments for the resulting function |
| transform | Function providing mapping from Args |
The Args must be default-constructible types, since transform need to be called at compilation time to determine the list of available parameters.
| void eicrecon::EvaluatorSvc::init | ( | ) |