CMS 3D CMS Logo

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