CMS 3D CMS Logo

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

#include <Phase2L1CaloEGammaUtils.h>

Public Member Functions

void computeClusterIsolationInPlace (int nGCTCard)
 
void setIsolationInfo (void)
 

Public Attributes

GCTCorrfiber_t GCTCorrfiber [N_GCTINTERNAL_FIBERS]
 

Detailed Description

Definition at line 1546 of file Phase2L1CaloEGammaUtils.h.

Member Function Documentation

◆ computeClusterIsolationInPlace()

void p2eg::GCTinternal_t::computeClusterIsolationInPlace ( int  nGCTCard)
inline

Definition at line 1550 of file Phase2L1CaloEGammaUtils.h.

References p2eg::GCTtower_t::ecalEt, EgHLTOffHistBins_cfi::et, p2eg::GCTcluster_t::et, nano_mu_digi_cff::float, p2eg::GCTCorrfiber_t::GCTclusters, GCTCorrfiber, p2eg::GCTCorrfiber_t::GCTtowers, l1tTowerCalibrationProducer_cfi::iEta, p2eg::GCTcluster_t::inCardToweriEta(), p2eg::GCTcluster_t::inCardToweriPhi(), p2eg::GCTcluster_t::iso, SiStripPI::max, SiStripPI::min, p2eg::N_GCTCLUSTERS_FIBER, p2eg::N_GCTETA, p2eg::N_GCTINTERNAL_FIBERS, p2eg::N_GCTPHI, p2eg::N_GCTPOSITIVE_FIBERS, p2eg::N_GCTTOWERS_CLUSTER_ISO_ONESIDE, p2eg::N_GCTTOWERS_FIBER, and scaleFactor.

Referenced by p2eg::algo_top().

1550  {
1551  for (unsigned int iFiber = 0; iFiber < N_GCTINTERNAL_FIBERS; iFiber++) {
1552  for (unsigned int iCluster = 0; iCluster < N_GCTCLUSTERS_FIBER; iCluster++) {
1553  // We will only save clusters with > 0 GeV, so only need to do this for clusters with >0 energy
1554  if (GCTCorrfiber[iFiber].GCTclusters[iCluster].et == 0) {
1555  GCTCorrfiber[iFiber].GCTclusters[iCluster].iso = 0;
1556  continue;
1557  }
1558 
1559  ap_uint<12> uint_isolation = 0;
1560 
1561  // do not add the GCT card off-set, so we remain in the gct local card iEta/iPhi
1562  int toweriEta_in_GCT_card = GCTCorrfiber[iFiber].GCTclusters[iCluster].inCardToweriEta();
1563  int toweriPhi_in_GCT_card = GCTCorrfiber[iFiber].GCTclusters[iCluster].inCardToweriPhi();
1564 
1565  // If cluster is in the overlap region, do not compute isolation
1566  bool inOverlapWithAnotherGCTCard = (((toweriPhi_in_GCT_card >= 0) && (toweriPhi_in_GCT_card < 4)) ||
1567  ((toweriPhi_in_GCT_card >= 28) && (toweriPhi_in_GCT_card < 32)));
1568  if (inOverlapWithAnotherGCTCard) {
1569  GCTCorrfiber[iFiber].GCTclusters[iCluster].iso = 0;
1570  continue;
1571  }
1572 
1573  // Size 5x5 in towers: include the overlap-region-between-GCT-cards-if-applicable. In eta direction, the min and max towers (inclusive!) are:
1574  int isoWindow_toweriEta_in_GCT_card_min = std::max(0, toweriEta_in_GCT_card - 2);
1575  int isoWindow_toweriEta_in_GCT_card_max = std::min(toweriEta_in_GCT_card + 2, N_GCTETA - 1); // N_GCTETA = 34
1576  // e.g. if our window is centered at tower_iEta = 5, we want to sum towers_iEta 3, 4, (5), 6, 7, inclusive
1577  // e.g. if our window is near the boundary, tower_iEta = 32, we want to sum towers_iEta 30, 31, (32), 33
1578  // inclusive (but there are only N_GCTETA = 34 towers, so we stop at tower_iEta = 33)
1579 
1580  // in phi direction, the min and max towers (inclusive!) are:
1581  int isoWindow_toweriPhi_in_GCT_card_min = std::max(0, toweriPhi_in_GCT_card - 2);
1582  int isoWindow_toweriPhi_in_GCT_card_max = std::min(toweriPhi_in_GCT_card + 2, N_GCTPHI - 1);
1583 
1584  // Keep track of the number of towers we summed over
1585  int nTowersSummed = 0;
1586 
1587  // First add any nearby clusters to the isolation
1588  for (unsigned int candFiber = 0; candFiber < N_GCTINTERNAL_FIBERS; candFiber++) {
1589  for (unsigned int candCluster = 0; candCluster < N_GCTCLUSTERS_FIBER; candCluster++) {
1590  // Do not double-count the cluster we are calculating the isolation for
1591  if (!((candFiber == iFiber) && (candCluster == iCluster))) {
1592  // Only consider clusters with et > 0 for isolation sum
1593  if (GCTCorrfiber[candFiber].GCTclusters[candCluster].et > 0) {
1594  // Get the candidate cluster's tower iEta and iPhi in GCT card
1595  int candidate_toweriEta = GCTCorrfiber[candFiber].GCTclusters[candCluster].inCardToweriEta();
1596  int candidate_toweriPhi = GCTCorrfiber[candFiber].GCTclusters[candCluster].inCardToweriPhi();
1597 
1598  // If the tower that the candidate cluster is in, is within a 5x5 window, add the candidate cluster energy's to the isolation as a proxy for the ECAL energy
1599  if (((candidate_toweriEta >= isoWindow_toweriEta_in_GCT_card_min) &&
1600  (candidate_toweriEta <= isoWindow_toweriEta_in_GCT_card_max)) &&
1601  ((candidate_toweriPhi >= isoWindow_toweriPhi_in_GCT_card_min) &&
1602  (candidate_toweriPhi <= isoWindow_toweriPhi_in_GCT_card_max))) {
1603  uint_isolation += GCTCorrfiber[candFiber].GCTclusters[candCluster].et;
1604  }
1605  }
1606  }
1607  }
1608  }
1609 
1610  // From "tower index in GCT card", get which fiber it is in (out of 64 fibers), and which tower it is inside the fiber (out of 17 towers)
1611  for (int iEta = isoWindow_toweriEta_in_GCT_card_min; iEta <= isoWindow_toweriEta_in_GCT_card_max; iEta++) {
1612  for (int iPhi = isoWindow_toweriPhi_in_GCT_card_min; iPhi <= isoWindow_toweriPhi_in_GCT_card_max; iPhi++) {
1613  nTowersSummed += 1;
1614 
1615  int indexInto64Fibers;
1616  int indexInto17TowersInFiber;
1617 
1618  bool isTowerInPositiveEta = (iEta >= N_GCTTOWERS_FIBER);
1619  if (isTowerInPositiveEta) {
1620  // phi index is simple (e.g. if real phi = +80 degrees, iPhi in GCT = 31)
1621  indexInto64Fibers = iPhi;
1622  // if real eta = 1.47, iEta in GCT card = 33. If real eta = 0.0, iEta in GCT = 17, so iEta in fiber = 17%17 = 0.
1623  indexInto17TowersInFiber = (iEta % 17);
1624  } else {
1625  // add offset (e.g. if real phi = +80 degrees, iPhi in GCT = 31, and my index into GCT fibers 31 + 32 = 63)
1626  indexInto64Fibers = (iPhi + N_GCTPOSITIVE_FIBERS);
1627  // e.g. if real eta = 0, iEta innew GCT card = 16, i.e. our index into the GCT fiber is 16-16 = 0
1628  indexInto17TowersInFiber = (16 - iEta);
1629  }
1630 
1631  ap_uint<12> ecalEt = GCTCorrfiber[indexInto64Fibers].GCTtowers[indexInto17TowersInFiber].ecalEt;
1632  uint_isolation += ecalEt;
1633  }
1634  }
1635 
1636  // Scale the isolation sum up if we summed over fewer than (5x5) = 25 towers
1637  float scaleFactor =
1639 
1640  uint_isolation = (ap_uint<12>)(((float)uint_isolation) * scaleFactor);
1641 
1642  // Set the iso in the cluster
1643  GCTCorrfiber[iFiber].GCTclusters[iCluster].iso = uint_isolation;
1644  }
1645  }
1646  }
static constexpr int N_GCTCLUSTERS_FIBER
static constexpr int N_GCTTOWERS_CLUSTER_ISO_ONESIDE
GCTCorrfiber_t GCTCorrfiber[N_GCTINTERNAL_FIBERS]
static constexpr int N_GCTPOSITIVE_FIBERS
static constexpr int N_GCTTOWERS_FIBER
GCTcluster_t GCTclusters[N_GCTCLUSTERS_FIBER]
static constexpr int N_GCTPHI
constexpr G4double scaleFactor
static constexpr int N_GCTINTERNAL_FIBERS
static constexpr int N_GCTETA
GCTtower_t GCTtowers[N_GCTTOWERS_FIBER]

◆ setIsolationInfo()

void p2eg::GCTinternal_t::setIsolationInfo ( void  )
inline

Definition at line 1648 of file Phase2L1CaloEGammaUtils.h.

References p2eg::GCTCorrfiber_t::GCTclusters, GCTCorrfiber, p2eg::N_GCTCLUSTERS_FIBER, p2eg::N_GCTINTERNAL_FIBERS, and p2eg::GCTcluster_t::setRelIsoAndFlags().

Referenced by p2eg::algo_top().

1648  {
1649  for (unsigned int iFiber = 0; iFiber < N_GCTINTERNAL_FIBERS; iFiber++) {
1650  for (unsigned int iCluster = 0; iCluster < N_GCTCLUSTERS_FIBER; iCluster++) {
1651  // update the cluster's isolation information
1652  GCTCorrfiber[iFiber].GCTclusters[iCluster].setRelIsoAndFlags();
1653  }
1654  }
1655  }
static constexpr int N_GCTCLUSTERS_FIBER
GCTCorrfiber_t GCTCorrfiber[N_GCTINTERNAL_FIBERS]
GCTcluster_t GCTclusters[N_GCTCLUSTERS_FIBER]
static constexpr int N_GCTINTERNAL_FIBERS

Member Data Documentation

◆ GCTCorrfiber

GCTCorrfiber_t p2eg::GCTinternal_t::GCTCorrfiber[N_GCTINTERNAL_FIBERS]