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

Member Function Documentation

◆ createCaloTowerFromFiberIdx()

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

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

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

References fb, hoe, and totalEtFloat().

Referenced by p2eg::writeToCorrelatorAndGTOutputs().

1434  {
1435  return l1tp2::DigitizedTowerCorrelator(totalEtFloat(), hoe, fb, indexCard, indexFiber, indexTower);
1436  }

◆ createFullTowerFromCardIdx()

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

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

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

References p2eg::ECAL_LSB, and ecalEt.

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

1308 { 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 1330 of file Phase2L1CaloEGammaUtils.h.

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

Referenced by createCaloTowerFromFiberIdx().

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

Referenced by createFullTowerFromCardIdx().

1371  {
1372  int global_iEta = gctCard_tower_iEta;
1373  return global_iEta;
1374  }

◆ globalToweriPhi()

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

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

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

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

References p2eg::HCAL_LSB, and hcalEt.

Referenced by createCaloTowerFromFiberIdx(), and printGCTTowerInfoFromGlobalIdx().

1309  {
1310  return ((float)hcalEt * HCAL_LSB);
1311  } // 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 1316 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().

1316  {
1317  et = rctTower.et;
1318  hoe = rctTower.hoe;
1319  ecalEt = rctTower.ecalEt;
1320  hcalEt = rctTower.hcalEt;
1321  }

◆ printGCTTowerInfoFromGlobalIdx()

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

Definition at line 1441 of file Phase2L1CaloEGammaUtils.h.

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

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

◆ totalEtFloat()

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

Definition at line 1305 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and et.

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

1305  {
1306  return ((float)et * ECAL_LSB);
1307  } // 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 1298 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 1303 of file Phase2L1CaloEGammaUtils.h.

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

◆ hoe

ap_uint<4> p2eg::GCTtower_t::hoe