Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:13

0001 #ifndef CommonTools_Utils_AndSelector_h
0002 #define CommonTools_Utils_AndSelector_h
0003 /* \class AndSelector
0004  *
0005  * \author Luca Lista, INFN
0006  *
0007  * $Id: AndSelector.h,v 1.7 2008/05/20 15:13:27 piccolo Exp $
0008  */
0009 
0010 namespace helpers {
0011   struct NullAndOperand;
0012 }
0013 
0014 namespace reco {
0015   namespace modules {
0016     template <typename T1, typename T2, typename T3, typename T4, typename T5>
0017     struct CombinedEventSetupInit;
0018   }
0019 }  // namespace reco
0020 
0021 template <typename S1,
0022           typename S2,
0023           typename S3 = helpers::NullAndOperand,
0024           typename S4 = helpers::NullAndOperand,
0025           typename S5 = helpers::NullAndOperand>
0026 struct AndSelector {
0027   AndSelector(const S1& s1, const S2& s2, const S3& s3, const S4& s4, const S5& s5)
0028       : s1_(s1), s2_(s2), s3_(s3), s4_(s4), s5_(s5) {}
0029   template <typename T>
0030   bool operator()(const T& t) const {
0031     return s1_(t) && s2_(t) && s3_(t) && s4_(t) && s5_(t);
0032   }
0033 
0034 private:
0035   friend struct reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, S5>;
0036   S1 s1_;
0037   S2 s2_;
0038   S3 s3_;
0039   S4 s4_;
0040   S5 s5_;
0041 };
0042 
0043 template <typename S1, typename S2>
0044 struct AndSelector<S1, S2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand> {
0045   AndSelector(const S1& s1, const S2& s2) : s1_(s1), s2_(s2) {}
0046   template <typename T>
0047   bool operator()(const T& t) const {
0048     return s1_(t) && s2_(t);
0049   }
0050   template <typename T1, typename T2>
0051   bool operator()(const T1& t1, const T2& t2) const {
0052     return s1_(t1) && s2_(t2);
0053   }
0054 
0055 private:
0056   friend struct reco::modules::
0057       CombinedEventSetupInit<S1, S2, helpers::NullAndOperand, helpers::NullAndOperand, helpers::NullAndOperand>;
0058   S1 s1_;
0059   S2 s2_;
0060 };
0061 
0062 template <typename S1, typename S2, typename S3>
0063 struct AndSelector<S1, S2, S3, helpers::NullAndOperand, helpers::NullAndOperand> {
0064   AndSelector(const S1& s1, const S2& s2, const S3& s3) : s1_(s1), s2_(s2), s3_(s3) {}
0065   template <typename T>
0066   bool operator()(const T& t) const {
0067     return s1_(t) && s2_(t) && s3_(t);
0068   }
0069   template <typename T1, typename T2, typename T3>
0070   bool operator()(const T1& t1, const T2& t2, const T3& t3) const {
0071     return s1_(t1) && s2_(t2) && s3_(t3);
0072   }
0073 
0074 private:
0075   friend struct reco::modules::CombinedEventSetupInit<S1, S2, S3, helpers::NullAndOperand, helpers::NullAndOperand>;
0076   S1 s1_;
0077   S2 s2_;
0078   S3 s3_;
0079 };
0080 
0081 template <typename S1, typename S2, typename S3, typename S4>
0082 struct AndSelector<S1, S2, S3, S4, helpers::NullAndOperand> {
0083   AndSelector(const S1& s1, const S2& s2, const S3& s3, const S4& s4) : s1_(s1), s2_(s2), s3_(s3), s4_(s4) {}
0084   template <typename T>
0085   bool operator()(const T& t) const {
0086     return s1_(t) && s2_(t) && s3_(t) && s4_(t);
0087   }
0088   template <typename T1, typename T2, typename T3, typename T4>
0089   bool operator()(const T1& t1, const T2& t2, const T3& t3, const T4& t4) const {
0090     return s1_(t1) && s2_(t2) && s3_(t3) && s4_(t4);
0091   }
0092 
0093 private:
0094   friend struct reco::modules::CombinedEventSetupInit<S1, S2, S3, S4, helpers::NullAndOperand>;
0095   S1 s1_;
0096   S2 s2_;
0097   S3 s3_;
0098   S4 s4_;
0099 };
0100 
0101 #endif