CMS 3D CMS Logo

CSCDetId.cc
Go to the documentation of this file.
2 
4  // UPDATED TO OCT 2005 - LGRAY Feb 2006
5 
6  int result;
7  int ring = this->ring();
8  int station = this->station();
9  int chamber = this->chamber();
10 
11  if (station > 1 && ring > 1) {
12  result = ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1; // ch 3-8->1, 9-14->2, ... 1,2 -> 6
13  } else {
14  result = (station != 1) ? ((static_cast<unsigned>(chamber - 2) & 0x1f) / 3) + 1 : // ch 2-4-> 1, 5-7->2, ...
15  ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1;
16  }
17 
18  // max sector is 6, some calculations give a value greater than six but this is expected.
19  return (result <= 6) ? result : 6;
20 }
21 
23  // UPDATED TO OCT 2005 - LGRAY Feb 2006
24 
25  int result;
26  int ring = this->ring();
27  int station = this->station();
28  int chamber = this->chamber();
29 
30  if (station == 1) {
31  result = (chamber) % 3 + 1; // 1,2,3
32  switch (ring) {
33  case 1:
34  break;
35  case 2:
36  result += 3; // 4,5,6
37  break;
38  case 3:
39  result += 6; // 7,8,9
40  break;
41  }
42  } else {
43  if (ring == 1) {
44  result = (chamber + 1) % 3 + 1; // 1,2,3
45  } else {
46  result = (chamber + 3) % 6 + 4; // 4,5,6,7,8,9
47  }
48  }
49  return result;
50 }
51 
52 unsigned short CSCDetId::iChamberType(unsigned short istation, unsigned short iring) {
53  int i = 2 * istation + iring; // i=2S+R ok for S=2, 3, 4
54  if (istation == 1) {
55  --i; // ring 1R -> i=1+R (2S+R-1=1+R for S=1)
56  if (i > 4)
57  i = 1; // But ring 1A (R=4) -> i=1
58  }
59  return i;
60 }
61 
63  const std::string eSign = endcap == 1 ? "+" : "-";
64  return "ME" + eSign + std::to_string(station) + "/" + std::to_string(ring) + "/" + std::to_string(chamber);
65 }
66 
68 
69 std::ostream& operator<<(std::ostream& os, const CSCDetId& id) {
70  // Note that there is no endl to end the output
71 
72  os << " E:" << id.endcap() << " S:" << id.station() << " R:" << id.ring() << " C:" << id.chamber()
73  << " L:" << id.layer();
74  return os;
75 }
int chamber() const
Definition: CSCDetId.h:62
std::ostream & operator<<(std::ostream &os, const CSCDetId &id)
Definition: CSCDetId.cc:69
int endcap() const
Definition: CSCDetId.h:85
unsigned short iChamberType() const
Definition: CSCDetId.h:96
int ring() const
Definition: CSCDetId.h:68
std::string chamberName() const
Definition: CSCDetId.cc:67
int triggerSector() const
Definition: CSCDetId.cc:3
int triggerCscId() const
Definition: CSCDetId.cc:22
int station() const
Definition: CSCDetId.h:79