Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-17 23:10:25

0001 #ifndef CommonTools_Utils_TrinarySelector_h
0002 #define CommonTools_Utils_TrinarySelector_h
0003 /* \class reco::parser::TrinarySelector
0004  *
0005  * Trinary selector
0006  *
0007  * \author original version: Chris Jones, Cornell, 
0008  *         adapted by Luca Lista, INFN
0009  *
0010  * \version $Revision: 1.2 $
0011  *
0012  */
0013 #include "CommonTools/Utils/interface/SelectorBase.h"
0014 #include "CommonTools/Utils/interface/ExpressionBase.h"
0015 #include "CommonTools/Utils/interface/ComparisonBase.h"
0016 
0017 namespace reco {
0018   namespace parser {
0019     struct TrinarySelector : public SelectorBase {
0020       TrinarySelector(std::shared_ptr<ExpressionBase> lhs,
0021                       std::shared_ptr<ComparisonBase> cmp1,
0022                       std::shared_ptr<ExpressionBase> mid,
0023                       std::shared_ptr<ComparisonBase> cmp2,
0024                       std::shared_ptr<ExpressionBase> rhs)
0025           : lhs_(lhs), cmp1_(cmp1), mid_(mid), cmp2_(cmp2), rhs_(rhs) {}
0026       bool operator()(const edm::ObjectWithDict& o) const override {
0027         return cmp1_->compare(lhs_->value(o), mid_->value(o)) && cmp2_->compare(mid_->value(o), rhs_->value(o));
0028       }
0029       std::shared_ptr<ExpressionBase> lhs_;
0030       std::shared_ptr<ComparisonBase> cmp1_;
0031       std::shared_ptr<ExpressionBase> mid_;
0032       std::shared_ptr<ComparisonBase> cmp2_;
0033       std::shared_ptr<ExpressionBase> rhs_;
0034     };
0035   }  // namespace parser
0036 }  // namespace reco
0037 
0038 #endif