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