File indexing completed on 2023-03-17 10:47:45
0001
0002
0003
0004
0005
0006 #include "FWCore/Framework/interface/Frameworkfwd.h"
0007 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0008 #include "FWCore/Framework/interface/Event.h"
0009 #include "FWCore/Framework/interface/EventSetup.h"
0010 #include "FWCore/Framework/interface/ESHandle.h"
0011 #include "FWCore/Framework/interface/MakerMacros.h"
0012
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 #include "FWCore/ServiceRegistry/interface/Service.h"
0015
0016 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0017
0018 #include "CondFormats/PPSObjects/interface/PPSAssociationCuts.h"
0019 #include "CondFormats/DataRecord/interface/PPSAssociationCutsRcd.h"
0020
0021 #include <memory>
0022
0023 class WritePPSAssociationCuts : public edm::one::EDAnalyzer<> {
0024 public:
0025 explicit WritePPSAssociationCuts(const edm::ParameterSet &);
0026
0027 private:
0028 void analyze(const edm::Event &, const edm::EventSetup &) override;
0029
0030 edm::ESGetToken<PPSAssociationCuts, PPSAssociationCutsRcd> esToken_;
0031 };
0032
0033 WritePPSAssociationCuts::WritePPSAssociationCuts(const edm::ParameterSet &iConfig)
0034 : esToken_(esConsumes<PPSAssociationCuts, PPSAssociationCutsRcd>(
0035 edm::ESInputTag("", iConfig.getParameter<std::string>("label")))) {}
0036
0037 void WritePPSAssociationCuts::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
0038
0039 const auto &ppsAssociationCuts = iSetup.getData(esToken_);
0040
0041
0042 edm::Service<cond::service::PoolDBOutputService> poolDbService;
0043 if (poolDbService.isAvailable()) {
0044 poolDbService->writeOneIOV(ppsAssociationCuts, poolDbService->currentTime(), "PPSAssociationCutsRcd");
0045 } else {
0046 throw cms::Exception("WritePPSAssociationCuts") << "PoolDBService required.";
0047 }
0048 }
0049
0050
0051 DEFINE_FWK_MODULE(WritePPSAssociationCuts);