CMS 3D CMS Logo

List of all members | Public Member Functions
PtAssignmentEngineAux Class Reference

#include <PtAssignmentEngineAux.h>

Inheritance diagram for PtAssignmentEngineAux:
PtAssignmentEngineAux2016 PtAssignmentEngineAux2017

Public Member Functions

std::pair< int, int > getGMTCharge (int mode, const std::vector< int > &phidiffs) const
 
int getGMTDxy (float dxy) const
 
int getGMTEta (int theta, int endcap) const
 
int getGMTPhi (int phi) const
 
int getGMTPhiV2 (int phi) const
 
int getGMTPt (float pt) const
 
int getGMTPtDxy (float pt) const
 
int getGMTQuality (int mode, int theta, bool promoteMode7, int version) const
 
float getPtFromGMTPt (int gmt_pt) const
 
float getPtFromGMTPtDxy (int gmt_pt_dxy) const
 

Detailed Description

Definition at line 13 of file PtAssignmentEngineAux.h.

Member Function Documentation

◆ getGMTCharge()

std::pair< int, int > PtAssignmentEngineAux::getGMTCharge ( int  mode,
const std::vector< int > &  phidiffs 
) const

Definition at line 192 of file PtAssignmentEngineAux.cc.

192  {
193  // -1 = postive physical charge to match pdgId code (i.e. -13 is positive, anti-muon). +1 = negative physical charge.
194  // Also matches DN-2015/017 format for track finder --> uGMT interface format, where 0 indicates positive, 1 negative.
195  int emuCharge = 0;
196 
197  // Note: sign_ph[0] == 1 in firmware actually translates to phidiffs[0] >= 0 (instead of phidiffs[0] > 0 in the old emulator)
198  // The effect needs to be checked
199 
200  switch (mode) {
201  case 15: // 1-2-3-4
202  if (phidiffs[0] >= 0) // 1-2 (should use > 0)
203  emuCharge = 1;
204  else if (phidiffs[0] == 0 && phidiffs[1] < 0) // 1-3
205  emuCharge = 1;
206  else if (phidiffs[1] == 0 && phidiffs[2] < 0) // 1-4
207  emuCharge = 1;
208  else
209  emuCharge = -1;
210  break;
211 
212  case 14: // 1-2-3
213  if (phidiffs[0] < 0) // 1-2
214  emuCharge = -1;
215  else if (phidiffs[0] == 0 && phidiffs[1] < 0) // 1-3
216  emuCharge = -1;
217  else
218  emuCharge = 1;
219  break;
220 
221  case 13: // 1-2-4
222  if (phidiffs[0] >= 0) // 1-2 (should use > 0)
223  emuCharge = 1;
224  else if (phidiffs[0] == 0 && phidiffs[2] < 0) // 1-4
225  emuCharge = 1;
226  else
227  emuCharge = -1;
228  break;
229 
230  case 12: // 1-2
231  if (phidiffs[0] >= 0) // 1-2
232  emuCharge = 1;
233  else
234  emuCharge = -1;
235  break;
236 
237  case 11: // 1-3-4
238  if (phidiffs[1] >= 0) // 1-3 (should use > 0)
239  emuCharge = 1;
240  else if (phidiffs[1] == 0 && phidiffs[2] < 0) // 1-4
241  emuCharge = 1;
242  else
243  emuCharge = -1;
244  break;
245 
246  case 10: // 1-3
247  if (phidiffs[1] >= 0) // 1-3
248  emuCharge = 1;
249  else
250  emuCharge = -1;
251  break;
252 
253  case 9: // 1-4
254  if (phidiffs[2] >= 0) // 1-4
255  emuCharge = 1;
256  else
257  emuCharge = -1;
258  break;
259 
260  case 7: // 2-3-4
261  if (phidiffs[3] >= 0) // 2-3 (should use > 0)
262  emuCharge = 1;
263  else if (phidiffs[3] == 0 && phidiffs[4] < 0) // 2-4
264  emuCharge = 1;
265  else
266  emuCharge = -1;
267  break;
268 
269  case 6: // 2-3
270  if (phidiffs[3] >= 0) // 2-3
271  emuCharge = 1;
272  else
273  emuCharge = -1;
274  break;
275 
276  case 5: // 2-4
277  if (phidiffs[4] >= 0) // 2-4
278  emuCharge = 1;
279  else
280  emuCharge = -1;
281  break;
282 
283  case 3: // 3-4
284  if (phidiffs[5] >= 0) // 3-4
285  emuCharge = 1;
286  else
287  emuCharge = -1;
288  break;
289 
290  default:
291  //emuCharge = -1;
292  emuCharge = 0;
293  break;
294  }
295 
296  int charge = 0;
297  if (emuCharge == 1)
298  charge = 1;
299 
300  int charge_valid = 1;
301  if (emuCharge == 0)
302  charge_valid = 0;
303  return std::make_pair(charge, charge_valid);
304 }

References ALCARECOTkAlJpsiMuMu_cff::charge, and ALCARECOPromptCalibProdSiPixelAli0T_cff::mode.

Referenced by PtAssignment::process().

◆ getGMTDxy()

int PtAssignmentEngineAux::getGMTDxy ( float  dxy) const

Definition at line 26 of file PtAssignmentEngineAux.cc.

26  {
27  int gmt_dxy = 0;
28  if (std::abs(dxy) < 25.) {
29  gmt_dxy = 0;
30  } else if (std::abs(dxy) < 50.) {
31  gmt_dxy = 1;
32  } else if (std::abs(dxy) < 75.) {
33  gmt_dxy = 2;
34  } else {
35  gmt_dxy = 3;
36  }
37  return gmt_dxy;
38 }

References funct::abs(), and PVValHelper::dxy.

Referenced by PtAssignment::process().

◆ getGMTEta()

int PtAssignmentEngineAux::getGMTEta ( int  theta,
int  endcap 
) const

Definition at line 70 of file PtAssignmentEngineAux.cc.

70  { // [-1,+1]
71  if (theta < 0)
72  return 0;
73  if (endcap == -1 && theta > 127)
74  return -240;
75  if (endcap == +1 && theta > 127)
76  return 239;
77 
79  if (endcap == -1)
80  eta = -eta;
81  return eta;
82 }

References makeMuonMisalignmentScenario::endcap, PVValHelper::eta, GMT_eta_from_theta, and theta().

Referenced by PtAssignment::process().

◆ getGMTPhi()

int PtAssignmentEngineAux::getGMTPhi ( int  phi) const

Definition at line 50 of file PtAssignmentEngineAux.cc.

50  {
51  // convert phi into gmt scale according to DN15-017
52  // full scale is -16 to 100, or 116 values, covers range -10 to 62.5 deg
53  // my internal ph scale is 0..5000, covers from -22 to 63.333 deg
54  // converted to GMT scale it is from -35 to 95
55  // bt_phi * 107.01/4096, equivalent to bt_phi * 6849/0x40000
56  phi *= 6849;
57  phi >>= 18; // divide by 0x40000
58  phi -= 35; // offset of -22 deg
59  return phi;
60 }

References phi.

Referenced by PtAssignment::process().

◆ getGMTPhiV2()

int PtAssignmentEngineAux::getGMTPhiV2 ( int  phi) const

Definition at line 62 of file PtAssignmentEngineAux.cc.

62  {
63  // convert phi into gmt scale according to DN15-017
64  phi *= 6991;
65  phi >>= 18; // divide by 0x40000
66  phi -= 35; // offset of -22 deg
67  return phi;
68 }

References phi.

Referenced by PtAssignment::process().

◆ getGMTPt()

int PtAssignmentEngineAux::getGMTPt ( float  pt) const

Definition at line 12 of file PtAssignmentEngineAux.cc.

12  {
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 }

References DiDispStaMuonMonitor_cfi::pt.

Referenced by PtAssignment::process().

◆ getGMTPtDxy()

int PtAssignmentEngineAux::getGMTPtDxy ( float  pt) const

Definition at line 19 of file PtAssignmentEngineAux.cc.

19  {
20  // compressed pt = pt*1 (scale) + 1 (pt = 0 is empty candidate)
21  int gmt_pt_dxy = (pt * 1) + 1;
22  gmt_pt_dxy = (gmt_pt_dxy > 255) ? 255 : gmt_pt_dxy;
23  return gmt_pt_dxy;
24 }

References DiDispStaMuonMonitor_cfi::pt.

Referenced by PtAssignment::process().

◆ getGMTQuality()

int PtAssignmentEngineAux::getGMTQuality ( int  mode,
int  theta,
bool  promoteMode7,
int  version 
) const

Definition at line 84 of file PtAssignmentEngineAux.cc.

84  {
85  int quality = 0;
86 
87  if (version == 2) { // 2018 mode <--> quality mapping
88  switch (mode) {
89  case 15:
90  quality = 15;
91  break;
92  case 14:
93  quality = 14;
94  break;
95  case 13:
96  quality = 13;
97  break;
98  case 12:
99  quality = 7;
100  break;
101  case 11:
102  quality = 12;
103  break;
104  case 10:
105  quality = 10;
106  break;
107  case 9:
108  quality = 9;
109  break;
110  case 7:
111  quality = 11;
112  break;
113  case 6:
114  quality = 6;
115  break;
116  case 5:
117  quality = 5;
118  break;
119  case 3:
120  quality = 4;
121  break;
122  default:
123  quality = 0;
124  break;
125  }
126 
127  if (theta > 88) { // if (eta < 1.19)
128  quality /= 4;
129  }
130  } // End 2018 mode <--> quality mapping
131 
132  else { // 2016 and 2017 mode <--> quality mapping
133  if (theta > 87) { // if (eta < 1.2)
134  switch (mode) {
135  case 15:
136  quality = 8;
137  break;
138  case 14:
139  quality = 4;
140  break;
141  case 13:
142  quality = 4;
143  break;
144  case 12:
145  quality = 4;
146  break;
147  case 11:
148  quality = 4;
149  break;
150  default:
151  quality = 4;
152  break;
153  }
154  } else {
155  switch (mode) {
156  case 15:
157  quality = 12;
158  break;
159  case 14:
160  quality = 12;
161  break;
162  case 13:
163  quality = 12;
164  break;
165  case 12:
166  quality = 8;
167  break;
168  case 11:
169  quality = 12;
170  break;
171  case 10:
172  quality = 8;
173  break;
174  case 7:
175  quality = 8;
176  break;
177  default:
178  quality = 4;
179  break;
180  }
181  }
182  quality |= (mode & 3);
183  } // End 2016 and 2017 mode <--> quality mapping
184 
185  // Fix for missing CSC LCTs in ME1/1, including dead "water-leak" chambers ME1/1/34 and 35
186  if (promoteMode7 && mode == 7 && theta <= 50)
187  quality = 12;
188 
189  return quality;
190 }

References ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, quality, theta(), and BeamSplash_cfg::version.

Referenced by PtAssignment::process().

◆ getPtFromGMTPt()

float PtAssignmentEngineAux::getPtFromGMTPt ( int  gmt_pt) const

Definition at line 40 of file PtAssignmentEngineAux.cc.

40  {
41  float pt = (gmt_pt <= 0) ? 0 : 0.5 * (gmt_pt - 1);
42  return pt;
43 }

References DiDispStaMuonMonitor_cfi::pt.

Referenced by PtAssignmentEngine::calculate_pt_lut().

◆ getPtFromGMTPtDxy()

float PtAssignmentEngineAux::getPtFromGMTPtDxy ( int  gmt_pt_dxy) const

Definition at line 45 of file PtAssignmentEngineAux.cc.

45  {
46  float pt = (gmt_pt_dxy <= 0) ? 0 : 1.0 * (gmt_pt_dxy - 1);
47  return pt;
48 }

References DiDispStaMuonMonitor_cfi::pt.

Referenced by PtAssignment::process().

GMT_eta_from_theta
static const int GMT_eta_from_theta[128]
Definition: PtAssignmentEngineAux.cc:4
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:122
PVValHelper::eta
Definition: PVValidationHelpers.h:70
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
DDAxes::phi
PVValHelper::dxy
Definition: PVValidationHelpers.h:48
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45