File indexing completed on 2024-04-06 12:02:08
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/DTMapWrite.h"
0018 #include "CondFormats/DTObjects/interface/DTReadOutMapping.h"
0019
0020 #include <string>
0021 #include <map>
0022 #include <iostream>
0023 #include <fstream>
0024
0025 namespace edmtest {
0026
0027 DTMapWrite::DTMapWrite(edm::ParameterSet const& p) {}
0028
0029 DTMapWrite::DTMapWrite(int i) {}
0030
0031 void DTMapWrite::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 DTMapWrite::endJob() {
0037 std::cout << "DTMapWrite::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 DTReadOutMapping ro_map("cmssw_ROB", "cmssw_ROS");
0045 int status = 0;
0046 std::ifstream ifile("testMap.txt");
0047 int ddu;
0048 int ros;
0049 int rob;
0050 int tdc;
0051 int cha;
0052 int whe;
0053 int sta;
0054 int sec;
0055 int qua;
0056 int lay;
0057 int cel;
0058 while (ifile >> ddu >> ros >> rob >> tdc >> cha >> whe >> sta >> sec >> qua >> lay >> cel) {
0059 status = ro_map.insertReadOutGeometryLink(ddu, ros, rob, tdc, cha, whe, sta, sec, qua, lay, cel);
0060 std::cout << ddu << " " << ros << " " << rob << " " << tdc << " " << cha << " " << whe << " " << sta << " " << sec
0061 << " " << qua << " " << lay << " " << cel << " -> ";
0062 std::cout << "insert status: " << status << std::endl;
0063 }
0064 if (dbservice->isNewTagRequest("DTReadOutMappingRcd")) {
0065 dbservice->createOneIOV<DTReadOutMapping>(ro_map, dbservice->beginOfTime(), "DTReadOutMappingRcd");
0066 } else {
0067 std::cout << "already present tag" << std::endl;
0068
0069
0070 }
0071 }
0072 DEFINE_FWK_MODULE(DTMapWrite);
0073 }