Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:19

0001 #ifndef CommonTools_Utils_ExpressionQuaterOperator_h
0002 #define CommonTools_Utils_ExpressionQuaterOperator_h
0003 /* \class reco::parser::ExpressionQuaterOperator
0004  *
0005  * Quater Operator expression
0006  *
0007  * \author original version: Chris Jones, Cornell, 
0008  *         adapted by Luca Lista, INFN
0009  *
0010  * \version $Revision: 1.2 $
0011  *
0012  */
0013 #include "CommonTools/Utils/interface/parser/ExpressionBase.h"
0014 #include "CommonTools/Utils/interface/parser/ExpressionStack.h"
0015 
0016 namespace reco {
0017   namespace parser {
0018     template <typename Op>
0019     struct ExpressionQuaterOperator : public ExpressionBase {
0020       double value(const edm::ObjectWithDict& o) const override {
0021         return op_(args_[0]->value(o), args_[1]->value(o), args_[2]->value(o), args_[3]->value(o));
0022       }
0023       ExpressionQuaterOperator(ExpressionStack& expStack) {
0024         args_[3] = expStack.back();
0025         expStack.pop_back();
0026         args_[2] = expStack.back();
0027         expStack.pop_back();
0028         args_[1] = expStack.back();
0029         expStack.pop_back();
0030         args_[0] = expStack.back();
0031         expStack.pop_back();
0032       }
0033 
0034     private:
0035       Op op_;
0036       ExpressionPtr args_[4];
0037     };
0038   }  // namespace parser
0039 }  // namespace reco
0040 
0041 #endif