CMS 3D CMS Logo

FebConnectorSpec.cc
Go to the documentation of this file.
4 #include <sstream>
5 
7  int num, const ChamberLocationSpec & chamber, const FebLocationSpec & feb)
8  : theLinkBoardInputNum(num),
9  theChamber(chamber),
10  theFeb(feb),
11  theAlgo(0),
12  theRawId(0)
13 { }
14 
15 const ChamberStripSpec FebConnectorSpec::strip( int pinNumber) const
16 {
17  int nStrips=theAlgo/10000;
18  int firstChamberStrip=(theAlgo-10000*nStrips)/100;
19  int pinAlgo=theAlgo-10000*nStrips-100*firstChamberStrip;
20  int slope=1;
21  if (pinAlgo > 3) {
22  pinAlgo=pinAlgo-4;
23  slope=-1;
24  }
25  bool valid=true;
26  if (pinNumber < pinAlgo) valid=false;
27  if (!pinAlgo && (pinNumber < 2)) valid=false;
28  if (pinAlgo && (pinNumber > pinAlgo+nStrips-1)) valid=false;
29  if (!pinAlgo && (pinNumber > nStrips+2 || pinNumber == 9)) valid=false;
30  int chamberStripNumber=-1;
31  if (valid) {
32  if (pinAlgo !=0) chamberStripNumber=firstChamberStrip+slope*(pinNumber-pinAlgo);
33  else if (pinNumber < 9) chamberStripNumber=firstChamberStrip+slope*(pinNumber-2);
34  else 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) return 0;
43  int firstChamberStrip=(theAlgo-10000*nStrips)/100;
44  int pinAlgo=theAlgo-10000*nStrips-100*firstChamberStrip;
45  int theStrip=firstChamberStrip+istrip;
46  if (pinAlgo>3) theStrip=firstChamberStrip-istrip;
47  return theStrip;
48 }
49 
50 const int FebConnectorSpec::cablePinNum(int istrip) const {
51  int nStrips = theAlgo/10000;
52  if (istrip<0 || istrip>nStrips-1) return 0;
53  int pinAlgo=theAlgo%100;
54  if (pinAlgo>3) pinAlgo=pinAlgo-4;
55  bool holeatpin9=(pinAlgo==0 && istrip>6);
56  int thePin = istrip+pinAlgo+holeatpin9+2*(pinAlgo==0);
57  return thePin;
58 }
59 
60 const uint32_t & FebConnectorSpec::rawId() const
61 {
62  DBSpecToDetUnit toDU;
63  if (!theRawId) theRawId = toDU(theChamber, theFeb);
64  return theRawId;
65 }
66 
67 
69 {
70  std::ostringstream str;
71  str << "FebConnectorSpec in LinkBoardNum ="<<linkBoardInputNum()
72  <<" rawId: " << rawId() <<std::endl;
73  RPCDetId aDet(rawId());
74  str<<aDet<<std::endl;
75  str << theChamber.print(depth)<< std::endl << theFeb.print(depth) ;
76  depth--;
77  if (depth >=0) {
78  int nStrips=theAlgo/10000;
79  for (int istrip=0; istrip<nStrips; istrip++) {
80  ChamberStripSpec aStrip={cablePinNum(istrip),chamberStripNum(istrip),cmsStripNum(istrip)};
81  str << aStrip.print(depth);
82  }
83  }
84  return str.str();
85 }
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]
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)