File indexing completed on 2024-12-20 03:14:11
0001
0002
0003
0004 #include <memory>
0005
0006 #include "FWCore/Framework/interface/Frameworkfwd.h"
0007 #include "FWCore/Framework/interface/global/EDProducer.h"
0008
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/Framework/interface/MakerMacros.h"
0011
0012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0013 #include "FWCore/Utilities/interface/EDGetToken.h"
0014 #include "FWCore/Utilities/interface/ESGetToken.h"
0015
0016 #include "SimDataFormats/Associations/interface/LayerClusterToSimTracksterAssociator.h"
0017 #include "LCToSimTSAssociatorByEnergyScoreImpl.h"
0018
0019 class LCToSimTSAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> {
0020 public:
0021 explicit LCToSimTSAssociatorByEnergyScoreProducer(const edm::ParameterSet &);
0022 ~LCToSimTSAssociatorByEnergyScoreProducer() override;
0023
0024 static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0025
0026 private:
0027 void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
0028 edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometry_;
0029 std::shared_ptr<hgcal::RecHitTools> rhtools_;
0030 };
0031
0032 LCToSimTSAssociatorByEnergyScoreProducer::LCToSimTSAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps)
0033 : caloGeometry_(esConsumes<CaloGeometry, CaloGeometryRecord>()) {
0034 rhtools_ = std::make_shared<hgcal::RecHitTools>();
0035
0036
0037 produces<ticl::LayerClusterToSimTracksterAssociator>();
0038 }
0039
0040 LCToSimTSAssociatorByEnergyScoreProducer::~LCToSimTSAssociatorByEnergyScoreProducer() {}
0041
0042 void LCToSimTSAssociatorByEnergyScoreProducer::produce(edm::StreamID,
0043 edm::Event &iEvent,
0044 const edm::EventSetup &es) const {
0045 edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_);
0046 rhtools_->setGeometry(*geom);
0047
0048 auto impl = std::make_unique<LCToSimTSAssociatorByEnergyScoreImpl>(iEvent.productGetter());
0049 auto toPut = std::make_unique<ticl::LayerClusterToSimTracksterAssociator>(std::move(impl));
0050 iEvent.put(std::move(toPut));
0051 }
0052
0053 void LCToSimTSAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) {
0054 edm::ParameterSetDescription desc;
0055 cfg.add("layerClusterSimTracksterAssociatorByEnergyScore", desc);
0056 }
0057
0058
0059 DEFINE_FWK_MODULE(LCToSimTSAssociatorByEnergyScoreProducer);