Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-17 23:36:20

0001 // -*- C++ -*-
0002 //
0003 // Package:    HcalSimulationConstantsESModule
0004 // Class:      HcalSimulationConstantsESModule
0005 //
0006 /**\class HcalSimulationConstantsESModule Geometry/HcalCommonData/plugins/HcalSimulationConstantsESModule.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Sunanda Banerjee
0015 //         Created:  Mon Aug 12 16:40:29 PDT 2019
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 //#define EDM_ML_DEBUG
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 // ------------ method called to produce the data  ------------
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 //define this as a plug-in
0065 DEFINE_FWK_EVENTSETUP_MODULE(HcalSimulationConstantsESModule);