CMS 3D CMS Logo

List of all members | Public Member Functions
PtAssignmentEngineAux Class Reference

#include <PtAssignmentEngineAux.h>

Public Member Functions

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

Detailed Description

Definition at line 11 of file PtAssignmentEngineAux.h.

Member Function Documentation

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

Definition at line 93 of file PtAssignmentEngineAux.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge.

Referenced by PtAssignment::process().

93  {
94  // -1 = postive physical charge to match pdgId code (i.e. -13 is positive, anti-muon). +1 = negative physical charge.
95  // Also matches DN-2015/017 format for track finder --> uGMT interface format, where 0 indicates positive, 1 negative.
96  int emuCharge = 0;
97 
98  // Note: sign_ph[0] == 1 in firmware actually translates to phidiffs[0] >= 0 (instead of phidiffs[0] > 0 in the old emulator)
99  // The effect needs to be checked
100 
101  switch (mode) {
102  case 15: // 1-2-3-4
103  if (phidiffs[0] >= 0) // 1-2 (should use > 0)
104  emuCharge = 1;
105  else if (phidiffs[0] == 0 && phidiffs[1] < 0) // 1-3
106  emuCharge = 1;
107  else if (phidiffs[1] == 0 && phidiffs[2] < 0) // 1-4
108  emuCharge = 1;
109  else
110  emuCharge = -1;
111  break;
112 
113  case 14: // 1-2-3
114  if (phidiffs[0] < 0) // 1-2
115  emuCharge = -1;
116  else if (phidiffs[0] == 0 && phidiffs[1] < 0) // 1-3
117  emuCharge = -1;
118  else
119  emuCharge = 1;
120  break;
121 
122  case 13: // 1-2-4
123  if (phidiffs[0] >= 0) // 1-2 (should use > 0)
124  emuCharge = 1;
125  else if (phidiffs[0] == 0 && phidiffs[2] < 0) // 1-4
126  emuCharge = 1;
127  else
128  emuCharge = -1;
129  break;
130 
131  case 12: // 1-2
132  if (phidiffs[0] >= 0) // 1-2
133  emuCharge = 1;
134  else
135  emuCharge = -1;
136  break;
137 
138  case 11: // 1-3-4
139  if (phidiffs[1] >= 0) // 1-3 (should use > 0)
140  emuCharge = 1;
141  else if (phidiffs[1] == 0 && phidiffs[2] < 0) // 1-4
142  emuCharge = 1;
143  else
144  emuCharge = -1;
145  break;
146 
147  case 10: // 1-3
148  if (phidiffs[1] >= 0) // 1-3
149  emuCharge = 1;
150  else
151  emuCharge = -1;
152  break;
153 
154  case 9: // 1-4
155  if (phidiffs[2] >= 0) // 1-4
156  emuCharge = 1;
157  else
158  emuCharge = -1;
159  break;
160 
161  case 7: // 2-3-4
162  if (phidiffs[3] >= 0) // 2-3 (should use > 0)
163  emuCharge = 1;
164  else if (phidiffs[3] == 0 && phidiffs[4] < 0) // 2-4
165  emuCharge = 1;
166  else
167  emuCharge = -1;
168  break;
169 
170  case 6: // 2-3
171  if (phidiffs[3] >= 0) // 2-3
172  emuCharge = 1;
173  else
174  emuCharge = -1;
175  break;
176 
177  case 5: // 2-4
178  if (phidiffs[4] >= 0) // 2-4
179  emuCharge = 1;
180  else
181  emuCharge = -1;
182  break;
183 
184  case 3: // 3-4
185  if (phidiffs[5] >= 0) // 3-4
186  emuCharge = 1;
187  else
188  emuCharge = -1;
189  break;
190 
191  default:
192  //emuCharge = -1;
193  emuCharge = 0;
194  break;
195  }
196 
197  int charge = 0;
198  if (emuCharge == 1)
199  charge = 1;
200 
201  int charge_valid = 1;
202  if (emuCharge == 0)
203  charge_valid = 0;
204  return std::make_pair(charge, charge_valid);
205 }
int PtAssignmentEngineAux::getGMTEta ( int  theta,
int  endcap 
) const

Definition at line 47 of file PtAssignmentEngineAux.cc.

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

Referenced by PtAssignment::process().

47  { // [-1,+1]
48  if (theta < 0)
49  return 0;
50  if (endcap == -1 && theta > 127)
51  return -240;
52  if (endcap == +1 && theta > 127)
53  return 239;
54 
56  if (endcap == -1)
57  eta = -eta;
58  return eta;
59 }
Geom::Theta< T > theta() const
static const int GMT_eta_from_theta[128]
int PtAssignmentEngineAux::getGMTPhi ( int  phi) const

Definition at line 27 of file PtAssignmentEngineAux.cc.

References phi.

Referenced by PtAssignment::process().

27  {
28  // convert phi into gmt scale according to DN15-017
29  // full scale is -16 to 100, or 116 values, covers range -10 to 62.5 deg
30  // my internal ph scale is 0..5000, covers from -22 to 63.333 deg
31  // converted to GMT scale it is from -35 to 95
32  // bt_phi * 107.01/4096, equivalent to bt_phi * 6849/0x40000
33  phi *= 6849;
34  phi >>= 18; // divide by 0x40000
35  phi -= 35; // offset of -22 deg
36  return phi;
37 }
int PtAssignmentEngineAux::getGMTPhiV2 ( int  phi) const

Definition at line 39 of file PtAssignmentEngineAux.cc.

References phi.

Referenced by PtAssignment::process().

39  {
40  // convert phi into gmt scale according to DN15-017
41  phi *= 6991;
42  phi >>= 18; // divide by 0x40000
43  phi -= 35; // offset of -22 deg
44  return phi;
45 }
int PtAssignmentEngineAux::getGMTPt ( float  pt) const

Definition at line 15 of file PtAssignmentEngineAux.cc.

Referenced by PtAssignment::process().

15  {
16  // compressed pt = pt*2 (scale) + 1 (pt = 0 is empty candidate)
17  int gmt_pt = (pt * 2) + 1;
18  gmt_pt = (gmt_pt > 511) ? 511 : gmt_pt;
19  return gmt_pt;
20 }
int PtAssignmentEngineAux::getGMTQuality ( int  mode,
int  theta,
bool  promoteMode7 
) const

Definition at line 61 of file PtAssignmentEngineAux.cc.

References jets_cff::quality.

Referenced by PtAssignment::process().

61  {
62  int quality = 0;
63  if (theta > 87) { // if (eta < 1.2)
64  switch (mode) {
65  case 15: quality = 8; break;
66  case 14: quality = 4; break;
67  case 13: quality = 4; break;
68  case 12: quality = 4; break;
69  case 11: quality = 4; break;
70  default: quality = 4; break;
71  }
72  } else {
73  switch (mode) {
74  case 15: quality = 12; break;
75  case 14: quality = 12; break;
76  case 13: quality = 12; break;
77  case 12: quality = 8; break;
78  case 11: quality = 12; break;
79  case 10: quality = 8; break;
80  case 7: quality = 8; break;
81  default: quality = 4; break;
82  }
83  }
84  quality |= (mode & 3);
85 
86  // Fix for missing CSC LCTs in ME1/1, including dead "water-leak" chambers ME1/1/34 and 35
87  if (promoteMode7 && mode == 7 && theta <= 50)
88  quality = 12;
89 
90  return quality;
91 }
Geom::Theta< T > theta() const
float PtAssignmentEngineAux::getPtFromGMTPt ( int  gmt_pt) const

Definition at line 22 of file PtAssignmentEngineAux.cc.

References EnergyCorrector::pt.

Referenced by PtAssignmentEngine::calculate_pt_lut().

22  {
23  float pt = (gmt_pt <= 0) ? 0 : 0.5 * (gmt_pt-1);
24  return pt;
25 }