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

Member Function Documentation

◆ createCaloTowerFromFiberIdx()

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

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

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

References fb, hoe, and totalEtFloat().

Referenced by p2eg::writeToCorrelatorAndGTOutputs().

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

◆ createFullTowerFromCardIdx()

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

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

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

References p2eg::ECAL_LSB, and ecalEt.

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

1306 { 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 1328 of file Phase2L1CaloEGammaUtils.h.

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

Referenced by createCaloTowerFromFiberIdx().

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

Referenced by createFullTowerFromCardIdx().

1369  {
1370  int global_iEta = gctCard_tower_iEta;
1371  return global_iEta;
1372  }

◆ globalToweriPhi()

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

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

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

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

References p2eg::HCAL_LSB, and hcalEt.

Referenced by createCaloTowerFromFiberIdx(), and printGCTTowerInfoFromGlobalIdx().

1307  {
1308  return ((float)hcalEt * HCAL_LSB);
1309  } // 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 1314 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().

1314  {
1315  et = rctTower.et;
1316  hoe = rctTower.hoe;
1317  ecalEt = rctTower.ecalEt;
1318  hcalEt = rctTower.hcalEt;
1319  }

◆ printGCTTowerInfoFromGlobalIdx()

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

Definition at line 1439 of file Phase2L1CaloEGammaUtils.h.

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

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

◆ totalEtFloat()

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

Definition at line 1303 of file Phase2L1CaloEGammaUtils.h.

References p2eg::ECAL_LSB, and et.

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

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

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

◆ hoe

ap_uint<4> p2eg::GCTtower_t::hoe