Go to the documentation of this file.00001 #ifndef CommonTools_UtilAlgos_ObjectCountEventSelector_h
00002 #define CommonTools_UtilAlgos_ObjectCountEventSelector_h
00003
00016 #include "FWCore/Framework/interface/Event.h"
00017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00018 #include "FWCore/Utilities/interface/InputTag.h"
00019 #include "CommonTools/UtilAlgos/interface/ParameterAdapter.h"
00020 #include "CommonTools/UtilAlgos/interface/CollectionFilterTrait.h"
00021 #include "CommonTools/UtilAlgos/interface/EventSelectorBase.h"
00022
00023 template<typename C,
00024 typename S = AnySelector,
00025 typename N = MinNumberSelector,
00026 typename CS = typename helper::CollectionFilterTrait<C, S, N>::type>
00027 class ObjectCountEventSelector : public EventSelectorBase
00028 {
00029 public:
00031 explicit ObjectCountEventSelector( const edm::ParameterSet & cfg ) :
00032 src_( cfg.template getParameter<edm::InputTag>( "src" ) ),
00033 select_( reco::modules::make<S>( cfg ) ),
00034 sizeSelect_( reco::modules::make<N>( cfg ) ) {
00035 }
00036
00037 bool operator()(edm::Event& evt, const edm::EventSetup&) {
00038 edm::Handle<C> source;
00039 evt.getByLabel( src_, source );
00040 return CS::filter( * source, select_, sizeSelect_ );
00041 }
00042
00043 private:
00045 edm::InputTag src_;
00046
00048 S select_;
00049
00051 N sizeSelect_;
00052 };
00053
00054 #endif