CMS 3D CMS Logo

FebConnectorSpec.cc
Go to the documentation of this file.
4 #include <sstream>
5 
7  : theLinkBoardInputNum(num), theChamber(chamber), theFeb(feb), theAlgo(0), theRawId(0) {}
8 
10  : theLinkBoardInputNum(iOther.theLinkBoardInputNum),
11  theChamber(iOther.theChamber),
12  theFeb(iOther.theFeb),
13  theAlgo(iOther.theAlgo),
14  theRawId(iOther.theRawId.load()) {}
15 
18  theChamber = iOther.theChamber;
19  theFeb = iOther.theFeb;
20  theAlgo = iOther.theAlgo;
21  theRawId.store(iOther.theRawId.load());
22  return *this;
23 }
24 
25 const ChamberStripSpec FebConnectorSpec::strip(int pinNumber) const {
26  int nStrips = theAlgo / 10000;
27  int firstChamberStrip = (theAlgo - 10000 * nStrips) / 100;
28  int pinAlgo = theAlgo - 10000 * nStrips - 100 * firstChamberStrip;
29  int slope = 1;
30  if (pinAlgo > 3) {
31  pinAlgo = pinAlgo - 4;
32  slope = -1;
33  }
34  bool valid = true;
35  if (pinNumber < pinAlgo)
36  valid = false;
37  if (!pinAlgo && (pinNumber < 2))
38  valid = false;
39  if (pinAlgo && (pinNumber > pinAlgo + nStrips - 1))
40  valid = false;
41  if (!pinAlgo && (pinNumber > nStrips + 2 || pinNumber == 9))
42  valid = false;
43  int chamberStripNumber = -1;
44  if (valid) {
45  if (pinAlgo != 0)
46  chamberStripNumber = firstChamberStrip + slope * (pinNumber - pinAlgo);
47  else if (pinNumber < 9)
48  chamberStripNumber = firstChamberStrip + slope * (pinNumber - 2);
49  else
50  chamberStripNumber = firstChamberStrip + slope * (pinNumber - 3);
51  }
52  ChamberStripSpec aStrip = {pinNumber, chamberStripNumber, 0};
53  return aStrip;
54 }
55 
56 const int FebConnectorSpec::chamberStripNum(int istrip) const {
57  int nStrips = theAlgo / 10000;
58  if (istrip < 0 || istrip > nStrips - 1)
59  return 0;
60  int firstChamberStrip = (theAlgo - 10000 * nStrips) / 100;
61  int pinAlgo = theAlgo - 10000 * nStrips - 100 * firstChamberStrip;
62  int theStrip = firstChamberStrip + istrip;
63  if (pinAlgo > 3)
64  theStrip = firstChamberStrip - istrip;
65  return theStrip;
66 }
67 
68 const int FebConnectorSpec::cablePinNum(int istrip) const {
69  int nStrips = theAlgo / 10000;
70  if (istrip < 0 || istrip > nStrips - 1)
71  return 0;
72  int pinAlgo = theAlgo % 100;
73  if (pinAlgo > 3)
74  pinAlgo = pinAlgo - 4;
75  bool holeatpin9 = (pinAlgo == 0 && istrip > 6);
76  int thePin = istrip + pinAlgo + holeatpin9 + 2 * (pinAlgo == 0);
77  return thePin;
78 }
79 
80 uint32_t FebConnectorSpec::rawId() const {
81  DBSpecToDetUnit toDU;
82  if (!theRawId) {
83  uint32_t expected = 0;
84  theRawId.compare_exchange_strong(expected, toDU(theChamber, theFeb));
85  }
86  return theRawId.load();
87 }
88 
90  std::ostringstream str;
91  str << "FebConnectorSpec in LinkBoardNum =" << linkBoardInputNum() << " rawId: " << rawId() << std::endl;
92  RPCDetId aDet(rawId());
93  str << aDet << std::endl;
94  str << theChamber.print(depth) << std::endl << theFeb.print(depth);
95  depth--;
96  if (depth >= 0) {
97  int nStrips = theAlgo / 10000;
98  for (int istrip = 0; istrip < nStrips; istrip++) {
99  ChamberStripSpec aStrip = {cablePinNum(istrip), chamberStripNum(istrip), cmsStripNum(istrip)};
100  str << aStrip.print(depth);
101  }
102  }
103  return str.str();
104 }
uint32_t rawId() const
DetUnit to which data belongs.
static const double slope[3]
std::atomic< uint32_t > theRawId
std::string print(int depth=0) const
debug printout
FebConnectorSpec & operator=(FebConnectorSpec const &)
std::string print(int depth=0) const
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
int linkBoardInputNum() const
this FEB channel in LinkBoard
const int cmsStripNum(int istrip) const
FebLocationSpec theFeb
const ChamberStripSpec strip(int pinNumber) const
strip info for input pin
def load(fileName)
Definition: svgfig.py:547
FebConnectorSpec(int num=-1)
ChamberLocationSpec theChamber
std::string print(int depth=0) const
debug
std::string print(int depth=0) const
debug printout
const int chamberStripNum(int istrip) const
const int cablePinNum(int istrip) const
#define str(s)