00001 #ifndef Utilities_TrinarySelector_h
00002 #define Utilities_TrinarySelector_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "PhysicsTools/Utilities/src/SelectorBase.h"
00014 #include "PhysicsTools/Utilities/src/ExpressionBase.h"
00015 #include "PhysicsTools/Utilities/src/ComparisonBase.h"
00016 #include <boost/shared_ptr.hpp>
00017
00018 namespace reco {
00019 namespace parser {
00020 struct TrinarySelector : public SelectorBase {
00021 TrinarySelector( boost::shared_ptr<ExpressionBase> lhs,
00022 boost::shared_ptr<ComparisonBase> cmp1,
00023 boost::shared_ptr<ExpressionBase> mid,
00024 boost::shared_ptr<ComparisonBase> cmp2,
00025 boost::shared_ptr<ExpressionBase> rhs ) :
00026 lhs_( lhs ), cmp1_( cmp1 ), mid_( mid ), cmp2_( cmp2 ),rhs_( rhs ) {}
00027 virtual bool operator()( const ROOT::Reflex::Object& o ) const {
00028 return
00029 cmp1_->compare( lhs_->value( o ), mid_->value( o ) ) &&
00030 cmp2_->compare( mid_->value( o ), rhs_->value( o ) );
00031 }
00032 boost::shared_ptr<ExpressionBase> lhs_;
00033 boost::shared_ptr<ComparisonBase> cmp1_;
00034 boost::shared_ptr<ExpressionBase> mid_;
00035 boost::shared_ptr<ComparisonBase> cmp2_;
00036 boost::shared_ptr<ExpressionBase> rhs_;
00037 };
00038 }
00039 }
00040
00041 #endif