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 ( 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 {
32  edm::LogInfo("RPCDCCLinkMapHandler") << "Configuring Input Connection";
33  connection_.setParameters(config.getParameter<edm::ParameterSet>("DBParameters"));
35 }
cond::persistency::ConnectionPool connection_
Definition: config.py:1
void setParameters(const edm::ParameterSet &connectionPset)
RPCDCCLinkMapHandler::~RPCDCCLinkMapHandler ( )
override

Definition at line 37 of file RPCDCCLinkMapHandler.cc.

38 {}

Member Function Documentation

void RPCDCCLinkMapHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< RPCDCCLinkMap >.

Definition at line 40 of file RPCDCCLinkMapHandler.cc.

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

41 {
42  edm::LogInfo("RPCDCCLinkMapHandler") << "getNewObjects";
43  cond::TagInfo const & tag_info = tagInfo();
44  if (since_run_ < tag_info.lastInterval.first)
45  throw cms::Exception("RPCDCCLinkMapHandler") << "Refuse to create RPCDCCLinkMap for run " << since_run_
46  << ", older than most recent tag" << tag_info.lastInterval.first;
47 
48  edm::LogInfo("RPCDCCLinkMapHandler") << "Opening read-only Input Session";
49  auto input_session = connection_.createCoralSession(connect_, false); // writeCapable
50  edm::LogInfo("RPCDCCLinkMapHandler") << "Started Input Transaction";
51  input_session->transaction().start(true); // readOnly
52 
53  std::auto_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");
58 
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");
63 
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);
69 
70  int dcc(0), dcc_input(0), tb_input(0);
71  std::string lb_name("");
72 
73  std::unique_ptr<RPCDCCLinkMap> dcc_link_map_object(new RPCDCCLinkMap());
74  RPCDCCLinkMap::map_type & dcc_link_map
75  = dcc_link_map_object->getMap();
76  RPCLBLink lb_link;
77 
78  edm::LogInfo("RPCDCCLinkMapHandler") << "Execute query";
79  coral::ICursor & cursor(query->execute());
80  while (cursor.next()) {
81  coral::AttributeList const & row(cursor.currentRow());
82 
83  // RPCLBLink
84  lb_name = row["LB_NAME"].data<std::string>();
85  RPCLBLinkNameParser::parse(lb_name, lb_link);
86  if (lb_name != lb_link.getName())
87  edm::LogWarning("RPCDCCLinkMapHandler") << "Mismatch LinkBoard Name: " << lb_name << " vs " << lb_link;
88  lb_link.setLinkBoard().setConnector(); // MLB to link
89 
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>();
93 
94  dcc_link_map.insert(std::pair<RPCDCCLink, RPCLBLink>(RPCDCCLink(dcc, dcc_input, tb_input)
95  , lb_link));
96  }
97  cursor.close();
98 
99  input_session->transaction().commit();
100 
101  if (!txt_file_.empty()) {
102  edm::LogInfo("RPCDCCLinkMapHandler") << "Fill txtFile";
103  std::ofstream ofstream(txt_file_);
104  for (auto const & link : dcc_link_map) {
105  ofstream << link.first << ": " << link.second << std::endl;
106  }
107  }
108 
109  edm::LogInfo("RPCDCCLinkMapHandler") << "Add to transfer list";
110  m_to_transfer.push_back(std::make_pair(dcc_link_map_object.release(), since_run_));
111 }
std::map< RPCDCCLink, RPCLBLink > map_type
Definition: RPCDCCLinkMap.h:14
cond::persistency::ConnectionPool connection_
def query(query_str, verbose=False)
Definition: das.py:5
Definition: query.py:1
cond::ValidityInterval lastInterval
Definition: Types.h:75
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 113 of file RPCDCCLinkMapHandler.cc.

References id_.

114 {
115  return id_;
116 }

Member Data Documentation

std::string RPCDCCLinkMapHandler::connect_
protected

Definition at line 34 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects().

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

Definition at line 35 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects(), and RPCDCCLinkMapHandler().

std::string RPCDCCLinkMapHandler::data_tag_
protected

Definition at line 29 of file RPCDCCLinkMapHandler.h.

std::string RPCDCCLinkMapHandler::id_
protected

Definition at line 28 of file RPCDCCLinkMapHandler.h.

Referenced by id().

cond::Time_t RPCDCCLinkMapHandler::since_run_
protected

Definition at line 30 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects().

std::string RPCDCCLinkMapHandler::txt_file_
protected

Definition at line 32 of file RPCDCCLinkMapHandler.h.

Referenced by getNewObjects().