Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#ifndef CommonTools_Utils_CutBinaryOperatorSetter_h
#define CommonTools_Utils_CutBinaryOperatorSetter_h
/* \class reco::parser::CutBinaryOperator
 *
 * Binary operator expression setter
 *
 * \author original version: Chris Jones, Cornell, 
 *         adapted by Luca Lista, INFN
 *
 * \version $Revision: 1.2 $
 *
 */
#include "CommonTools/Utils/src/CutBinaryOperator.h"
#include "CommonTools/Utils/src/CutStack.h"
#include <cmath>

namespace reco {
  namespace parser {

    template<typename T>
    struct power_of {
      T operator()(T lhs, T rhs) const { return pow(lhs, rhs); }
    };

    template<typename Op>
    struct CutBinaryOperatorSetter {
      CutBinaryOperatorSetter(CutStack & stack) : stack_(stack) { }
      void operator()(const char*, const char*) const {
	stack_.push_back(CutPtr(new CutBinaryOperator<Op>(stack_)));
      }
    private:
      CutStack & stack_;
    };
  }
}

#endif