00001 #ifndef PhysicsTools_PatUtils_interface_EventHypothesisTools_h 00002 #define PhysicsTools_PatUtils_interface_EventHypothesisTools_h 00003 00004 #include "boost/ptr_container/ptr_vector.hpp" 00005 #include "DataFormats/PatCandidates/interface/EventHypothesis.h" 00006 #include "PhysicsTools/Utilities/interface/StringCutObjectSelector.h" 00007 00008 namespace pat { namespace eventhypothesis { 00009 00011 class AndFilter : public ParticleFilter { 00012 public: 00013 AndFilter() : filters_(2) {} 00014 AndFilter(ParticleFilter *f1, ParticleFilter *f2) ; 00015 virtual ~AndFilter() {} 00016 AndFilter & operator&=(ParticleFilter *filter) { filters_.push_back(filter); return *this; } 00017 virtual bool operator()(const CandRefType &cand, const std::string &role) const ; 00018 private: 00019 boost::ptr_vector<ParticleFilter> filters_; 00020 }; 00021 00023 class OrFilter : public ParticleFilter { 00024 public: 00025 OrFilter() : filters_(2) {} 00026 OrFilter(ParticleFilter *f1, ParticleFilter *f2) ; 00027 virtual ~OrFilter() {} 00028 OrFilter & operator&=(ParticleFilter *filter) { filters_.push_back(filter); return *this; } 00029 virtual bool operator()(const CandRefType &cand, const std::string &role) const ; 00030 private: 00031 boost::ptr_vector<ParticleFilter> filters_; 00032 }; 00033 00034 class ByPdgId : public ParticleFilter { 00035 public: 00036 explicit ByPdgId(int32_t pdgCode, bool alsoAntiparticle=true) ; 00037 virtual ~ByPdgId() {} 00038 virtual bool operator()(const CandRefType &cand, const std::string &role) const ; 00039 private: 00040 int32_t pdgCode_; 00041 bool antiparticle_; 00042 }; 00043 00044 class ByString : public ParticleFilter { 00045 public: 00046 ByString(const std::string &cut) ; // not putting the explicit on purpose, I want to see what happens 00047 virtual ~ByString() {} 00048 virtual bool operator()(const CandRefType &cand, const std::string &role) const ; 00049 private: 00050 StringCutObjectSelector<reco::Candidate> sel_; 00051 00052 }; 00053 00054 00055 00056 } } 00057 00058 #endif