Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Package:    HcalDDDSimConstantsESModule
0004 // Class:      HcalDDDSimConstantsESModule
0005 //
0006 /**\class HcalDDDSimConstantsESModule Geometry/HcalCommonData/plugins/HcalDDDSimConstantsESModule.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Sunanda Banerjee
0015 //         Created:  Tue Dec 24 16:40:29 PDT 2013
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/HcalDDDSimConstants.h>
0026 #include <Geometry/Records/interface/HcalSimNumberingRecord.h>
0027 
0028 //#define EDM_ML_DEBUG
0029 
0030 class HcalDDDSimConstantsESModule : public edm::ESProducer {
0031 public:
0032   HcalDDDSimConstantsESModule(const edm::ParameterSet&);
0033 
0034   using ReturnType = std::unique_ptr<HcalDDDSimConstants>;
0035 
0036   static void fillDescriptions(edm::ConfigurationDescriptions&);
0037 
0038   ReturnType produce(const HcalSimNumberingRecord&);
0039 
0040 private:
0041   edm::ESGetToken<HcalParameters, HcalParametersRcd> parToken_;
0042 };
0043 
0044 HcalDDDSimConstantsESModule::HcalDDDSimConstantsESModule(const edm::ParameterSet&) {
0045 #ifdef EDM_ML_DEBUG
0046   edm::LogVerbatim("HCalGeom") << "constructing HcalDDDSimConstantsESModule";
0047 #endif
0048   auto cc = setWhatProduced(this);
0049   parToken_ = cc.consumesFrom<HcalParameters, HcalParametersRcd>(edm::ESInputTag{});
0050 }
0051 
0052 void HcalDDDSimConstantsESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0053   edm::ParameterSetDescription desc;
0054   descriptions.add("hcalDDDSimConstants", desc);
0055 }
0056 
0057 // ------------ method called to produce the data  ------------
0058 HcalDDDSimConstantsESModule::ReturnType HcalDDDSimConstantsESModule::produce(const HcalSimNumberingRecord& iRecord) {
0059   const auto& par = iRecord.get(parToken_);
0060   return std::make_unique<HcalDDDSimConstants>(&par);
0061 }
0062 
0063 //define this as a plug-in
0064 DEFINE_FWK_EVENTSETUP_MODULE(HcalDDDSimConstantsESModule);