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

Member Function Documentation

◆ computeClusterIsolationInPlace()

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

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

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

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