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  {
34 
35  public:
36  template<typename T>
37  FunctionTwoArgsEvaluator(std::shared_ptr<EvaluatorBase> iArg1,
38  std::shared_ptr<EvaluatorBase> iArg2,
39  T iFunc):
40  m_arg1(std::move(iArg1)),
41  m_arg2(std::move(iArg2)),
42  m_function(iFunc)
43  {}
44 
45  // ---------- const member functions ---------------------
46  virtual double evaluate(double const* iVariables, double const* iParameters) const override final {
47  return m_function( m_arg1->evaluate(iVariables,iParameters),
48  m_arg2->evaluate(iVariables,iParameters) );
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  }
62 }
63 
64 
65 #endif
const FunctionTwoArgsEvaluator & operator=(const FunctionTwoArgsEvaluator &)=delete
std::function< double(double, double)> m_function
virtual double evaluate(double const *iVariables, double const *iParameters) const override final
fixed size matrix
long double T
def move(src, dest)
Definition: eostools.py:510
FunctionTwoArgsEvaluator(std::shared_ptr< EvaluatorBase > iArg1, std::shared_ptr< EvaluatorBase > iArg2, T iFunc)