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
 
Clusteroperator= (const Cluster &rhs)
 
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 803 of file Phase2L1CaloEGammaUtils.h.

Constructor & Destructor Documentation

◆ Cluster() [1/2]

p2eg::Cluster::Cluster ( )
inline

Definition at line 816 of file Phase2L1CaloEGammaUtils.h.

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

816  {
817  data = 0;
818  regionIdx = -1;
819  calib = 1.0;
820  brems = 0;
821  et5x5 = 0;
822  et2x5 = 0;
823  is_ss = false;
824  is_looseTkss = false;
825  is_iso = false;
826  is_looseTkiso = false;
827  }

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

843  {
844  data = (clusterEnergy) | (((ap_uint<32>)towerEta) << 12) | (((ap_uint<32>)towerPhi) << 17) |
845  (((ap_uint<32>)clusterEta) << 19) | (((ap_uint<32>)clusterPhi) << 22) | (((ap_uint<32>)satur) << 25);
846  regionIdx = clusterRegionIdx, et5x5 = clusterEt5x5;
847  et2x5 = clusterEt2x5;
848  brems = clusterBrems;
849  calib = clusterCalib;
850  is_ss = cluster_is_ss;
851  is_looseTkss = cluster_is_looseTkss;
852  is_iso = cluster_is_iso;
853  is_looseTkiso = cluster_is_looseTkiso;
854  }
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 899 of file Phase2L1CaloEGammaUtils.h.

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

899  {
900  float newPt = getPt() * factor;
901  // Convert the new pT to an unsigned int, 28 bits to take the logical OR with the mask
902  ap_uint<28> newPt_uint = (ap_uint<28>)(int)(newPt / ECAL_LSB);
903  // Make sure that the new pT only takes up the last twelve bits
904  newPt_uint = (newPt_uint & 0x0000FFF);
905 
906  // Modify 'data'
907  ap_uint<28> bitMask = 0xFFFF000; // last twelve digits are zero
908  data = (data & bitMask); // zero out the last twelve digits
909  data = (data | newPt_uint); // write in the new ET
910  }
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 875 of file Phase2L1CaloEGammaUtils.h.

References data.

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

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

◆ clusterPhi()

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

Definition at line 876 of file Phase2L1CaloEGammaUtils.h.

References data.

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

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

◆ crystaliEtaFromCardRegionInfo()

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

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

913  {
914  int crystalEta_in_card =
916  if ((cc % 2) == 1) {
917  return (getCard_refCrystal_iEta(cc) + crystalEta_in_card);
918  } else {
919  // if card is even (negative eta)
920  return (getCard_refCrystal_iEta(cc) - crystalEta_in_card);
921  }
922  }
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 925 of file Phase2L1CaloEGammaUtils.h.

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

Referenced by realPhi().

925  {
926  int crystalPhi_in_card = (towerPhi() * CRYSTALS_IN_TOWER_PHI) + clusterPhi();
927  if ((cc % 2) == 1) {
928  // if card is odd (positive eta)
929  return (getCard_refCrystal_iPhi(cc) + crystalPhi_in_card);
930  } else {
931  // if card is even (negative eta)
932  return (getCard_refCrystal_iPhi(cc) - crystalPhi_in_card);
933  }
934  }
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 883 of file Phase2L1CaloEGammaUtils.h.

References brems.

Referenced by p2eg::stitchClusterOverRegionBoundary().

883 { return (int)brems; }

◆ getCalib()

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

Definition at line 884 of file Phase2L1CaloEGammaUtils.h.

References calib.

884 { return (float)calib; }

◆ getEt2x5()

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

Definition at line 887 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and et2x5.

887 { 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 886 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and et5x5.

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

◆ getIsIso()

bool p2eg::Cluster::getIsIso ( )
inline

Definition at line 893 of file Phase2L1CaloEGammaUtils.h.

References is_iso.

893 { return is_iso; }

◆ getIsLooseTkIso()

bool p2eg::Cluster::getIsLooseTkIso ( )
inline

Definition at line 894 of file Phase2L1CaloEGammaUtils.h.

References is_looseTkiso.

894 { return is_looseTkiso; }

◆ getIsLooseTkss()

bool p2eg::Cluster::getIsLooseTkss ( )
inline

Definition at line 892 of file Phase2L1CaloEGammaUtils.h.

References is_looseTkss.

Referenced by p2eg::stitchClusterOverRegionBoundary().

892 { return is_looseTkss; }

◆ getIsSS()

bool p2eg::Cluster::getIsSS ( )
inline

Definition at line 891 of file Phase2L1CaloEGammaUtils.h.

References is_ss.

Referenced by p2eg::stitchClusterOverRegionBoundary().

891 { return is_ss; }

◆ getPt()

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

Definition at line 885 of file Phase2L1CaloEGammaUtils.h.

References clusterEnergy(), and p2eg::ECAL_LSB.

Referenced by applyCalibration(), and printClusterInfo().

885 { 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 881 of file Phase2L1CaloEGammaUtils.h.

References data.

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

◆ operator=()

Cluster& p2eg::Cluster::operator= ( const Cluster rhs)
inline

Definition at line 856 of file Phase2L1CaloEGammaUtils.h.

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

856  {
857  data = rhs.data;
858  regionIdx = rhs.regionIdx;
859  calib = rhs.calib;
860  brems = rhs.brems;
861  et5x5 = rhs.et5x5;
862  et2x5 = rhs.et2x5;
863  is_ss = rhs.is_ss;
864  is_looseTkss = rhs.is_looseTkss;
865  is_iso = rhs.is_iso;
866  is_looseTkiso = rhs.is_looseTkiso;
867  return *this;
868  }

◆ printClusterInfo()

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

Definition at line 949 of file Phase2L1CaloEGammaUtils.h.

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

949  {
950  std::cout << "[Print Cluster class info:] [" << description << "]: "
951  << "card " << cc << ", "
952  << "et (float): " << getPt() << ", "
953  << "eta: " << realEta(cc) << ", "
954  << "phi: " << realPhi(cc) << std::endl;
955  }
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 937 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().

937  {
938  float size_cell = 2 * ECAL_eta_range / (CRYSTALS_IN_TOWER_ETA * n_towers_Eta);
940  }
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 943 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().

943  {
944  float size_cell = 2 * M_PI / (CRYSTALS_IN_TOWER_PHI * n_towers_Phi);
945  return crystaliPhiFromCardRegionInfo(cc) * size_cell - M_PI + half_crystal_size;
946  }
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 877 of file Phase2L1CaloEGammaUtils.h.

References data.

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

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

◆ setRegionIdx()

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

Definition at line 870 of file Phase2L1CaloEGammaUtils.h.

References regionIdx.

Referenced by Phase2L1CaloEGammaEmulator::produce().

870 { regionIdx = regIdx; } // Newly added

◆ towerEta()

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

Definition at line 873 of file Phase2L1CaloEGammaUtils.h.

References data.

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

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

◆ towerEtaInCard()

int p2eg::Cluster::towerEtaInCard ( )
inline

Definition at line 889 of file Phase2L1CaloEGammaUtils.h.

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

Referenced by p2eg::stitchClusterOverRegionBoundary().

889 { 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 874 of file Phase2L1CaloEGammaUtils.h.

References data.

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

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

◆ uint_et2x5()

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

Definition at line 878 of file Phase2L1CaloEGammaUtils.h.

References et2x5.

Referenced by p2eg::stitchClusterOverRegionBoundary().

878 { return et2x5; }

◆ uint_et5x5()

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

Definition at line 879 of file Phase2L1CaloEGammaUtils.h.

References et5x5.

Referenced by p2eg::stitchClusterOverRegionBoundary().

879 { return et5x5; }

Member Data Documentation

◆ brems

ap_uint<2> p2eg::Cluster::brems

Definition at line 808 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), getBrems(), and operator=().

◆ calib

float p2eg::Cluster::calib

Definition at line 807 of file Phase2L1CaloEGammaUtils.h.

Referenced by getCalib(), and operator=().

◆ data

ap_uint<28> p2eg::Cluster::data

◆ et2x5

ap_uint<15> p2eg::Cluster::et2x5

Definition at line 810 of file Phase2L1CaloEGammaUtils.h.

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

◆ et5x5

ap_uint<15> p2eg::Cluster::et5x5

Definition at line 809 of file Phase2L1CaloEGammaUtils.h.

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

◆ is_iso

bool p2eg::Cluster::is_iso

Definition at line 813 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), getIsIso(), and operator=().

◆ is_looseTkiso

bool p2eg::Cluster::is_looseTkiso

Definition at line 814 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), getIsLooseTkIso(), and operator=().

◆ is_looseTkss

bool p2eg::Cluster::is_looseTkss

Definition at line 812 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), getIsLooseTkss(), and operator=().

◆ is_ss

bool p2eg::Cluster::is_ss

Definition at line 811 of file Phase2L1CaloEGammaUtils.h.

Referenced by Cluster(), getIsSS(), and operator=().

◆ regionIdx

int p2eg::Cluster::regionIdx

Definition at line 806 of file Phase2L1CaloEGammaUtils.h.

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