CMS 3D CMS Logo

Classes | Typedefs | Functions | Variables
l1tmetemu Namespace Reference

Classes

struct  EtMiss
 

Typedefs

typedef ap_int< kInternalPtWidth+kEtExtraEt_t
 
typedef ap_uint< kInternalEtaWidtheta_t
 
typedef ap_uint< kInternalPhiWidth+kGlobalPhiExtraglobal_phi_t
 
typedef ap_uint< kMETSizeMET_t
 
typedef ap_uint< kMETPhiSizeMETphi_t
 
typedef ap_uint< 3 > nstub_t
 
typedef ap_uint< kInternalPtWidthpt_t
 
typedef ap_uint< kInternalVTXWidthz_t
 

Functions

template<typename T >
T digitizeSignedValue (double value, unsigned int nBits, double lsb)
 
std::vector< global_phi_tgenerateCosLUT (unsigned int size)
 
std::vector< z_tgenerateDeltaZLUT (vector< double > DeltaZBins)
 
std::vector< z_tgenerateDeltaZLUT (std::vector< double > DeltaZBins)
 
std::vector< eta_tgenerateEtaRegionLUT (vector< double > EtaRegions)
 
std::vector< eta_tgenerateEtaRegionLUT (std::vector< double > EtaRegions)
 
template<typename T >
unsigned int getBin (double value, const T &bins)
 
unsigned int transformSignedValue (unsigned int bits, unsigned int oldnBits, unsigned int newnBits)
 
int unpackSignedValue (unsigned int bits, unsigned int nBits)
 

Variables

const unsigned int kEtExtra {10}
 
const unsigned int kGlobalPhiBins = 1 << kInternalPhiWidth
 
const unsigned int kGlobalPhiExtra {3}
 
const unsigned int kInternalEtaWidth {8}
 
const unsigned int kInternalPhiWidth {8}
 
const unsigned int kInternalPtWidth {15}
 
const unsigned int kInternalVTXWidth {12}
 
const float kMaxCosLUTPhi {M_PI / 2}
 
const float kMaxMET {4096}
 
const float kMaxMETPhi {2 * M_PI}
 
const float kMaxTrackEta {4}
 
const float kMaxTrackPt {512}
 
const float kMaxTrackZ0 {-TTTrack_TrackWord::minZ0}
 
const unsigned int kMETBins = 1 << kMETSize
 
const unsigned int kMETPhiBins = 1 << kMETPhiSize
 
const unsigned int kMETPhiSize {14}
 
const unsigned int kMETSize {15}
 
const unsigned int kNEtaRegion {6}
 
const unsigned int kNQuadrants {4}
 
const unsigned int kNSector {9}
 
const double kStepEta = (2 * std::abs(kMaxTrackEta)) / (1 << kInternalEtaWidth)
 
const double kStepMET = (l1tmetemu::kMaxMET / l1tmetemu::kMETBins)
 
const double kStepMETPhi = (l1tmetemu::kMaxMETPhi / l1tmetemu::kMETPhiBins)
 
const double kStepPhi = (2 * -TTTrack_TrackWord::minPhi0) / (kGlobalPhiBins - 1)
 
const double kStepPt = (std::abs(kMaxTrackPt)) / (1 << kInternalPtWidth)
 
const double kStepZ0 = (2 * std::abs(kMaxTrackZ0)) / (1 << kInternalVTXWidth)
 

Typedef Documentation

◆ Et_t

Definition at line 40 of file L1TkEtMissEmuAlgo.h.

◆ eta_t

Definition at line 36 of file L1TkEtMissEmuAlgo.h.

◆ global_phi_t

Definition at line 33 of file L1TkEtMissEmuAlgo.h.

◆ MET_t

typedef ap_uint<kMETSize> l1tmetemu::MET_t

Definition at line 48 of file L1TkEtMissEmuAlgo.h.

◆ METphi_t

typedef ap_uint<kMETPhiSize> l1tmetemu::METphi_t

Definition at line 51 of file L1TkEtMissEmuAlgo.h.

◆ nstub_t

typedef ap_uint<3> l1tmetemu::nstub_t

Definition at line 31 of file L1TkEtMissEmuAlgo.h.

◆ pt_t

Definition at line 35 of file L1TkEtMissEmuAlgo.h.

◆ z_t

Definition at line 37 of file L1TkEtMissEmuAlgo.h.

Function Documentation

◆ digitizeSignedValue()

template<typename T >
T l1tmetemu::digitizeSignedValue ( double  value,
unsigned int  nBits,
double  lsb 
)

Definition at line 91 of file L1TkEtMissEmuAlgo.h.

References hgcalVFEProducer_cfi::lsb.

91  {
92  // Digitize the incoming value
93  int digitizedValue = std::floor(value / lsb);
94 
95  // Calculate the maxmum possible positive value given an output of nBits in size
96  int digitizedMaximum = (1 << (nBits - 1)) - 1; // The remove 1 bit from nBits to account for the sign
97  int digitizedMinimum = -1. * (digitizedMaximum + 1);
98 
99  // Saturate the digitized value
100  digitizedValue = std::clamp(digitizedValue, digitizedMinimum, digitizedMaximum);
101 
102  // Do the two's compliment encoding
103  T twosValue = digitizedValue;
104  if (digitizedValue < 0) {
105  twosValue += (1 << nBits);
106  }
107 
108  return twosValue;
109  }
Definition: value.py:1
long double T

◆ generateCosLUT()

std::vector< global_phi_t > l1tmetemu::generateCosLUT ( unsigned int  size)

Definition at line 6 of file L1TkEtMissEmuAlgo.cc.

References funct::cos(), kGlobalPhiBins, kStepPhi, and findQualityFiles::size.

Referenced by L1TrackerEtMissEmulatorProducer::L1TrackerEtMissEmulatorProducer().

6  { // Fill cosine LUT with integer values
7  float phi = 0;
8  std::vector<global_phi_t> cosLUT;
9  for (unsigned int LUT_idx = 0; LUT_idx < size; LUT_idx++) {
10  cosLUT.push_back((global_phi_t)(floor(cos(phi) * (kGlobalPhiBins - 1))));
12  }
13  cosLUT.push_back((global_phi_t)(0)); //Prevent overflow in last bin
14  return cosLUT;
15  }
size
Write out results.
const unsigned int kGlobalPhiBins
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
ap_uint< kInternalPhiWidth+kGlobalPhiExtra > global_phi_t
const double kStepPhi

◆ generateDeltaZLUT() [1/2]

std::vector<z_t> l1tmetemu::generateDeltaZLUT ( vector< double >  DeltaZBins)

Definition at line 27 of file L1TkEtMissEmuAlgo.cc.

References kInternalVTXWidth, kStepZ0, and submitPVResolutionJobs::q.

Referenced by L1TrackerEtMissEmulatorProducer::L1TrackerEtMissEmulatorProducer().

27  {
28  std::vector<z_t> LUT;
29  for (unsigned int q = 0; q < DeltaZBins.size(); q++) {
30  LUT.push_back(digitizeSignedValue<z_t>(DeltaZBins[q], l1tmetemu::kInternalVTXWidth, l1tmetemu::kStepZ0));
31  //std::cout << LUT[q] << "|" << DeltaZBins[q] << std::endl;
32  }
33  return LUT;
34  }
const unsigned int kInternalVTXWidth
const double kStepZ0
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:31

◆ generateDeltaZLUT() [2/2]

std::vector<z_t> l1tmetemu::generateDeltaZLUT ( std::vector< double >  DeltaZBins)

Definition at line 27 of file L1TkEtMissEmuAlgo.cc.

References kInternalVTXWidth, kStepZ0, and submitPVResolutionJobs::q.

Referenced by L1TrackerEtMissEmulatorProducer::L1TrackerEtMissEmulatorProducer().

27  {
28  std::vector<z_t> LUT;
29  for (unsigned int q = 0; q < DeltaZBins.size(); q++) {
30  LUT.push_back(digitizeSignedValue<z_t>(DeltaZBins[q], l1tmetemu::kInternalVTXWidth, l1tmetemu::kStepZ0));
31  //std::cout << LUT[q] << "|" << DeltaZBins[q] << std::endl;
32  }
33  return LUT;
34  }
const unsigned int kInternalVTXWidth
const double kStepZ0
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:31

◆ generateEtaRegionLUT() [1/2]

std::vector<eta_t> l1tmetemu::generateEtaRegionLUT ( vector< double >  EtaRegions)

Definition at line 18 of file L1TkEtMissEmuAlgo.cc.

References TMTrackProducer_Defaults_cfi::EtaRegions, kInternalEtaWidth, kStepEta, and submitPVResolutionJobs::q.

Referenced by L1TrackerEtMissEmulatorProducer::L1TrackerEtMissEmulatorProducer().

18  {
19  std::vector<eta_t> LUT;
20  for (unsigned int q = 0; q < EtaRegions.size(); q++) {
21  LUT.push_back(digitizeSignedValue<eta_t>(EtaRegions[q], l1tmetemu::kInternalEtaWidth, l1tmetemu::kStepEta));
22  //std::cout << LUT[q] << "|" << EtaRegions[q] << std::endl;
23  }
24  return LUT;
25  }
const double kStepEta
const unsigned int kInternalEtaWidth
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:31

◆ generateEtaRegionLUT() [2/2]

std::vector<eta_t> l1tmetemu::generateEtaRegionLUT ( std::vector< double >  EtaRegions)

Definition at line 18 of file L1TkEtMissEmuAlgo.cc.

References TMTrackProducer_Defaults_cfi::EtaRegions, kInternalEtaWidth, kStepEta, and submitPVResolutionJobs::q.

Referenced by L1TrackerEtMissEmulatorProducer::L1TrackerEtMissEmulatorProducer().

18  {
19  std::vector<eta_t> LUT;
20  for (unsigned int q = 0; q < EtaRegions.size(); q++) {
21  LUT.push_back(digitizeSignedValue<eta_t>(EtaRegions[q], l1tmetemu::kInternalEtaWidth, l1tmetemu::kStepEta));
22  //std::cout << LUT[q] << "|" << EtaRegions[q] << std::endl;
23  }
24  return LUT;
25  }
const double kStepEta
const unsigned int kInternalEtaWidth
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:31

◆ getBin()

template<typename T >
unsigned int l1tmetemu::getBin ( double  value,
const T bins 
)

◆ transformSignedValue()

unsigned int l1tmetemu::transformSignedValue ( unsigned int  bits,
unsigned int  oldnBits,
unsigned int  newnBits 
)

Definition at line 46 of file L1TkEtMissEmuAlgo.cc.

References gpuClustering::pixelStatus::bits, createfilelist::int, and groupFilesInBlocks::temp.

Referenced by L1TkEtMissEmuTrackTransform::transformTrack().

46  {
47  int isign = 1;
48  unsigned int olddigitized_maximum = (1 << oldnBits) - 1;
49  unsigned int newdigitized_maximum = (1 << newnBits) - 1;
50  if (bits & (1 << (oldnBits - 1))) { // check the sign
51  isign = -1;
52  bits = (1 << (oldnBits + 1)) - bits; // if negative, flip everything for two's complement encoding
53  }
54  unsigned int temp = (int(bits & olddigitized_maximum));
55 
56  temp = round(temp / (1 << (oldnBits - newnBits)));
57 
58  if (temp > newdigitized_maximum)
59  temp = newdigitized_maximum;
60  if (isign < 0)
61  temp = (1 << newnBits) - 1 - temp; // two's complement encoding
62 
63  return temp;
64  }
constexpr uint32_t bits
Definition: gpuClustering.h:23

◆ unpackSignedValue()

int l1tmetemu::unpackSignedValue ( unsigned int  bits,
unsigned int  nBits 
)

Definition at line 36 of file L1TkEtMissEmuAlgo.cc.

References gpuClustering::pixelStatus::bits.

Referenced by L1TkEtMissEmuTrackTransform::localToGlobalPhi(), and L1TrackerEtMissEmulatorProducer::produce().

36  {
37  int isign = 1;
38  unsigned int digitized_maximum = (1 << nBits) - 1;
39  if (bits & (1 << (nBits - 1))) { // check the sign
40  isign = -1;
41  bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding
42  }
43  return (int(bits & digitized_maximum)) * isign;
44  }
constexpr uint32_t bits
Definition: gpuClustering.h:23

Variable Documentation

◆ kEtExtra

const unsigned int l1tmetemu::kEtExtra {10}

Definition at line 29 of file L1TkEtMissEmuAlgo.h.

◆ kGlobalPhiBins

const unsigned int l1tmetemu::kGlobalPhiBins = 1 << kInternalPhiWidth

Definition at line 53 of file L1TkEtMissEmuAlgo.h.

Referenced by generateCosLUT(), and L1TrackerEtMissEmulatorProducer::produce().

◆ kGlobalPhiExtra

const unsigned int l1tmetemu::kGlobalPhiExtra {3}

Definition at line 27 of file L1TkEtMissEmuAlgo.h.

◆ kInternalEtaWidth

const unsigned int l1tmetemu::kInternalEtaWidth {8}

◆ kInternalPhiWidth

const unsigned int l1tmetemu::kInternalPhiWidth {8}

Definition at line 24 of file L1TkEtMissEmuAlgo.h.

Referenced by L1TkEtMissEmuTrackTransform::localToGlobalPhi().

◆ kInternalPtWidth

const unsigned int l1tmetemu::kInternalPtWidth {15}

◆ kInternalVTXWidth

const unsigned int l1tmetemu::kInternalVTXWidth {12}

◆ kMaxCosLUTPhi

const float l1tmetemu::kMaxCosLUTPhi {M_PI / 2}

◆ kMaxMET

const float l1tmetemu::kMaxMET {4096}

Definition at line 43 of file L1TkEtMissEmuAlgo.h.

Referenced by Cordic::toPolar().

◆ kMaxMETPhi

const float l1tmetemu::kMaxMETPhi {2 * M_PI}

Definition at line 44 of file L1TkEtMissEmuAlgo.h.

◆ kMaxTrackEta

const float l1tmetemu::kMaxTrackEta {4}

Definition at line 63 of file L1TkEtMissEmuAlgo.h.

◆ kMaxTrackPt

const float l1tmetemu::kMaxTrackPt {512}

Definition at line 62 of file L1TkEtMissEmuAlgo.h.

Referenced by Cordic::toPolar().

◆ kMaxTrackZ0

const float l1tmetemu::kMaxTrackZ0 {-TTTrack_TrackWord::minZ0}

Definition at line 61 of file L1TkEtMissEmuAlgo.h.

◆ kMETBins

const unsigned int l1tmetemu::kMETBins = 1 << kMETSize

Definition at line 54 of file L1TkEtMissEmuAlgo.h.

◆ kMETPhiBins

const unsigned int l1tmetemu::kMETPhiBins = 1 << kMETPhiSize

Definition at line 55 of file L1TkEtMissEmuAlgo.h.

Referenced by L1TrackerEtMissEmulatorProducer::produce().

◆ kMETPhiSize

const unsigned int l1tmetemu::kMETPhiSize {14}

Definition at line 46 of file L1TkEtMissEmuAlgo.h.

◆ kMETSize

const unsigned int l1tmetemu::kMETSize {15}

◆ kNEtaRegion

const unsigned int l1tmetemu::kNEtaRegion {6}

Definition at line 57 of file L1TkEtMissEmuAlgo.h.

Referenced by L1TrackerEtMissEmulatorProducer::produce().

◆ kNQuadrants

const unsigned int l1tmetemu::kNQuadrants {4}

Definition at line 59 of file L1TkEtMissEmuAlgo.h.

Referenced by L1TkEtMissEmuTrackTransform::generateLUTs().

◆ kNSector

const unsigned int l1tmetemu::kNSector {9}

◆ kStepEta

const double l1tmetemu::kStepEta = (2 * std::abs(kMaxTrackEta)) / (1 << kInternalEtaWidth)

◆ kStepMET

const double l1tmetemu::kStepMET = (l1tmetemu::kMaxMET / l1tmetemu::kMETBins)

Definition at line 73 of file L1TkEtMissEmuAlgo.h.

Referenced by L1TrackerEtMissEmulatorProducer::produce().

◆ kStepMETPhi

const double l1tmetemu::kStepMETPhi = (l1tmetemu::kMaxMETPhi / l1tmetemu::kMETPhiBins)

Definition at line 74 of file L1TkEtMissEmuAlgo.h.

Referenced by L1TrackerEtMissEmulatorProducer::produce().

◆ kStepPhi

const double l1tmetemu::kStepPhi = (2 * -TTTrack_TrackWord::minPhi0) / (kGlobalPhiBins - 1)

◆ kStepPt

const double l1tmetemu::kStepPt = (std::abs(kMaxTrackPt)) / (1 << kInternalPtWidth)

◆ kStepZ0

const double l1tmetemu::kStepZ0 = (2 * std::abs(kMaxTrackZ0)) / (1 << kInternalVTXWidth)