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 RPCAMCLinkMap &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 30 of file OmtfLinkMappingRpc.h.

Constructor & Destructor Documentation

◆ RpcLinkMap()

omtf::RpcLinkMap::RpcLinkMap ( )
inline

Definition at line 32 of file OmtfLinkMappingRpc.h.

32 {}

Member Function Documentation

◆ init() [1/2]

void omtf::RpcLinkMap::init ( const RPCAMCLinkMap es)

Definition at line 75 of file OmtfLinkMappingRpc.cc.

75  {
76  const RPCAMCLinkMap::map_type& amcMap = amcMapping.getMap();
77 
78  for (const auto& item : amcMap) {
79  unsigned int fedId = item.first.getFED();
80  unsigned int amcSlot = item.first.getAMCNumber();
81  unsigned int link = item.first.getAMCInput();
82  std::string lbName = item.second.getName();
83 
84  std::string processorNameStr = "OMTF";
85  ;
86  if (fedId == 1380)
87  processorNameStr = "OMTFn";
88  else
89  processorNameStr = "OMTFp";
90  processorNameStr += std::to_string(amcSlot / 2 + 1);
91  std::string processorName = processorNameStr;
92 
93  std::map<unsigned int, std::string>& li2lb = link2lbName[processorName];
94  std::map<std::string, unsigned int>& lb2li = lbName2link[processorName];
95  li2lb[link] = lbName;
96  lb2li[lbName] = link;
97  EleIndex ele(processorName, link);
98  lbName2OmtfIndex[lbName].push_back(ele);
99  }
100  }

References l1tstage2_dqm_sourceclient-live_cfg::fedId, RPCAMCLinkMap::getMap(), B2GTnPMonitor_cfi::item, lbName(), lbName2link, lbName2OmtfIndex, link(), link2lbName, and AlCaHLTBitMon_QueryRunRegistry::string.

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

◆ init() [2/2]

void omtf::RpcLinkMap::init ( const std::string &  fName)

Definition at line 102 of file OmtfLinkMappingRpc.cc.

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

References MainPageGenerator::fName, lbName(), lbName2link, lbName2OmtfIndex, mps_splice::line, link(), link2lbName, LogTrace, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ lbName()

const std::string& omtf::RpcLinkMap::lbName ( const std::string &  board,
unsigned int  link 
) const
inline

Definition at line 38 of file OmtfLinkMappingRpc.h.

38  {
39  return link2lbName.at(board).at(link);
40  }

References link(), and link2lbName.

Referenced by init(), link(), and omtfEleIndex().

◆ link()

unsigned int omtf::RpcLinkMap::link ( const std::string &  board,
const std::string &  lbName 
) const
inline

Definition at line 42 of file OmtfLinkMappingRpc.h.

42  {
43  return lbName2link.at(board).at(lbName);
44  }

References lbName(), and lbName2link.

Referenced by init(), and lbName().

◆ omtfEleIndex()

std::vector< EleIndex > omtf::RpcLinkMap::omtfEleIndex ( const std::string &  lbName) const

Definition at line 133 of file OmtfLinkMappingRpc.cc.

133  {
134  const auto pos = lbName2OmtfIndex.find(lbName);
135  return pos != lbName2OmtfIndex.end() ? pos->second : std::vector<EleIndex>();
136  }

References lbName(), and lbName2OmtfIndex.

Referenced by omtf::translateOmtf2Pact().

Member Data Documentation

◆ lbName2link

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

Definition at line 50 of file OmtfLinkMappingRpc.h.

Referenced by init(), and link().

◆ lbName2OmtfIndex

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

Definition at line 51 of file OmtfLinkMappingRpc.h.

Referenced by init(), and omtfEleIndex().

◆ link2lbName

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

Definition at line 49 of file OmtfLinkMappingRpc.h.

Referenced by init(), and lbName().

omtf::RpcLinkMap::lbName2link
std::map< std::string, std::map< std::string, unsigned int > > lbName2link
Definition: OmtfLinkMappingRpc.h:50
pos
Definition: PixelAliasList.h:18
omtf::RpcLinkMap::lbName
const std::string & lbName(const std::string &board, unsigned int link) const
Definition: OmtfLinkMappingRpc.h:38
MainPageGenerator.fName
fName
Definition: MainPageGenerator.py:301
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
omtf::RpcLinkMap::link2lbName
std::map< std::string, std::map< unsigned int, std::string > > link2lbName
Definition: OmtfLinkMappingRpc.h:49
omtf::RpcLinkMap::lbName2OmtfIndex
std::map< std::string, std::vector< EleIndex > > lbName2OmtfIndex
Definition: OmtfLinkMappingRpc.h:51
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:89
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
mps_splice.line
line
Definition: mps_splice.py:76
omtf::RpcLinkMap::link
unsigned int link(const std::string &board, const std::string &lbName) const
Definition: OmtfLinkMappingRpc.h:42
RPCAMCLinkMap::map_type
std::map< RPCAMCLink, RPCLBLink > map_type
Definition: RPCAMCLinkMap.h:13