CMS 3D CMS Logo

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

#include <RPCTwinMuxLinkMapHandler.h>

Inheritance diagram for RPCTwinMuxLinkMapHandler:
popcon::PopConSourceHandler< RPCAMCLinkMap >

Public Member Functions

void getNewObjects ()
 
std::string id () const
 
 RPCTwinMuxLinkMapHandler (edm::ParameterSet const &_config)
 
 ~RPCTwinMuxLinkMapHandler ()
 
- Public Member Functions inherited from popcon::PopConSourceHandler< RPCAMCLinkMap >
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 data_tag_
 
std::string id_
 
std::string input_file_
 
cond::Time_t since_run_
 
std::string txt_file_
 
std::vector< int > wheel_fed_
 
std::vector< std::vector< int > > wheel_sector_amc_
 
- Protected Attributes inherited from popcon::PopConSourceHandler< RPCAMCLinkMap >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Additional Inherited Members

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

Detailed Description

Definition at line 17 of file RPCTwinMuxLinkMapHandler.h.

Constructor & Destructor Documentation

RPCTwinMuxLinkMapHandler::RPCTwinMuxLinkMapHandler ( edm::ParameterSet const &  _config)

Definition at line 13 of file RPCTwinMuxLinkMapHandler.cc.

References edm::ParameterSet::getParameter(), and wheel_sector_amc_.

14  : id_(_config.getParameter<std::string>("identifier"))
15  , data_tag_(_config.getParameter<std::string>("dataTag"))
16  , since_run_(_config.getParameter<unsigned long long>("sinceRun"))
17  , input_file_(_config.getParameter<edm::FileInPath>("inputFile").fullPath())
18  , wheel_fed_(_config.getParameter<std::vector<int> >("wheelFED"))
19  , wheel_sector_amc_(std::vector<std::vector<int> >(5, std::vector<int>(12, 0)))
20  , txt_file_(_config.getUntrackedParameter<std::string>("txtFile", ""))
21 {
22  std::vector<long long> _wheel_sector_amc_packed(_config.getParameter<std::vector<long long> >("wheelSectorAMC"));
23  std::vector<std::vector<int> >::iterator _sector_amc = wheel_sector_amc_.begin();
24  for (std::vector<long long>::const_iterator _sector_amc_packed = _wheel_sector_amc_packed.begin()
25  ; _sector_amc_packed != _wheel_sector_amc_packed.end() ; ++_sector_amc_packed, ++_sector_amc)
26  for (unsigned int _sector = 0 ; _sector < 12 ; ++_sector)
27  _sector_amc->at(_sector) = ((*_sector_amc_packed) >> (11*4-4*_sector)) & 0xf;
28 }
std::vector< std::vector< int > > wheel_sector_amc_
std::string fullPath() const
Definition: FileInPath.cc:184
RPCTwinMuxLinkMapHandler::~RPCTwinMuxLinkMapHandler ( )

Definition at line 30 of file RPCTwinMuxLinkMapHandler.cc.

31 {}

Member Function Documentation

void RPCTwinMuxLinkMapHandler::getNewObjects ( )
virtual

Implements popcon::PopConSourceHandler< RPCAMCLinkMap >.

Definition at line 33 of file RPCTwinMuxLinkMapHandler.cc.

References Exception, RPCAMCLinkMap::getMap(), input_file_, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< RPCAMCLinkMap >::m_to_transfer, RPCLBLinkNameParser::parse(), since_run_, AlCaHLTBitMon_QueryRunRegistry::string, popcon::PopConSourceHandler< RPCAMCLinkMap >::tagInfo(), txt_file_, wheel_fed_, and wheel_sector_amc_.

34 {
35  edm::LogInfo("RPCTwinMuxLinkMapHandler") << "getNewObjects";
36  cond::TagInfo const & _tag_info = tagInfo();
37  if (since_run_ < _tag_info.lastInterval.first)
38  throw cms::Exception("RPCTwinMuxLinkMapHandler") << "Refuse to create RPCTwinMuxLinkMap for run " << since_run_
39  << ", older than most recent tag" << _tag_info.lastInterval.first;
40 
41  std::string _tm_name, _link_name;
42  int _wheel, _fed, _sector, _amc_number, _tm_input;
43 
44  RPCAMCLinkMap * _twinmux_link_map_object = new RPCAMCLinkMap();
45  RPCAMCLinkMap::map_type & _twinmux_link_map
46  = _twinmux_link_map_object->getMap();
47  RPCLBLink _lb_link;
48 
49  std::string _line;
50  std::istringstream _conv;
51 
52  std::ifstream _input_file(input_file_);
53 
54  _input_file >> _tm_name >> _tm_name >> _tm_input >> _link_name;
55  std::getline(_input_file, _line);
56 
57  while (_input_file) {
58  // parse AMC Slot Name - no checking: failure is an error
59  std::string::size_type _pos(2), _next(2);
60  _next = _tm_name.find_first_not_of("+-0123456789", _pos);
61  _conv.clear();
62  _conv.str(_tm_name.substr(_pos, _next - _pos));
63  _conv >> _wheel;
64 
65  _pos = _next + 2;
66  _next = _tm_name.find_first_not_of("+-0123456789", _pos);
67  if (_next == std::string::npos)
68  _next = _tm_name.size();
69  _conv.clear();
70  _conv.str(_tm_name.substr(_pos, _next - _pos));
71  _conv >> _sector;
72 
73  _fed = wheel_fed_.at(_wheel + 2);
74  _amc_number = wheel_sector_amc_.at(_wheel + 2).at(_sector - 1);
75 
76  RPCLBLinkNameParser::parse(_link_name, _lb_link);
77 
78  _twinmux_link_map.insert(std::pair<RPCAMCLink, RPCLBLink>(RPCAMCLink(_fed, _amc_number, _tm_input)
79  , _lb_link));
80 
81  _input_file >> _tm_name >> _tm_name >> _tm_input >> _link_name;
82  std::getline(_input_file, _line);
83  }
84  _input_file.close();
85 
86  if (!txt_file_.empty()) {
87  edm::LogInfo("RPCTwinMuxLinkMapHandler") << "Fill txtFile";
88  std::ofstream _ofstream(txt_file_);
89  for (RPCAMCLinkMap::map_type::const_iterator _link = _twinmux_link_map.begin()
90  ; _link != _twinmux_link_map.end() ; ++_link) {
91  _ofstream << _link->first << ": " << _link->second << std::endl;
92  }
93  }
94 
95  edm::LogInfo("RPCTwinMuxLinkMapHandler") << "Add to transfer list";
96  m_to_transfer.push_back(std::make_pair(_twinmux_link_map_object, since_run_));
97 }
std::vector< std::vector< int > > wheel_sector_amc_
uint16_t size_type
cond::ValidityInterval lastInterval
Definition: Types.h:74
map_type & getMap()
Definition: RPCAMCLinkMap.h:28
std::map< RPCAMCLink, RPCLBLink > map_type
Definition: RPCAMCLinkMap.h:14
static void parse(std::string const &_name, RPCLBLink &_lb_link)
std::string RPCTwinMuxLinkMapHandler::id ( ) const
virtual

Implements popcon::PopConSourceHandler< RPCAMCLinkMap >.

Definition at line 99 of file RPCTwinMuxLinkMapHandler.cc.

References id_.

100 {
101  return id_;
102 }

Member Data Documentation

std::string RPCTwinMuxLinkMapHandler::data_tag_
protected

Definition at line 29 of file RPCTwinMuxLinkMapHandler.h.

std::string RPCTwinMuxLinkMapHandler::id_
protected

Definition at line 28 of file RPCTwinMuxLinkMapHandler.h.

Referenced by id().

std::string RPCTwinMuxLinkMapHandler::input_file_
protected

Definition at line 32 of file RPCTwinMuxLinkMapHandler.h.

Referenced by getNewObjects().

cond::Time_t RPCTwinMuxLinkMapHandler::since_run_
protected

Definition at line 30 of file RPCTwinMuxLinkMapHandler.h.

Referenced by getNewObjects().

std::string RPCTwinMuxLinkMapHandler::txt_file_
protected

Definition at line 36 of file RPCTwinMuxLinkMapHandler.h.

Referenced by getNewObjects().

std::vector<int> RPCTwinMuxLinkMapHandler::wheel_fed_
protected

Definition at line 33 of file RPCTwinMuxLinkMapHandler.h.

Referenced by getNewObjects().

std::vector<std::vector<int> > RPCTwinMuxLinkMapHandler::wheel_sector_amc_
protected

Definition at line 34 of file RPCTwinMuxLinkMapHandler.h.

Referenced by getNewObjects(), and RPCTwinMuxLinkMapHandler().