00001 #ifndef Utilities_CutBinaryOperatorSetter_h 00002 #define Utilities_CutBinaryOperatorSetter_h 00003 /* \class reco::parser::CutBinaryOperator 00004 * 00005 * Binary operator expression setter 00006 * 00007 * \author original version: Chris Jones, Cornell, 00008 * adapted to Reflex by Luca Lista, INFN 00009 * 00010 * \version $Revision: 1.1 $ 00011 * 00012 */ 00013 #include "PhysicsTools/Utilities/src/CutBinaryOperator.h" 00014 #include "PhysicsTools/Utilities/src/CutStack.h" 00015 #include <cmath> 00016 00017 namespace reco { 00018 namespace parser { 00019 00020 template<typename T> 00021 struct power_of { 00022 T operator()(T lhs, T rhs) const { return pow(lhs, rhs); } 00023 }; 00024 00025 template<typename Op> 00026 struct CutBinaryOperatorSetter { 00027 CutBinaryOperatorSetter(CutStack & stack) : stack_(stack) { } 00028 void operator()(const char*, const char*) const { 00029 stack_.push_back(CutPtr(new CutBinaryOperator<Op>(stack_))); 00030 } 00031 private: 00032 CutStack & stack_; 00033 }; 00034 } 00035 } 00036 00037 #endif