Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-09-29 01:11:53

0001 // -*- C++ -*-
0002 //
0003 // Package:     FWCore/Framework
0004 // Class  :     TestPRegisterModule1
0005 //
0006 /**\class TestPRegisterModule1
0007 
0008  Description:
0009 
0010  Usage:
0011 
0012    \author Stefano ARGIRO, Chris Jones
0013    \date 19 May 2005
0014 */
0015 
0016 #include "DataFormats/TestObjects/interface/ToyProducts.h"
0017 #include "FWCore/Framework/interface/Event.h"
0018 #include "FWCore/Framework/interface/FrameworkfwdMostUsed.h"
0019 #include "FWCore/Framework/interface/MakerMacros.h"
0020 #include "FWCore/Framework/interface/global/EDProducer.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 
0023 #include <memory>
0024 #include <string>
0025 
0026 class TestPRegisterModule1 : public edm::global::EDProducer<> {
0027 public:
0028   explicit TestPRegisterModule1(edm::ParameterSet const&);
0029   void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override;
0030 
0031 private:
0032   edm::ParameterSet pset_;
0033 };
0034 
0035 TestPRegisterModule1::TestPRegisterModule1(edm::ParameterSet const& pset) : pset_(pset) {
0036   produces<edmtest::StringProduct>();
0037 }
0038 
0039 void TestPRegisterModule1::produce(edm::StreamID, edm::Event& event, edm::EventSetup const&) const {
0040   std::string myname = pset_.getParameter<std::string>("@module_label");
0041   event.put(std::make_unique<edmtest::StringProduct>(myname));
0042 }
0043 
0044 DEFINE_FWK_MODULE(TestPRegisterModule1);