CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
omtf::RpcLinkMap Class Reference

#include <OmtfLinkMappingRpc.h>

Public Member Functions

void init (const edm::EventSetup &es)
 
void init (const std::string &fName)
 
const std::string & lbName (const std::string &board, unsigned int link) const
 
unsigned int link (const std::string &board, const std::string &lbName) const
 
std::vector< EleIndexomtfEleIndex (const std::string &lbName) const
 
 RpcLinkMap ()
 

Private Attributes

std::map< std::string, std::map< std::string, unsigned int > > lbName2link
 
std::map< std::string, std::vector< EleIndex > > lbName2OmtfIndex
 
std::map< std::string, std::map< unsigned int, std::string > > link2lbName
 

Detailed Description

Definition at line 32 of file OmtfLinkMappingRpc.h.

Constructor & Destructor Documentation

omtf::RpcLinkMap::RpcLinkMap ( )
inline

Definition at line 34 of file OmtfLinkMappingRpc.h.

References MainPageGenerator::fName, init, and AlCaHLTBitMon_QueryRunRegistry::string.

34 {}

Member Function Documentation

void omtf::RpcLinkMap::init ( const edm::EventSetup es)

Definition at line 78 of file OmtfLinkMappingRpc.cc.

References l1tstage2_dqm_sourceclient-live_cfg::fedId, edm::EventSetup::get(), RPCAMCLinkMap::getMap(), B2GTnPMonitor_cfi::item, MainPageGenerator::link, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by omtf::RpcPacker::init(), and omtf::RpcUnpacker::init().

78  {
80  es.get<RPCOMTFLinkMapRcd>().get(amcMapping);
81  const RPCAMCLinkMap::map_type& amcMap = amcMapping->getMap();
82 
83  for (const auto& item : amcMap) {
84  unsigned int fedId = item.first.getFED();
85  unsigned int amcSlot = item.first.getAMCNumber();
86  unsigned int link = item.first.getAMCInput();
87  std::string lbName = item.second.getName();
88 
89  std::string processorNameStr = "OMTF";
90  ;
91  if (fedId == 1380)
92  processorNameStr = "OMTFn";
93  else
94  processorNameStr = "OMTFp";
95  processorNameStr += std::to_string(amcSlot / 2 + 1);
96  std::string processorName = processorNameStr;
97 
98  std::map<unsigned int, std::string>& li2lb = link2lbName[processorName];
99  std::map<std::string, unsigned int>& lb2li = lbName2link[processorName];
100  li2lb[link] = lbName;
101  lb2li[lbName] = link;
102  EleIndex ele(processorName, link);
103  lbName2OmtfIndex[lbName].push_back(ele);
104  }
105  }
unsigned int link(const std::string &board, const std::string &lbName) const
std::map< std::string, std::map< unsigned int, std::string > > link2lbName
std::map< std::string, std::vector< EleIndex > > lbName2OmtfIndex
std::map< std::string, std::map< std::string, unsigned int > > lbName2link
map_type & getMap()
Definition: RPCAMCLinkMap.h:27
std::map< RPCAMCLink, RPCLBLink > map_type
Definition: RPCAMCLinkMap.h:13
const std::string & lbName(const std::string &board, unsigned int link) const
T get() const
Definition: EventSetup.h:73
void omtf::RpcLinkMap::init ( const std::string &  fName)

Definition at line 107 of file OmtfLinkMappingRpc.cc.

References MainPageGenerator::fName, mps_splice::line, MainPageGenerator::link, LogTrace, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

107  {
108  std::ifstream inFile;
109  inFile.open(fName);
110  if (inFile) {
111  LogTrace("") << " reading OmtfRpcLinksMap from: " << fName;
112  } else {
113  LogTrace("") << " Unable to open file " << fName;
114 
115  throw std::runtime_error("Unable to open OmtfRpcLinksMap file " + fName);
116  }
117 
119  while (std::getline(inFile, line)) {
120  line.erase(0, line.find_first_not_of(" \t\r\n")); //cut first character
121  if (line.empty() || !line.compare(0, 2, "--"))
122  continue; // empty or comment line
123  std::stringstream ss(line);
124  std::string processorName, lbName;
125  unsigned int link, dbId;
126  if (ss >> processorName >> link >> lbName >> dbId) {
127  std::map<unsigned int, std::string>& li2lb = link2lbName[processorName];
128  std::map<std::string, unsigned int>& lb2li = lbName2link[processorName];
129  li2lb[link] = lbName;
130  lb2li[lbName] = link;
131  EleIndex ele(processorName, link);
132  lbName2OmtfIndex[lbName].push_back(ele);
133  }
134  }
135  inFile.close();
136  }
unsigned int link(const std::string &board, const std::string &lbName) const
std::map< std::string, std::map< unsigned int, std::string > > link2lbName
std::map< std::string, std::vector< EleIndex > > lbName2OmtfIndex
std::map< std::string, std::map< std::string, unsigned int > > lbName2link
#define LogTrace(id)
const std::string & lbName(const std::string &board, unsigned int link) const
const std::string& omtf::RpcLinkMap::lbName ( const std::string &  board,
unsigned int  link 
) const
inline

Definition at line 40 of file OmtfLinkMappingRpc.h.

40  {
41  return link2lbName.at(board).at(link);
42  }
unsigned int link(const std::string &board, const std::string &lbName) const
std::map< std::string, std::map< unsigned int, std::string > > link2lbName
unsigned int omtf::RpcLinkMap::link ( const std::string &  board,
const std::string &  lbName 
) const
inline

Definition at line 44 of file OmtfLinkMappingRpc.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

44  {
45  return lbName2link.at(board).at(lbName);
46  }
std::map< std::string, std::map< std::string, unsigned int > > lbName2link
const std::string & lbName(const std::string &board, unsigned int link) const
std::vector< EleIndex > omtf::RpcLinkMap::omtfEleIndex ( const std::string &  lbName) const

Definition at line 138 of file OmtfLinkMappingRpc.cc.

Referenced by omtf::translateOmtf2Pact().

138  {
139  const auto pos = lbName2OmtfIndex.find(lbName);
140  return pos != lbName2OmtfIndex.end() ? pos->second : std::vector<EleIndex>();
141  }
std::map< std::string, std::vector< EleIndex > > lbName2OmtfIndex
const std::string & lbName(const std::string &board, unsigned int link) const

Member Data Documentation

std::map<std::string, std::map<std::string, unsigned int> > omtf::RpcLinkMap::lbName2link
private

Definition at line 52 of file OmtfLinkMappingRpc.h.

std::map<std::string, std::vector<EleIndex> > omtf::RpcLinkMap::lbName2OmtfIndex
private

Definition at line 53 of file OmtfLinkMappingRpc.h.

std::map<std::string, std::map<unsigned int, std::string> > omtf::RpcLinkMap::link2lbName
private

Definition at line 51 of file OmtfLinkMappingRpc.h.