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
#ifndef CommonTools_Utils_CutBinaryOperator_h
#define CommonTools_Utils_CutBinaryOperator_h
/* \class reco::parser::CutBinaryOperator
 *
 * Binary Operator expression
 *
 * \author original version: Chris Jones, Cornell, 
 *         adapted by Luca Lista, INFN
 *
 * \version $Revision: 1.2 $
 *
 */
#include "CommonTools/Utils/src/CutBase.h"
#include "CommonTools/Utils/src/CutStack.h"

namespace reco {
  namespace parser {
    template<typename Op>
    struct CutBinaryOperator : public CutBase {
      virtual double value(const edm::ObjectWithDict& o) const { 
	return op_((*lhs_).value(o), (*rhs_).value(o));
      }
      CutBinaryOperator(CutStack & cutStack) { 
	rhs_ = cutStack.back(); cutStack.pop_back();
	lhs_ = cutStack.back(); cutStack.pop_back();
      }
    private:
      Op op_;
      CutPtr lhs_, rhs_;
    };
  }
}

#endif