CMS 3D CMS Logo

PtAssignmentEngineAux.cc
Go to the documentation of this file.
2 
3 // _____________________________________________________________________________
4 static const int GMT_eta_from_theta[128] = {
5  239, 235, 233, 230, 227, 224, 222, 219, 217, 214, 212, 210, 207, 205, 203, 201, 199, 197, 195, 193, 191, 189,
6  187, 186, 184, 182, 180, 179, 177, 176, 174, 172, 171, 169, 168, 166, 165, 164, 162, 161, 160, 158, 157, 156,
7  154, 153, 152, 151, 149, 148, 147, 146, 145, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131,
8  130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 116, 115, 114, 113, 112, 111, 110,
9  110, 109, 108, 107, 106, 106, 105, 104, 103, 102, 102, 101, 100, 99, 99, 98, 97, 96, 96, 95, 94, 93,
10  93, 92, 91, 91, 90, 89, 89, 88, 87, 87, 86, 85, 84, 84, 83, 83, 82, 81};
11 
13  // compressed pt = pt*2 (scale) + 1 (pt = 0 is empty candidate)
14  int gmt_pt = (pt * 2) + 1;
15  gmt_pt = (gmt_pt > 511) ? 511 : gmt_pt;
16  return gmt_pt;
17 }
18 
19 float PtAssignmentEngineAux::getPtFromGMTPt(int gmt_pt) const {
20  float pt = (gmt_pt <= 0) ? 0 : 0.5 * (gmt_pt - 1);
21  return pt;
22 }
23 
25  // convert phi into gmt scale according to DN15-017
26  // full scale is -16 to 100, or 116 values, covers range -10 to 62.5 deg
27  // my internal ph scale is 0..5000, covers from -22 to 63.333 deg
28  // converted to GMT scale it is from -35 to 95
29  // bt_phi * 107.01/4096, equivalent to bt_phi * 6849/0x40000
30  phi *= 6849;
31  phi >>= 18; // divide by 0x40000
32  phi -= 35; // offset of -22 deg
33  return phi;
34 }
35 
37  // convert phi into gmt scale according to DN15-017
38  phi *= 6991;
39  phi >>= 18; // divide by 0x40000
40  phi -= 35; // offset of -22 deg
41  return phi;
42 }
43 
44 int PtAssignmentEngineAux::getGMTEta(int theta, int endcap) const { // [-1,+1]
45  if (theta < 0)
46  return 0;
47  if (endcap == -1 && theta > 127)
48  return -240;
49  if (endcap == +1 && theta > 127)
50  return 239;
51 
53  if (endcap == -1)
54  eta = -eta;
55  return eta;
56 }
57 
58 int PtAssignmentEngineAux::getGMTQuality(int mode, int theta, bool promoteMode7, int version) const {
59  int quality = 0;
60 
61  if (version == 2) { // 2018 mode <--> quality mapping
62  switch (mode) {
63  case 15:
64  quality = 15;
65  break;
66  case 14:
67  quality = 14;
68  break;
69  case 13:
70  quality = 13;
71  break;
72  case 12:
73  quality = 7;
74  break;
75  case 11:
76  quality = 12;
77  break;
78  case 10:
79  quality = 10;
80  break;
81  case 9:
82  quality = 9;
83  break;
84  case 7:
85  quality = 11;
86  break;
87  case 6:
88  quality = 6;
89  break;
90  case 5:
91  quality = 5;
92  break;
93  case 3:
94  quality = 4;
95  break;
96  default:
97  quality = 0;
98  break;
99  }
100 
101  if (theta > 88) { // if (eta < 1.19)
102  quality /= 4;
103  }
104  } // End 2018 mode <--> quality mapping
105 
106  else { // 2016 and 2017 mode <--> quality mapping
107  if (theta > 87) { // if (eta < 1.2)
108  switch (mode) {
109  case 15:
110  quality = 8;
111  break;
112  case 14:
113  quality = 4;
114  break;
115  case 13:
116  quality = 4;
117  break;
118  case 12:
119  quality = 4;
120  break;
121  case 11:
122  quality = 4;
123  break;
124  default:
125  quality = 4;
126  break;
127  }
128  } else {
129  switch (mode) {
130  case 15:
131  quality = 12;
132  break;
133  case 14:
134  quality = 12;
135  break;
136  case 13:
137  quality = 12;
138  break;
139  case 12:
140  quality = 8;
141  break;
142  case 11:
143  quality = 12;
144  break;
145  case 10:
146  quality = 8;
147  break;
148  case 7:
149  quality = 8;
150  break;
151  default:
152  quality = 4;
153  break;
154  }
155  }
156  quality |= (mode & 3);
157  } // End 2016 and 2017 mode <--> quality mapping
158 
159  // Fix for missing CSC LCTs in ME1/1, including dead "water-leak" chambers ME1/1/34 and 35
160  if (promoteMode7 && mode == 7 && theta <= 50)
161  quality = 12;
162 
163  return quality;
164 }
165 
166 std::pair<int, int> PtAssignmentEngineAux::getGMTCharge(int mode, const std::vector<int>& phidiffs) const {
167  // -1 = postive physical charge to match pdgId code (i.e. -13 is positive, anti-muon). +1 = negative physical charge.
168  // Also matches DN-2015/017 format for track finder --> uGMT interface format, where 0 indicates positive, 1 negative.
169  int emuCharge = 0;
170 
171  // Note: sign_ph[0] == 1 in firmware actually translates to phidiffs[0] >= 0 (instead of phidiffs[0] > 0 in the old emulator)
172  // The effect needs to be checked
173 
174  switch (mode) {
175  case 15: // 1-2-3-4
176  if (phidiffs[0] >= 0) // 1-2 (should use > 0)
177  emuCharge = 1;
178  else if (phidiffs[0] == 0 && phidiffs[1] < 0) // 1-3
179  emuCharge = 1;
180  else if (phidiffs[1] == 0 && phidiffs[2] < 0) // 1-4
181  emuCharge = 1;
182  else
183  emuCharge = -1;
184  break;
185 
186  case 14: // 1-2-3
187  if (phidiffs[0] < 0) // 1-2
188  emuCharge = -1;
189  else if (phidiffs[0] == 0 && phidiffs[1] < 0) // 1-3
190  emuCharge = -1;
191  else
192  emuCharge = 1;
193  break;
194 
195  case 13: // 1-2-4
196  if (phidiffs[0] >= 0) // 1-2 (should use > 0)
197  emuCharge = 1;
198  else if (phidiffs[0] == 0 && phidiffs[2] < 0) // 1-4
199  emuCharge = 1;
200  else
201  emuCharge = -1;
202  break;
203 
204  case 12: // 1-2
205  if (phidiffs[0] >= 0) // 1-2
206  emuCharge = 1;
207  else
208  emuCharge = -1;
209  break;
210 
211  case 11: // 1-3-4
212  if (phidiffs[1] >= 0) // 1-3 (should use > 0)
213  emuCharge = 1;
214  else if (phidiffs[1] == 0 && phidiffs[2] < 0) // 1-4
215  emuCharge = 1;
216  else
217  emuCharge = -1;
218  break;
219 
220  case 10: // 1-3
221  if (phidiffs[1] >= 0) // 1-3
222  emuCharge = 1;
223  else
224  emuCharge = -1;
225  break;
226 
227  case 9: // 1-4
228  if (phidiffs[2] >= 0) // 1-4
229  emuCharge = 1;
230  else
231  emuCharge = -1;
232  break;
233 
234  case 7: // 2-3-4
235  if (phidiffs[3] >= 0) // 2-3 (should use > 0)
236  emuCharge = 1;
237  else if (phidiffs[3] == 0 && phidiffs[4] < 0) // 2-4
238  emuCharge = 1;
239  else
240  emuCharge = -1;
241  break;
242 
243  case 6: // 2-3
244  if (phidiffs[3] >= 0) // 2-3
245  emuCharge = 1;
246  else
247  emuCharge = -1;
248  break;
249 
250  case 5: // 2-4
251  if (phidiffs[4] >= 0) // 2-4
252  emuCharge = 1;
253  else
254  emuCharge = -1;
255  break;
256 
257  case 3: // 3-4
258  if (phidiffs[5] >= 0) // 3-4
259  emuCharge = 1;
260  else
261  emuCharge = -1;
262  break;
263 
264  default:
265  //emuCharge = -1;
266  emuCharge = 0;
267  break;
268  }
269 
270  int charge = 0;
271  if (emuCharge == 1)
272  charge = 1;
273 
274  int charge_valid = 1;
275  if (emuCharge == 0)
276  charge_valid = 0;
277  return std::make_pair(charge, charge_valid);
278 }
GMT_eta_from_theta
static const int GMT_eta_from_theta[128]
Definition: PtAssignmentEngineAux.cc:4
PtAssignmentEngineAux::getGMTPt
int getGMTPt(float pt) const
Definition: PtAssignmentEngineAux.cc:12
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
PtAssignmentEngineAux::getGMTCharge
std::pair< int, int > getGMTCharge(int mode, const std::vector< int > &phidiffs) const
Definition: PtAssignmentEngineAux.cc:166
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
PVValHelper::eta
Definition: PVValidationHelpers.h:69
PtAssignmentEngineAux::getGMTEta
int getGMTEta(int theta, int endcap) const
Definition: PtAssignmentEngineAux.cc:44
PtAssignmentEngineAux::getGMTPhiV2
int getGMTPhiV2(int phi) const
Definition: PtAssignmentEngineAux.cc:36
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
PVValHelper::phi
Definition: PVValidationHelpers.h:68
PtAssignmentEngineAux::getPtFromGMTPt
float getPtFromGMTPt(int gmt_pt) const
Definition: PtAssignmentEngineAux.cc:19
PtAssignmentEngineAux.h
PtAssignmentEngineAux::getGMTQuality
int getGMTQuality(int mode, int theta, bool promoteMode7, int version) const
Definition: PtAssignmentEngineAux.cc:58
PtAssignmentEngineAux::getGMTPhi
int getGMTPhi(int phi) const
Definition: PtAssignmentEngineAux.cc:24
DDAxes::phi
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45