Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-18 00:39:48

0001 // -*- C++ -*-
0002 //
0003 // Package:    RecoEcal/EcalSCDynamicDPhiParametersMaker
0004 // Class:      EcalSCDynamicDPhiParametersMaker
0005 //
0006 /**\class EcalSCDynamicDPhiParametersMaker EcalSCDynamicDPhiParametersMaker.cc
0007 
0008  Description: Writes EcalSCDynamicDPhiParameters to the DB
0009 
0010  Implementation:
0011      [Notes on implementation]
0012 */
0013 //
0014 // Original Author:  Thomas Reis
0015 //         Created:  Thu, 05 Nov 2020 12:32:03 GMT
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0025 
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/EventSetup.h"
0028 #include "FWCore/Framework/interface/MakerMacros.h"
0029 #include "FWCore/Utilities/interface/Exception.h"
0030 
0031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0032 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0033 #include "FWCore/ServiceRegistry/interface/Service.h"
0034 #include "CondFormats/EcalObjects/interface/EcalSCDynamicDPhiParameters.h"
0035 #include "CondFormats/DataRecord/interface/EcalSCDynamicDPhiParametersRcd.h"
0036 
0037 class EcalSCDynamicDPhiParametersMaker : public edm::one::EDAnalyzer<> {
0038 public:
0039   explicit EcalSCDynamicDPhiParametersMaker(const edm::ParameterSet&);
0040 
0041   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0042 
0043 private:
0044   void analyze(const edm::Event&, const edm::EventSetup&) override;
0045 
0046   edm::ESGetToken<EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd> parametersToken_;
0047 };
0048 
0049 EcalSCDynamicDPhiParametersMaker::EcalSCDynamicDPhiParametersMaker(const edm::ParameterSet& iConfig)
0050     : parametersToken_(esConsumes<EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd>()) {}
0051 
0052 void EcalSCDynamicDPhiParametersMaker::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0053   const auto& esParams = iSetup.getData(parametersToken_);
0054 
0055   edm::Service<cond::service::PoolDBOutputService> poolDbService;
0056   if (poolDbService.isAvailable()) {
0057     poolDbService->writeOneIOV(esParams, poolDbService->currentTime(), "EcalSCDynamicDPhiParametersRcd");
0058   } else {
0059     throw cms::Exception("PoolDBService") << "No PoolDBService available.";
0060   }
0061 }
0062 
0063 void EcalSCDynamicDPhiParametersMaker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0064   edm::ParameterSetDescription desc;
0065   descriptions.addDefault(desc);
0066 }
0067 
0068 DEFINE_FWK_MODULE(EcalSCDynamicDPhiParametersMaker);