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.
3 #include <iostream>
4 
5 #ifdef EDM_ML_DEBUG
6 CSCDetId::CSCDetId(uint32_t id):DetId(id) {
8  throw cms::Exception("InvalidDetId") << "CSCDetId ctor:"
9  << " det: " << det()
10  << " subdet: " << subdetId()
11  << " is not a valid CSC id";
12  }
13 }
14 
17  throw cms::Exception("InvalidDetId") << "CSCDetId ctor:"
18  << " det: " << det()
19  << " subdet: " << subdetId()
20  << " is not a valid CSC id";
21  }
22 }
23 
24 CSCDetId::CSCDetId( int iendcap, int istation, int iring, int ichamber,
25  int ilayer ) :
26  DetId(DetId::Muon, MuonSubdetId::CSC)
27 {
28  if (iendcap < 0 || iendcap > MAX_ENDCAP ||
29  istation < 0 || istation > MAX_STATION ||
30  iring < 0 || iring > MAX_RING ||
31  ichamber < 0 || ichamber > MAX_CHAMBER ||
32  ilayer < 0 || ilayer > MAX_LAYER ) {
33  throw cms::Exception("InvalidDetId") << "CSCDetId ctor:"
34  << " Invalid parameters: "
35  << " E:"<< iendcap
36  << " S:"<< istation
37  << " R:"<< iring
38  << " C:"<< ichamber
39  << " L:"<< ilayer
40  << std::endl;
41  }
42  id_ |= init(iendcap, istation, iring, ichamber, ilayer);
43 }
44 
45 #endif
46 
48 {
49  // UPDATED TO OCT 2005 - LGRAY Feb 2006
50 
51  int result;
52  int ring = this->ring();
53  int station = this->station();
54  int chamber = this->chamber();
55 
56  if(station > 1 && ring > 1 ) {
57  result = ((static_cast<unsigned>(chamber-3) & 0x7f) / 6) + 1; // ch 3-8->1, 9-14->2, ... 1,2 -> 6
58  }
59  else {
60  result = (station != 1) ? ((static_cast<unsigned>(chamber-2) & 0x1f) / 3) + 1 : // ch 2-4-> 1, 5-7->2, ...
61  ((static_cast<unsigned>(chamber-3) & 0x7f) / 6) + 1;
62  }
63 
64  return (result <= 6) ? result : 6; // max sector is 6, some calculations give a value greater than six but this is expected.
65 }
66 
68 {
69  // UPDATED TO OCT 2005 - LGRAY Feb 2006
70 
71  int result;
72  int ring = this->ring();
73  int station = this->station();
74  int chamber = this->chamber();
75 
76  if( station == 1 ) {
77  result = (chamber) % 3 + 1; // 1,2,3
78  switch (ring) {
79  case 1:
80  break;
81  case 2:
82  result += 3; // 4,5,6
83  break;
84  case 3:
85  result += 6; // 7,8,9
86  break;
87  }
88  }
89  else {
90  if( ring == 1 ) {
91  result = (chamber+1) % 3 + 1; // 1,2,3
92  }
93  else {
94  result = (chamber+3) % 6 + 4; // 4,5,6,7,8,9
95  }
96  }
97  return result;
98 }
99 
100 unsigned short CSCDetId::iChamberType( unsigned short istation, unsigned short iring ) {
101  int i = 2 * istation + iring; // i=2S+R ok for S=2, 3, 4
102  if ( istation == 1 ) {
103  --i; // ring 1R -> i=1+R (2S+R-1=1+R for S=1)
104  if ( i > 4 ) i = 1; // But ring 1A (R=4) -> i=1
105  }
106  return i;
107 }
108 
109 
110 std::ostream& operator<<( std::ostream& os, const CSCDetId& id )
111 {
112  // Note that there is no endl to end the output
113 
114  os << " E:" << id.endcap()
115  << " S:" << id.station()
116  << " R:" << id.ring()
117  << " C:" << id.chamber()
118  << " L:" << id.layer();
119  return os;
120 }
121 
int chamber() const
Definition: CSCDetId.h:81
int i
Definition: DBlmapReader.cc:9
void init(int region, int ring, int station, int sector, int layer, int subsector, int roll)
Definition: RPCDetId.cc:213
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
CSCDetId()
Definition: CSCDetId.h:34
static const int CSC
Definition: MuonSubdetId.h:13
tuple result
Definition: query.py:137
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
unsigned short iChamberType()
Definition: CSCDetId.h:120
int ring() const
Definition: CSCDetId.h:88
Definition: DetId.h:18
uint32_t id_
Definition: DetId.h:55
</a ></td >< td >< ahref="RecoLocalMuon_CSCRecHit.html"> csc2DRecHits</a ></td >< tdclass="description"> CSC(x, y) rechits</td >< td >T.Cox</td ></tr >< tr >< td >< a href
int triggerSector() const
Definition: CSCDetId.cc:47
int triggerCscId() const
Definition: CSCDetId.cc:67
int station() const
Definition: CSCDetId.h:99
Detector det() const
get the detector field from this detid
Definition: DetId.h:35