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

◆ RpcLinkMap()

omtf::RpcLinkMap::RpcLinkMap ( )
inline

Definition at line 34 of file OmtfLinkMappingRpc.h.

34 {}

Member Function Documentation

◆ init() [1/2]

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

Definition at line 78 of file OmtfLinkMappingRpc.cc.

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  }

References l1tstage2_dqm_sourceclient-live_cfg::fedId, edm::EventSetup::get(), get, 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 107 of file OmtfLinkMappingRpc.cc.

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  }

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 40 of file OmtfLinkMappingRpc.h.

40  {
41  return link2lbName.at(board).at(link);
42  }

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 44 of file OmtfLinkMappingRpc.h.

44  {
45  return lbName2link.at(board).at(lbName);
46  }

References lbName(), and lbName2link.

Referenced by init(), and lbName().

◆ omtfEleIndex()

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

Definition at line 138 of file OmtfLinkMappingRpc.cc.

138  {
139  const auto pos = lbName2OmtfIndex.find(lbName);
140  return pos != lbName2OmtfIndex.end() ? pos->second : std::vector<EleIndex>();
141  }

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 52 of file OmtfLinkMappingRpc.h.

Referenced by init(), and link().

◆ lbName2OmtfIndex

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

Definition at line 53 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 51 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:52
RPCOMTFLinkMapRcd
Definition: RPCOMTFLinkMapRcd.h:6
pos
Definition: PixelAliasList.h:18
omtf::RpcLinkMap::lbName
const std::string & lbName(const std::string &board, unsigned int link) const
Definition: OmtfLinkMappingRpc.h:40
MainPageGenerator.fName
fName
Definition: MainPageGenerator.py:301
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::ESHandle< RPCAMCLinkMap >
omtf::RpcLinkMap::link2lbName
std::map< std::string, std::map< unsigned int, std::string > > link2lbName
Definition: OmtfLinkMappingRpc.h:51
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
omtf::RpcLinkMap::lbName2OmtfIndex
std::map< std::string, std::vector< EleIndex > > lbName2OmtfIndex
Definition: OmtfLinkMappingRpc.h:53
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:82
get
#define get
RPCAMCLinkMap::getMap
map_type & getMap()
Definition: RPCAMCLinkMap.h:27
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
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:44
RPCAMCLinkMap::map_type
std::map< RPCAMCLink, RPCLBLink > map_type
Definition: RPCAMCLinkMap.h:13