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
 
const std::vector< EleIndex > & omtfEleIndex (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 28 of file OmtfLinkMappingRpc.h.

Constructor & Destructor Documentation

omtf::RpcLinkMap::RpcLinkMap ( )
inline

Definition at line 30 of file OmtfLinkMappingRpc.h.

References init, and AlCaHLTBitMon_QueryRunRegistry::string.

30 { }

Member Function Documentation

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

Definition at line 72 of file OmtfLinkMappingRpc.cc.

References l1t::stage2::layer2::fedId, edm::EventSetup::get(), RPCAMCLinkMap::getMap(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

72  {
73 
75  es.get<RPCOMTFLinkMapRcd>().get(amcMapping);
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  if (fedId==1380) processorNameStr = "OMTFn"; else processorNameStr = "OMTFp";
86  processorNameStr += std::to_string(amcSlot/2+1);
87  std::string processorName = processorNameStr;
88 
89  std::map< unsigned int, std::string > & li2lb = link2lbName[processorName];
90  std::map< std::string, unsigned int > & lb2li = lbName2link[processorName];
91  li2lb[link] = lbName;
92  lb2li[lbName] = link;
93  EleIndex ele(processorName, link);
94  lbName2OmtfIndex[lbName].push_back(ele);
95  }
96 }
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:28
std::map< RPCAMCLink, RPCLBLink > map_type
Definition: RPCAMCLinkMap.h:14
const T & get() const
Definition: EventSetup.h:55
const std::string & lbName(const std::string &board, unsigned int link) const
void omtf::RpcLinkMap::init ( const std::string &  fName)

Definition at line 98 of file OmtfLinkMappingRpc.cc.

References geometryCSVtoXML::line, LogTrace, and AlCaHLTBitMon_QueryRunRegistry::string.

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

36 { return link2lbName.at(board).at(link); }
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 38 of file OmtfLinkMappingRpc.h.

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

Definition at line 40 of file OmtfLinkMappingRpc.h.

Referenced by omtf::translateOmtf2Pact().

40 { return lbName2OmtfIndex.at(lbName); }
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 44 of file OmtfLinkMappingRpc.h.

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

Definition at line 45 of file OmtfLinkMappingRpc.h.

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

Definition at line 43 of file OmtfLinkMappingRpc.h.