CMS 3D CMS Logo

formulaUnaryMinusEvaluator.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_formulaUnaryMinusEvaluator_h
2 #define CommonTools_Utils_formulaUnaryMinusEvaluator_h
3 // -*- C++ -*-
4 //
5 // Package: CommonTools/Utils
6 // Class : formulaUnaryMinusEvaluator
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  explicit UnaryMinusEvaluator(std::shared_ptr<EvaluatorBase> iArg)
35  : EvaluatorBase(Precedence::kUnaryMinusOperator), m_arg(std::move(iArg)) {}
36 
37  // ---------- const member functions ---------------------
38  double evaluate(double const* iVariables, double const* iParameters) const final {
39  return -1. * m_arg->evaluate(iVariables, iParameters);
40  }
41  std::vector<std::string> abstractSyntaxTree() const final {
42  auto ret = shiftAST(m_arg->abstractSyntaxTree());
43  ret.emplace(ret.begin(), "unary minus");
44  return ret;
45  }
46 
48 
49  const UnaryMinusEvaluator& operator=(const UnaryMinusEvaluator&) = delete;
50 
51  private:
52  // ---------- member data --------------------------------
53  std::shared_ptr<EvaluatorBase> m_arg;
54  };
55  } // namespace formula
56 } // namespace reco
57 
58 #endif
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
reco::formula::EvaluatorBase
Definition: formulaEvaluatorBase.h:34
reco::formula::UnaryMinusEvaluator::UnaryMinusEvaluator
UnaryMinusEvaluator(std::shared_ptr< EvaluatorBase > iArg)
Definition: formulaUnaryMinusEvaluator.h:34
pfMETCorrectionType0_cfi.formula
formula
Definition: pfMETCorrectionType0_cfi.py:46
reco::formula::EvaluatorBase::Precedence
Precedence
Definition: formulaEvaluatorBase.h:36
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
watchdog.const
const
Definition: watchdog.py:83
reco::formula::UnaryMinusEvaluator::operator=
const UnaryMinusEvaluator & operator=(const UnaryMinusEvaluator &)=delete
reco::formula::UnaryMinusEvaluator::evaluate
double evaluate(double const *iVariables, double const *iParameters) const final
Definition: formulaUnaryMinusEvaluator.h:38
reco::formula::UnaryMinusEvaluator::m_arg
std::shared_ptr< EvaluatorBase > m_arg
Definition: formulaUnaryMinusEvaluator.h:53
reco::formula::UnaryMinusEvaluator::abstractSyntaxTree
std::vector< std::string > abstractSyntaxTree() const final
Definition: formulaUnaryMinusEvaluator.h:41
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
formulaEvaluatorBase.h
reco::formula::UnaryMinusEvaluator
Definition: formulaUnaryMinusEvaluator.h:32