CMS 3D CMS Logo

L1TkEtMissEmuTrackTransform.cc
Go to the documentation of this file.
2 
3 #include <cmath>
4 
5 using namespace l1tmetemu;
6 
8  phiQuadrants = generatePhiSliceLUT(l1tmetemu::kNQuadrants);
9  phiShift = generatePhiSliceLUT(l1tmetemu::kNSector);
10 }
11 
13  global_phi_t sector_shift) {
14  int PhiMin = 0;
15  int PhiMax = phiQuadrants.back();
16  int phiMultiplier = TTTrack_TrackWord::TrackBitWidths::kPhiSize - l1tmetemu::kInternalPhiWidth;
17 
18  int tempPhi =
19  floor(unpackSignedValue(local_phi, TTTrack_TrackWord::TrackBitWidths::kPhiSize) / pow(2, phiMultiplier)) +
20  sector_shift;
21 
22  if (tempPhi < PhiMin) {
23  tempPhi = tempPhi + PhiMax;
24  } else if (tempPhi > PhiMax) {
25  tempPhi = tempPhi - PhiMax;
26  } // else
27  // tempPhi = tempPhi;
28 
29  global_phi_t globalPhi = global_phi_t(tempPhi);
30 
31  return globalPhi;
32 }
33 
35  nstub_t Nstub = 0;
36  for (int i = (TTTrack_TrackWord::kHitPatternSize - 1); i >= 0; i--) {
37  int k = Hitpattern >> i;
38  if (k & 1)
39  Nstub++;
40  }
41  return Nstub;
42 }
43 
44 std::vector<global_phi_t> L1TkEtMissEmuTrackTransform::generatePhiSliceLUT(unsigned int N) {
45  float sliceCentre = 0.0;
46  std::vector<global_phi_t> phiLUT;
47  for (unsigned int q = 0; q <= N; q++) {
48  phiLUT.push_back((global_phi_t)(sliceCentre / l1tmetemu::kStepPhi));
49  sliceCentre += 2 * M_PI / N;
50  }
51  return phiLUT;
52 }
int unpackSignedValue(unsigned int bits, unsigned int nBits)
std::vector< l1tmetemu::global_phi_t > generatePhiSliceLUT(unsigned int N)
const unsigned int kNQuadrants
const unsigned int kNSector
ap_uint< TrackBitWidths::kHitPatternSize > hit_t
#define M_PI
ap_uint< kInternalPhiWidth+kGlobalPhiExtra > global_phi_t
#define N
Definition: blowfish.cc:9
l1tmetemu::global_phi_t localToGlobalPhi(TTTrack_TrackWord::phi_t local_phi, l1tmetemu::global_phi_t sector_shift)
ap_uint< 3 > nstub_t
l1tmetemu::nstub_t countNStub(TTTrack_TrackWord::hit_t Hitpattern)
const unsigned int kInternalPhiWidth
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
ap_uint< TrackBitWidths::kPhiSize > phi_t
const double kStepPhi