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