CMS 3D CMS Logo

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

#include <Phase2L1CaloEGammaUtils.h>

Public Member Functions

l1tp2::CaloTower createCaloTowerFromFiberIdx (int nGCTCard, int iFiber, int iTowerInFiber)
 
l1tp2::DigitizedTowerCorrelator createDigitizedTowerCorrelator (unsigned int indexCard, unsigned int indexFiber, unsigned int indexTower)
 
l1tp2::CaloTower createFullTowerFromCardIdx (int nGCTCard, int gctCard_tower_iEta, int gctCard_tower_iPhi)
 
float ecalEtFloat () const
 
int globalToweriEta (unsigned int nGCTCard, unsigned int gctCorrFiberIdx, unsigned int posInFiber)
 
int globalToweriEtaFromGCTcardiEta (int gctCard_tower_iEta)
 
int globalToweriPhi (unsigned int nGCTCard, unsigned int gctCorrFiberIdx, unsigned int posInFiber)
 
int globalToweriPhiFromGCTcardiPhi (unsigned int nGCTCard, int gctCard_tower_iPhi)
 
float hcalEtFloat () const
 
void initFromRCTTower (const RCTtower_t &rctTower)
 
void printGCTTowerInfoFromGlobalIdx (int global_tower_iEta, int global_tower_iPhi, std::string description="")
 
float totalEtFloat () const
 

Public Attributes

ap_uint< 12 > ecalEt
 
ap_uint< 12 > et
 
ap_uint< 2 > fb
 
ap_uint< 12 > hcalEt
 
ap_uint< 4 > hoe
 

Detailed Description

Definition at line 1378 of file Phase2L1CaloEGammaUtils.h.

Member Function Documentation

◆ createCaloTowerFromFiberIdx()

l1tp2::CaloTower p2eg::GCTtower_t::createCaloTowerFromFiberIdx ( int  nGCTCard,
int  iFiber,
int  iTowerInFiber 
)
inline

Definition at line 1480 of file Phase2L1CaloEGammaUtils.h.

References ecalEtFloat(), p2eg::getTowerEta_fromAbsID(), p2eg::getTowerPhi_fromAbsID(), globalToweriEta(), globalToweriPhi(), hcalEtFloat(), l1tp2::CaloTower::setEcalTowerEt(), l1tp2::CaloTower::setHcalTowerEt(), l1tp2::CaloTower::setTowerEta(), l1tp2::CaloTower::setTowerIEta(), l1tp2::CaloTower::setTowerIPhi(), and l1tp2::CaloTower::setTowerPhi().

Referenced by p2eg::writeToCorrelatorAndGTOutputs().

1480  {
1481  l1tp2::CaloTower l1CaloTower;
1482  l1CaloTower.setEcalTowerEt(ecalEtFloat()); // float: ECAL divide by 8.0
1483  l1CaloTower.setHcalTowerEt(hcalEtFloat()); // float: HCAL multiply by LSB
1484  int global_tower_iEta = globalToweriEta(nGCTCard, iFiber, iTowerInFiber);
1485  int global_tower_iPhi = globalToweriPhi(nGCTCard, iFiber, iTowerInFiber);
1486  l1CaloTower.setTowerIEta(global_tower_iEta);
1487  l1CaloTower.setTowerIPhi(global_tower_iPhi);
1488  l1CaloTower.setTowerEta(getTowerEta_fromAbsID(global_tower_iEta));
1489  l1CaloTower.setTowerPhi(getTowerPhi_fromAbsID(global_tower_iPhi));
1490  return l1CaloTower;
1491  }
void setEcalTowerEt(float et)
Definition: CaloTower.h:49
void setTowerIPhi(int iPhi)
Definition: CaloTower.h:51
int globalToweriPhi(unsigned int nGCTCard, unsigned int gctCorrFiberIdx, unsigned int posInFiber)
int globalToweriEta(unsigned int nGCTCard, unsigned int gctCorrFiberIdx, unsigned int posInFiber)
void setHcalTowerEt(float et)
Definition: CaloTower.h:50
void setTowerIEta(int iEta)
Definition: CaloTower.h:52
float getTowerPhi_fromAbsID(int id)
void setTowerPhi(float phi)
Definition: CaloTower.h:53
float getTowerEta_fromAbsID(int id)
void setTowerEta(float eta)
Definition: CaloTower.h:54

◆ createDigitizedTowerCorrelator()

l1tp2::DigitizedTowerCorrelator p2eg::GCTtower_t::createDigitizedTowerCorrelator ( unsigned int  indexCard,
unsigned int  indexFiber,
unsigned int  indexTower 
)
inline

Definition at line 1513 of file Phase2L1CaloEGammaUtils.h.

References fb, hoe, and totalEtFloat().

Referenced by p2eg::writeToCorrelatorAndGTOutputs().

1515  {
1516  return l1tp2::DigitizedTowerCorrelator(totalEtFloat(), hoe, fb, indexCard, indexFiber, indexTower);
1517  }

◆ createFullTowerFromCardIdx()

l1tp2::CaloTower p2eg::GCTtower_t::createFullTowerFromCardIdx ( int  nGCTCard,
int  gctCard_tower_iEta,
int  gctCard_tower_iPhi 
)
inline

Definition at line 1496 of file Phase2L1CaloEGammaUtils.h.

References p2eg::getTowerEta_fromAbsID(), p2eg::getTowerPhi_fromAbsID(), globalToweriEtaFromGCTcardiEta(), globalToweriPhiFromGCTcardiPhi(), l1tp2::CaloTower::setEcalTowerEt(), l1tp2::CaloTower::setTowerEta(), l1tp2::CaloTower::setTowerIEta(), l1tp2::CaloTower::setTowerIPhi(), l1tp2::CaloTower::setTowerPhi(), and totalEtFloat().

Referenced by p2eg::GCTintTowers_t::writeToPFOutput().

1496  {
1497  l1tp2::CaloTower l1CaloTower;
1498  // Store total Et (HCAL+ECAL) in the ECAL Et member
1499  l1CaloTower.setEcalTowerEt(totalEtFloat());
1500  int global_tower_iEta = globalToweriEtaFromGCTcardiEta(gctCard_tower_iEta);
1501  int global_tower_iPhi = globalToweriPhiFromGCTcardiPhi(nGCTCard, gctCard_tower_iPhi);
1502  l1CaloTower.setTowerIEta(global_tower_iEta);
1503  l1CaloTower.setTowerIPhi(global_tower_iPhi);
1504  l1CaloTower.setTowerEta(getTowerEta_fromAbsID(global_tower_iEta));
1505  l1CaloTower.setTowerPhi(getTowerPhi_fromAbsID(global_tower_iPhi));
1506  return l1CaloTower;
1507  }
void setEcalTowerEt(float et)
Definition: CaloTower.h:49
void setTowerIPhi(int iPhi)
Definition: CaloTower.h:51
void setTowerIEta(int iEta)
Definition: CaloTower.h:52
float getTowerPhi_fromAbsID(int id)
void setTowerPhi(float phi)
Definition: CaloTower.h:53
float getTowerEta_fromAbsID(int id)
int globalToweriPhiFromGCTcardiPhi(unsigned int nGCTCard, int gctCard_tower_iPhi)
void setTowerEta(float eta)
Definition: CaloTower.h:54
int globalToweriEtaFromGCTcardiEta(int gctCard_tower_iEta)

◆ ecalEtFloat()

float p2eg::GCTtower_t::ecalEtFloat ( ) const
inline

Definition at line 1390 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and ecalEt.

Referenced by createCaloTowerFromFiberIdx(), and printGCTTowerInfoFromGlobalIdx().

1390 { return ((float)ecalEt * ECAL_LSB); } // Return ECAL energy as a float
static constexpr float ECAL_LSB

◆ globalToweriEta()

int p2eg::GCTtower_t::globalToweriEta ( unsigned int  nGCTCard,
unsigned int  gctCorrFiberIdx,
unsigned int  posInFiber 
)
inline

Definition at line 1412 of file Phase2L1CaloEGammaUtils.h.

References p2eg::N_GCTPOSITIVE_FIBERS, p2eg::N_GCTTOWERS_FIBER, and funct::void.

Referenced by createCaloTowerFromFiberIdx().

1412  {
1413  (void)nGCTCard; // not needed
1414  bool isTowerInPositiveEta = (gctCorrFiberIdx < N_GCTPOSITIVE_FIBERS); // N_GCTPOSITIVE_FIBERS = 32
1415  int global_toweriEta;
1416  if (isTowerInPositiveEta) {
1417  global_toweriEta = (N_GCTTOWERS_FIBER + posInFiber); // N_GCTTOWERS_FIBER = 17
1418  } else {
1419  // e.g. For negative eta, posInFiber = 0 is at real eta = 0, and global tower iEta is 17 - 1 - 0 = 16
1420  // posInFiber = 16 is at real eta = -1.4841, and global tower iEta is 17 - 1 - 16 = 0.
1421  global_toweriEta = (N_GCTTOWERS_FIBER - 1 - posInFiber);
1422  }
1423  return global_toweriEta;
1424  }
static constexpr int N_GCTPOSITIVE_FIBERS
static constexpr int N_GCTTOWERS_FIBER
TEMPL(T2) struct Divides void
Definition: Factorize.h:24

◆ globalToweriEtaFromGCTcardiEta()

int p2eg::GCTtower_t::globalToweriEtaFromGCTcardiEta ( int  gctCard_tower_iEta)
inline

Definition at line 1453 of file Phase2L1CaloEGammaUtils.h.

Referenced by createFullTowerFromCardIdx().

1453  {
1454  int global_iEta = gctCard_tower_iEta;
1455  return global_iEta;
1456  }

◆ globalToweriPhi()

int p2eg::GCTtower_t::globalToweriPhi ( unsigned int  nGCTCard,
unsigned int  gctCorrFiberIdx,
unsigned int  posInFiber 
)
inline

Definition at line 1434 of file Phase2L1CaloEGammaUtils.h.

References p2eg::GCTCARD_0_TOWER_IPHI_OFFSET, p2eg::GCTCARD_1_TOWER_IPHI_OFFSET, p2eg::GCTCARD_2_TOWER_IPHI_OFFSET, p2eg::N_GCTPOSITIVE_FIBERS, p2eg::n_towers_Phi, and funct::void.

Referenced by createCaloTowerFromFiberIdx().

1434  {
1435  (void)posInFiber; // not needed
1436  unsigned int effectiveFiberIdx = (gctCorrFiberIdx % N_GCTPOSITIVE_FIBERS); // N_GCTPOSITIVE_FIBERS = 32
1437  int toweriPhi_card_offset = 0;
1438  if (nGCTCard == 0)
1439  toweriPhi_card_offset = GCTCARD_0_TOWER_IPHI_OFFSET;
1440  else if (nGCTCard == 1)
1441  toweriPhi_card_offset = GCTCARD_1_TOWER_IPHI_OFFSET;
1442  else if (nGCTCard == 2)
1443  toweriPhi_card_offset = GCTCARD_2_TOWER_IPHI_OFFSET;
1444 
1445  // as explained above, effectiveFiberIdx is [0, 32). n_towers_Phi = 72:
1446  int global_tower_iPhi = (toweriPhi_card_offset + effectiveFiberIdx) % (n_towers_Phi);
1447  return global_tower_iPhi;
1448  }
static constexpr int GCTCARD_1_TOWER_IPHI_OFFSET
static constexpr int N_GCTPOSITIVE_FIBERS
static constexpr int n_towers_Phi
static constexpr int GCTCARD_0_TOWER_IPHI_OFFSET
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
static constexpr int GCTCARD_2_TOWER_IPHI_OFFSET

◆ globalToweriPhiFromGCTcardiPhi()

int p2eg::GCTtower_t::globalToweriPhiFromGCTcardiPhi ( unsigned int  nGCTCard,
int  gctCard_tower_iPhi 
)
inline

Definition at line 1461 of file Phase2L1CaloEGammaUtils.h.

References cms::cuda::assert(), p2eg::GCTCARD_0_TOWER_IPHI_OFFSET, p2eg::GCTCARD_1_TOWER_IPHI_OFFSET, p2eg::GCTCARD_2_TOWER_IPHI_OFFSET, and p2eg::n_towers_Phi.

Referenced by createFullTowerFromCardIdx().

1461  {
1462  assert(nGCTCard <= 2); // Make sure the card number is valid
1463  int toweriPhi_card_offset = 0;
1464  if (nGCTCard == 0)
1465  toweriPhi_card_offset = GCTCARD_0_TOWER_IPHI_OFFSET;
1466  else if (nGCTCard == 1)
1467  toweriPhi_card_offset = GCTCARD_1_TOWER_IPHI_OFFSET;
1468  else if (nGCTCard == 2)
1469  toweriPhi_card_offset = GCTCARD_2_TOWER_IPHI_OFFSET;
1470 
1471  int global_iPhi = (toweriPhi_card_offset + gctCard_tower_iPhi) % (n_towers_Phi); // n_towers_Phi = 72
1472  return global_iPhi;
1473  }
static constexpr int GCTCARD_1_TOWER_IPHI_OFFSET
static constexpr int n_towers_Phi
assert(be >=bs)
static constexpr int GCTCARD_0_TOWER_IPHI_OFFSET
static constexpr int GCTCARD_2_TOWER_IPHI_OFFSET

◆ hcalEtFloat()

float p2eg::GCTtower_t::hcalEtFloat ( ) const
inline

Definition at line 1391 of file Phase2L1CaloEGammaUtils.h.

References p2eg::HCAL_LSB, and hcalEt.

Referenced by createCaloTowerFromFiberIdx(), and printGCTTowerInfoFromGlobalIdx().

1391  {
1392  return ((float)hcalEt * HCAL_LSB);
1393  } // Return HCAL energy as a float, use HCAL LSB
static constexpr float HCAL_LSB

◆ initFromRCTTower()

void p2eg::GCTtower_t::initFromRCTTower ( const RCTtower_t rctTower)
inline

Definition at line 1398 of file Phase2L1CaloEGammaUtils.h.

References p2eg::RCTtower_t::ecalEt, ecalEt, p2eg::RCTtower_t::et, et, p2eg::RCTtower_t::hcalEt, hcalEt, p2eg::RCTtower_t::hoe, and hoe.

Referenced by p2eg::getClustersTowers().

1398  {
1399  et = rctTower.et;
1400  hoe = rctTower.hoe;
1401  ecalEt = rctTower.ecalEt;
1402  hcalEt = rctTower.hcalEt;
1403  }

◆ printGCTTowerInfoFromGlobalIdx()

void p2eg::GCTtower_t::printGCTTowerInfoFromGlobalIdx ( int  global_tower_iEta,
int  global_tower_iPhi,
std::string  description = "" 
)
inline

Definition at line 1522 of file Phase2L1CaloEGammaUtils.h.

References gather_cfg::cout, makeListRunsInFiles::description, ecalEtFloat(), fb, p2eg::getTowerEta_fromAbsID(), p2eg::getTowerPhi_fromAbsID(), hcalEtFloat(), and totalEtFloat().

1522  {
1523  std::cout << "[Print GCTtower_t class info from global idx:] [" << description << "]: "
1524  << "total et (float): " << totalEtFloat() << ", "
1525  << "ecal et (float): " << ecalEtFloat() << ", "
1526  << "hcal et (float): " << hcalEtFloat() << ", "
1527  << "fb: " << fb << ", "
1528  << "global tower ieta: " << global_tower_iEta << ", "
1529  << "global tower iphi: " << global_tower_iPhi << ", "
1530  << "eta: " << getTowerEta_fromAbsID(global_tower_iEta) << ", "
1531  << "phi: " << getTowerPhi_fromAbsID(global_tower_iPhi) << std::endl;
1532  }
float getTowerPhi_fromAbsID(int id)
float getTowerEta_fromAbsID(int id)

◆ totalEtFloat()

float p2eg::GCTtower_t::totalEtFloat ( ) const
inline

Definition at line 1387 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and et.

Referenced by createDigitizedTowerCorrelator(), createFullTowerFromCardIdx(), and printGCTTowerInfoFromGlobalIdx().

1387  {
1388  return ((float)et * ECAL_LSB);
1389  } // Return total energy as a float (assuming the energy uses the ECAL LSB convention)
static constexpr float ECAL_LSB

Member Data Documentation

◆ ecalEt

ap_uint<12> p2eg::GCTtower_t::ecalEt

◆ et

ap_uint<12> p2eg::GCTtower_t::et

Definition at line 1380 of file Phase2L1CaloEGammaUtils.h.

Referenced by p2eg::getFullTowers(), initFromRCTTower(), and totalEtFloat().

◆ fb

ap_uint<2> p2eg::GCTtower_t::fb

◆ hcalEt

ap_uint<12> p2eg::GCTtower_t::hcalEt

Definition at line 1385 of file Phase2L1CaloEGammaUtils.h.

Referenced by hcalEtFloat(), and initFromRCTTower().

◆ hoe

ap_uint<4> p2eg::GCTtower_t::hoe