Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Package:    HcalDDDRecConstantsESModule
0004 // Class:      HcalDDDRecConstantsESModule
0005 //
0006 /**\class HcalDDDRecConstantsESModule HcalDDDRecConstantsESModule.h Geometry/HcalCommonData/interface/HcalDDDRecConstantsESModule.h
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 // $Id: HcalDDDRecConstantsESModule.cc,v 1.0 2013/12/24 12:47:41 sunanda Exp $
0017 //
0018 //
0019 
0020 // system include files
0021 #include <memory>
0022 
0023 // user include files
0024 #include <FWCore/Framework/interface/ModuleFactory.h>
0025 #include <FWCore/Framework/interface/ESProducer.h>
0026 #include <FWCore/MessageLogger/interface/MessageLogger.h>
0027 
0028 #include <CondFormats/GeometryObjects/interface/HcalParameters.h>
0029 #include <Geometry/HcalCommonData/interface/HcalDDDSimConstants.h>
0030 #include <Geometry/HcalCommonData/interface/HcalDDDRecConstants.h>
0031 #include <Geometry/Records/interface/HcalRecNumberingRecord.h>
0032 
0033 //#define EDM_ML_DEBUG
0034 
0035 class HcalDDDRecConstantsESModule : public edm::ESProducer {
0036 public:
0037   HcalDDDRecConstantsESModule(const edm::ParameterSet&);
0038   ~HcalDDDRecConstantsESModule() override;
0039 
0040   using ReturnType = std::unique_ptr<HcalDDDRecConstants>;
0041 
0042   static void fillDescriptions(edm::ConfigurationDescriptions&);
0043 
0044   ReturnType produce(const HcalRecNumberingRecord&);
0045 
0046 private:
0047   edm::ESGetToken<HcalParameters, HcalParametersRcd> parToken_;
0048   edm::ESGetToken<HcalDDDSimConstants, HcalSimNumberingRecord> hdcToken_;
0049 };
0050 
0051 HcalDDDRecConstantsESModule::HcalDDDRecConstantsESModule(const edm::ParameterSet& iConfig) {
0052 #ifdef EDM_ML_DEBUG
0053   edm::LogVerbatim("HCalGeom") << "constructing HcalDDDRecConstantsESModule";
0054 #endif
0055   auto cc = setWhatProduced(this);
0056   parToken_ = cc.consumesFrom<HcalParameters, HcalParametersRcd>(edm::ESInputTag{});
0057   hdcToken_ = cc.consumesFrom<HcalDDDSimConstants, HcalSimNumberingRecord>(edm::ESInputTag{});
0058 }
0059 
0060 HcalDDDRecConstantsESModule::~HcalDDDRecConstantsESModule() {}
0061 
0062 void HcalDDDRecConstantsESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0063   edm::ParameterSetDescription desc;
0064   descriptions.add("hcalDDDRecConstants", desc);
0065 }
0066 
0067 // ------------ method called to produce the data  ------------
0068 HcalDDDRecConstantsESModule::ReturnType HcalDDDRecConstantsESModule::produce(const HcalRecNumberingRecord& iRecord) {
0069 #ifdef EDM_ML_DEBUG
0070   edm::LogVerbatim("HCalGeom") << "in HcalDDDRecConstantsESModule::produce";
0071 #endif
0072   const auto& par = iRecord.get(parToken_);
0073   const auto& hdc = iRecord.get(hdcToken_);
0074 
0075   return std::make_unique<HcalDDDRecConstants>(&par, hdc);
0076 }
0077 
0078 //define this as a plug-in
0079 DEFINE_FWK_EVENTSETUP_MODULE(HcalDDDRecConstantsESModule);