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

Member Function Documentation

◆ computeClusterIsolationInPlace()

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

Definition at line 1469 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, l1tPhase2CaloJetEmulator_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().

1469  {
1470  for (unsigned int iFiber = 0; iFiber < N_GCTINTERNAL_FIBERS; iFiber++) {
1471  for (unsigned int iCluster = 0; iCluster < N_GCTCLUSTERS_FIBER; iCluster++) {
1472  // We will only save clusters with > 0 GeV, so only need to do this for clusters with >0 energy
1473  if (GCTCorrfiber[iFiber].GCTclusters[iCluster].et == 0) {
1474  GCTCorrfiber[iFiber].GCTclusters[iCluster].iso = 0;
1475  continue;
1476  }
1477 
1478  ap_uint<12> uint_isolation = 0;
1479 
1480  // do not add the GCT card off-set, so we remain in the gct local card iEta/iPhi
1481  int toweriEta_in_GCT_card = GCTCorrfiber[iFiber].GCTclusters[iCluster].inCardToweriEta();
1482  int toweriPhi_in_GCT_card = GCTCorrfiber[iFiber].GCTclusters[iCluster].inCardToweriPhi();
1483 
1484  // If cluster is in the overlap region, do not compute isolation
1485  bool inOverlapWithAnotherGCTCard = (((toweriPhi_in_GCT_card >= 0) && (toweriPhi_in_GCT_card < 4)) ||
1486  ((toweriPhi_in_GCT_card >= 28) && (toweriPhi_in_GCT_card < 32)));
1487  if (inOverlapWithAnotherGCTCard) {
1488  GCTCorrfiber[iFiber].GCTclusters[iCluster].iso = 0;
1489  continue;
1490  }
1491 
1492  // Size 5x5 in towers: include the overlap-region-between-GCT-cards-if-applicable. In eta direction, the min and max towers (inclusive!) are:
1493  int isoWindow_toweriEta_in_GCT_card_min = std::max(0, toweriEta_in_GCT_card - 2);
1494  int isoWindow_toweriEta_in_GCT_card_max = std::min(toweriEta_in_GCT_card + 2, N_GCTETA - 1); // N_GCTETA = 34
1495  // e.g. if our window is centered at tower_iEta = 5, we want to sum towers_iEta 3, 4, (5), 6, 7, inclusive
1496  // e.g. if our window is near the boundary, tower_iEta = 32, we want to sum towers_iEta 30, 31, (32), 33
1497  // inclusive (but there are only N_GCTETA = 34 towers, so we stop at tower_iEta = 33)
1498 
1499  // in phi direction, the min and max towers (inclusive!) are:
1500  int isoWindow_toweriPhi_in_GCT_card_min = std::max(0, toweriPhi_in_GCT_card - 2);
1501  int isoWindow_toweriPhi_in_GCT_card_max = std::min(toweriPhi_in_GCT_card + 2, N_GCTPHI - 1);
1502 
1503  // Keep track of the number of towers we summed over
1504  int nTowersSummed = 0;
1505 
1506  // First add any nearby clusters to the isolation
1507  for (unsigned int candFiber = 0; candFiber < N_GCTINTERNAL_FIBERS; candFiber++) {
1508  for (unsigned int candCluster = 0; candCluster < N_GCTCLUSTERS_FIBER; candCluster++) {
1509  // Do not double-count the cluster we are calculating the isolation for
1510  if (!((candFiber == iFiber) && (candCluster == iCluster))) {
1511  // Only consider clusters with et > 0 for isolation sum
1512  if (GCTCorrfiber[candFiber].GCTclusters[candCluster].et > 0) {
1513  // Get the candidate cluster's tower iEta and iPhi in GCT card
1514  int candidate_toweriEta = GCTCorrfiber[candFiber].GCTclusters[candCluster].inCardToweriEta();
1515  int candidate_toweriPhi = GCTCorrfiber[candFiber].GCTclusters[candCluster].inCardToweriPhi();
1516 
1517  // 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
1518  if (((candidate_toweriEta >= isoWindow_toweriEta_in_GCT_card_min) &&
1519  (candidate_toweriEta <= isoWindow_toweriEta_in_GCT_card_max)) &&
1520  ((candidate_toweriPhi >= isoWindow_toweriPhi_in_GCT_card_min) &&
1521  (candidate_toweriPhi <= isoWindow_toweriPhi_in_GCT_card_max))) {
1522  uint_isolation += GCTCorrfiber[candFiber].GCTclusters[candCluster].et;
1523  }
1524  }
1525  }
1526  }
1527  }
1528 
1529  // 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)
1530  for (int iEta = isoWindow_toweriEta_in_GCT_card_min; iEta <= isoWindow_toweriEta_in_GCT_card_max; iEta++) {
1531  for (int iPhi = isoWindow_toweriPhi_in_GCT_card_min; iPhi <= isoWindow_toweriPhi_in_GCT_card_max; iPhi++) {
1532  nTowersSummed += 1;
1533 
1534  int indexInto64Fibers;
1535  int indexInto17TowersInFiber;
1536 
1537  bool isTowerInPositiveEta = (iEta >= N_GCTTOWERS_FIBER);
1538  if (isTowerInPositiveEta) {
1539  // phi index is simple (e.g. if real phi = +80 degrees, iPhi in GCT = 31)
1540  indexInto64Fibers = iPhi;
1541  // 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.
1542  indexInto17TowersInFiber = (iEta % 17);
1543  } else {
1544  // add offset (e.g. if real phi = +80 degrees, iPhi in GCT = 31, and my index into GCT fibers 31 + 32 = 63)
1545  indexInto64Fibers = (iPhi + N_GCTPOSITIVE_FIBERS);
1546  // e.g. if real eta = 0, iEta innew GCT card = 16, i.e. our index into the GCT fiber is 16-16 = 0
1547  indexInto17TowersInFiber = (16 - iEta);
1548  }
1549 
1550  ap_uint<12> ecalEt = GCTCorrfiber[indexInto64Fibers].GCTtowers[indexInto17TowersInFiber].ecalEt;
1551  uint_isolation += ecalEt;
1552  }
1553  }
1554 
1555  // Scale the isolation sum up if we summed over fewer than (5x5) = 25 towers
1556  float scaleFactor =
1558 
1559  uint_isolation = (ap_uint<12>)(((float)uint_isolation) * scaleFactor);
1560 
1561  // Set the iso in the cluster
1562  GCTCorrfiber[iFiber].GCTclusters[iCluster].iso = uint_isolation;
1563  }
1564  }
1565  }
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 1567 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().

1567  {
1568  for (unsigned int iFiber = 0; iFiber < N_GCTINTERNAL_FIBERS; iFiber++) {
1569  for (unsigned int iCluster = 0; iCluster < N_GCTCLUSTERS_FIBER; iCluster++) {
1570  // update the cluster's isolation information
1571  GCTCorrfiber[iFiber].GCTclusters[iCluster].setRelIsoAndFlags();
1572  }
1573  }
1574  }
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]