File indexing completed on 2023-03-17 10:46:50
0001
0002
0003
0004
0005
0006
0007
0008 #include <stdexcept>
0009 #include <string>
0010 #include <iostream>
0011 #include <map>
0012 #include "FWCore/Framework/interface/MakerMacros.h"
0013
0014 #include "FWCore/ServiceRegistry/interface/Service.h"
0015 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0016
0017 #include "CondFormats/DTObjects/test/stubs/DTRangeT0Write.h"
0018 #include "CondFormats/DTObjects/interface/DTRangeT0.h"
0019
0020 #include <string>
0021 #include <map>
0022 #include <iostream>
0023 #include <fstream>
0024
0025 namespace edmtest {
0026
0027 DTRangeT0Write::DTRangeT0Write(edm::ParameterSet const& p) {}
0028
0029 DTRangeT0Write::DTRangeT0Write(int i) {}
0030
0031 void DTRangeT0Write::analyze(const edm::Event& e, const edm::EventSetup& context) {
0032 std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
0033 std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl;
0034 }
0035
0036 void DTRangeT0Write::endJob() {
0037 std::cout << "DTRangeT0Write::analyze " << std::endl;
0038 edm::Service<cond::service::PoolDBOutputService> dbservice;
0039 if (!dbservice.isAvailable()) {
0040 std::cout << "db service unavailable" << std::endl;
0041 return;
0042 }
0043
0044 DTRangeT0 rt0("cmssw_rt0");
0045
0046 int status = 0;
0047 std::ifstream ifile("testRT0.txt");
0048 int whe;
0049 int sta;
0050 int sec;
0051 int qua;
0052 int t0min;
0053 int t0max;
0054 while (ifile >> whe >> sta >> sec >> qua >> t0min >> t0max) {
0055 status = rt0.set(whe, sta, sec, qua, t0min, t0max);
0056 std::cout << whe << " " << sta << " " << sec << " " << qua << " " << t0min << " " << t0max << " -> ";
0057 std::cout << "insert status: " << status << std::endl;
0058 }
0059
0060 if (dbservice->isNewTagRequest("DTRangeT0Rcd")) {
0061 dbservice->createOneIOV<DTRangeT0>(rt0, dbservice->beginOfTime(), "DTRangeT0Rcd");
0062 } else {
0063 std::cout << "already present tag" << std::endl;
0064
0065
0066 }
0067 }
0068 DEFINE_FWK_MODULE(DTRangeT0Write);
0069 }