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 }
MuonHitHelper::RPC_MB12n
Definition: MuonHitHelper.h:58
MuonSubdetId::GEM
static constexpr int GEM
Definition: MuonSubdetId.h:14
MuonHitHelper::chamber
static int chamber(const DetId &id)
Definition: MuonHitHelper.cc:23
MuonSubdetId::CSC
static constexpr int CSC
Definition: MuonSubdetId.h:12
MuonHitHelper::DT_MB14n
Definition: MuonHitHelper.h:85
MuonHitHelper::isME0
static bool isME0(unsigned int detId)
Definition: MuonHitHelper.cc:19
MuonHitHelper::DT_MB14p
Definition: MuonHitHelper.h:77
MuonHitHelper::toGEMType
static int toGEMType(int st, int ri)
Definition: MuonHitHelper.cc:49
MuonHitHelper::CSC_ME11
Definition: MuonHitHelper.h:16
MuonHitHelper::DT_MB24p
Definition: MuonHitHelper.h:81
RPCDetId
Definition: RPCDetId.h:16
MuonHitHelper::CSC_ME42
Definition: MuonHitHelper.h:26
MuonHitHelper::CSC_ME1a
Definition: MuonHitHelper.h:17
MuonHitHelper::DT_MB01
Definition: MuonHitHelper.h:70
MuonHitHelper::isGEM
static bool isGEM(unsigned int detId)
Definition: MuonHitHelper.cc:7
MuonHitHelper::RPC_ME31
Definition: MuonHitHelper.h:39
MuonHitHelper::CSC_ALL
Definition: MuonHitHelper.h:15
MuonHitHelper::isCSC
static bool isCSC(unsigned int detId)
Definition: MuonHitHelper.cc:11
MuonHitHelper::RPC_ME12
Definition: MuonHitHelper.h:35
MuonHitHelper::RPC_MB13n
Definition: MuonHitHelper.h:59
MuonHitHelper::DT_MB22n
Definition: MuonHitHelper.h:87
MuonHitHelper::DT_MB02
Definition: MuonHitHelper.h:71
MuonHitHelper::RPC_MB21p
Definition: MuonHitHelper.h:53
MuonHitHelper::RPC_MB12p
Definition: MuonHitHelper.h:50
MuonHitHelper::RPC_MB22p
Definition: MuonHitHelper.h:54
MuonHitHelper::DT_MB11n
Definition: MuonHitHelper.h:82
MuonHitHelper::RPC_ME13
Definition: MuonHitHelper.h:36
MuonHitHelper::DT_MB11p
Definition: MuonHitHelper.h:74
MuonHitHelper::isRPC
static bool isRPC(unsigned int detId)
Definition: MuonHitHelper.cc:15
DetId
Definition: DetId.h:17
MuonHitHelper::RPC_ME32
Definition: MuonHitHelper.h:40
MuonHitHelper::RPC_ME23
Definition: MuonHitHelper.h:38
MuonHitHelper::toDTType
static int toDTType(int wh, int st)
Definition: MuonHitHelper.cc:141
MuonHitHelper::RPC_MB23p
Definition: MuonHitHelper.h:55
MuonHitHelper::CSC_ME41
Definition: MuonHitHelper.h:25
MuonHitHelper::RPC_MB21n
Definition: MuonHitHelper.h:61
MuonHitHelper::RPC_MB22n
Definition: MuonHitHelper.h:62
MuonHitHelper::RPC_ME33
Definition: MuonHitHelper.h:41
MuonHitHelper::DT_MB13p
Definition: MuonHitHelper.h:76
MuonHitHelper::RPC_MB11n
Definition: MuonHitHelper.h:57
MuonHitHelper::GEM_ME11
Definition: MuonHitHelper.h:30
MuonHitHelper::CSC_ME13
Definition: MuonHitHelper.h:20
MuonHitHelper::CSC_ME12
Definition: MuonHitHelper.h:19
MuonSubdetId::DT
static constexpr int DT
Definition: MuonSubdetId.h:11
MuonHitHelper::RPC_MB04
Definition: MuonHitHelper.h:48
MuonHitHelper::RPC_ME41
Definition: MuonHitHelper.h:42
MuonHitHelper::RPC_ALL
Definition: MuonHitHelper.h:34
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:183
MuonHitHelper::DT_MB23n
Definition: MuonHitHelper.h:88
MuonHitHelper::DT_MB21n
Definition: MuonHitHelper.h:86
MuonHitHelper::DT_MB21p
Definition: MuonHitHelper.h:78
MuonHitHelper::DT_MB23p
Definition: MuonHitHelper.h:80
GEMDetId
Definition: GEMDetId.h:18
CSCDetId
Definition: CSCDetId.h:26
MuonHitHelper::DT_MB12n
Definition: MuonHitHelper.h:83
MuonHitHelper::RPC_ME43
Definition: MuonHitHelper.h:44
MuonHitHelper::CSC_ME22
Definition: MuonHitHelper.h:22
MuonHitHelper::toRPCType
static int toRPCType(int re, int st, int ri)
Definition: MuonHitHelper.cc:60
dumpRecoGeometry_cfg.Muon
Muon
Definition: dumpRecoGeometry_cfg.py:190
MuonHitHelper::RPC_MB14p
Definition: MuonHitHelper.h:52
MuonHitHelper::CSC_ME21
Definition: MuonHitHelper.h:21
CSCDetId::chamber
int chamber() const
Definition: CSCDetId.h:62
MuonHitHelper::CSC_ME31
Definition: MuonHitHelper.h:23
MuonHitHelper::GEM_ME21
Definition: MuonHitHelper.h:30
ME0DetId
Definition: ME0DetId.h:16
MuonHitHelper::DT_MB04
Definition: MuonHitHelper.h:73
MuonSubdetId::ME0
static constexpr int ME0
Definition: MuonSubdetId.h:15
MuonHitHelper::RPC_MB24p
Definition: MuonHitHelper.h:56
MuonHitHelper::RPC_ME22
Definition: MuonHitHelper.h:37
MuonHitHelper::RPC_MB24n
Definition: MuonHitHelper.h:64
MuonHitHelper::DT_MB22p
Definition: MuonHitHelper.h:79
MuonHitHelper::DT_MB12p
Definition: MuonHitHelper.h:75
MuonHitHelper::CSC_ME1b
Definition: MuonHitHelper.h:18
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
MuonHitHelper::RPC_MB03
Definition: MuonHitHelper.h:47
MuonHitHelper::RPC_MB02
Definition: MuonHitHelper.h:46
MuonSubdetId::RPC
static constexpr int RPC
Definition: MuonSubdetId.h:13
RPCDetId::sector
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
MuonHitHelper::DT_ALL
Definition: MuonHitHelper.h:69
ME0DetId::chamber
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:41
MuonHitHelper::DT_MB24n
Definition: MuonHitHelper.h:89
MuonHitHelper::RPC_MB11p
Definition: MuonHitHelper.h:49
MuonHitHelper::GEM_ALL
Definition: MuonHitHelper.h:30
MuonHitHelper::DT_MB13n
Definition: MuonHitHelper.h:84
MuonHitHelper::RPC_MB13p
Definition: MuonHitHelper.h:51
DetId::Muon
Definition: DetId.h:26
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DTChamberId
Definition: DTChamberId.h:14
MuonHitHelper::toCSCType
static int toCSCType(int st, int ri)
Definition: MuonHitHelper.cc:195
MuonHitHelper::RPC_ME42
Definition: MuonHitHelper.h:43
MuonHitHelper::RPC_MB23n
Definition: MuonHitHelper.h:63
MuonHitHelper::DT_MB03
Definition: MuonHitHelper.h:72
MuonHitHelper.h
MuonHitHelper::RPC_MB14n
Definition: MuonHitHelper.h:60
MuonHitHelper::isDT
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
MuonHitHelper::RPC_MB01
Definition: MuonHitHelper.h:45
MuonHitHelper::CSC_ME32
Definition: MuonHitHelper.h:24