Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:34

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() override;
0017     static void fillDescriptions(ConfigurationDescriptions& descriptions);
0018 
0019   private:
0020     bool setRunAndEventInfo(EventID& id, TimeValue_t& time, edm::EventAuxiliary::ExperimentType& eType) override;
0021     void produce(Event&) override;
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);