CMS 3D CMS Logo

MuonHitHelper.cc
Go to the documentation of this file.
2 
3 bool MuonHitHelper::isDT(unsigned int detId) {
4  return (DetId(detId)).det() == DetId::Muon && (DetId(detId)).subdetId() == MuonSubdetId::DT;
5 }
6 
7 bool MuonHitHelper::isGEM(unsigned int detId) {
8  return (DetId(detId)).det() == DetId::Muon && (DetId(detId)).subdetId() == MuonSubdetId::GEM;
9 }
10 
11 bool MuonHitHelper::isCSC(unsigned int detId) {
12  return (DetId(detId)).det() == DetId::Muon && (DetId(detId)).subdetId() == MuonSubdetId::CSC;
13 }
14 
15 bool MuonHitHelper::isRPC(unsigned int detId) {
16  return (DetId(detId)).det() == DetId::Muon && (DetId(detId)).subdetId() == MuonSubdetId::RPC;
17 }
18 
19 bool MuonHitHelper::isME0(unsigned int detId) {
20  return (DetId(detId)).det() == DetId::Muon && (DetId(detId)).subdetId() == MuonSubdetId::ME0;
21 }
22 
23 int MuonHitHelper::chamber(const DetId& id) {
24  if (id.det() != DetId::Detector::Muon)
25  return -99;
26  int chamberN = 0;
27  switch (id.subdetId()) {
28  case MuonSubdetId::GEM:
29  chamberN = GEMDetId(id).chamber();
30  break;
31  case MuonSubdetId::RPC:
32  // works only for endcap!!
33  chamberN = RPCDetId(id).sector();
34  break;
35  case MuonSubdetId::CSC:
36  chamberN = CSCDetId(id).chamber();
37  break;
38  case MuonSubdetId::ME0:
39  chamberN = ME0DetId(id).chamber();
40  break;
41  case MuonSubdetId::DT:
42  chamberN = DTChamberId(id).sector();
43  break;
44  };
45  return chamberN;
46 }
47 
48 // return MuonType for a particular DetId
49 int MuonHitHelper::toGEMType(int st, int ri) {
50  if (st == 1) {
51  if (ri == 1)
52  return GEM_ME11;
53  } else if (st == 2) {
54  if (ri == 1)
55  return GEM_ME21;
56  }
57  return GEM_ALL;
58 }
59 
60 int MuonHitHelper::toRPCType(int re, int st, int ri) {
61  // endcap
62  if (std::abs(re) == 1) {
63  if (st == 1) {
64  if (ri == 2)
65  return RPC_ME12;
66  if (ri == 3)
67  return RPC_ME13;
68  } else if (st == 2) {
69  if (ri == 2)
70  return RPC_ME22;
71  if (ri == 3)
72  return RPC_ME23;
73  } else if (st == 3) {
74  if (ri == 1)
75  return RPC_ME31;
76  if (ri == 2)
77  return RPC_ME32;
78  if (ri == 3)
79  return RPC_ME33;
80  } else if (st == 4) {
81  if (ri == 1)
82  return RPC_ME41;
83  if (ri == 2)
84  return RPC_ME42;
85  if (ri == 3)
86  return RPC_ME43;
87  }
88  }
89  // Barrel
90  else {
91  if (ri == -2) {
92  if (st == 1)
93  return RPC_MB21n;
94  if (st == 2)
95  return RPC_MB22n;
96  if (st == 3)
97  return RPC_MB23n;
98  if (st == 4)
99  return RPC_MB24n;
100  } else if (ri == -1) {
101  if (st == 1)
102  return RPC_MB11n;
103  if (st == 2)
104  return RPC_MB12n;
105  if (st == 3)
106  return RPC_MB13n;
107  if (st == 4)
108  return RPC_MB14n;
109  } else if (ri == 0) {
110  if (st == 1)
111  return RPC_MB01;
112  if (st == 2)
113  return RPC_MB02;
114  if (st == 3)
115  return RPC_MB03;
116  if (st == 4)
117  return RPC_MB04;
118  } else if (ri == 1) {
119  if (st == 1)
120  return RPC_MB11p;
121  if (st == 2)
122  return RPC_MB12p;
123  if (st == 3)
124  return RPC_MB13p;
125  if (st == 4)
126  return RPC_MB14p;
127  } else if (ri == 2) {
128  if (st == 1)
129  return RPC_MB21p;
130  if (st == 2)
131  return RPC_MB22p;
132  if (st == 3)
133  return RPC_MB23p;
134  if (st == 4)
135  return RPC_MB24p;
136  }
137  }
138  return RPC_ALL;
139 }
140 
141 int MuonHitHelper::toDTType(int wh, int st) {
142  if (wh == -2) {
143  if (st == 1)
144  return DT_MB21n;
145  if (st == 2)
146  return DT_MB22n;
147  if (st == 3)
148  return DT_MB23n;
149  if (st == 4)
150  return DT_MB24n;
151  }
152  if (wh == -1) {
153  if (st == 1)
154  return DT_MB11n;
155  if (st == 2)
156  return DT_MB12n;
157  if (st == 3)
158  return DT_MB13n;
159  if (st == 4)
160  return DT_MB14n;
161  }
162  if (wh == 0) {
163  if (st == 1)
164  return DT_MB01;
165  if (st == 2)
166  return DT_MB02;
167  if (st == 3)
168  return DT_MB03;
169  if (st == 4)
170  return DT_MB04;
171  }
172  if (wh == 1) {
173  if (st == 1)
174  return DT_MB11p;
175  if (st == 2)
176  return DT_MB12p;
177  if (st == 3)
178  return DT_MB13p;
179  if (st == 4)
180  return DT_MB14p;
181  }
182  if (wh == 2) {
183  if (st == 1)
184  return DT_MB21p;
185  if (st == 2)
186  return DT_MB22p;
187  if (st == 3)
188  return DT_MB23p;
189  if (st == 4)
190  return DT_MB24p;
191  }
192  return DT_ALL;
193 }
194 
195 int MuonHitHelper::toCSCType(int st, int ri) {
196  if (st == 1) {
197  if (ri == 0)
198  return CSC_ME11;
199  if (ri == 1)
200  return CSC_ME1b;
201  if (ri == 2)
202  return CSC_ME12;
203  if (ri == 3)
204  return CSC_ME13;
205  if (ri == 4)
206  return CSC_ME1a;
207  } else if (st == 2) {
208  if (ri == 1)
209  return CSC_ME21;
210  if (ri == 2)
211  return CSC_ME22;
212  } else if (st == 3) {
213  if (ri == 1)
214  return CSC_ME31;
215  if (ri == 2)
216  return CSC_ME32;
217  } else if (st == 4) {
218  if (ri == 1)
219  return CSC_ME41;
220  if (ri == 2)
221  return CSC_ME42;
222  }
223  return CSC_ALL;
224 }
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
static int toCSCType(int st, int ri)
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
static constexpr int GEM
Definition: MuonSubdetId.h:14
static bool isCSC(unsigned int detId)
static bool isME0(unsigned int detId)
constexpr int chamber() const
Definition: GEMDetId.h:183
static int toGEMType(int st, int ri)
static int chamber(const DetId &id)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int chamber() const
Definition: CSCDetId.h:62
static constexpr int ME0
Definition: MuonSubdetId.h:15
static bool isRPC(unsigned int detId)
Definition: DetId.h:17
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:41
static constexpr int RPC
Definition: MuonSubdetId.h:13
static bool isGEM(unsigned int detId)
Definition: MuonHitHelper.cc:7
int sector() const
Definition: DTChamberId.h:52
static constexpr int DT
Definition: MuonSubdetId.h:11
static int toRPCType(int re, int st, int ri)
static int toDTType(int wh, int st)
static constexpr int CSC
Definition: MuonSubdetId.h:12