File indexing completed on 2024-04-06 12:14:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <memory>
0020
0021 #include <FWCore/Framework/interface/ModuleFactory.h>
0022 #include <FWCore/Framework/interface/ESProducer.h>
0023 #include <FWCore/MessageLogger/interface/MessageLogger.h>
0024
0025 #include <Geometry/HcalCommonData/interface/HcalSimulationConstants.h>
0026 #include <Geometry/Records/interface/HcalSimNumberingRecord.h>
0027
0028
0029
0030 class HcalSimulationConstantsESModule : public edm::ESProducer {
0031 public:
0032 HcalSimulationConstantsESModule(const edm::ParameterSet&);
0033
0034 using ReturnType = std::unique_ptr<HcalSimulationConstants>;
0035
0036 static void fillDescriptions(edm::ConfigurationDescriptions&);
0037
0038 ReturnType produce(const HcalSimNumberingRecord&);
0039
0040 private:
0041 edm::ESGetToken<HcalSimulationParameters, HcalParametersRcd> parSimToken_;
0042 };
0043
0044 HcalSimulationConstantsESModule::HcalSimulationConstantsESModule(const edm::ParameterSet&) {
0045 #ifdef EDM_ML_DEBUG
0046 edm::LogVerbatim("HCalGeom") << "constructing HcalSimulationConstantsESModule";
0047 #endif
0048 auto cc = setWhatProduced(this);
0049 parSimToken_ = cc.consumesFrom<HcalSimulationParameters, HcalParametersRcd>(edm::ESInputTag{});
0050 }
0051
0052 void HcalSimulationConstantsESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0053 edm::ParameterSetDescription desc;
0054 descriptions.add("hcalSimulationConstants", desc);
0055 }
0056
0057
0058 HcalSimulationConstantsESModule::ReturnType HcalSimulationConstantsESModule::produce(
0059 const HcalSimNumberingRecord& iRecord) {
0060 const auto& parSim = iRecord.get(parSimToken_);
0061 return std::make_unique<HcalSimulationConstants>(&parSim);
0062 }
0063
0064
0065 DEFINE_FWK_EVENTSETUP_MODULE(HcalSimulationConstantsESModule);