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 733 of file Phase2L1CaloEGammaUtils.h.

Constructor & Destructor Documentation

◆ Cluster() [1/2]

p2eg::Cluster::Cluster ( )
inline

Definition at line 746 of file Phase2L1CaloEGammaUtils.h.

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

746  {
747  data = 0;
748  regionIdx = -1;
749  calib = 1.0;
750  brems = 0;
751  et5x5 = 0;
752  et2x5 = 0;
753  is_ss = false;
754  is_looseTkss = false;
755  is_iso = false;
756  is_looseTkiso = false;
757  }

◆ 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 759 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().

773  {
774  data = (clusterEnergy) | (((ap_uint<32>)towerEta) << 12) | (((ap_uint<32>)towerPhi) << 17) |
775  (((ap_uint<32>)clusterEta) << 19) | (((ap_uint<32>)clusterPhi) << 22) | (((ap_uint<32>)satur) << 25);
776  regionIdx = clusterRegionIdx, et5x5 = clusterEt5x5;
777  et2x5 = clusterEt2x5;
778  brems = clusterBrems;
779  calib = clusterCalib;
780  is_ss = cluster_is_ss;
781  is_looseTkss = cluster_is_looseTkss;
782  is_iso = cluster_is_iso;
783  is_looseTkiso = cluster_is_looseTkiso;
784  }
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 815 of file Phase2L1CaloEGammaUtils.h.

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

815  {
816  float newPt = getPt() * factor;
817  // Convert the new pT to an unsigned int, 28 bits to take the logical OR with the mask
818  ap_uint<28> newPt_uint = (ap_uint<28>)(int)(newPt / ECAL_LSB);
819  // Make sure that the new pT only takes up the last twelve bits
820  newPt_uint = (newPt_uint & 0x0000FFF);
821 
822  // Modify 'data'
823  ap_uint<28> bitMask = 0xFFFF000; // last twelve digits are zero
824  data = (data & bitMask); // zero out the last twelve digits
825  data = (data | newPt_uint); // write in the new ET
826  }
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 791 of file Phase2L1CaloEGammaUtils.h.

References data.

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

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

◆ clusterPhi()

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

Definition at line 792 of file Phase2L1CaloEGammaUtils.h.

References data.

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

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

◆ crystaliEtaFromCardRegionInfo()

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

Definition at line 829 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().

829  {
830  int crystalEta_in_card =
832  if ((cc % 2) == 1) {
833  return (getCard_refCrystal_iEta(cc) + crystalEta_in_card);
834  } else {
835  // if card is even (negative eta)
836  return (getCard_refCrystal_iEta(cc) - crystalEta_in_card);
837  }
838  }
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 841 of file Phase2L1CaloEGammaUtils.h.

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

Referenced by realPhi().

841  {
842  int crystalPhi_in_card = (towerPhi() * CRYSTALS_IN_TOWER_PHI) + clusterPhi();
843  if ((cc % 2) == 1) {
844  // if card is odd (positive eta)
845  return (getCard_refCrystal_iPhi(cc) + crystalPhi_in_card);
846  } else {
847  // if card is even (negative eta)
848  return (getCard_refCrystal_iPhi(cc) - crystalPhi_in_card);
849  }
850  }
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 799 of file Phase2L1CaloEGammaUtils.h.

References brems.

Referenced by p2eg::stitchClusterOverRegionBoundary().

799 { return (int)brems; }

◆ getCalib()

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

Definition at line 800 of file Phase2L1CaloEGammaUtils.h.

References calib.

800 { return (float)calib; }

◆ getEt2x5()

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

Definition at line 803 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and et2x5.

803 { 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 802 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and et5x5.

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

◆ getIsIso()

bool p2eg::Cluster::getIsIso ( )
inline

Definition at line 809 of file Phase2L1CaloEGammaUtils.h.

References is_iso.

809 { return is_iso; }

◆ getIsLooseTkIso()

bool p2eg::Cluster::getIsLooseTkIso ( )
inline

Definition at line 810 of file Phase2L1CaloEGammaUtils.h.

References is_looseTkiso.

810 { return is_looseTkiso; }

◆ getIsLooseTkss()

bool p2eg::Cluster::getIsLooseTkss ( )
inline

Definition at line 808 of file Phase2L1CaloEGammaUtils.h.

References is_looseTkss.

Referenced by p2eg::stitchClusterOverRegionBoundary().

808 { return is_looseTkss; }

◆ getIsSS()

bool p2eg::Cluster::getIsSS ( )
inline

Definition at line 807 of file Phase2L1CaloEGammaUtils.h.

References is_ss.

Referenced by p2eg::stitchClusterOverRegionBoundary().

807 { return is_ss; }

◆ getPt()

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

Definition at line 801 of file Phase2L1CaloEGammaUtils.h.

References clusterEnergy(), and p2eg::ECAL_LSB.

Referenced by applyCalibration(), and printClusterInfo().

801 { 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 797 of file Phase2L1CaloEGammaUtils.h.

References data.

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

◆ printClusterInfo()

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

Definition at line 865 of file Phase2L1CaloEGammaUtils.h.

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

865  {
866  std::cout << "[Print Cluster class info:] [" << description << "]: "
867  << "card " << cc << ", "
868  << "et (float): " << getPt() << ", "
869  << "eta: " << realEta(cc) << ", "
870  << "phi: " << realPhi(cc) << std::endl;
871  }
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 853 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().

853  {
854  float size_cell = 2 * ECAL_eta_range / (CRYSTALS_IN_TOWER_ETA * n_towers_Eta);
856  }
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 859 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().

859  {
860  float size_cell = 2 * M_PI / (CRYSTALS_IN_TOWER_PHI * n_towers_Phi);
861  return crystaliPhiFromCardRegionInfo(cc) * size_cell - M_PI + half_crystal_size;
862  }
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 793 of file Phase2L1CaloEGammaUtils.h.

References data.

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

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

◆ setRegionIdx()

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

Definition at line 786 of file Phase2L1CaloEGammaUtils.h.

References regionIdx.

Referenced by Phase2L1CaloEGammaEmulator::produce().

786 { regionIdx = regIdx; } // Newly added

◆ towerEta()

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

Definition at line 789 of file Phase2L1CaloEGammaUtils.h.

References data.

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

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

◆ towerEtaInCard()

int p2eg::Cluster::towerEtaInCard ( )
inline

Definition at line 805 of file Phase2L1CaloEGammaUtils.h.

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

Referenced by p2eg::stitchClusterOverRegionBoundary().

805 { 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 790 of file Phase2L1CaloEGammaUtils.h.

References data.

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

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

◆ uint_et2x5()

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

Definition at line 794 of file Phase2L1CaloEGammaUtils.h.

References et2x5.

Referenced by p2eg::stitchClusterOverRegionBoundary().

794 { return et2x5; }

◆ uint_et5x5()

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

Definition at line 795 of file Phase2L1CaloEGammaUtils.h.

References et5x5.

Referenced by p2eg::stitchClusterOverRegionBoundary().

795 { return et5x5; }

Member Data Documentation

◆ brems

ap_uint<2> p2eg::Cluster::brems

Definition at line 738 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), and getBrems().

◆ calib

float p2eg::Cluster::calib

Definition at line 737 of file Phase2L1CaloEGammaUtils.h.

Referenced by getCalib().

◆ data

ap_uint<28> p2eg::Cluster::data

◆ et2x5

ap_uint<15> p2eg::Cluster::et2x5

Definition at line 740 of file Phase2L1CaloEGammaUtils.h.

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

◆ et5x5

ap_uint<15> p2eg::Cluster::et5x5

Definition at line 739 of file Phase2L1CaloEGammaUtils.h.

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

◆ is_iso

bool p2eg::Cluster::is_iso

Definition at line 743 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), and getIsIso().

◆ is_looseTkiso

bool p2eg::Cluster::is_looseTkiso

Definition at line 744 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), and getIsLooseTkIso().

◆ is_looseTkss

bool p2eg::Cluster::is_looseTkss

Definition at line 742 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), and getIsLooseTkss().

◆ is_ss

bool p2eg::Cluster::is_ss

Definition at line 741 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), and getIsSS().

◆ regionIdx

int p2eg::Cluster::regionIdx

Definition at line 736 of file Phase2L1CaloEGammaUtils.h.

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