File indexing completed on 2024-04-06 12:02:44
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014 #include "FWCore/Framework/interface/ESHandle.h"
0015 #include "CondCore/CondDB/interface/Time.h"
0016
0017 #include "FWCore/Framework/interface/Frameworkfwd.h"
0018
0019 #include "FWCore/ServiceRegistry/interface/Service.h"
0020 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0021
0022 #include "CondFormats/DataRecord/interface/CTPPSPixelDAQMappingRcd.h"
0023 #include "CondFormats/DataRecord/interface/CTPPSPixelAnalysisMaskRcd.h"
0024 #include "CondFormats/PPSObjects/interface/CTPPSPixelDAQMapping.h"
0025 #include "CondFormats/PPSObjects/interface/CTPPSPixelAnalysisMask.h"
0026 #include "FWCore/Utilities/interface/ESInputTag.h"
0027
0028 #include <cstdint>
0029
0030
0031
0032
0033
0034
0035 class WriteCTPPSPixelDAQMapping : public edm::one::EDAnalyzer<> {
0036 public:
0037 WriteCTPPSPixelDAQMapping(const edm::ParameterSet &ps);
0038 ~WriteCTPPSPixelDAQMapping() override {}
0039
0040 private:
0041 void analyze(const edm::Event &e, const edm::EventSetup &es) override;
0042 cond::Time_t daqmappingiov_;
0043 std::string record_;
0044 std::string label_;
0045
0046 edm::ESGetToken<CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd> tokenMapping_;
0047 };
0048
0049 using namespace std;
0050 using namespace edm;
0051
0052
0053
0054 WriteCTPPSPixelDAQMapping::WriteCTPPSPixelDAQMapping(const edm::ParameterSet &ps)
0055 : daqmappingiov_(ps.getParameter<unsigned long long>("daqmappingiov")),
0056 record_(ps.getParameter<string>("record")),
0057 label_(ps.getParameter<string>("label")),
0058 tokenMapping_(esConsumes<CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd>(edm::ESInputTag("", label_))) {}
0059
0060 void WriteCTPPSPixelDAQMapping::analyze(const edm::Event &, edm::EventSetup const &es) {
0061
0062
0063
0064
0065
0066
0067
0068
0069 const auto &mapping = es.getData(tokenMapping_);
0070
0071 edm::Service<cond::service::PoolDBOutputService> poolDbService;
0072 if (poolDbService.isAvailable()) {
0073 poolDbService->writeOneIOV(mapping, daqmappingiov_, record_);
0074 }
0075 }
0076
0077
0078
0079 DEFINE_FWK_MODULE(WriteCTPPSPixelDAQMapping);