00001 #ifndef Utilities_ExpressionUnaryOperator_h 00002 #define Utilities_ExpressionUnaryOperator_h 00003 /* \class reco::parser::ExpressionUnaryOperator 00004 * 00005 * Unary Operator expression 00006 * 00007 * \author original version: Chris Jones, Cornell, 00008 * adapted to Reflex by Luca Lista, INFN 00009 * 00010 * \version $Revision: 1.2 $ 00011 * 00012 */ 00013 #include "PhysicsTools/Utilities/src/ExpressionBase.h" 00014 #include "PhysicsTools/Utilities/src/ExpressionStack.h" 00015 00016 namespace reco { 00017 namespace parser { 00018 template<typename Op> 00019 struct ExpressionUnaryOperator : public ExpressionBase { 00020 virtual double value(const ROOT::Reflex::Object& o) const { 00021 return op_((*exp_).value(o)); 00022 } 00023 ExpressionUnaryOperator(ExpressionStack & expStack) { 00024 exp_ = expStack.back(); expStack.pop_back(); 00025 } 00026 private: 00027 Op op_; 00028 ExpressionPtr exp_; 00029 }; 00030 } 00031 } 00032 00033 #endif