Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:29

0001 #include "FWCore/Framework/interface/Frameworkfwd.h"
0002 #include "FWCore/Framework/interface/InputSourceMacros.h"
0003 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0005 #include "FWCore/Sources/interface/ProducerSourceBase.h"
0006 #include "DataFormats/TestObjects/interface/ToyProducts.h"
0007 #include "FWCore/Framework/interface/Event.h"
0008 
0009 #include <memory>
0010 
0011 namespace edm {
0012 
0013   class IntSource : public ProducerSourceBase {
0014   public:
0015     explicit IntSource(ParameterSet const&, InputSourceDescription const&);
0016     ~IntSource();
0017     static void fillDescriptions(ConfigurationDescriptions& descriptions);
0018 
0019   private:
0020     virtual bool setRunAndEventInfo(EventID& id, TimeValue_t& time, edm::EventAuxiliary::ExperimentType& eType);
0021     virtual void produce(Event&);
0022   };
0023 
0024   IntSource::IntSource(ParameterSet const& pset, InputSourceDescription const& desc)
0025       : ProducerSourceBase(pset, desc, false) {
0026     produces<edmtest::IntProduct>();
0027   }
0028 
0029   IntSource::~IntSource() {}
0030 
0031   bool IntSource::setRunAndEventInfo(EventID&, TimeValue_t&, edm::EventAuxiliary::ExperimentType&) { return true; }
0032 
0033   void IntSource::produce(edm::Event& e) { e.put(std::make_unique<edmtest::IntProduct>(4)); }
0034 
0035   void IntSource::fillDescriptions(ConfigurationDescriptions& descriptions) {
0036     ParameterSetDescription desc;
0037     ProducerSourceBase::fillDescription(desc);
0038     descriptions.add("source", desc);
0039   }
0040 }  // namespace edm
0041 using edm::IntSource;
0042 DEFINE_FWK_INPUT_SOURCE(IntSource);