CMS 3D CMS Logo

LinkBoardSpec.cc
Go to the documentation of this file.
1 
3 #include <sstream>
4 
5 LinkBoardSpec::LinkBoardSpec(bool m, int l, int n) : theMaster(m), theLinkBoardNumInLink(l), theCode(n) {}
6 
7 void LinkBoardSpec::add(const FebConnectorSpec& feb) { theFebs.push_back(feb); }
8 
9 const FebConnectorSpec* LinkBoardSpec::feb(int febInputNum) const {
10  //FIXME - temporary implementaion, to be replace by LUT (in preparation)
11  typedef std::vector<FebConnectorSpec>::const_iterator IT;
12  for (IT it = theFebs.begin(); it != theFebs.end(); it++) {
13  if (febInputNum == it->linkBoardInputNum())
14  return &(*it);
15  }
16  return nullptr;
17 }
18 
20  std::ostringstream lbName;
21  std::string char1Val[2] = {"B", "E"}; // 1,2
22  std::string char2Val[3] = {"N", "M", "P"}; // 0,1,2
23  std::string char4Val[9] = {"0", "1", "2", "3", "A", "B", "C", "D", "E"}; // 0,...,8
24  int n3 = theCode % 10;
25  int num3 = (theCode % 100) / 10;
26  int n2 = (theCode % 1000) / 100;
27  int n1 = (theCode % 10000) / 1000;
28  int wheel = (theCode % 100000) / 10000;
29  if (n2 == 0)
30  wheel = -wheel;
31  int sector = theCode / 100000;
32  std::string sign = "";
33  if (wheel > 0)
34  sign = "+";
35  lbName << "LB_R" << char1Val[n1 - 1] << sign << wheel << "_S" << sector << "_" << char1Val[n1 - 1] << char2Val[n2]
36  << num3 << char4Val[n3] << "_CH" << theLinkBoardNumInLink;
37  return lbName.str();
38 }
39 
41  std::ostringstream str;
42  std::string type = (theMaster) ? "master" : "slave";
43  str << " LinkBoardSpec: " << std::endl
44  << " --->" << type << " linkBoardNumInLink: " << theLinkBoardNumInLink << std::endl;
45  depth--;
46  if (depth >= 0) {
47  typedef std::vector<FebConnectorSpec>::const_iterator IT;
48  for (IT it = theFebs.begin(); it != theFebs.end(); it++)
49  str << (*it).print(depth);
50  }
51  return str.str();
52 }
void add(const FebConnectorSpec &feb)
attach feb
Definition: LinkBoardSpec.cc:7
std::string print(int depth=0) const
debud printout
std::string linkBoardName() const
LB name as in OMDS.
int theLinkBoardNumInLink
Definition: LinkBoardSpec.h:43
LinkBoardSpec()
dummy
Definition: LinkBoardSpec.h:16
const FebConnectorSpec * feb(int febInputNum) const
get Feb by its connection number to this board
Definition: LinkBoardSpec.cc:9
std::vector< LinkConnSpec >::const_iterator IT
std::vector< FebConnectorSpec > theFebs
Definition: LinkBoardSpec.h:45
#define str(s)