File indexing completed on 2024-04-06 12:10:44
0001
0002 #include <memory>
0003
0004
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
0014 #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h"
0015
0016 class HGCalRawToDigiFake : public edm::global::EDProducer<> {
0017 public:
0018 explicit HGCalRawToDigiFake(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_ee_;
0024 edm::EDGetTokenT<HGCalDigiCollection> tok_fh_;
0025 edm::EDGetTokenT<HGCalDigiCollection> tok_bh_;
0026 };
0027
0028 HGCalRawToDigiFake::HGCalRawToDigiFake(const edm::ParameterSet& iConfig)
0029 : tok_ee_(consumes<HGCalDigiCollection>(iConfig.getParameter<edm::InputTag>("eeDigis"))),
0030 tok_fh_(consumes<HGCalDigiCollection>(iConfig.getParameter<edm::InputTag>("fhDigis"))),
0031 tok_bh_(consumes<HGCalDigiCollection>(iConfig.getParameter<edm::InputTag>("bhDigis"))) {
0032 produces<HGCalDigiCollection>("EE");
0033 produces<HGCalDigiCollection>("HEfront");
0034 produces<HGCalDigiCollection>("HEback");
0035 }
0036
0037 void HGCalRawToDigiFake::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0038 edm::Handle<HGCalDigiCollection> h_ee;
0039 edm::Handle<HGCalDigiCollection> h_fh;
0040 edm::Handle<HGCalDigiCollection> h_bh;
0041
0042 iEvent.getByToken(tok_ee_, h_ee);
0043 iEvent.getByToken(tok_fh_, h_fh);
0044 iEvent.getByToken(tok_bh_, h_bh);
0045
0046 auto out_ee = std::make_unique<HGCalDigiCollection>();
0047 if (h_ee.isValid()) {
0048 out_ee = std::make_unique<HGCalDigiCollection>(*(h_ee.product()));
0049 }
0050 iEvent.put(std::move(out_ee), "EE");
0051
0052 auto out_fh = std::make_unique<HGCalDigiCollection>();
0053 if (h_fh.isValid()) {
0054 out_fh = std::make_unique<HGCalDigiCollection>(*(h_fh.product()));
0055 }
0056 iEvent.put(std::move(out_fh), "HEfront");
0057
0058 auto out_bh = std::make_unique<HGCalDigiCollection>();
0059 if (h_bh.isValid()) {
0060 out_bh = std::make_unique<HGCalDigiCollection>(*(h_bh.product()));
0061 }
0062 iEvent.put(std::move(out_bh), "HEback");
0063 }
0064
0065 void HGCalRawToDigiFake::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0066 edm::ParameterSetDescription desc;
0067 desc.add<edm::InputTag>("eeDigis", edm::InputTag("simHGCalUnsuppressedDigis:EE"));
0068 desc.add<edm::InputTag>("fhDigis", edm::InputTag("simHGCalUnsuppressedDigis:HEfront"));
0069 desc.add<edm::InputTag>("bhDigis", edm::InputTag("simHGCalUnsuppressedDigis:HEback"));
0070
0071 descriptions.add("HGCalRawToDigiFake", desc);
0072 }
0073
0074
0075 DEFINE_FWK_MODULE(HGCalRawToDigiFake);