Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CommonTools_UtilAlgos_EventSelectorAdapter_h
0002 #define CommonTools_UtilAlgos_EventSelectorAdapter_h
0003 
0004 /** \class EventSelectorAdapter
0005  *
0006  * Provide classes derrived from EventSelectorBase with an EDFilter interface
0007  *
0008  * \author Christian Veelken, UC Davis
0009  *
0010  * \version $Revision: 1.1 $
0011  *
0012  * $Id: EventSelectorAdapter.h,v 1.1 2009/03/03 13:07:26 llista Exp $
0013  *
0014  */
0015 
0016 #include "FWCore/Framework/interface/global/EDFilter.h"
0017 #include "FWCore/Framework/interface/Event.h"
0018 #include "FWCore/Framework/interface/EventSetup.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0021 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0022 
0023 template <typename T>
0024 class EventSelectorAdapter : public edm::global::EDFilter<> {
0025 public:
0026   // constructor
0027   explicit EventSelectorAdapter(const edm::ParameterSet& cfg) : eventSelector_(cfg, consumesCollector()) {}
0028 
0029   // destructor
0030   ~EventSelectorAdapter() override {}
0031 
0032   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0033     edm::ParameterSetDescription desc;
0034     T::fillPSetDescription(desc);
0035     descriptions.addWithDefaultLabel(desc);
0036   }
0037 
0038 private:
0039   bool filter(edm::StreamID, edm::Event& evt, const edm::EventSetup& es) const override {
0040     return eventSelector_(evt, es);
0041   }
0042 
0043   T eventSelector_;
0044 };
0045 
0046 #endif