Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-28 23:10:55

0001 // CMSSW include files
0002 #include "DataFormats/Provenance/interface/EventID.h"
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/ParameterSetDescription.h"
0007 #include "FWCore/Utilities/interface/EDPutToken.h"
0008 
0009 namespace edmtest {
0010 
0011   class EventIDProducer : public edm::global::EDProducer<> {
0012   public:
0013     EventIDProducer(edm::ParameterSet const& config) : token_(produces()) {}
0014 
0015     void produce(edm::StreamID, edm::Event& event, edm::EventSetup const&) const final {
0016       event.emplace(token_, event.id());
0017     }
0018 
0019     static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0020       edm::ParameterSetDescription desc;
0021       descriptions.addWithDefaultLabel(desc);
0022     }
0023 
0024   private:
0025     edm::EDPutTokenT<edm::EventID> token_;
0026   };
0027 
0028 }  // namespace edmtest
0029 
0030 #include "FWCore/Framework/interface/MakerMacros.h"
0031 DEFINE_FWK_MODULE(edmtest::EventIDProducer);