Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:15

0001 // -*- C++ -*-
0002 //
0003 // Package:    HGCalNumberingInitialization
0004 // Class:      HGCalNumberingInitialization
0005 //
0006 /**\class HGCalNumberingInitialization HGCalNumberingInitialization.h
0007  Geometry/HGCalCommonData/interface/HGCalNumberingInitialization.h
0008 
0009  Description: <one line class summary>
0010 
0011  Implementation:
0012      <Notes on implementation>
0013 */
0014 //
0015 // Original Author:  Sunanda Banerjee
0016 //         Created:  Tue Mar 21 16:40:29 PDT 2013
0017 //
0018 
0019 // user include files
0020 #include "FWCore/Framework/interface/ESProducer.h"
0021 #include "FWCore/Framework/interface/ModuleFactory.h"
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024 
0025 #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h"
0026 #include "Geometry/HGCalCommonData/interface/HGCalParameters.h"
0027 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0028 
0029 //#define EDM_ML_DEBUG
0030 
0031 class HGCalNumberingInitialization : public edm::ESProducer {
0032 public:
0033   HGCalNumberingInitialization(const edm::ParameterSet&);
0034   ~HGCalNumberingInitialization() override;
0035 
0036   typedef std::unique_ptr<HGCalDDDConstants> ReturnType;
0037 
0038   ReturnType produce(const IdealGeometryRecord&);
0039 
0040 private:
0041   edm::ESGetToken<HGCalParameters, IdealGeometryRecord> hgParToken_;
0042   std::string name_;
0043 };
0044 
0045 HGCalNumberingInitialization::HGCalNumberingInitialization(const edm::ParameterSet& iConfig) {
0046   name_ = iConfig.getUntrackedParameter<std::string>("Name");
0047 #ifdef EDM_ML_DEBUG
0048   edm::LogVerbatim("HGCalGeom") << "HGCalNumberingInitialization for " << name_;
0049 #endif
0050   auto cc = setWhatProduced(this, name_);
0051   hgParToken_ = cc.consumes<HGCalParameters>(edm::ESInputTag{"", name_});
0052 }
0053 
0054 HGCalNumberingInitialization::~HGCalNumberingInitialization() {}
0055 
0056 // ------------ method called to produce the data  ------------
0057 HGCalNumberingInitialization::ReturnType HGCalNumberingInitialization::produce(const IdealGeometryRecord& iRecord) {
0058   edm::LogVerbatim("HGCalGeom") << "in HGCalNumberingInitialization::produce for " << name_;
0059   const auto& pHGpar = iRecord.get(hgParToken_);
0060   return std::make_unique<HGCalDDDConstants>(&pHGpar, name_);
0061 }
0062 
0063 // define this as a plug-in
0064 DEFINE_FWK_EVENTSETUP_MODULE(HGCalNumberingInitialization);