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"))
32 edm::LogInfo(
"RPCDCCLinkMapHandler") <<
"Configuring Input Connection";
46 <<
", older than most recent tag" << tag_info.
lastInterval.first;
48 edm::LogInfo(
"RPCDCCLinkMapHandler") <<
"Opening read-only Input Session";
50 edm::LogInfo(
"RPCDCCLinkMapHandler") <<
"Started Input Transaction";
51 input_session->transaction().start(
true);
53 std::unique_ptr<coral::IQuery>
query(input_session->schema(
"CMS_RPC_CONF").newQuery());
54 query->addToTableList(
"DCCBOARD");
55 query->addToTableList(
"TRIGGERBOARD");
56 query->addToTableList(
"BOARDBOARDCONN");
57 query->addToTableList(
"BOARD");
59 query->addToOutputList(
"DCCBOARD.FEDNUMBER",
"DCC");
60 query->addToOutputList(
"TRIGGERBOARD.DCCINPUTCHANNELNUM",
"DCC_INPUT");
61 query->addToOutputList(
"BOARDBOARDCONN.COLLECTORBOARDINPUTNUM",
"TB_INPUT");
62 query->addToOutputList(
"BOARD.NAME",
"LB_NAME");
64 coral::AttributeList query_condition_data;
65 query->setCondition(
"TRIGGERBOARD.DCCBOARD_DCCBOARDID=DCCBOARD.DCCBOARDID" 66 " AND BOARDBOARDCONN.BOARD_COLLECTORBOARDID=TRIGGERBOARD.TRIGGERBOARDID" 67 " AND BOARD.BOARDID=BOARDBOARDCONN.BOARD_BOARDID" 68 , query_condition_data);
70 int dcc(0), dcc_input(0), tb_input(0);
73 std::unique_ptr<RPCDCCLinkMap> dcc_link_map_object(
new RPCDCCLinkMap());
75 = dcc_link_map_object->getMap();
79 coral::ICursor & cursor(
query->execute());
80 while (cursor.next()) {
81 coral::AttributeList
const & row(cursor.currentRow());
86 if (lb_name != lb_link.
getName())
87 edm::LogWarning(
"RPCDCCLinkMapHandler") <<
"Mismatch LinkBoard Name: " << lb_name <<
" vs " << lb_link;
90 dcc = row[
"DCC"].data<
long long>();
91 dcc_input = row[
"DCC_INPUT"].data<
long long>();
92 tb_input = row[
"TB_INPUT"].data<
long long>();
94 dcc_link_map.insert(std::pair<RPCDCCLink, RPCLBLink>(
RPCDCCLink(dcc, dcc_input, tb_input)
99 input_session->transaction().commit();
104 for (
auto const & link : dcc_link_map) {
105 ofstream << link.first <<
": " << link.second << std::endl;
109 edm::LogInfo(
"RPCDCCLinkMapHandler") <<
"Add to transfer list";
std::map< RPCDCCLink, RPCLBLink > map_type
cond::persistency::ConnectionPool connection_
T getParameter(std::string const &) const
void getNewObjects() override
RPCLBLink & setConnector(int connector=wildcard_)
RPCDCCLinkMapHandler(edm::ParameterSet const &config)
def query(query_str, verbose=False)
OldContainer m_to_transfer
void setParameters(const edm::ParameterSet &connectionPset)
cond::ValidityInterval lastInterval
std::string getName() const
std::string id() const override
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
cond::TagInfo_t const & tagInfo() const