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

Member Function Documentation

◆ computeClusterIsolationInPlace()

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

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

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

1589  {
1590  for (unsigned int iFiber = 0; iFiber < N_GCTINTERNAL_FIBERS; iFiber++) {
1591  for (unsigned int iCluster = 0; iCluster < N_GCTCLUSTERS_FIBER; iCluster++) {
1592  // update the cluster's isolation information
1593  GCTCorrfiber[iFiber].GCTclusters[iCluster].setRelIsoAndFlags();
1594  }
1595  }
1596  }
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]