test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
65 
66 std::ostream& operator<<( std::ostream& os, const CSCDetId& id )
67 {
68  // Note that there is no endl to end the output
69 
70  os << " E:" << id.endcap()
71  << " S:" << id.station()
72  << " R:" << id.ring()
73  << " C:" << id.chamber()
74  << " L:" << id.layer();
75  return os;
76 }
77 
int chamber() const
Definition: CSCDetId.h:68
int i
Definition: DBlmapReader.cc:9
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
tuple result
Definition: mps_fire.py:84
unsigned short iChamberType()
Definition: CSCDetId.h:107
int ring() const
Definition: CSCDetId.h:75
int triggerSector() const
Definition: CSCDetId.cc:3
int triggerCscId() const
Definition: CSCDetId.cc:23
int station() const
Definition: CSCDetId.h:86