CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 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 ()
 
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 >
Container m_iovs
 
std::vector< std::pair
< RPCDCCLinkMap *, Time_t > > 
m_to_transfer
 
std::string m_userTextLog
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< RPCDCCLinkMap >
typedef std::map< Time_t,
std::shared_ptr< RPCDCCLinkMap > > 
Container
 
typedef std::unique_ptr
< RPCDCCLinkMap
Ref
 
typedef PopConSourceHandler
< RPCDCCLinkMap
self
 
typedef cond::Time_t Time_t
 
typedef RPCDCCLinkMap value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< RPCDCCLinkMap >
cond::persistency::SessiondbSession () const
 

Detailed Description

Definition at line 17 of file RPCDCCLinkMapHandler.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file RPCDCCLinkMapHandler.cc.

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

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 }
cond::persistency::ConnectionPool connection_
void setParameters(const edm::ParameterSet &connectionPset)
Log< level::Info, false > LogInfo
tuple config
parse the configuration file
RPCDCCLinkMapHandler::~RPCDCCLinkMapHandler ( )
override

Definition at line 36 of file RPCDCCLinkMapHandler.cc.

36 {}

Member Function Documentation

void RPCDCCLinkMapHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< RPCDCCLinkMap >.

Definition at line 38 of file RPCDCCLinkMapHandler.cc.

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_.

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 }
std::map< RPCDCCLink, RPCLBLink > map_type
Definition: RPCDCCLinkMap.h:13
cond::persistency::ConnectionPool connection_
Iov_t lastInterval
Definition: Types.h:73
Time_t since
Definition: Types.h:53
std::vector< std::pair< RPCDCCLinkMap *, Time_t > > m_to_transfer
Log< level::Info, false > LogInfo
static void parse(std::string const &name, RPCLBLink &lb_link)
std::shared_ptr< coral::ISessionProxy > createCoralSession(const std::string &connectionString, bool writeCapable=false)
std::string RPCDCCLinkMapHandler::id ( ) const
overridevirtual

Implements popcon::PopConSourceHandler< RPCDCCLinkMap >.

Definition at line 109 of file RPCDCCLinkMapHandler.cc.

References id_.

109 { return id_; }

Member Data Documentation

std::string RPCDCCLinkMapHandler::connect_
protected

Definition at line 32 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects().

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

Definition at line 33 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects(), and RPCDCCLinkMapHandler().

std::string RPCDCCLinkMapHandler::data_tag_
protected

Definition at line 27 of file RPCDCCLinkMapHandler.h.

std::string RPCDCCLinkMapHandler::id_
protected

Definition at line 26 of file RPCDCCLinkMapHandler.h.

Referenced by id().

cond::Time_t RPCDCCLinkMapHandler::since_run_
protected

Definition at line 28 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects().

std::string RPCDCCLinkMapHandler::txt_file_
protected

Definition at line 30 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects().