CMS 3D CMS Logo

formulaFunctionOneArgEvaluator.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_formulaFunctionOneArgEvaluator_h
2 #define CommonTools_Utils_formulaFunctionOneArgEvaluator_h
3 // -*- C++ -*-
4 //
5 // Package: CommonTools/Utils
6 // Class : formulaFunctionOneArgEvaluator
7 //
16 //
17 // Original Author: Christopher Jones
18 // Created: Wed, 23 Sep 2015 17:41:33 GMT
19 //
20 
21 // system include files
22 #include <memory>
23 #include <functional>
24 
25 // user include files
26 #include "formulaEvaluatorBase.h"
27 
28 // forward declarations
29 
30 namespace reco {
31  namespace formula {
33  public:
34  template <typename T>
35  explicit FunctionOneArgEvaluator(std::shared_ptr<EvaluatorBase> iArg, T iFunc)
36  : m_arg(std::move(iArg)), m_function(iFunc) {}
37 
38  // ---------- const member functions ---------------------
39  double evaluate(double const* iVariables, double const* iParameters) const final {
40  return m_function(m_arg->evaluate(iVariables, iParameters));
41  }
42  std::vector<std::string> abstractSyntaxTree() const final {
43  auto ret = shiftAST(m_arg->abstractSyntaxTree());
44  ret.emplace(ret.begin(), "func 1 arg");
45  return ret;
46  }
47 
48  private:
50 
52 
53  // ---------- member data --------------------------------
54  std::shared_ptr<EvaluatorBase> m_arg;
55  std::function<double(double)> m_function;
56  };
57  } // namespace formula
58 } // namespace reco
59 
60 #endif
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
reco::formula::EvaluatorBase
Definition: formulaEvaluatorBase.h:34
pfMETCorrectionType0_cfi.formula
formula
Definition: pfMETCorrectionType0_cfi.py:46
reco::formula::FunctionOneArgEvaluator::m_arg
std::shared_ptr< EvaluatorBase > m_arg
Definition: formulaFunctionOneArgEvaluator.h:54
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
watchdog.const
const
Definition: watchdog.py:83
reco::formula::FunctionOneArgEvaluator::m_function
std::function< double(double)> m_function
Definition: formulaFunctionOneArgEvaluator.h:55
reco::formula::FunctionOneArgEvaluator::abstractSyntaxTree
std::vector< std::string > abstractSyntaxTree() const final
Definition: formulaFunctionOneArgEvaluator.h:42
reco::formula::FunctionOneArgEvaluator
Definition: formulaFunctionOneArgEvaluator.h:32
reco::formula::FunctionOneArgEvaluator::FunctionOneArgEvaluator
FunctionOneArgEvaluator(std::shared_ptr< EvaluatorBase > iArg, T iFunc)
Definition: formulaFunctionOneArgEvaluator.h:35
reco::formula::shiftAST
std::vector< std::string > shiftAST(std::vector< std::string > child)
Definition: formulaEvaluatorBase.cc:36
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
T
long double T
Definition: Basic3DVectorLD.h:48
HiBiasedCentrality_cfi.function
function
Definition: HiBiasedCentrality_cfi.py:4
reco::formula::FunctionOneArgEvaluator::evaluate
double evaluate(double const *iVariables, double const *iParameters) const final
Definition: formulaFunctionOneArgEvaluator.h:39
formulaEvaluatorBase.h
reco::formula::FunctionOneArgEvaluator::operator=
const FunctionOneArgEvaluator & operator=(const FunctionOneArgEvaluator &)=delete