File indexing completed on 2025-02-26 04:25:19
0001 #include "FWCore/Framework/interface/Event.h"
0002 #include "FWCore/Framework/interface/global/EDProducer.h"
0003 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0006 #include "FWCore/Utilities/interface/EDPutToken.h"
0007
0008 namespace edmtest {
0009
0010 class GlobalIntProducer : public edm::global::EDProducer<> {
0011 public:
0012 explicit GlobalIntProducer(edm::ParameterSet const& ps);
0013
0014 void produce(edm::StreamID sid, edm::Event& event, edm::EventSetup const& es) const override;
0015
0016 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0017
0018 private:
0019 edm::EDPutTokenT<int> token_;
0020 int value_;
0021 };
0022
0023 GlobalIntProducer::GlobalIntProducer(edm::ParameterSet const& config)
0024 : token_(produces()), value_(config.getParameter<int>("value")) {}
0025
0026 void GlobalIntProducer::produce(edm::StreamID sid, edm::Event& event, edm::EventSetup const& es) const {
0027 event.emplace(token_, value_);
0028 }
0029
0030 void GlobalIntProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0031 edm::ParameterSetDescription desc;
0032 desc.add<int>("value", 0);
0033 descriptions.addDefault(desc);
0034 }
0035
0036 }
0037
0038 #include "FWCore/Framework/interface/MakerMacros.h"
0039 DEFINE_FWK_MODULE(edmtest::GlobalIntProducer);