CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
62 bool CSCDetId::isME1a() const { return iChamberType(station(), ring()) == 1; }
63 bool CSCDetId::isME1b() const { return iChamberType(station(), ring()) == 2; }
64 bool CSCDetId::isME11() const { return isME1a() or isME1b(); }
65 bool CSCDetId::isME12() const { return iChamberType(station(), ring()) == 3; }
66 bool CSCDetId::isME13() const { return iChamberType(station(), ring()) == 4; }
67 bool CSCDetId::isME21() const { return iChamberType(station(), ring()) == 5; }
68 bool CSCDetId::isME22() const { return iChamberType(station(), ring()) == 6; }
69 bool CSCDetId::isME31() const { return iChamberType(station(), ring()) == 7; }
70 bool CSCDetId::isME32() const { return iChamberType(station(), ring()) == 8; }
71 bool CSCDetId::isME41() const { return iChamberType(station(), ring()) == 9; }
72 bool CSCDetId::isME42() const { return iChamberType(station(), ring()) == 10; }
73 
74 std::string CSCDetId::chamberName(int endcap, int station, int ring, int chamber) {
75  const std::string eSign = endcap == 1 ? "+" : "-";
76  return "ME" + eSign + std::to_string(station) + "/" + std::to_string(ring) + "/" + std::to_string(chamber);
77 }
78 
79 std::string CSCDetId::layerName(int endcap, int station, int ring, int chamber, int layer) {
80  const std::string eSign = endcap == 1 ? "+" : "-";
81  return "ME" + eSign + std::to_string(station) + "/" + std::to_string(ring) + "/" + std::to_string(chamber) + "/" +
82  std::to_string(layer);
83 }
84 
86  // ME1a, ME1b, ME12, ME13, ME21, ME22, ME31, ME32, ME41, ME42
87  const unsigned stations[10] = {1, 1, 1, 1, 2, 2, 3, 3, 4, 4};
88  const std::string rings[10] = {"A", "B", "2", "3", "1", "2", "1", "2", "1", "2"};
89  return "ME" + std::to_string(stations[chamberType - 1]) + rings[chamberType - 1];
90 }
91 
93 
95 
96 std::ostream& operator<<(std::ostream& os, const CSCDetId& id) {
97  // Note that there is no endl to end the output
98 
99  os << " E:" << id.endcap() << " S:" << id.station() << " R:" << id.ring() << " C:" << id.chamber()
100  << " L:" << id.layer();
101  return os;
102 }
bool isME1a() const
Definition: CSCDetId.cc:62
int chamber() const
Definition: CSCDetId.h:62
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
bool isME13() const
Definition: CSCDetId.cc:66
std::string to_string(const V &value)
Definition: OMSAccess.h:71
bool isME1b() const
Definition: CSCDetId.cc:63
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
int layer() const
Definition: CSCDetId.h:56
bool isME12() const
Definition: CSCDetId.cc:65
constexpr std::array< uint8_t, layerIndexSize > layer
tuple result
Definition: mps_fire.py:311
int endcap() const
Definition: CSCDetId.h:85
bool isME32() const
Definition: CSCDetId.cc:70
bool isME11() const
Definition: CSCDetId.cc:64
bool isME21() const
Definition: CSCDetId.cc:67
unsigned short iChamberType() const
Definition: CSCDetId.h:96
bool isME41() const
Definition: CSCDetId.cc:71
std::string layerName() const
Definition: CSCDetId.cc:94
int ring() const
Definition: CSCDetId.h:68
std::string chamberName() const
Definition: CSCDetId.cc:92
bool isME22() const
Definition: CSCDetId.cc:68
int triggerSector() const
Definition: CSCDetId.cc:3
bool isME42() const
Definition: CSCDetId.cc:72
int triggerCscId() const
Definition: CSCDetId.cc:22
int station() const
Definition: CSCDetId.h:79
bool isME31() const
Definition: CSCDetId.cc:69