Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-26 10:51:24

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "FWCore/Framework/interface/ESHandle.h"
0003 
0004 #include "L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapParamsDBProducer.h"
0005 
0006 #include <memory>
0007 
0008 #include "CondFormats/DataRecord/interface/L1TMuonOverlapParamsRcd.h"
0009 #include "CondFormats/L1TObjects/interface/L1TMuonOverlapParams.h"
0010 
0011 #include "FWCore/ServiceRegistry/interface/Service.h"
0012 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0013 
0014 L1MuonOverlapParamsDBProducer::L1MuonOverlapParamsDBProducer(const edm::ParameterSet& cfg) {}
0015 ///////////////////////////////////////////////////////////////
0016 ///////////////////////////////////////////////////////////////
0017 void L1MuonOverlapParamsDBProducer::beginRun(edm::Run const& run, edm::EventSetup const& iSetup) {
0018   const L1TMuonOverlapParamsRcd& omtfParamsRcd = iSetup.get<L1TMuonOverlapParamsRcd>();
0019 
0020   edm::ESHandle<L1TMuonOverlapParams> omtfParamsHandle;
0021 
0022   omtfParamsRcd.get("params", omtfParamsHandle);
0023 
0024   omtfParams = std::make_unique<L1TMuonOverlapParams>(*omtfParamsHandle.product());
0025   if (!omtfParams) {
0026     edm::LogError("L1TMuonOverlapTrackProducer") << "Could not retrieve parameters from Event Setup" << std::endl;
0027   }
0028 }
0029 ///////////////////////////////////////////////////////////////
0030 ///////////////////////////////////////////////////////////////
0031 void L1MuonOverlapParamsDBProducer::analyze(const edm::Event& ev, const edm::EventSetup& es) {
0032   std::string recordName = "L1TMuonOverlapParamsRcd";
0033   edm::Service<cond::service::PoolDBOutputService> poolDbService;
0034   if (poolDbService.isAvailable()) {
0035     poolDbService->writeOneIOV(*omtfParams, poolDbService->currentTime(), recordName);
0036   }
0037 }
0038 ///////////////////////////////////////////////////////////////
0039 ///////////////////////////////////////////////////////////////
0040 #include "FWCore/Framework/interface/MakerMacros.h"
0041 DEFINE_FWK_MODULE(L1MuonOverlapParamsDBProducer);