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

Member Function Documentation

◆ createCaloTowerFromFiberIdx()

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

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

1421  {
1422  l1tp2::CaloTower l1CaloTower;
1423  l1CaloTower.setEcalTowerEt(ecalEtFloat()); // float: ECAL divide by 8.0
1424  l1CaloTower.setHcalTowerEt(hcalEtFloat()); // float: HCAL multiply by LSB
1425  int global_tower_iEta = globalToweriEta(nGCTCard, iFiber, iTowerInFiber);
1426  int global_tower_iPhi = globalToweriPhi(nGCTCard, iFiber, iTowerInFiber);
1427  l1CaloTower.setTowerIEta(global_tower_iEta);
1428  l1CaloTower.setTowerIPhi(global_tower_iPhi);
1429  l1CaloTower.setTowerEta(getTowerEta_fromAbsID(global_tower_iEta));
1430  l1CaloTower.setTowerPhi(getTowerPhi_fromAbsID(global_tower_iPhi));
1431  return l1CaloTower;
1432  }
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 1454 of file Phase2L1CaloEGammaUtils.h.

References fb, hoe, and totalEtFloat().

Referenced by p2eg::writeToCorrelatorAndGTOutputs().

1456  {
1457  return l1tp2::DigitizedTowerCorrelator(totalEtFloat(), hoe, fb, indexCard, indexFiber, indexTower);
1458  }

◆ createFullTowerFromCardIdx()

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

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

1437  {
1438  l1tp2::CaloTower l1CaloTower;
1439  // Store total Et (HCAL+ECAL) in the ECAL Et member
1440  l1CaloTower.setEcalTowerEt(totalEtFloat());
1441  int global_tower_iEta = globalToweriEtaFromGCTcardiEta(gctCard_tower_iEta);
1442  int global_tower_iPhi = globalToweriPhiFromGCTcardiPhi(nGCTCard, gctCard_tower_iPhi);
1443  l1CaloTower.setTowerIEta(global_tower_iEta);
1444  l1CaloTower.setTowerIPhi(global_tower_iPhi);
1445  l1CaloTower.setTowerEta(getTowerEta_fromAbsID(global_tower_iEta));
1446  l1CaloTower.setTowerPhi(getTowerPhi_fromAbsID(global_tower_iPhi));
1447  return l1CaloTower;
1448  }
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 1331 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and ecalEt.

Referenced by createCaloTowerFromFiberIdx(), and printGCTTowerInfoFromGlobalIdx().

1331 { 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 1353 of file Phase2L1CaloEGammaUtils.h.

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

Referenced by createCaloTowerFromFiberIdx().

1353  {
1354  (void)nGCTCard; // not needed
1355  bool isTowerInPositiveEta = (gctCorrFiberIdx < N_GCTPOSITIVE_FIBERS); // N_GCTPOSITIVE_FIBERS = 32
1356  int global_toweriEta;
1357  if (isTowerInPositiveEta) {
1358  global_toweriEta = (N_GCTTOWERS_FIBER + posInFiber); // N_GCTTOWERS_FIBER = 17
1359  } else {
1360  // e.g. For negative eta, posInFiber = 0 is at real eta = 0, and global tower iEta is 17 - 1 - 0 = 16
1361  // posInFiber = 16 is at real eta = -1.4841, and global tower iEta is 17 - 1 - 16 = 0.
1362  global_toweriEta = (N_GCTTOWERS_FIBER - 1 - posInFiber);
1363  }
1364  return global_toweriEta;
1365  }
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 1394 of file Phase2L1CaloEGammaUtils.h.

Referenced by createFullTowerFromCardIdx().

1394  {
1395  int global_iEta = gctCard_tower_iEta;
1396  return global_iEta;
1397  }

◆ globalToweriPhi()

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

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

1375  {
1376  (void)posInFiber; // not needed
1377  unsigned int effectiveFiberIdx = (gctCorrFiberIdx % N_GCTPOSITIVE_FIBERS); // N_GCTPOSITIVE_FIBERS = 32
1378  int toweriPhi_card_offset = 0;
1379  if (nGCTCard == 0)
1380  toweriPhi_card_offset = GCTCARD_0_TOWER_IPHI_OFFSET;
1381  else if (nGCTCard == 1)
1382  toweriPhi_card_offset = GCTCARD_1_TOWER_IPHI_OFFSET;
1383  else if (nGCTCard == 2)
1384  toweriPhi_card_offset = GCTCARD_2_TOWER_IPHI_OFFSET;
1385 
1386  // as explained above, effectiveFiberIdx is [0, 32). n_towers_Phi = 72:
1387  int global_tower_iPhi = (toweriPhi_card_offset + effectiveFiberIdx) % (n_towers_Phi);
1388  return global_tower_iPhi;
1389  }
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 1402 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().

1402  {
1403  assert(nGCTCard <= 2); // Make sure the card number is valid
1404  int toweriPhi_card_offset = 0;
1405  if (nGCTCard == 0)
1406  toweriPhi_card_offset = GCTCARD_0_TOWER_IPHI_OFFSET;
1407  else if (nGCTCard == 1)
1408  toweriPhi_card_offset = GCTCARD_1_TOWER_IPHI_OFFSET;
1409  else if (nGCTCard == 2)
1410  toweriPhi_card_offset = GCTCARD_2_TOWER_IPHI_OFFSET;
1411 
1412  int global_iPhi = (toweriPhi_card_offset + gctCard_tower_iPhi) % (n_towers_Phi); // n_towers_Phi = 72
1413  return global_iPhi;
1414  }
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 1332 of file Phase2L1CaloEGammaUtils.h.

References p2eg::HCAL_LSB, and hcalEt.

Referenced by createCaloTowerFromFiberIdx(), and printGCTTowerInfoFromGlobalIdx().

1332  {
1333  return ((float)hcalEt * HCAL_LSB);
1334  } // 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 1339 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().

1339  {
1340  et = rctTower.et;
1341  hoe = rctTower.hoe;
1342  ecalEt = rctTower.ecalEt;
1343  hcalEt = rctTower.hcalEt;
1344  }

◆ printGCTTowerInfoFromGlobalIdx()

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

Definition at line 1463 of file Phase2L1CaloEGammaUtils.h.

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

1463  {
1464  std::cout << "[Print GCTtower_t class info from global idx:] [" << description << "]: "
1465  << "total et (float): " << totalEtFloat() << ", "
1466  << "ecal et (float): " << ecalEtFloat() << ", "
1467  << "hcal et (float): " << hcalEtFloat() << ", "
1468  << "fb: " << fb << ", "
1469  << "global tower ieta: " << global_tower_iEta << ", "
1470  << "global tower iphi: " << global_tower_iPhi << ", "
1471  << "eta: " << getTowerEta_fromAbsID(global_tower_iEta) << ", "
1472  << "phi: " << getTowerPhi_fromAbsID(global_tower_iPhi) << std::endl;
1473  }
float getTowerPhi_fromAbsID(int id)
float getTowerEta_fromAbsID(int id)

◆ totalEtFloat()

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

Definition at line 1328 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and et.

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

1328  {
1329  return ((float)et * ECAL_LSB);
1330  } // 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 1321 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 1326 of file Phase2L1CaloEGammaUtils.h.

Referenced by hcalEtFloat(), and initFromRCTTower().

◆ hoe

ap_uint<4> p2eg::GCTtower_t::hoe