CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 ()
 
std::string id () const
 
 RPCDCCLinkMapHandler (edm::ParameterSet const &_config)
 
 ~RPCDCCLinkMapHandler ()
 
- 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
< RPCDCCLinkMap
self
 
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)
 

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_
void setParameters(const edm::ParameterSet &connectionPset)
RPCDCCLinkMapHandler::~RPCDCCLinkMapHandler ( )

Definition at line 37 of file RPCDCCLinkMapHandler.cc.

38 {}

Member Function Documentation

void RPCDCCLinkMapHandler::getNewObjects ( )
virtual

Implements popcon::PopConSourceHandler< RPCDCCLinkMap >.

Definition at line 40 of file RPCDCCLinkMapHandler.cc.

References connect_, connection_, cond::persistency::ConnectionPool::createCoralSession(), Exception, RPCDCCLinkMap::getMap(), RPCLBLink::getName(), cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< RPCDCCLinkMap >::m_to_transfer, RPCLBLinkNameParser::parse(), 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  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 (RPCDCCLinkMap::map_type::const_iterator _link = _dcc_link_map.begin()
105  ; _link != _dcc_link_map.end() ; ++_link) {
106  _ofstream << _link->first << ": " << _link->second << std::endl;
107  }
108  }
109 
110  edm::LogInfo("RPCDCCLinkMapHandler") << "Add to transfer list";
111  m_to_transfer.push_back(std::make_pair(_dcc_link_map_object, since_run_));
112 }
std::map< RPCDCCLink, RPCLBLink > map_type
Definition: RPCDCCLinkMap.h:14
cond::persistency::ConnectionPool connection_
map_type & getMap()
Definition: RPCDCCLinkMap.h:28
cond::ValidityInterval lastInterval
Definition: Types.h:73
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
virtual

Implements popcon::PopConSourceHandler< RPCDCCLinkMap >.

Definition at line 114 of file RPCDCCLinkMapHandler.cc.

References id_.

115 {
116  return id_;
117 }

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().