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 
6 
7 
8 CSCDetId::CSCDetId(uint32_t id):DetId(id) {
10  throw cms::Exception("InvalidDetId") << "CSCDetId ctor:"
11  << " det: " << det()
12  << " subdet: " << subdetId()
13  << " is not a valid CSC id";
14  }
15 }
16 
19  throw cms::Exception("InvalidDetId") << "CSCDetId ctor:"
20  << " det: " << det()
21  << " subdet: " << subdetId()
22  << " is not a valid CSC id";
23  }
24 }
25 
26 CSCDetId::CSCDetId( int iendcap, int istation, int iring, int ichamber,
27  int ilayer ) :
28  DetId(DetId::Muon, MuonSubdetId::CSC)
29 {
30  if (iendcap < 0 || iendcap > MAX_ENDCAP ||
31  istation < 0 || istation > MAX_STATION ||
32  iring < 0 || iring > MAX_RING ||
33  ichamber < 0 || ichamber > MAX_CHAMBER ||
34  ilayer < 0 || ilayer > MAX_LAYER ) {
35  throw cms::Exception("InvalidDetId") << "CSCDetId ctor:"
36  << " Invalid parameters: "
37  << " E:"<< iendcap
38  << " S:"<< istation
39  << " R:"<< iring
40  << " C:"<< ichamber
41  << " L:"<< ilayer
42  << std::endl;
43  }
44  id_ |= init(iendcap, istation, iring, ichamber, ilayer);
45 }
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:70
int i
Definition: DBlmapReader.cc:9
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
CSCDetId()
Definition: CSCDetId.cc:5
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:109
int ring() const
Definition: CSCDetId.h:77
Definition: DetId.h:18
static uint32_t init(int iendcap, int istation, int iring, int ichamber, int ilayer)
Definition: CSCDetId.h:255
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:88
Detector det() const
get the detector field from this detid
Definition: DetId.h:35