CMS 3D CMS Logo

formulaFunctionTwoArgsEvaluator.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_formulaFunctionTwoArgsEvaluator_h
2 #define CommonTools_Utils_formulaFunctionTwoArgsEvaluator_h
3 // -*- C++ -*-
4 //
5 // Package: CommonTools/Utils
6 // Class : formulaFunctionTwoArgsEvaluator
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  FunctionTwoArgsEvaluator(std::shared_ptr<EvaluatorBase> iArg1, std::shared_ptr<EvaluatorBase> iArg2, T iFunc)
36  : m_arg1(std::move(iArg1)), m_arg2(std::move(iArg2)), m_function(iFunc) {}
37 
38  // ---------- const member functions ---------------------
39  double evaluate(double const* iVariables, double const* iParameters) const final {
40  return m_function(m_arg1->evaluate(iVariables, iParameters), m_arg2->evaluate(iVariables, iParameters));
41  }
42  std::vector<std::string> abstractSyntaxTree() const final {
43  auto ret = shiftAST(m_arg1->abstractSyntaxTree());
44  for (auto& v : shiftAST(m_arg2->abstractSyntaxTree())) {
45  ret.emplace_back(std::move(v));
46  }
47  ret.emplace(ret.begin(), "func 2 args");
48  return ret;
49  }
50 
51  private:
53 
55 
56  // ---------- member data --------------------------------
57  std::shared_ptr<EvaluatorBase> m_arg1;
58  std::shared_ptr<EvaluatorBase> m_arg2;
59  std::function<double(double, double)> m_function;
60  };
61  } // namespace formula
62 } // namespace reco
63 
64 #endif
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
reco::formula::FunctionTwoArgsEvaluator::abstractSyntaxTree
std::vector< std::string > abstractSyntaxTree() const final
Definition: formulaFunctionTwoArgsEvaluator.h:42
reco::formula::EvaluatorBase
Definition: formulaEvaluatorBase.h:34
reco::formula::FunctionTwoArgsEvaluator::m_arg2
std::shared_ptr< EvaluatorBase > m_arg2
Definition: formulaFunctionTwoArgsEvaluator.h:58
pfMETCorrectionType0_cfi.formula
formula
Definition: pfMETCorrectionType0_cfi.py:46
reco::formula::FunctionTwoArgsEvaluator::FunctionTwoArgsEvaluator
FunctionTwoArgsEvaluator(std::shared_ptr< EvaluatorBase > iArg1, std::shared_ptr< EvaluatorBase > iArg2, T iFunc)
Definition: formulaFunctionTwoArgsEvaluator.h:35
reco::formula::FunctionTwoArgsEvaluator::m_arg1
std::shared_ptr< EvaluatorBase > m_arg1
Definition: formulaFunctionTwoArgsEvaluator.h:57
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
findQualityFiles.v
v
Definition: findQualityFiles.py:179
watchdog.const
const
Definition: watchdog.py:83
reco::formula::FunctionTwoArgsEvaluator
Definition: formulaFunctionTwoArgsEvaluator.h:32
reco::formula::FunctionTwoArgsEvaluator::m_function
std::function< double(double, double)> m_function
Definition: formulaFunctionTwoArgsEvaluator.h:59
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::FunctionTwoArgsEvaluator::evaluate
double evaluate(double const *iVariables, double const *iParameters) const final
Definition: formulaFunctionTwoArgsEvaluator.h:39
reco::formula::FunctionTwoArgsEvaluator::operator=
const FunctionTwoArgsEvaluator & operator=(const FunctionTwoArgsEvaluator &)=delete
formulaEvaluatorBase.h