CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
RPCDCCLinkMapHandler Class Reference

#include <RPCDCCLinkMapHandler.h>

Inheritance diagram for RPCDCCLinkMapHandler:
popcon::PopConSourceHandler< RPCDCCLinkMap >

Public Member Functions

void getNewObjects () override
 
std::string id () const override
 
 RPCDCCLinkMapHandler (edm::ParameterSet const &config)
 
 ~RPCDCCLinkMapHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< RPCDCCLinkMap >
void convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const *, std::string const > operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
void sort ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Protected Attributes

std::string connect_
 
cond::persistency::ConnectionPool connection_
 
std::string data_tag_
 
std::string id_
 
cond::Time_t since_run_
 
std::string txt_file_
 
- Protected Attributes inherited from popcon::PopConSourceHandler< RPCDCCLinkMap >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< RPCDCCLinkMap >
typedef std::vector< Triplet > Container
 
typedef std::vector< std::pair< RPCDCCLinkMap *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< RPCDCCLinkMapself
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef RPCDCCLinkMap value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< RPCDCCLinkMap >
int add (value_type *payload, Summary *summary, Time_t time)
 
cond::persistency::SessiondbSession () const
 

Detailed Description

Definition at line 17 of file RPCDCCLinkMapHandler.h.

Constructor & Destructor Documentation

◆ RPCDCCLinkMapHandler()

RPCDCCLinkMapHandler::RPCDCCLinkMapHandler ( edm::ParameterSet const &  config)

Definition at line 25 of file RPCDCCLinkMapHandler.cc.

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";
32  connection_.setParameters(config.getParameter<edm::ParameterSet>("DBParameters"));
34 }

References cond::persistency::ConnectionPool::configure(), connection_, and cond::persistency::ConnectionPool::setParameters().

◆ ~RPCDCCLinkMapHandler()

RPCDCCLinkMapHandler::~RPCDCCLinkMapHandler ( )
override

Definition at line 36 of file RPCDCCLinkMapHandler.cc.

36 {}

Member Function Documentation

◆ getNewObjects()

void RPCDCCLinkMapHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< RPCDCCLinkMap >.

Definition at line 38 of file RPCDCCLinkMapHandler.cc.

38  {
39  edm::LogInfo("RPCDCCLinkMapHandler") << "getNewObjects";
40  cond::TagInfo_t const& tag_info = tagInfo();
41  if (since_run_ < tag_info.lastInterval.since)
42  throw cms::Exception("RPCDCCLinkMapHandler") << "Refuse to create RPCDCCLinkMap for run " << since_run_
43  << ", older than most recent tag" << tag_info.lastInterval.since;
44 
45  edm::LogInfo("RPCDCCLinkMapHandler") << "Opening read-only Input Session";
46  auto input_session = connection_.createCoralSession(connect_, false); // writeCapable
47  edm::LogInfo("RPCDCCLinkMapHandler") << "Started Input Transaction";
48  input_session->transaction().start(true); // readOnly
49 
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");
55 
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");
60 
61  coral::AttributeList query_condition_data;
62  query->setCondition(
63  "TRIGGERBOARD.DCCBOARD_DCCBOARDID=DCCBOARD.DCCBOARDID"
64  " AND BOARDBOARDCONN.BOARD_COLLECTORBOARDID=TRIGGERBOARD.TRIGGERBOARDID"
65  " AND BOARD.BOARDID=BOARDBOARDCONN.BOARD_BOARDID",
66  query_condition_data);
67 
68  int dcc(0), dcc_input(0), tb_input(0);
69  std::string lb_name("");
70 
71  std::unique_ptr<RPCDCCLinkMap> dcc_link_map_object(new RPCDCCLinkMap());
72  RPCDCCLinkMap::map_type& dcc_link_map = dcc_link_map_object->getMap();
73  RPCLBLink lb_link;
74 
75  edm::LogInfo("RPCDCCLinkMapHandler") << "Execute query";
76  coral::ICursor& cursor(query->execute());
77  while (cursor.next()) {
78  coral::AttributeList const& row(cursor.currentRow());
79 
80  // RPCLBLink
81  lb_name = row["LB_NAME"].data<std::string>();
82  RPCLBLinkNameParser::parse(lb_name, lb_link);
83  if (lb_name != lb_link.getName())
84  edm::LogWarning("RPCDCCLinkMapHandler") << "Mismatch LinkBoard Name: " << lb_name << " vs " << lb_link;
85  lb_link.setLinkBoard().setConnector(); // MLB to link
86 
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>();
90 
91  dcc_link_map.insert(std::pair<RPCDCCLink, RPCLBLink>(RPCDCCLink(dcc, dcc_input, tb_input), lb_link));
92  }
93  cursor.close();
94 
95  input_session->transaction().commit();
96 
97  if (!txt_file_.empty()) {
98  edm::LogInfo("RPCDCCLinkMapHandler") << "Fill txtFile";
99  std::ofstream ofstream(txt_file_);
100  for (auto const& link : dcc_link_map) {
101  ofstream << link.first << ": " << link.second << std::endl;
102  }
103  }
104 
105  edm::LogInfo("RPCDCCLinkMapHandler") << "Add to transfer list";
106  m_to_transfer.push_back(std::make_pair(dcc_link_map_object.release(), since_run_));
107 }

References connect_, connection_, cond::persistency::ConnectionPool::createCoralSession(), Exception, RPCLBLink::getName(), cond::TagInfo_t::lastInterval, MainPageGenerator::link, popcon::PopConSourceHandler< RPCDCCLinkMap >::m_to_transfer, RPCLBLinkNameParser::parse(), contentValuesFiles::query, RPCLBLink::setConnector(), RPCLBLink::setLinkBoard(), cond::Iov_t::since, since_run_, AlCaHLTBitMon_QueryRunRegistry::string, popcon::PopConSourceHandler< RPCDCCLinkMap >::tagInfo(), and txt_file_.

◆ id()

std::string RPCDCCLinkMapHandler::id ( ) const
overridevirtual

Implements popcon::PopConSourceHandler< RPCDCCLinkMap >.

Definition at line 109 of file RPCDCCLinkMapHandler.cc.

109 { return id_; }

References id_.

Member Data Documentation

◆ connect_

std::string RPCDCCLinkMapHandler::connect_
protected

Definition at line 32 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects().

◆ connection_

cond::persistency::ConnectionPool RPCDCCLinkMapHandler::connection_
protected

Definition at line 33 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects(), and RPCDCCLinkMapHandler().

◆ data_tag_

std::string RPCDCCLinkMapHandler::data_tag_
protected

Definition at line 27 of file RPCDCCLinkMapHandler.h.

◆ id_

std::string RPCDCCLinkMapHandler::id_
protected

Definition at line 26 of file RPCDCCLinkMapHandler.h.

Referenced by id().

◆ since_run_

cond::Time_t RPCDCCLinkMapHandler::since_run_
protected

Definition at line 28 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects().

◆ txt_file_

std::string RPCDCCLinkMapHandler::txt_file_
protected

Definition at line 30 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects().

RPCLBLinkNameParser::parse
static void parse(std::string const &name, RPCLBLink &lb_link)
Definition: RPCLBLinkNameParser.cc:7
popcon::PopConSourceHandler< RPCDCCLinkMap >::m_to_transfer
OldContainer m_to_transfer
Definition: PopConSourceHandler.h:162
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
cond::persistency::ConnectionPool::createCoralSession
std::shared_ptr< coral::ISessionProxy > createCoralSession(const std::string &connectionString, bool writeCapable=false)
Definition: ConnectionPool.cc:167
edm::LogInfo
Definition: MessageLogger.h:254
config
Definition: config.py:1
RPCDCCLinkMapHandler::txt_file_
std::string txt_file_
Definition: RPCDCCLinkMapHandler.h:30
RPCDCCLinkMapHandler::connect_
std::string connect_
Definition: RPCDCCLinkMapHandler.h:32
query
Definition: query.py:1
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
edm::ParameterSet
Definition: ParameterSet.h:36
popcon::PopConSourceHandler< RPCDCCLinkMap >::tagInfo
cond::TagInfo_t const & tagInfo() const
Definition: PopConSourceHandler.h:78
RPCDCCLinkMapHandler::id_
std::string id_
Definition: RPCDCCLinkMapHandler.h:26
cond::Iov_t::since
Time_t since
Definition: Types.h:53
cond::persistency::ConnectionPool::setParameters
void setParameters(const edm::ParameterSet &connectionPset)
Definition: ConnectionPool.cc:39
cond::persistency::ConnectionPool::configure
void configure()
Definition: ConnectionPool.cc:125
RPCDCCLinkMap::map_type
std::map< RPCDCCLink, RPCLBLink > map_type
Definition: RPCDCCLinkMap.h:13
RPCDCCLinkMapHandler::data_tag_
std::string data_tag_
Definition: RPCDCCLinkMapHandler.h:27
cond::TagInfo_t::lastInterval
Iov_t lastInterval
Definition: Types.h:73
Exception
Definition: hltDiff.cc:246
RPCDCCLinkMap
Definition: RPCDCCLinkMap.h:11
contentValuesFiles.query
query
Definition: contentValuesFiles.py:38
RPCDCCLinkMapHandler::since_run_
cond::Time_t since_run_
Definition: RPCDCCLinkMapHandler.h:28
cond::TagInfo_t
Definition: Types.h:69
RPCDCCLinkMapHandler::connection_
cond::persistency::ConnectionPool connection_
Definition: RPCDCCLinkMapHandler.h:33