13 #include "RelationalAccess/ICursor.h"
14 #include "RelationalAccess/IQuery.h"
15 #include "RelationalAccess/IQueryDefinition.h"
16 #include "RelationalAccess/ISchema.h"
17 #include "RelationalAccess/ISessionProxy.h"
18 #include "RelationalAccess/ITransaction.h"
20 #include "CoralBase/Attribute.h"
21 #include "CoralBase/AttributeList.h"
26 : id_(config.getParameter<std::
string>(
"identifier")),
27 data_tag_(config.getParameter<std::
string>(
"dataTag")),
28 since_run_(config.getParameter<unsigned long long>(
"sinceRun")),
29 txt_file_(config.getUntrackedParameter<std::
string>(
"txtFile",
"")),
30 connect_(config.getParameter<std::
string>(
"connect")) {
31 edm::LogInfo(
"RPCDCCLinkMapHandler") <<
"Configuring Input Connection";
45 edm::LogInfo(
"RPCDCCLinkMapHandler") <<
"Opening read-only Input Session";
47 edm::LogInfo(
"RPCDCCLinkMapHandler") <<
"Started Input Transaction";
48 input_session->transaction().start(
true);
50 std::unique_ptr<coral::IQuery>
query(input_session->schema(
"CMS_RPC_CONF").newQuery());
51 query->addToTableList(
"DCCBOARD");
52 query->addToTableList(
"TRIGGERBOARD");
53 query->addToTableList(
"BOARDBOARDCONN");
54 query->addToTableList(
"BOARD");
56 query->addToOutputList(
"DCCBOARD.FEDNUMBER",
"DCC");
57 query->addToOutputList(
"TRIGGERBOARD.DCCINPUTCHANNELNUM",
"DCC_INPUT");
58 query->addToOutputList(
"BOARDBOARDCONN.COLLECTORBOARDINPUTNUM",
"TB_INPUT");
59 query->addToOutputList(
"BOARD.NAME",
"LB_NAME");
61 coral::AttributeList query_condition_data;
63 "TRIGGERBOARD.DCCBOARD_DCCBOARDID=DCCBOARD.DCCBOARDID"
64 " AND BOARDBOARDCONN.BOARD_COLLECTORBOARDID=TRIGGERBOARD.TRIGGERBOARDID"
65 " AND BOARD.BOARDID=BOARDBOARDCONN.BOARD_BOARDID",
66 query_condition_data);
68 int dcc(0), dcc_input(0), tb_input(0);
71 std::unique_ptr<RPCDCCLinkMap> dcc_link_map_object(
new RPCDCCLinkMap());
76 coral::ICursor& cursor(
query->execute());
77 while (cursor.next()) {
78 coral::AttributeList
const& row(cursor.currentRow());
83 if (lb_name != lb_link.
getName())
84 edm::LogWarning(
"RPCDCCLinkMapHandler") <<
"Mismatch LinkBoard Name: " << lb_name <<
" vs " << lb_link;
87 dcc = row[
"DCC"].data<
long long>();
88 dcc_input = row[
"DCC_INPUT"].data<
long long>();
89 tb_input = row[
"TB_INPUT"].data<
long long>();
91 dcc_link_map.insert(std::pair<RPCDCCLink, RPCLBLink>(
RPCDCCLink(dcc, dcc_input, tb_input), lb_link));
95 input_session->transaction().commit();
100 for (
auto const&
link : dcc_link_map) {
101 ofstream <<
link.first <<
": " <<
link.second << std::endl;
105 edm::LogInfo(
"RPCDCCLinkMapHandler") <<
"Add to transfer list";
std::map< RPCDCCLink, RPCLBLink > map_type
cond::persistency::ConnectionPool connection_
void getNewObjects() override
RPCLBLink & setConnector(int connector=wildcard_)
RPCDCCLinkMapHandler(edm::ParameterSet const &config)
void setParameters(const edm::ParameterSet &connectionPset)
std::vector< std::pair< RPCDCCLinkMap *, Time_t > > m_to_transfer
std::string getName() const
Log< level::Info, false > LogInfo
T getParameter(std::string const &) const
tuple config
parse the configuration file
RPCLBLink & setLinkBoard(int linkboard=wildcard_)
static void parse(std::string const &name, RPCLBLink &lb_link)
std::shared_ptr< coral::ISessionProxy > createCoralSession(const std::string &connectionString, bool writeCapable=false)
~RPCDCCLinkMapHandler() override
std::string id() const override
cond::TagInfo_t const & tagInfo() const