Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:19

0001 #include "FWCore/Framework/interface/global/EDProducer.h"
0002 #include "FWCore/Framework/interface/Run.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 #include "FWCore/ParameterSet/interface/Registry.h"
0005 #include "FWCore/Utilities/interface/EDPutToken.h"
0006 
0007 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0008 #include "DataFormats/Provenance/interface/ParameterSetBlob.h"
0009 
0010 class ParameterSetBlobProducer : public edm::global::EDProducer<edm::BeginRunProducer> {
0011 public:
0012   ParameterSetBlobProducer(edm::ParameterSet const&);
0013 
0014   void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const final;
0015 
0016   void globalBeginRunProduce(edm::Run&, edm::EventSetup const&) const final;
0017 
0018   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0019     edm::ParameterSetDescription desc;
0020     descriptions.addWithDefaultLabel(desc);
0021   }
0022 
0023 private:
0024   edm::EDPutTokenT<std::map<edm::ParameterSetID, edm::ParameterSetBlob>> const token_;
0025 };
0026 
0027 ParameterSetBlobProducer::ParameterSetBlobProducer(edm::ParameterSet const&)
0028     : token_{produces<std::map<edm::ParameterSetID, edm::ParameterSetBlob>, edm::Transition::BeginRun>()} {}
0029 
0030 void ParameterSetBlobProducer::produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const {}
0031 
0032 void ParameterSetBlobProducer::globalBeginRunProduce(edm::Run& iRun, edm::EventSetup const&) const {
0033   std::map<edm::ParameterSetID, edm::ParameterSetBlob> psetMap;
0034   edm::pset::Registry::instance()->fillMap(psetMap);
0035 
0036   iRun.emplace(token_, std::move(psetMap));
0037 }
0038 
0039 DEFINE_FWK_MODULE(ParameterSetBlobProducer);