Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:44

0001 //STL includes
0002 #include <memory>
0003 
0004 //framework includes
0005 #include "FWCore/Framework/interface/Frameworkfwd.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/Framework/interface/ESHandle.h"
0008 #include "FWCore/Framework/interface/global/EDProducer.h"
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/Framework/interface/MakerMacros.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 
0013 //other includes
0014 #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h"
0015 
0016 class HFNoseRawToDigiFake : public edm::global::EDProducer<> {
0017 public:
0018   explicit HFNoseRawToDigiFake(const edm::ParameterSet&);
0019   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0020 
0021 private:
0022   void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
0023   edm::EDGetTokenT<HGCalDigiCollection> tok_hfn_;
0024 };
0025 
0026 HFNoseRawToDigiFake::HFNoseRawToDigiFake(const edm::ParameterSet& iConfig)
0027     : tok_hfn_(consumes<HGCalDigiCollection>(iConfig.getParameter<edm::InputTag>("hfnoseDigis"))) {
0028   produces<HGCalDigiCollection>("HFNose");
0029 }
0030 
0031 void HFNoseRawToDigiFake::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0032   edm::Handle<HGCalDigiCollection> hfn;
0033   iEvent.getByToken(tok_hfn_, hfn);
0034 
0035   auto out_hfn = std::make_unique<HGCalDigiCollection>();
0036   if (hfn.isValid()) {
0037     out_hfn = std::make_unique<HGCalDigiCollection>(*(hfn.product()));
0038   }
0039   iEvent.put(std::move(out_hfn), "HFNose");
0040 }
0041 
0042 void HFNoseRawToDigiFake::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0043   edm::ParameterSetDescription desc;
0044   desc.add<edm::InputTag>("hfnoseDigis", edm::InputTag("simHFNoseUnsuppressedDigis:HFNose"));
0045   descriptions.add("HFNoseRawToDigiFake", desc);
0046 }
0047 
0048 //define this as a plug-in
0049 DEFINE_FWK_MODULE(HFNoseRawToDigiFake);