Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:13

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:  Fri Dec 30 16:40:29 PDT 2022
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/HGCalTBCommonData/interface/HGCalTBDDDConstants.h"
0026 #include "Geometry/HGCalTBCommonData/interface/HGCalTBParameters.h"
0027 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0028 
0029 //#define EDM_ML_DEBUG
0030 
0031 class HGCalTBNumberingInitialization : public edm::ESProducer {
0032 public:
0033   HGCalTBNumberingInitialization(const edm::ParameterSet&);
0034   ~HGCalTBNumberingInitialization() override = default;
0035 
0036   typedef std::unique_ptr<HGCalTBDDDConstants> ReturnType;
0037 
0038   ReturnType produce(const IdealGeometryRecord&);
0039 
0040 private:
0041   edm::ESGetToken<HGCalTBParameters, IdealGeometryRecord> hgParToken_;
0042   std::string name_;
0043 };
0044 
0045 HGCalTBNumberingInitialization::HGCalTBNumberingInitialization(const edm::ParameterSet& iConfig) {
0046   name_ = iConfig.getUntrackedParameter<std::string>("name");
0047   edm::LogVerbatim("HGCalGeom") << "HGCalTBNumberingInitialization for " << name_;
0048   auto cc = setWhatProduced(this, name_);
0049   hgParToken_ = cc.consumes<HGCalTBParameters>(edm::ESInputTag{"", name_});
0050 }
0051 
0052 // ------------ method called to produce the data  ------------
0053 HGCalTBNumberingInitialization::ReturnType HGCalTBNumberingInitialization::produce(const IdealGeometryRecord& iRecord) {
0054   edm::LogVerbatim("HGCalGeom") << "in HGCalTBNumberingInitialization::produce for " << name_;
0055   const auto& pHGpar = iRecord.get(hgParToken_);
0056   return std::make_unique<HGCalTBDDDConstants>(&pHGpar, name_);
0057 }
0058 
0059 // define this as a plug-in
0060 DEFINE_FWK_EVENTSETUP_MODULE(HGCalTBNumberingInitialization);