CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
p2eg::Cluster Class Reference

#include <Phase2L1CaloEGammaUtils.h>

Public Member Functions

void applyCalibration (float factor)
 
 Cluster ()
 
 Cluster (ap_uint< 12 > clusterEnergy, ap_uint< 5 > towerEta, ap_uint< 2 > towerPhi, ap_uint< 3 > clusterEta, ap_uint< 3 > clusterPhi, ap_uint< 3 > satur, ap_uint< 15 > clusterEt5x5=0, ap_uint< 15 > clusterEt2x5=0, ap_uint< 2 > clusterBrems=0, float clusterCalib=1.0, bool cluster_is_ss=false, bool cluster_is_looseTkss=false, bool cluster_is_iso=false, bool cluster_is_looseTkiso=false, int clusterRegionIdx=0)
 
ap_uint< 12 > clusterEnergy () const
 
ap_uint< 3 > clusterEta () const
 
ap_uint< 3 > clusterPhi () const
 
const int crystaliEtaFromCardRegionInfo (int cc)
 
const int crystaliPhiFromCardRegionInfo (int cc)
 
int getBrems () const
 
float getCalib () const
 
float getEt2x5 () const
 
float getEt5x5 () const
 
bool getIsIso ()
 
bool getIsLooseTkIso ()
 
bool getIsLooseTkss ()
 
bool getIsSS ()
 
float getPt () const
 
 operator uint32_t () const
 
void printClusterInfo (int cc, std::string description="")
 
const float realEta (int cc)
 
const float realPhi (int cc)
 
int region () const
 
ap_uint< 3 > satur () const
 
void setRegionIdx (int regIdx)
 
ap_uint< 5 > towerEta () const
 
int towerEtaInCard ()
 
ap_uint< 2 > towerPhi () const
 
ap_uint< 15 > uint_et2x5 () const
 
ap_uint< 15 > uint_et5x5 () const
 

Public Attributes

ap_uint< 2 > brems
 
float calib
 
ap_uint< 28 > data
 
ap_uint< 15 > et2x5
 
ap_uint< 15 > et5x5
 
bool is_iso
 
bool is_looseTkiso
 
bool is_looseTkss
 
bool is_ss
 
int regionIdx
 

Detailed Description

Definition at line 728 of file Phase2L1CaloEGammaUtils.h.

Constructor & Destructor Documentation

◆ Cluster() [1/2]

p2eg::Cluster::Cluster ( )
inline

Definition at line 741 of file Phase2L1CaloEGammaUtils.h.

References brems, data, et2x5, et5x5, is_iso, is_looseTkiso, is_looseTkss, is_ss, and regionIdx.

741  {
742  data = 0;
743  regionIdx = -1;
744  calib = 1.0;
745  brems = 0;
746  et5x5 = 0;
747  et2x5 = 0;
748  is_ss = false;
749  is_looseTkss = false;
750  is_iso = false;
751  is_looseTkiso = false;
752  }

◆ Cluster() [2/2]

p2eg::Cluster::Cluster ( ap_uint< 12 >  clusterEnergy,
ap_uint< 5 >  towerEta,
ap_uint< 2 >  towerPhi,
ap_uint< 3 >  clusterEta,
ap_uint< 3 >  clusterPhi,
ap_uint< 3 >  satur,
ap_uint< 15 >  clusterEt5x5 = 0,
ap_uint< 15 >  clusterEt2x5 = 0,
ap_uint< 2 >  clusterBrems = 0,
float  clusterCalib = 1.0,
bool  cluster_is_ss = false,
bool  cluster_is_looseTkss = false,
bool  cluster_is_iso = false,
bool  cluster_is_looseTkiso = false,
int  clusterRegionIdx = 0 
)
inline

Definition at line 754 of file Phase2L1CaloEGammaUtils.h.

References brems, clusterEnergy(), clusterEta(), clusterPhi(), data, et2x5, et5x5, is_iso, is_looseTkiso, is_looseTkss, is_ss, regionIdx, satur(), towerEta(), and towerPhi().

768  {
769  data = (clusterEnergy) | (((ap_uint<32>)towerEta) << 12) | (((ap_uint<32>)towerPhi) << 17) |
770  (((ap_uint<32>)clusterEta) << 19) | (((ap_uint<32>)clusterPhi) << 22) | (((ap_uint<32>)satur) << 25);
771  regionIdx = clusterRegionIdx;
772  et5x5 = clusterEt5x5;
773  et2x5 = clusterEt2x5;
774  brems = clusterBrems;
775  calib = clusterCalib;
776  is_ss = cluster_is_ss;
777  is_looseTkss = cluster_is_looseTkss;
778  is_iso = cluster_is_iso;
779  is_looseTkiso = cluster_is_looseTkiso;
780  }
ap_uint< 3 > clusterEta() const
ap_uint< 5 > towerEta() const
ap_uint< 3 > satur() const
ap_uint< 3 > clusterPhi() const
ap_uint< 2 > towerPhi() const
ap_uint< 12 > clusterEnergy() const

Member Function Documentation

◆ applyCalibration()

void p2eg::Cluster::applyCalibration ( float  factor)
inline

Definition at line 811 of file Phase2L1CaloEGammaUtils.h.

References data, p2eg::ECAL_LSB, and getPt().

811  {
812  float newPt = getPt() * factor;
813  // Convert the new pT to an unsigned int, 28 bits to take the logical OR with the mask
814  ap_uint<28> newPt_uint = (ap_uint<28>)(int)(newPt / ECAL_LSB);
815  // Make sure that the new pT only takes up the last twelve bits
816  newPt_uint = (newPt_uint & 0x0000FFF);
817 
818  // Modify 'data'
819  ap_uint<28> bitMask = 0xFFFF000; // last twelve digits are zero
820  data = (data & bitMask); // zero out the last twelve digits
821  data = (data | newPt_uint); // write in the new ET
822  }
static constexpr float ECAL_LSB

◆ clusterEnergy()

ap_uint<12> p2eg::Cluster::clusterEnergy ( ) const
inline

◆ clusterEta()

ap_uint<3> p2eg::Cluster::clusterEta ( ) const
inline

Definition at line 787 of file Phase2L1CaloEGammaUtils.h.

References data.

Referenced by Cluster(), crystaliEtaFromCardRegionInfo(), and p2eg::stitchClusterOverRegionBoundary().

787 { return ((data >> 19) & 0x7); }

◆ clusterPhi()

ap_uint<3> p2eg::Cluster::clusterPhi ( ) const
inline

Definition at line 788 of file Phase2L1CaloEGammaUtils.h.

References data.

Referenced by Cluster(), crystaliPhiFromCardRegionInfo(), and p2eg::stitchClusterOverRegionBoundary().

788 { return ((data >> 22) & 0x7); }

◆ crystaliEtaFromCardRegionInfo()

const int p2eg::Cluster::crystaliEtaFromCardRegionInfo ( int  cc)
inline

Definition at line 825 of file Phase2L1CaloEGammaUtils.h.

References gpuPixelDoublets::cc, clusterEta(), p2eg::CRYSTALS_IN_TOWER_ETA, p2eg::getCard_refCrystal_iEta(), region(), p2eg::TOWER_IN_ETA, and towerEta().

Referenced by realEta().

825  {
826  int crystalEta_in_card =
828  if ((cc % 2) == 1) {
829  return (getCard_refCrystal_iEta(cc) + crystalEta_in_card);
830  } else {
831  // if card is even (negative eta)
832  return (getCard_refCrystal_iEta(cc) - crystalEta_in_card);
833  }
834  }
ap_uint< 3 > clusterEta() const
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
int getCard_refCrystal_iEta(int cc)
ap_uint< 5 > towerEta() const
static constexpr int TOWER_IN_ETA
static constexpr int CRYSTALS_IN_TOWER_ETA

◆ crystaliPhiFromCardRegionInfo()

const int p2eg::Cluster::crystaliPhiFromCardRegionInfo ( int  cc)
inline

Definition at line 837 of file Phase2L1CaloEGammaUtils.h.

References gpuPixelDoublets::cc, clusterPhi(), p2eg::CRYSTALS_IN_TOWER_PHI, p2eg::getCard_refCrystal_iPhi(), and towerPhi().

Referenced by realPhi().

837  {
838  int crystalPhi_in_card = (towerPhi() * CRYSTALS_IN_TOWER_PHI) + clusterPhi();
839  if ((cc % 2) == 1) {
840  // if card is odd (positive eta)
841  return (getCard_refCrystal_iPhi(cc) + crystalPhi_in_card);
842  } else {
843  // if card is even (negative eta)
844  return (getCard_refCrystal_iPhi(cc) - crystalPhi_in_card);
845  }
846  }
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
ap_uint< 3 > clusterPhi() const
ap_uint< 2 > towerPhi() const
int getCard_refCrystal_iPhi(int cc)
static constexpr int CRYSTALS_IN_TOWER_PHI

◆ getBrems()

int p2eg::Cluster::getBrems ( ) const
inline

Definition at line 795 of file Phase2L1CaloEGammaUtils.h.

References brems.

Referenced by p2eg::stitchClusterOverRegionBoundary().

795 { return (int)brems; }

◆ getCalib()

float p2eg::Cluster::getCalib ( ) const
inline

Definition at line 796 of file Phase2L1CaloEGammaUtils.h.

References calib.

Referenced by p2eg::stitchClusterOverRegionBoundary().

796 { return (float)calib; }

◆ getEt2x5()

float p2eg::Cluster::getEt2x5 ( ) const
inline

Definition at line 799 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and et2x5.

799 { return ((float)et2x5 * ECAL_LSB); } // Return ET2x5 as a float
static constexpr float ECAL_LSB

◆ getEt5x5()

float p2eg::Cluster::getEt5x5 ( ) const
inline

Definition at line 798 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and et5x5.

798 { return ((float)et5x5 * ECAL_LSB); } // Return ET5x5 as a float
static constexpr float ECAL_LSB

◆ getIsIso()

bool p2eg::Cluster::getIsIso ( )
inline

Definition at line 805 of file Phase2L1CaloEGammaUtils.h.

References is_iso.

805 { return is_iso; }

◆ getIsLooseTkIso()

bool p2eg::Cluster::getIsLooseTkIso ( )
inline

Definition at line 806 of file Phase2L1CaloEGammaUtils.h.

References is_looseTkiso.

806 { return is_looseTkiso; }

◆ getIsLooseTkss()

bool p2eg::Cluster::getIsLooseTkss ( )
inline

Definition at line 804 of file Phase2L1CaloEGammaUtils.h.

References is_looseTkss.

Referenced by p2eg::stitchClusterOverRegionBoundary().

804 { return is_looseTkss; }

◆ getIsSS()

bool p2eg::Cluster::getIsSS ( )
inline

Definition at line 803 of file Phase2L1CaloEGammaUtils.h.

References is_ss.

Referenced by p2eg::stitchClusterOverRegionBoundary().

803 { return is_ss; }

◆ getPt()

float p2eg::Cluster::getPt ( ) const
inline

Definition at line 797 of file Phase2L1CaloEGammaUtils.h.

References clusterEnergy(), and p2eg::ECAL_LSB.

Referenced by applyCalibration(), and printClusterInfo().

797 { return ((float)clusterEnergy() * ECAL_LSB); } // Return pT as a float
static constexpr float ECAL_LSB
ap_uint< 12 > clusterEnergy() const

◆ operator uint32_t()

p2eg::Cluster::operator uint32_t ( ) const
inline

Definition at line 793 of file Phase2L1CaloEGammaUtils.h.

References data.

793 { return (ap_uint<28>)data; }

◆ printClusterInfo()

void p2eg::Cluster::printClusterInfo ( int  cc,
std::string  description = "" 
)
inline

Definition at line 861 of file Phase2L1CaloEGammaUtils.h.

References gpuPixelDoublets::cc, gather_cfg::cout, makeListRunsInFiles::description, getPt(), realEta(), and realPhi().

861  {
862  std::cout << "[Print Cluster class info:] [" << description << "]: "
863  << "card " << cc << ", "
864  << "et (float): " << getPt() << ", "
865  << "eta: " << realEta(cc) << ", "
866  << "phi: " << realPhi(cc) << std::endl;
867  }
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
const float realPhi(int cc)
const float realEta(int cc)

◆ realEta()

const float p2eg::Cluster::realEta ( int  cc)
inline

Definition at line 849 of file Phase2L1CaloEGammaUtils.h.

References gpuPixelDoublets::cc, crystaliEtaFromCardRegionInfo(), p2eg::CRYSTALS_IN_TOWER_ETA, p2eg::ECAL_eta_range, p2eg::half_crystal_size, and p2eg::n_towers_Eta.

Referenced by printClusterInfo().

849  {
850  float size_cell = 2 * ECAL_eta_range / (CRYSTALS_IN_TOWER_ETA * n_towers_Eta);
852  }
static constexpr float ECAL_eta_range
static constexpr float half_crystal_size
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
static constexpr int n_towers_Eta
static constexpr int CRYSTALS_IN_TOWER_ETA
const int crystaliEtaFromCardRegionInfo(int cc)

◆ realPhi()

const float p2eg::Cluster::realPhi ( int  cc)
inline

Definition at line 855 of file Phase2L1CaloEGammaUtils.h.

References gpuPixelDoublets::cc, crystaliPhiFromCardRegionInfo(), p2eg::CRYSTALS_IN_TOWER_PHI, p2eg::half_crystal_size, M_PI, and p2eg::n_towers_Phi.

Referenced by printClusterInfo().

855  {
856  float size_cell = 2 * M_PI / (CRYSTALS_IN_TOWER_PHI * n_towers_Phi);
857  return crystaliPhiFromCardRegionInfo(cc) * size_cell - M_PI + half_crystal_size;
858  }
static constexpr float half_crystal_size
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
static constexpr int n_towers_Phi
#define M_PI
const int crystaliPhiFromCardRegionInfo(int cc)
static constexpr int CRYSTALS_IN_TOWER_PHI

◆ region()

int p2eg::Cluster::region ( ) const
inline

◆ satur()

ap_uint<3> p2eg::Cluster::satur ( ) const
inline

Definition at line 789 of file Phase2L1CaloEGammaUtils.h.

References data.

Referenced by Cluster(), and p2eg::stitchClusterOverRegionBoundary().

789 { return ((data >> 25) & 0x7); }

◆ setRegionIdx()

void p2eg::Cluster::setRegionIdx ( int  regIdx)
inline

Definition at line 782 of file Phase2L1CaloEGammaUtils.h.

References regionIdx.

Referenced by Phase2L1CaloEGammaEmulator::produce().

782 { regionIdx = regIdx; } // Newly added

◆ towerEta()

ap_uint<5> p2eg::Cluster::towerEta ( ) const
inline

Definition at line 785 of file Phase2L1CaloEGammaUtils.h.

References data.

Referenced by Cluster(), crystaliEtaFromCardRegionInfo(), Phase2L1CaloEGammaEmulator::produce(), p2eg::stitchClusterOverRegionBoundary(), and towerEtaInCard().

785 { return ((data >> 12) & 0x1F); } // goes from 0 to 3 (need region for full info)

◆ towerEtaInCard()

int p2eg::Cluster::towerEtaInCard ( )
inline

Definition at line 801 of file Phase2L1CaloEGammaUtils.h.

References region(), p2eg::TOWER_IN_ETA, and towerEta().

Referenced by p2eg::stitchClusterOverRegionBoundary().

801 { return ((int)(region() * TOWER_IN_ETA) + towerEta()); }
ap_uint< 5 > towerEta() const
static constexpr int TOWER_IN_ETA

◆ towerPhi()

ap_uint<2> p2eg::Cluster::towerPhi ( ) const
inline

Definition at line 786 of file Phase2L1CaloEGammaUtils.h.

References data.

Referenced by Cluster(), crystaliPhiFromCardRegionInfo(), Phase2L1CaloEGammaEmulator::produce(), and p2eg::stitchClusterOverRegionBoundary().

786 { return ((data >> 17) & 0x3); }

◆ uint_et2x5()

ap_uint<15> p2eg::Cluster::uint_et2x5 ( ) const
inline

Definition at line 790 of file Phase2L1CaloEGammaUtils.h.

References et2x5.

Referenced by p2eg::stitchClusterOverRegionBoundary().

790 { return et2x5; }

◆ uint_et5x5()

ap_uint<15> p2eg::Cluster::uint_et5x5 ( ) const
inline

Definition at line 791 of file Phase2L1CaloEGammaUtils.h.

References et5x5.

Referenced by p2eg::stitchClusterOverRegionBoundary().

791 { return et5x5; }

Member Data Documentation

◆ brems

ap_uint<2> p2eg::Cluster::brems

Definition at line 733 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), and getBrems().

◆ calib

float p2eg::Cluster::calib

Definition at line 732 of file Phase2L1CaloEGammaUtils.h.

Referenced by getCalib().

◆ data

ap_uint<28> p2eg::Cluster::data

◆ et2x5

ap_uint<15> p2eg::Cluster::et2x5

Definition at line 735 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), getEt2x5(), and uint_et2x5().

◆ et5x5

ap_uint<15> p2eg::Cluster::et5x5

Definition at line 734 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), getEt5x5(), and uint_et5x5().

◆ is_iso

bool p2eg::Cluster::is_iso

Definition at line 738 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), and getIsIso().

◆ is_looseTkiso

bool p2eg::Cluster::is_looseTkiso

Definition at line 739 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), and getIsLooseTkIso().

◆ is_looseTkss

bool p2eg::Cluster::is_looseTkss

Definition at line 737 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), and getIsLooseTkss().

◆ is_ss

bool p2eg::Cluster::is_ss

Definition at line 736 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), and getIsSS().

◆ regionIdx

int p2eg::Cluster::regionIdx

Definition at line 731 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), region(), and setRegionIdx().