CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
l1tp2::DigitizedClusterGT Class Reference

#include <DigitizedClusterGT.h>

Public Member Functions

ap_uint< 64 > data () const
 
 DigitizedClusterGT ()
 
 DigitizedClusterGT (ap_uint< 64 > data)
 
 DigitizedClusterGT (ap_uint< 1 > isValid, ap_uint< 16 > pt, ap_int< 13 > phi, ap_int< 14 > eta, bool fullyDigitizedInputs)
 
 DigitizedClusterGT (bool isValid, float pt_f, float phi_f, float eta_f)
 
ap_int< 14 > eta () const
 
float etaLSB () const
 
ap_uint< 1 > isValid () const
 
bool passNullBitsCheck (void) const
 
ap_int< 13 > phi () const
 
float phiLSB () const
 
ap_uint< 16 > pt () const
 
float ptFloat () const
 
float ptLSB () const
 
float realEta () const
 
float realPhi () const
 
const int unusedBitsStart () const
 

Private Member Functions

ap_int< 14 > digitizeEta (float eta_f)
 
ap_uint< 1 > digitizeIsValid (bool isValid)
 
ap_int< 13 > digitizePhi (float phi_f)
 
ap_uint< 16 > digitizePt (float pt_f)
 

Private Attributes

ap_uint< 64 > clusterData
 
float LSB_ETA = (M_PI / std::pow(2, n_bits_eta_pi))
 
float LSB_PHI = (M_PI / std::pow(2, n_bits_phi_pi))
 

Static Private Attributes

static constexpr float LSB_PT = 0.03125
 
static constexpr unsigned int n_bits_eta_pi = 12
 
static constexpr unsigned int n_bits_phi_pi = 12
 
static constexpr unsigned int n_bits_pt = 16
 
static constexpr unsigned int n_bits_unused_start = 44
 

Detailed Description

Definition at line 9 of file DigitizedClusterGT.h.

Constructor & Destructor Documentation

◆ DigitizedClusterGT() [1/4]

l1tp2::DigitizedClusterGT::DigitizedClusterGT ( )
inline

Definition at line 49 of file DigitizedClusterGT.h.

References clusterData.

49 { clusterData = 0x0; }

◆ DigitizedClusterGT() [2/4]

l1tp2::DigitizedClusterGT::DigitizedClusterGT ( ap_uint< 64 >  data)
inline

Definition at line 51 of file DigitizedClusterGT.h.

References clusterData, and data().

51 { clusterData = data; }
ap_uint< 64 > data() const

◆ DigitizedClusterGT() [3/4]

l1tp2::DigitizedClusterGT::DigitizedClusterGT ( ap_uint< 1 >  isValid,
ap_uint< 16 >  pt,
ap_int< 13 >  phi,
ap_int< 14 >  eta,
bool  fullyDigitizedInputs 
)
inline

Definition at line 54 of file DigitizedClusterGT.h.

References clusterData, eta(), isValid(), phi(), pt(), and funct::void.

54  {
55  (void)fullyDigitizedInputs;
56  clusterData =
57  ((ap_uint<64>)isValid) | (((ap_uint<64>)pt) << 1) | (((ap_uint<64>)phi) << 17) | (((ap_uint<64>)eta) << 30);
58  }
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
ap_uint< 1 > isValid() const
ap_int< 14 > eta() const
ap_int< 13 > phi() const
ap_uint< 16 > pt() const

◆ DigitizedClusterGT() [4/4]

l1tp2::DigitizedClusterGT::DigitizedClusterGT ( bool  isValid,
float  pt_f,
float  phi_f,
float  eta_f 
)
inline

Definition at line 61 of file DigitizedClusterGT.h.

References clusterData, digitizeEta(), digitizeIsValid(), digitizePhi(), digitizePt(), and isValid().

61  {
62  // N.b.: For eta/phi, after shifting the bits to the correct place and casting to ap_uint<64>,
63  // we have an additional bit mask
64  // e.g. 0x3FFE0000 for phi. This mask is all zero's except for 1 in the phi bits (bits 17 through 29):
65  // bit mask = 0x3FFE0000 = 0b111111111111100000000000000000
66  // Applying the "and" of this bitmask, avoids bogus 1's in the case where phi is negative
67 
68  clusterData = ((ap_uint<64>)digitizeIsValid(isValid)) | ((ap_uint<64>)digitizePt(pt_f) << 1) |
69  (((ap_uint<64>)digitizePhi(phi_f) << 17) &
70  0x3FFE0000) | // 0x3FFE0000 is all zero's except the phi bits (bits 17 through 29)
71  (((ap_uint<64>)digitizeEta(eta_f) << 30) &
72  0xFFFC0000000); // 0xFFFC0000000 is all zero's except the eta bits (bits 30 through 32)
73  }
ap_uint< 1 > digitizeIsValid(bool isValid)
ap_int< 14 > digitizeEta(float eta_f)
ap_uint< 1 > isValid() const
ap_int< 13 > digitizePhi(float phi_f)
ap_uint< 16 > digitizePt(float pt_f)

Member Function Documentation

◆ data()

ap_uint<64> l1tp2::DigitizedClusterGT::data ( ) const
inline

Definition at line 75 of file DigitizedClusterGT.h.

References clusterData.

Referenced by DigitizedClusterGT(), and passNullBitsCheck().

75 { return clusterData; }

◆ digitizeEta()

ap_int<14> l1tp2::DigitizedClusterGT::digitizeEta ( float  eta_f)
inlineprivate

Definition at line 43 of file DigitizedClusterGT.h.

References LSB_ETA.

Referenced by DigitizedClusterGT().

43  {
44  ap_int<14> eta_digitized = (eta_f / LSB_ETA);
45  return eta_digitized;
46  }

◆ digitizeIsValid()

ap_uint<1> l1tp2::DigitizedClusterGT::digitizeIsValid ( bool  isValid)
inlineprivate

Definition at line 25 of file DigitizedClusterGT.h.

References isValid().

Referenced by DigitizedClusterGT().

25 { return (ap_uint<1>)isValid; }
ap_uint< 1 > isValid() const

◆ digitizePhi()

ap_int<13> l1tp2::DigitizedClusterGT::digitizePhi ( float  phi_f)
inlineprivate

Definition at line 37 of file DigitizedClusterGT.h.

References LSB_PHI.

Referenced by DigitizedClusterGT().

37  {
38  ap_int<13> phi_digitized = (phi_f / LSB_PHI);
39  return phi_digitized;
40  }

◆ digitizePt()

ap_uint<16> l1tp2::DigitizedClusterGT::digitizePt ( float  pt_f)
inlineprivate

Definition at line 27 of file DigitizedClusterGT.h.

References LSB_PT, n_bits_pt, and conifer::pow().

Referenced by DigitizedClusterGT().

27  {
28  float maxPt_f = (std::pow(2, n_bits_pt) - 1) * LSB_PT;
29  // If pT exceeds the maximum, saturate the value
30  if (pt_f >= maxPt_f) {
31  return (ap_uint<16>)0xFFFF;
32  }
33  return (ap_uint<16>)(pt_f / LSB_PT);
34  }
static constexpr unsigned int n_bits_pt
constexpr int pow(int x)
Definition: conifer.h:24
static constexpr float LSB_PT

◆ eta()

ap_int<14> l1tp2::DigitizedClusterGT::eta ( ) const
inline

Definition at line 84 of file DigitizedClusterGT.h.

References clusterData.

Referenced by Particle.Particle::__str__(), DigitizedClusterGT(), Jet.Jet::jetID(), Jet.Jet::puJetId(), and realEta().

84 { return ((clusterData >> 30) & 0x3FFF); } // (fourteen 1's) = 0x3FFF

◆ etaLSB()

float l1tp2::DigitizedClusterGT::etaLSB ( ) const
inline

Definition at line 80 of file DigitizedClusterGT.h.

References LSB_ETA.

Referenced by realEta().

80 { return LSB_ETA; }

◆ isValid()

ap_uint<1> l1tp2::DigitizedClusterGT::isValid ( void  ) const
inline

◆ passNullBitsCheck()

bool l1tp2::DigitizedClusterGT::passNullBitsCheck ( void  ) const
inline

Definition at line 96 of file DigitizedClusterGT.h.

References data(), and unusedBitsStart().

96 { return ((data() >> unusedBitsStart()) == 0x0); }
ap_uint< 64 > data() const
const int unusedBitsStart() const

◆ phi()

ap_int<13> l1tp2::DigitizedClusterGT::phi ( ) const
inline

Definition at line 83 of file DigitizedClusterGT.h.

References clusterData.

Referenced by Particle.Particle::__str__(), DigitizedClusterGT(), ntupleDataFormat.Track::phiPull(), and realPhi().

83 { return ((clusterData >> 17) & 0x1FFF); } // (thirteen 1's)= 0x1FFF

◆ phiLSB()

float l1tp2::DigitizedClusterGT::phiLSB ( ) const
inline

Definition at line 79 of file DigitizedClusterGT.h.

References LSB_PHI.

Referenced by realPhi().

79 { return LSB_PHI; }

◆ pt()

ap_uint<16> l1tp2::DigitizedClusterGT::pt ( ) const
inline

◆ ptFloat()

float l1tp2::DigitizedClusterGT::ptFloat ( ) const
inline

Definition at line 86 of file DigitizedClusterGT.h.

References pt(), and ptLSB().

86 { return (pt() * ptLSB()); }
ap_uint< 16 > pt() const

◆ ptLSB()

float l1tp2::DigitizedClusterGT::ptLSB ( ) const
inline

Definition at line 78 of file DigitizedClusterGT.h.

References LSB_PT.

Referenced by ptFloat().

78 { return LSB_PT; }
static constexpr float LSB_PT

◆ realEta()

float l1tp2::DigitizedClusterGT::realEta ( ) const
inline

Definition at line 90 of file DigitizedClusterGT.h.

References eta(), and etaLSB().

90  { // convert from signed int to float
91  return (eta() * etaLSB());
92  }
ap_int< 14 > eta() const

◆ realPhi()

float l1tp2::DigitizedClusterGT::realPhi ( ) const
inline

Definition at line 87 of file DigitizedClusterGT.h.

References phi(), and phiLSB().

87  { // convert from signed int to float
88  return (phi() * phiLSB());
89  }
ap_int< 13 > phi() const

◆ unusedBitsStart()

const int l1tp2::DigitizedClusterGT::unusedBitsStart ( ) const
inline

Definition at line 93 of file DigitizedClusterGT.h.

References n_bits_unused_start.

Referenced by passNullBitsCheck().

93 { return n_bits_unused_start; } // unused bits start at bit 44
static constexpr unsigned int n_bits_unused_start

Member Data Documentation

◆ clusterData

ap_uint<64> l1tp2::DigitizedClusterGT::clusterData
private

Definition at line 12 of file DigitizedClusterGT.h.

Referenced by data(), DigitizedClusterGT(), eta(), isValid(), phi(), and pt().

◆ LSB_ETA

float l1tp2::DigitizedClusterGT::LSB_ETA = (M_PI / std::pow(2, n_bits_eta_pi))
private

Definition at line 21 of file DigitizedClusterGT.h.

Referenced by digitizeEta(), and etaLSB().

◆ LSB_PHI

float l1tp2::DigitizedClusterGT::LSB_PHI = (M_PI / std::pow(2, n_bits_phi_pi))
private

Definition at line 22 of file DigitizedClusterGT.h.

Referenced by digitizePhi(), and phiLSB().

◆ LSB_PT

constexpr float l1tp2::DigitizedClusterGT::LSB_PT = 0.03125
staticprivate

Definition at line 15 of file DigitizedClusterGT.h.

Referenced by digitizePt(), and ptLSB().

◆ n_bits_eta_pi

constexpr unsigned int l1tp2::DigitizedClusterGT::n_bits_eta_pi = 12
staticprivate

Definition at line 16 of file DigitizedClusterGT.h.

◆ n_bits_phi_pi

constexpr unsigned int l1tp2::DigitizedClusterGT::n_bits_phi_pi = 12
staticprivate

Definition at line 17 of file DigitizedClusterGT.h.

◆ n_bits_pt

constexpr unsigned int l1tp2::DigitizedClusterGT::n_bits_pt = 16
staticprivate

Definition at line 18 of file DigitizedClusterGT.h.

Referenced by digitizePt().

◆ n_bits_unused_start

constexpr unsigned int l1tp2::DigitizedClusterGT::n_bits_unused_start = 44
staticprivate

Definition at line 19 of file DigitizedClusterGT.h.

Referenced by unusedBitsStart().