Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-02 03:45:36

0001 // -*- C++ -*-
0002 //
0003 // Package:    EcalRegionCablingESProducer
0004 // Class:      EcalRegionCablingESProducer
0005 //
0006 /**\class EcalRegionCablingESProducer EcalRegionCablingESProducer.h EventFilter/EcalRegionCablingESProducer/src/EcalRegionCablingESProducer.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Jean-Roch Vlimant
0015 //         Created:  Sun Oct  7 00:37:06 CEST 2007
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/ESProducer.h"
0024 #include "FWCore/Framework/interface/ESHandle.h"
0025 #include "FWCore/Utilities/interface/ESGetToken.h"
0026 
0027 #include "EventFilter/EcalRawToDigi/interface/EcalRegionCablingRecord.h"
0028 #include "EventFilter/EcalRawToDigi/interface/EcalRegionCabling.h"
0029 
0030 class EcalRegionCablingESProducer : public edm::ESProducer {
0031 public:
0032   EcalRegionCablingESProducer(const edm::ParameterSet&);
0033   ~EcalRegionCablingESProducer() override;
0034 
0035   typedef std::unique_ptr<EcalRegionCabling> ReturnType;
0036 
0037   ReturnType produce(const EcalRegionCablingRecord&);
0038 
0039 private:
0040   edm::ParameterSet conf_;
0041 
0042   edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> esEcalElectronicsMappingToken_;
0043 };
0044 
0045 EcalRegionCablingESProducer::EcalRegionCablingESProducer(const edm::ParameterSet& iConfig) : conf_(iConfig) {
0046   auto cc = setWhatProduced(this);
0047   esEcalElectronicsMappingToken_ = cc.consumesFrom<EcalElectronicsMapping, EcalMappingRcd>();
0048 }
0049 
0050 EcalRegionCablingESProducer::~EcalRegionCablingESProducer() {}
0051 
0052 EcalRegionCablingESProducer::ReturnType EcalRegionCablingESProducer::produce(const EcalRegionCablingRecord& iRecord) {
0053   edm::ESHandle<EcalElectronicsMapping> mapping = iRecord.getHandle(esEcalElectronicsMappingToken_);
0054 
0055   return std::make_unique<EcalRegionCabling>(conf_, mapping.product());
0056 }
0057 
0058 #include "FWCore/Framework/interface/ModuleFactory.h"
0059 DEFINE_FWK_EVENTSETUP_MODULE(EcalRegionCablingESProducer);