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

Member Function Documentation

◆ createCaloTowerFromFiberIdx()

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

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

1401  {
1402  l1tp2::CaloTower l1CaloTower;
1403  l1CaloTower.setEcalTowerEt(ecalEtFloat()); // float: ECAL divide by 8.0
1404  l1CaloTower.setHcalTowerEt(hcalEtFloat()); // float: HCAL multiply by LSB
1405  int global_tower_iEta = globalToweriEta(nGCTCard, iFiber, iTowerInFiber);
1406  int global_tower_iPhi = globalToweriPhi(nGCTCard, iFiber, iTowerInFiber);
1407  l1CaloTower.setTowerIEta(global_tower_iEta);
1408  l1CaloTower.setTowerIPhi(global_tower_iPhi);
1409  l1CaloTower.setTowerEta(getTowerEta_fromAbsID(global_tower_iEta));
1410  l1CaloTower.setTowerPhi(getTowerPhi_fromAbsID(global_tower_iPhi));
1411  return l1CaloTower;
1412  }
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 1435 of file Phase2L1CaloEGammaUtils.h.

References fb, hoe, and totalEtFloat().

Referenced by p2eg::writeToCorrelatorAndGTOutputs().

1437  {
1438  return l1tp2::DigitizedTowerCorrelator(totalEtFloat(), hoe, fb, indexCard, indexFiber, indexTower);
1439  }

◆ createFullTowerFromCardIdx()

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

Definition at line 1417 of file Phase2L1CaloEGammaUtils.h.

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

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

1417  {
1418  l1tp2::CaloTower l1CaloTower;
1419  // Store total Et (HCAL+ECAL) in the ECAL Et member
1420  l1CaloTower.setEcalTowerEt(totalEtFloat());
1421  l1CaloTower.setHcalTowerEt(ecalEtFloat());
1422  int global_tower_iEta = globalToweriEtaFromGCTcardiEta(gctCard_tower_iEta);
1423  int global_tower_iPhi = globalToweriPhiFromGCTcardiPhi(nGCTCard, gctCard_tower_iPhi);
1424  l1CaloTower.setTowerIEta(global_tower_iEta);
1425  l1CaloTower.setTowerIPhi(global_tower_iPhi);
1426  l1CaloTower.setTowerEta(getTowerEta_fromAbsID(global_tower_iEta));
1427  l1CaloTower.setTowerPhi(getTowerPhi_fromAbsID(global_tower_iPhi));
1428  return l1CaloTower;
1429  }
void setEcalTowerEt(float et)
Definition: CaloTower.h:49
void setTowerIPhi(int iPhi)
Definition: CaloTower.h:51
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)
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 1311 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and ecalEt.

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

1311 { 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 1333 of file Phase2L1CaloEGammaUtils.h.

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

Referenced by createCaloTowerFromFiberIdx().

1333  {
1334  (void)nGCTCard; // not needed
1335  bool isTowerInPositiveEta = (gctCorrFiberIdx < N_GCTPOSITIVE_FIBERS); // N_GCTPOSITIVE_FIBERS = 32
1336  int global_toweriEta;
1337  if (isTowerInPositiveEta) {
1338  global_toweriEta = (N_GCTTOWERS_FIBER + posInFiber); // N_GCTTOWERS_FIBER = 17
1339  } else {
1340  // e.g. For negative eta, posInFiber = 0 is at real eta = 0, and global tower iEta is 17 - 1 - 0 = 16
1341  // posInFiber = 16 is at real eta = -1.4841, and global tower iEta is 17 - 1 - 16 = 0.
1342  global_toweriEta = (N_GCTTOWERS_FIBER - 1 - posInFiber);
1343  }
1344  return global_toweriEta;
1345  }
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 1374 of file Phase2L1CaloEGammaUtils.h.

Referenced by createFullTowerFromCardIdx().

1374  {
1375  int global_iEta = gctCard_tower_iEta;
1376  return global_iEta;
1377  }

◆ globalToweriPhi()

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

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

1355  {
1356  (void)posInFiber; // not needed
1357  unsigned int effectiveFiberIdx = (gctCorrFiberIdx % N_GCTPOSITIVE_FIBERS); // N_GCTPOSITIVE_FIBERS = 32
1358  int toweriPhi_card_offset = 0;
1359  if (nGCTCard == 0)
1360  toweriPhi_card_offset = GCTCARD_0_TOWER_IPHI_OFFSET;
1361  else if (nGCTCard == 1)
1362  toweriPhi_card_offset = GCTCARD_1_TOWER_IPHI_OFFSET;
1363  else if (nGCTCard == 2)
1364  toweriPhi_card_offset = GCTCARD_2_TOWER_IPHI_OFFSET;
1365 
1366  // as explained above, effectiveFiberIdx is [0, 32). n_towers_Phi = 72:
1367  int global_tower_iPhi = (toweriPhi_card_offset + effectiveFiberIdx) % (n_towers_Phi);
1368  return global_tower_iPhi;
1369  }
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 1382 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().

1382  {
1383  assert(nGCTCard <= 2); // Make sure the card number is valid
1384  int toweriPhi_card_offset = 0;
1385  if (nGCTCard == 0)
1386  toweriPhi_card_offset = GCTCARD_0_TOWER_IPHI_OFFSET;
1387  else if (nGCTCard == 1)
1388  toweriPhi_card_offset = GCTCARD_1_TOWER_IPHI_OFFSET;
1389  else if (nGCTCard == 2)
1390  toweriPhi_card_offset = GCTCARD_2_TOWER_IPHI_OFFSET;
1391 
1392  int global_iPhi = (toweriPhi_card_offset + gctCard_tower_iPhi) % (n_towers_Phi); // n_towers_Phi = 72
1393  return global_iPhi;
1394  }
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 1312 of file Phase2L1CaloEGammaUtils.h.

References p2eg::HCAL_LSB, and hcalEt.

Referenced by createCaloTowerFromFiberIdx(), and printGCTTowerInfoFromGlobalIdx().

1312  {
1313  return ((float)hcalEt * HCAL_LSB);
1314  } // 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 1319 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().

1319  {
1320  et = rctTower.et;
1321  hoe = rctTower.hoe;
1322  ecalEt = rctTower.ecalEt;
1323  hcalEt = rctTower.hcalEt;
1324  }

◆ printGCTTowerInfoFromGlobalIdx()

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

Definition at line 1444 of file Phase2L1CaloEGammaUtils.h.

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

1444  {
1445  std::cout << "[Print GCTtower_t class info from global idx:] [" << description << "]: "
1446  << "total et (float): " << totalEtFloat() << ", "
1447  << "ecal et (float): " << ecalEtFloat() << ", "
1448  << "hcal et (float): " << hcalEtFloat() << ", "
1449  << "fb: " << fb << ", "
1450  << "global tower ieta: " << global_tower_iEta << ", "
1451  << "global tower iphi: " << global_tower_iPhi << ", "
1452  << "eta: " << getTowerEta_fromAbsID(global_tower_iEta) << ", "
1453  << "phi: " << getTowerPhi_fromAbsID(global_tower_iPhi) << std::endl;
1454  }
float getTowerPhi_fromAbsID(int id)
float getTowerEta_fromAbsID(int id)

◆ totalEtFloat()

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

Definition at line 1308 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and et.

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

1308  {
1309  return ((float)et * ECAL_LSB);
1310  } // 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 1301 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 1306 of file Phase2L1CaloEGammaUtils.h.

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

◆ hoe

ap_uint<4> p2eg::GCTtower_t::hoe