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

Member Function Documentation

◆ computeClusterIsolationInPlace()

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

Definition at line 1472 of file Phase2L1CaloEGammaUtils.h.

References p2eg::GCTtower_t::ecalEt, l1tnanotables_cff::et, p2eg::GCTcluster_t::et, ALCARECOEcalPhiSym_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, WZElectronSkims53X_cff::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().

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

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