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 }
FebLocationSpec::print
std::string print(int depth=0) const
Definition: FebLocationSpec.cc:11
ChamberLocationSpec
Definition: ChamberLocationSpec.h:11
DBSpecToDetUnit
Definition: DBSpecToDetUnit.h:8
FebConnectorSpec::theFeb
FebLocationSpec theFeb
Definition: FebConnectorSpec.h:58
FebConnectorSpec::strip
const ChamberStripSpec strip(int pinNumber) const
strip info for input pin
Definition: FebConnectorSpec.cc:9
RPCDetId
Definition: RPCDetId.h:16
FebConnectorSpec::FebConnectorSpec
FebConnectorSpec(int num=-1)
Definition: FebConnectorSpec.h:25
FebConnectorSpec::print
std::string print(int depth=0) const
debug
Definition: FebConnectorSpec.cc:71
ChamberStripSpec
Definition: ChamberStripSpec.h:11
ChamberLocationSpec::print
std::string print(int depth=0) const
debug printout
Definition: ChamberLocationSpec.cc:4
FebConnectorSpec::theChamber
ChamberLocationSpec theChamber
Definition: FebConnectorSpec.h:57
FebConnectorSpec::cablePinNum
const int cablePinNum(int istrip) const
Definition: FebConnectorSpec.cc:52
FebConnectorSpec::chamberStripNum
const int chamberStripNum(int istrip) const
Definition: FebConnectorSpec.cc:40
str
#define str(s)
Definition: TestProcessor.cc:51
FebConnectorSpec::theAlgo
int theAlgo
Definition: FebConnectorSpec.h:60
FebConnectorSpec::rawId
const uint32_t & rawId() const
DetUnit to which data belongs.
Definition: FebConnectorSpec.cc:64
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCDetId.h
FebConnectorSpec.h
FebConnectorSpec::theRawId
uint32_t theRawId
Definition: FebConnectorSpec.h:61
ChamberStripSpec::print
std::string print(int depth=0) const
debug printout
Definition: ChamberStripSpec.cc:4
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
me0TriggerPseudoDigis_cff.nStrips
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
Definition: me0TriggerPseudoDigis_cff.py:26
FebLocationSpec
Definition: FebLocationSpec.h:12
DBSpecToDetUnit.h
FebConnectorSpec::linkBoardInputNum
int linkBoardInputNum() const
this FEB channel in LinkBoard
Definition: FebConnectorSpec.h:29
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6
FebConnectorSpec::cmsStripNum
const int cmsStripNum(int istrip) const
Definition: FebConnectorSpec.h:47