CMS 3D CMS Logo

List of all members | Classes | Static Public Member Functions | Static Private Member Functions
EcalClusterToolsT< noZS > Class Template Reference

#include <EcalClusterTools.h>

Classes

struct  EcalClusterEnergyDeposition
 

Static Public Member Functions

static Cluster2ndMoments cluster2ndMoments (const reco::BasicCluster &basicCluster, const EcalRecHitCollection &recHits, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true)
 
static Cluster2ndMoments cluster2ndMoments (const reco::SuperCluster &superCluster, const EcalRecHitCollection &recHits, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true)
 
static Cluster2ndMoments cluster2ndMoments (const std::vector< std::pair< const EcalRecHit *, float >> &RH_ptrs_fracs, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true)
 
static std::array< float, 3 > covariances (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, float w0=4.7)
 
static float e1x3 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e1x5 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2nd (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
 
static float e2x2 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2x5Bottom (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2x5Left (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2x5Max (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2x5Right (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2x5Top (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e3x1 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e3x2 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e3x3 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e4x4 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e5x1 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e5x5 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float eBottom (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float eLeft (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float eMax (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
 
static std::vector< float > energyBasketFractionEta (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
 
static std::vector< float > energyBasketFractionPhi (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
 
static float eRight (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float eTop (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float getFraction (const std::vector< std::pair< DetId, float >> &v_id, DetId id)
 
static std::pair< DetId, float > getMaximum (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
 
static std::pair< DetId, float > getMaximum (const std::vector< std::pair< DetId, float >> &v_id, const EcalRecHitCollection *recHits)
 
static std::vector< float > lat (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW=true, float w0=4.7)
 
static std::array< float, 3 > localCovariances (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=EgammaLocalCovParamDefaults::kRelEnCut, const EcalPFRecHitThresholds *thresholds=nullptr, float multEB=0.0, float multEE=0.0)
 
static std::vector< DetIdmatrixDetId (const CaloTopology *topology, DetId id, CaloRectangle rectangle)
 
static std::vector< DetIdmatrixDetId (const CaloTopology *topology, DetId id, int size)
 
static float matrixEnergy (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
 
static int matrixSize (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
 
static int n5x5 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static int nrSaturatedCrysIn5x5 (const DetId &id, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float recHitEnergy (DetId id, const EcalRecHitCollection *recHits)
 
static std::vector< float > roundnessBarrelSuperClusters (const reco::SuperCluster &superCluster, const EcalRecHitCollection &recHits, int weightedPositionMethod=0, float energyThreshold=0.0)
 
static std::vector< float > roundnessBarrelSuperClustersUserExtended (const reco::SuperCluster &superCluster, const EcalRecHitCollection &recHits, int ieta_delta=0, int iphi_delta=0, float energyRHThresh=0.00000, int weightedPositionMethod=0)
 
static std::vector< float > roundnessSelectedBarrelRecHits (const std::vector< std::pair< const EcalRecHit *, float >> &rhVector, int weightedPositionMethod=0)
 
static std::array< float, 3 > scLocalCovariances (const reco::SuperCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=4.7)
 
static double zernike20 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, double R0=6.6, bool logW=true, float w0=4.7)
 
static double zernike42 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, double R0=6.6, bool logW=true, float w0=4.7)
 

Static Private Member Functions

static double absZernikeMoment (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)
 
static double calc_AbsZernikeMoment (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)
 
static float computeWeight (float eRH, float energyTotal, int weightedPositionMethod)
 
static int deltaIEta (int seed_ieta, int rh_ieta)
 
static int deltaIPhi (int seed_iphi, int rh_iphi)
 
static double f00 (double r)
 
static double f11 (double r)
 
static double f20 (double r)
 
static double f22 (double r)
 
static double f31 (double r)
 
static double f33 (double r)
 
static double f40 (double r)
 
static double f42 (double r)
 
static double f44 (double r)
 
static double f51 (double r)
 
static double f53 (double r)
 
static double f55 (double r)
 
static double factorial (int n)
 
static double fast_AbsZernikeMoment (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)
 
static float getDPhiEndcap (const DetId &crysId, float meanX, float meanY)
 
static std::vector< EcalClusterEnergyDepositiongetEnergyDepTopology (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW, float w0)
 
static float getIEta (const DetId &id)
 
static float getIPhi (const DetId &id)
 
static float getNormedIX (const DetId &id)
 
static float getNormedIY (const DetId &id)
 
static float getNrCrysDiffInEta (const DetId &crysId, const DetId &orginId)
 
static float getNrCrysDiffInPhi (const DetId &crysId, const DetId &orginId)
 
static std::vector< int > getSeedPosition (const std::vector< std::pair< const EcalRecHit *, float >> &RH_ptrs)
 
static float getSumEnergy (const std::vector< std::pair< const EcalRecHit *, float >> &RH_ptrs_fracs)
 
static std::pair< float, float > mean5x5PositionInLocalCrysCoord (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static std::pair< float, float > mean5x5PositionInXY (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static math::XYZVector meanClusterPosition (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry)
 

Detailed Description

template<bool noZS>
class EcalClusterToolsT< noZS >

Definition at line 76 of file EcalClusterTools.h.

Member Function Documentation

◆ absZernikeMoment()

template<bool noZS>
double EcalClusterToolsT< noZS >::absZernikeMoment ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
int  n,
int  m,
double  R0,
bool  logW,
float  w0 
)
staticprivate

Definition at line 1149 of file EcalClusterTools.h.

References visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, HLT_2022v12_cff::R0, and FastTrackerRecHitMaskProducer_cfi::recHits.

1156  {
1157  // 1. Check if n,m are correctly
1158  if ((m > n) || ((n - m) % 2 != 0) || (n < 0) || (m < 0))
1159  return -1;
1160 
1161  // 2. Check if n,R0 are within validity Range :
1162  // n>20 or R0<2.19cm just makes no sense !
1163  if ((n > 20) || (R0 <= 2.19))
1164  return -1;
1165  if (n <= 5)
1166  return fast_AbsZernikeMoment(cluster, recHits, geometry, n, m, R0, logW, w0);
1167  else
1168  return calc_AbsZernikeMoment(cluster, recHits, geometry, n, m, R0, logW, w0);
1169 }
static double calc_AbsZernikeMoment(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)
static double fast_AbsZernikeMoment(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)

◆ calc_AbsZernikeMoment()

template<bool noZS>
double EcalClusterToolsT< noZS >::calc_AbsZernikeMoment ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
int  n,
int  m,
double  R0,
bool  logW,
float  w0 
)
staticprivate

Definition at line 1215 of file EcalClusterTools.h.

References funct::cos(), MillePedeFileConverter_cfg::e, reco::CaloCluster::energy(), factorial(), mps_fire::i, visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, funct::pow(), alignCSCRings::r, HLT_2022v12_cff::R0, FastTrackerRecHitMaskProducer_cfi::recHits, alignCSCRings::s, funct::sin(), and mathSSE::sqrt().

1222  {
1223  double r, ph, e, Re = 0, Im = 0, f_nm;
1224  double TotalEnergy = cluster.energy();
1225  std::vector<EcalClusterEnergyDeposition> energyDistribution =
1226  getEnergyDepTopology(cluster, recHits, geometry, logW, w0);
1227  int clusterSize = energyDistribution.size();
1228  if (clusterSize < 3)
1229  return 0.0;
1230 
1231  for (int i = 0; i < clusterSize; ++i) {
1232  r = energyDistribution[i].r / R0;
1233  if (r < 1) {
1234  ph = energyDistribution[i].phi;
1235  e = energyDistribution[i].deposited_energy;
1236  f_nm = 0;
1237  for (int s = 0; s <= (n - m) / 2; s++) {
1238  if (s % 2 == 0) {
1239  f_nm = f_nm + factorial(n - s) * pow(r, (double)(n - 2 * s)) /
1240  (factorial(s) * factorial((n + m) / 2 - s) * factorial((n - m) / 2 - s));
1241  } else {
1242  f_nm = f_nm - factorial(n - s) * pow(r, (double)(n - 2 * s)) /
1243  (factorial(s) * factorial((n + m) / 2 - s) * factorial((n - m) / 2 - s));
1244  }
1245  }
1246  Re = Re + e / TotalEnergy * f_nm * cos((double)m * ph);
1247  Im = Im - e / TotalEnergy * f_nm * sin((double)m * ph);
1248  }
1249  }
1250  return sqrt(Re * Re + Im * Im);
1251 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static std::vector< EcalClusterEnergyDeposition > getEnergyDepTopology(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW, float w0)
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static double factorial(int n)
double energy() const
cluster energy
Definition: CaloCluster.h:149
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ cluster2ndMoments() [1/3]

template<bool noZS>
Cluster2ndMoments EcalClusterToolsT< noZS >::cluster2ndMoments ( const reco::BasicCluster basicCluster,
const EcalRecHitCollection recHits,
double  phiCorrectionFactor = 0.8,
double  w0 = 4.7,
bool  useLogWeights = true 
)
static

Definition at line 1459 of file EcalClusterTools.h.

References first, reco::CaloCluster::hitsAndFractions(), mps_fire::i, FastTrackerRecHitMaskProducer_cfi::recHits, and edm::second().

Referenced by EcalClusterToolsT< noZS >::cluster2ndMoments(), GEDPhotonProducer::fillPhotonCollection(), and EG9X105XObjectUpdateModifier::modifyObject().

1463  {
1464  if (recHits.empty())
1465  return Cluster2ndMoments();
1466 
1467  std::vector<std::pair<const EcalRecHit *, float>> RH_ptrs_fracs;
1468 
1469  const std::vector<std::pair<DetId, float>> &myHitsPair = basicCluster.hitsAndFractions();
1470 
1471  for (unsigned int i = 0; i < myHitsPair.size(); i++) {
1472  //get pointer to recHit object
1473  EcalRecHitCollection::const_iterator myRH = recHits.find(myHitsPair[i].first);
1474  if (myRH != recHits.end()) {
1475  RH_ptrs_fracs.push_back(std::make_pair(&(*myRH), myHitsPair[i].second));
1476  }
1477  }
1478 
1479  return EcalClusterToolsT<noZS>::cluster2ndMoments(RH_ptrs_fracs, phiCorrectionFactor, w0, useLogWeights);
1480 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
std::vector< EcalRecHit >::const_iterator const_iterator
U second(std::pair< T, U > const &p)
static Cluster2ndMoments cluster2ndMoments(const reco::BasicCluster &basicCluster, const EcalRecHitCollection &recHits, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true)

◆ cluster2ndMoments() [2/3]

template<bool noZS>
Cluster2ndMoments EcalClusterToolsT< noZS >::cluster2ndMoments ( const reco::SuperCluster superCluster,
const EcalRecHitCollection recHits,
double  phiCorrectionFactor = 0.8,
double  w0 = 4.7,
bool  useLogWeights = true 
)
static

Definition at line 1483 of file EcalClusterTools.h.

References EcalClusterToolsT< noZS >::cluster2ndMoments(), FastTrackerRecHitMaskProducer_cfi::recHits, and reco::SuperCluster::seed().

1487  {
1489  *(superCluster.seed()), recHits, phiCorrectionFactor, w0, useLogWeights);
1490 }
static Cluster2ndMoments cluster2ndMoments(const reco::BasicCluster &basicCluster, const EcalRecHitCollection &recHits, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true)
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77

◆ cluster2ndMoments() [3/3]

template<bool noZS>
Cluster2ndMoments EcalClusterToolsT< noZS >::cluster2ndMoments ( const std::vector< std::pair< const EcalRecHit *, float >> &  RH_ptrs_fracs,
double  phiCorrectionFactor = 0.8,
double  w0 = 4.7,
bool  useLogWeights = true 
)
static

Definition at line 1493 of file EcalClusterTools.h.

References funct::abs(), Cluster2ndMoments::alpha, bTagMiniDQMDeepCSV::denominator, EcalRecHit::detid(), EcalBarrel, EcalRecHit::energy(), EcalClusterToolsT< noZS >::getSumEnergy(), mps_fire::i, PixelPluginsPhase0_cfi::isBarrel, dqm-mbProfile::log, SiStripPI::max, PVValHelper::phi, Cluster2ndMoments::sMaj, Cluster2ndMoments::sMin, mathSSE::sqrt(), DetId::subdetId(), and trackerHitRTTI::vector.

1497  {
1498  if (RH_ptrs_fracs.empty())
1499  return Cluster2ndMoments();
1500 
1501  double mid_eta(0), mid_phi(0), mid_x(0), mid_y(0);
1502 
1503  double Etot = EcalClusterToolsT<noZS>::getSumEnergy(RH_ptrs_fracs);
1504 
1505  double max_phi = -10.;
1506  double min_phi = 100.;
1507 
1508  std::vector<double> etaDetId;
1509  std::vector<double> phiDetId;
1510  std::vector<double> xDetId;
1511  std::vector<double> yDetId;
1512  std::vector<double> wiDetId;
1513 
1514  unsigned int nCry = 0;
1515  double denominator = 0.;
1516  bool isBarrel(true);
1517 
1518  // loop over rechits and compute weights:
1519  for (std::vector<std::pair<const EcalRecHit *, float>>::const_iterator rhf_ptr = RH_ptrs_fracs.begin();
1520  rhf_ptr != RH_ptrs_fracs.end();
1521  rhf_ptr++) {
1522  const EcalRecHit *rh_ptr = rhf_ptr->first;
1523 
1524  //get iEta, iPhi
1525  double temp_eta(0), temp_phi(0), temp_x(0), temp_y(0);
1526  isBarrel = rh_ptr->detid().subdetId() == EcalBarrel;
1527 
1528  if (isBarrel) {
1529  temp_eta = (getIEta(rh_ptr->detid()) > 0. ? getIEta(rh_ptr->detid()) + 84.5 : getIEta(rh_ptr->detid()) + 85.5);
1530  temp_phi = getIPhi(rh_ptr->detid()) - 0.5;
1531  } else {
1532  temp_eta = getIEta(rh_ptr->detid());
1533  temp_x = getNormedIX(rh_ptr->detid());
1534  temp_y = getNormedIY(rh_ptr->detid());
1535  }
1536 
1537  double temp_ene = rh_ptr->energy() * (noZS ? 1.0 : rhf_ptr->second);
1538 
1539  double temp_wi = ((useLogWeights) ? std::max(0.0, w0 + std::log(std::abs(temp_ene) / Etot)) : temp_ene);
1540 
1541  if (temp_phi > max_phi)
1542  max_phi = temp_phi;
1543  if (temp_phi < min_phi)
1544  min_phi = temp_phi;
1545  etaDetId.push_back(temp_eta);
1546  phiDetId.push_back(temp_phi);
1547  xDetId.push_back(temp_x);
1548  yDetId.push_back(temp_y);
1549  wiDetId.push_back(temp_wi);
1550  denominator += temp_wi;
1551  nCry++;
1552  }
1553 
1554  if (isBarrel) {
1555  // correct phi wrap-around:
1556  if (max_phi == 359.5 && min_phi == 0.5) {
1557  for (unsigned int i = 0; i < nCry; i++) {
1558  if (phiDetId[i] - 179. > 0.)
1559  phiDetId[i] -= 360.;
1560  mid_phi += phiDetId[i] * wiDetId[i];
1561  mid_eta += etaDetId[i] * wiDetId[i];
1562  }
1563  } else {
1564  for (unsigned int i = 0; i < nCry; i++) {
1565  mid_phi += phiDetId[i] * wiDetId[i];
1566  mid_eta += etaDetId[i] * wiDetId[i];
1567  }
1568  }
1569  } else {
1570  for (unsigned int i = 0; i < nCry; i++) {
1571  mid_eta += etaDetId[i] * wiDetId[i];
1572  mid_x += xDetId[i] * wiDetId[i];
1573  mid_y += yDetId[i] * wiDetId[i];
1574  }
1575  }
1576 
1577  mid_eta /= denominator;
1578  mid_phi /= denominator;
1579  mid_x /= denominator;
1580  mid_y /= denominator;
1581 
1582  // See = sigma eta eta
1583  // Spp = (B field corrected) sigma phi phi
1584  // See = (B field corrected) sigma eta phi
1585  double See = 0.;
1586  double Spp = 0.;
1587  double Sep = 0.;
1588  double deta(0), dphi(0);
1589  // compute (phi-corrected) covariance matrix:
1590  for (unsigned int i = 0; i < nCry; i++) {
1591  if (isBarrel) {
1592  deta = etaDetId[i] - mid_eta;
1593  dphi = phiDetId[i] - mid_phi;
1594  } else {
1595  deta = etaDetId[i] - mid_eta;
1596  float hitLocalR2 = (xDetId[i] - mid_x) * (xDetId[i] - mid_x) + (yDetId[i] - mid_y) * (yDetId[i] - mid_y);
1597  float hitR2 = xDetId[i] * xDetId[i] + yDetId[i] * yDetId[i];
1598  float meanR2 = mid_x * mid_x + mid_y * mid_y;
1599  float hitR = sqrt(hitR2);
1600  float meanR = sqrt(meanR2);
1601  float phi = acos((hitR2 + meanR2 - hitLocalR2) / (2 * hitR * meanR));
1602  dphi = hitR * phi;
1603  }
1604  See += (wiDetId[i] * deta * deta) / denominator;
1605  Spp += phiCorrectionFactor * (wiDetId[i] * dphi * dphi) / denominator;
1606  Sep += sqrt(phiCorrectionFactor) * (wiDetId[i] * deta * dphi) / denominator;
1607  }
1608 
1609  Cluster2ndMoments returnMoments;
1610 
1611  // compute matrix eigenvalues:
1612  returnMoments.sMaj = ((See + Spp) + sqrt((See - Spp) * (See - Spp) + 4. * Sep * Sep)) / 2.;
1613  returnMoments.sMin = ((See + Spp) - sqrt((See - Spp) * (See - Spp) + 4. * Sep * Sep)) / 2.;
1614 
1615  returnMoments.alpha = atan((See - Spp + sqrt((Spp - See) * (Spp - See) + 4. * Sep * Sep)) / (2. * Sep));
1616 
1617  return returnMoments;
1618 }
static float getIEta(const DetId &id)
static float getIPhi(const DetId &id)
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static float getNormedIY(const DetId &id)
static float getSumEnergy(const std::vector< std::pair< const EcalRecHit *, float >> &RH_ptrs_fracs)
const DetId & detid() const
Definition: EcalRecHit.h:72
float energy() const
Definition: EcalRecHit.h:68
static float getNormedIX(const DetId &id)

◆ computeWeight()

template<bool noZS>
static float EcalClusterToolsT< noZS >::computeWeight ( float  eRH,
float  energyTotal,
int  weightedPositionMethod 
)
staticprivate

◆ covariances()

template<bool noZS>
std::array< float, 3 > EcalClusterToolsT< noZS >::covariances ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
const CaloGeometry geometry,
float  w0 = 4.7 
)
static

Definition at line 962 of file EcalClusterTools.h.

References bTagMiniDQMDeepCSV::denominator, HLT_2022v12_cff::dEta, HLT_2022v12_cff::dPhi, HCALHighEnergyHPDFilter_cfi::energy, f, DivergingColor::frac, CaloSubdetectorGeometry::getGeometry(), SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), dqm-mbProfile::log, SiStripPI::max, Geom::pi(), position, FastTrackerRecHitMaskProducer_cfi::recHits, Geom::twoPi(), findQualityFiles::v, and w().

Referenced by PhotonProducer::fillPhotonCollection(), and GEDPhotonProducer::fillPhotonCollection().

966  {
967  float e_5x5 = e5x5(cluster, recHits, topology);
968  float covEtaEta, covEtaPhi, covPhiPhi;
969  if (e_5x5 >= 0.) {
970  //double w0_ = parameterMap_.find("W0")->second;
971  const std::vector<std::pair<DetId, float>> &v_id = cluster.hitsAndFractions();
972  math::XYZVector meanPosition = meanClusterPosition(cluster, recHits, topology, geometry);
973 
974  // now we can calculate the covariances
975  double numeratorEtaEta = 0;
976  double numeratorEtaPhi = 0;
977  double numeratorPhiPhi = 0;
978  double denominator = 0;
979 
980  DetId id = getMaximum(v_id, recHits).first;
981  CaloRectangle rectangle{-2, 2, -2, 2};
982  for (auto const &detId : rectangle(id, *topology)) {
983  float frac = getFraction(v_id, detId);
984  float energy = recHitEnergy(detId, recHits) * frac;
985 
986  if (energy <= 0)
987  continue;
988 
989  const CaloSubdetectorGeometry *geo = geometry->getSubdetectorGeometry(detId);
990  GlobalPoint position = geo->getGeometry(detId)->getPosition();
991 
992  double dPhi = position.phi() - meanPosition.phi();
993  if (dPhi > +Geom::pi()) {
994  dPhi = Geom::twoPi() - dPhi;
995  }
996  if (dPhi < -Geom::pi()) {
997  dPhi = Geom::twoPi() + dPhi;
998  }
999 
1000  double dEta = position.eta() - meanPosition.eta();
1001  double w = 0.;
1002  w = std::max(0.0f, w0 + std::log(energy / e_5x5));
1003 
1004  denominator += w;
1005  numeratorEtaEta += w * dEta * dEta;
1006  numeratorEtaPhi += w * dEta * dPhi;
1007  numeratorPhiPhi += w * dPhi * dPhi;
1008  }
1009 
1010  if (denominator != 0.0) {
1011  covEtaEta = numeratorEtaEta / denominator;
1012  covEtaPhi = numeratorEtaPhi / denominator;
1013  covPhiPhi = numeratorPhiPhi / denominator;
1014  } else {
1015  covEtaEta = 999.9;
1016  covEtaPhi = 999.9;
1017  covPhiPhi = 999.9;
1018  }
1019 
1020  } else {
1021  // Warn the user if there was no energy in the cells and return zeroes.
1022  // std::cout << "\ClusterShapeAlgo::Calculate_Covariances: no energy in supplied cells.\n";
1023  covEtaEta = 0;
1024  covEtaPhi = 0;
1025  covPhiPhi = 0;
1026  }
1027  std::array<float, 3> v{{covEtaEta, covEtaPhi, covPhiPhi}};
1028  return v;
1029 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static math::XYZVector meanClusterPosition(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry)
T w() const
static float getFraction(const std::vector< std::pair< DetId, float >> &v_id, DetId id)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
double f[11][100]
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
Definition: DetId.h:17
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
static int position[264][3]
Definition: ReadPGInfo.cc:289
constexpr double pi()
Definition: Pi.h:31
constexpr double twoPi()
Definition: Pi.h:32
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)

◆ deltaIEta()

template<bool noZS>
int EcalClusterToolsT< noZS >::deltaIEta ( int  seed_ieta,
int  rh_ieta 
)
staticprivate

Definition at line 1872 of file EcalClusterTools.h.

1872  {
1873  // get rid of the fact that there is no ieta=0
1874  if (seed_ieta < 0)
1875  seed_ieta++;
1876  if (rh_ieta < 0)
1877  rh_ieta++;
1878  int rel_ieta = rh_ieta - seed_ieta;
1879  return rel_ieta;
1880 }

◆ deltaIPhi()

template<bool noZS>
int EcalClusterToolsT< noZS >::deltaIPhi ( int  seed_iphi,
int  rh_iphi 
)
staticprivate

Definition at line 1858 of file EcalClusterTools.h.

1858  {
1859  int rel_iphi = rh_iphi - seed_iphi;
1860  // take care of cyclic variable iphi [1,360]
1861  if (rel_iphi > 180)
1862  rel_iphi = rel_iphi - 360;
1863  if (rel_iphi < -180)
1864  rel_iphi = rel_iphi + 360;
1865  return rel_iphi;
1866 }

◆ e1x3()

template<bool noZS>
float EcalClusterToolsT< noZS >::e1x3 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 641 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by GEDPhotonProducer::fillPhotonCollection().

643  {
644  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
645  return matrixEnergy(cluster, recHits, topology, id, {0, 0, -1, 1});
646 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e1x5()

template<bool noZS>
float EcalClusterToolsT< noZS >::e1x5 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 625 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by PhotonProducer::fillPhotonCollection(), and GEDPhotonProducer::fillPhotonCollection().

627  {
628  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
629  return matrixEnergy(cluster, recHits, topology, id, {0, 0, -2, 2});
630 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e2nd()

template<bool noZS>
float EcalClusterToolsT< noZS >::e2nd ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits 
)
static

Definition at line 560 of file EcalClusterTools.h.

References first, reco::CaloCluster::hitsAndFractions(), mps_fire::i, FastTrackerRecHitMaskProducer_cfi::recHits, and edm::second().

Referenced by GEDPhotonProducer::fillPhotonCollection().

560  {
561  std::vector<float> energies;
562  const std::vector<std::pair<DetId, float>> &v_id = cluster.hitsAndFractions();
563  energies.reserve(v_id.size());
564  if (v_id.size() < 2)
565  return 0;
566  for (size_t i = 0; i < v_id.size(); ++i) {
567  energies.push_back(recHitEnergy(v_id[i].first, recHits) * (noZS ? 1.0 : v_id[i].second));
568  }
569  std::partial_sort(energies.begin(), energies.begin() + 2, energies.end(), std::greater<float>());
570  return energies[1];
571 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
U second(std::pair< T, U > const &p)
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)

◆ e2x2()

template<bool noZS>
float EcalClusterToolsT< noZS >::e2x2 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 494 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), SiStripPI::max, and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by GEDPhotonProducer::fillPhotonCollection().

496  {
497  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
498  std::list<float> energies;
499  float max_E = matrixEnergy(cluster, recHits, topology, id, {-1, 0, -1, 0});
500  max_E = std::max(max_E, matrixEnergy(cluster, recHits, topology, id, {-1, 0, 0, 1}));
501  max_E = std::max(max_E, matrixEnergy(cluster, recHits, topology, id, {0, 1, 0, 1}));
502  max_E = std::max(max_E, matrixEnergy(cluster, recHits, topology, id, {0, 1, -1, 0}));
503  return max_E;
504 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e2x5Bottom()

template<bool noZS>
float EcalClusterToolsT< noZS >::e2x5Bottom ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 598 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by GEDPhotonProducer::fillPhotonCollection(), and EG8XObjectUpdateModifier::modifyObject().

600  {
601  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
602  return matrixEnergy(cluster, recHits, topology, id, {-2, 2, -2, -1});
603 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e2x5Left()

template<bool noZS>
float EcalClusterToolsT< noZS >::e2x5Left ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 582 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by GEDPhotonProducer::fillPhotonCollection(), and EG8XObjectUpdateModifier::modifyObject().

584  {
585  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
586  return matrixEnergy(cluster, recHits, topology, id, {-2, -1, -2, 2});
587 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e2x5Max()

template<bool noZS>
float EcalClusterToolsT< noZS >::e2x5Max ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 608 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by PhotonProducer::fillPhotonCollection(), and GEDPhotonProducer::fillPhotonCollection().

610  {
611  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
612 
613  // 1x5 strip left of seed
614  float left = matrixEnergy(cluster, recHits, topology, id, {-1, -1, -2, 2});
615  // 1x5 strip right of seed
616  float right = matrixEnergy(cluster, recHits, topology, id, {1, 1, -2, 2});
617  // 1x5 strip containing seed
618  float centre = matrixEnergy(cluster, recHits, topology, id, {0, 0, -2, 2});
619 
620  // Return the maximum of (left+center) or (right+center) strip
621  return left > right ? left + centre : right + centre;
622 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e2x5Right()

template<bool noZS>
float EcalClusterToolsT< noZS >::e2x5Right ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 574 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by GEDPhotonProducer::fillPhotonCollection(), and EG8XObjectUpdateModifier::modifyObject().

576  {
577  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
578  return matrixEnergy(cluster, recHits, topology, id, {1, 2, -2, 2});
579 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e2x5Top()

template<bool noZS>
float EcalClusterToolsT< noZS >::e2x5Top ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 590 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by GEDPhotonProducer::fillPhotonCollection(), and EG8XObjectUpdateModifier::modifyObject().

592  {
593  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
594  return matrixEnergy(cluster, recHits, topology, id, {-2, 2, 1, 2});
595 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e3x1()

template<bool noZS>
float EcalClusterToolsT< noZS >::e3x1 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 649 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

651  {
652  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
653  return matrixEnergy(cluster, recHits, topology, id, {-1, 1, 0, 0});
654 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e3x2()

template<bool noZS>
float EcalClusterToolsT< noZS >::e3x2 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 507 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), SiStripPI::max, and FastTrackerRecHitMaskProducer_cfi::recHits.

509  {
510  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
511  float max_E = matrixEnergy(cluster, recHits, topology, id, {-1, 1, -1, 0});
512  max_E = std::max(max_E, matrixEnergy(cluster, recHits, topology, id, {0, 1, -1, 1}));
513  max_E = std::max(max_E, matrixEnergy(cluster, recHits, topology, id, {-1, 1, 0, 1}));
514  max_E = std::max(max_E, matrixEnergy(cluster, recHits, topology, id, {-1, 0, -1, 1}));
515  return max_E;
516 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e3x3()

template<bool noZS>
float EcalClusterToolsT< noZS >::e3x3 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 519 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by PhotonProducer::fillPhotonCollection(), GEDPhotonProducer::fillPhotonCollection(), and ecaldqm::ClusterTask::runOnSuperClusters().

521  {
522  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
523  return matrixEnergy(cluster, recHits, topology, id, {-1, 1, -1, 1});
524 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e4x4()

template<bool noZS>
float EcalClusterToolsT< noZS >::e4x4 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 527 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), SiStripPI::max, and FastTrackerRecHitMaskProducer_cfi::recHits.

529  {
530  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
531  float max_E = matrixEnergy(cluster, recHits, topology, id, {-1, 2, -2, 1});
532  max_E = std::max(max_E, matrixEnergy(cluster, recHits, topology, id, {-2, 1, -2, 1}));
533  max_E = std::max(max_E, matrixEnergy(cluster, recHits, topology, id, {-2, 1, -1, 2}));
534  max_E = std::max(max_E, matrixEnergy(cluster, recHits, topology, id, {-1, 2, -1, 2}));
535  return max_E;
536 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e5x1()

template<bool noZS>
float EcalClusterToolsT< noZS >::e5x1 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 633 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

635  {
636  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
637  return matrixEnergy(cluster, recHits, topology, id, {-2, 2, 0, 0});
638 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ e5x5()

template<bool noZS>
float EcalClusterToolsT< noZS >::e5x5 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 539 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by PhotonProducer::fillPhotonCollection(), and GEDPhotonProducer::fillPhotonCollection().

541  {
542  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
543  return matrixEnergy(cluster, recHits, topology, id, {-2, 2, -2, 2});
544 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ eBottom()

template<bool noZS>
float EcalClusterToolsT< noZS >::eBottom ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 681 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by GEDPhotonProducer::fillPhotonCollection().

683  {
684  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
685  return matrixEnergy(cluster, recHits, topology, id, {0, 0, -1, -1});
686 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ eLeft()

template<bool noZS>
float EcalClusterToolsT< noZS >::eLeft ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 657 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by GEDPhotonProducer::fillPhotonCollection().

659  {
660  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
661  return matrixEnergy(cluster, recHits, topology, id, {-1, -1, 0, 0});
662 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ eMax()

template<bool noZS>
float EcalClusterToolsT< noZS >::eMax ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits 
)
static

Definition at line 555 of file EcalClusterTools.h.

References SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), FastTrackerRecHitMaskProducer_cfi::recHits, and edm::second().

Referenced by PhotonProducer::fillPhotonCollection(), and GEDPhotonProducer::fillPhotonCollection().

555  {
556  return getMaximum(cluster.hitsAndFractions(), recHits).second;
557 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
U second(std::pair< T, U > const &p)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)

◆ energyBasketFractionEta()

template<bool noZS>
std::vector< float > EcalClusterToolsT< noZS >::energyBasketFractionEta ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits 
)
static

Definition at line 689 of file EcalClusterTools.h.

References EcalBarrel, reco::CaloCluster::energy(), first, reco::CaloCluster::hitsAndFractions(), mps_fire::i, EBDetId::im(), EBDetId::kModulesPerSM, EBDetId::positiveZ(), FastTrackerRecHitMaskProducer_cfi::recHits, and jetUpdater_cfi::sort.

690  {
691  std::vector<float> basketFraction(2 * EBDetId::kModulesPerSM);
692  float clusterEnergy = cluster.energy();
693  const std::vector<std::pair<DetId, float>> &v_id = cluster.hitsAndFractions();
694  if (v_id[0].first.subdetId() != EcalBarrel) {
695  edm::LogWarning("EcalClusterToolsT<noZS>::energyBasketFractionEta")
696  << "Trying to get basket fraction for endcap basic-clusters. Basket fractions can be obtained ONLY for barrel "
697  "basic-clusters. Returning empty vector.";
698  return basketFraction;
699  }
700  for (size_t i = 0; i < v_id.size(); ++i) {
701  basketFraction[EBDetId(v_id[i].first).im() - 1 + EBDetId(v_id[i].first).positiveZ() * EBDetId::kModulesPerSM] +=
702  recHitEnergy(v_id[i].first, recHits) * v_id[i].second / clusterEnergy;
703  }
704  std::sort(basketFraction.rbegin(), basketFraction.rend());
705  return basketFraction;
706 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
int im() const
get the number of module inside the SM (1-4)
Definition: EBDetId.h:64
bool positiveZ() const
Definition: EBDetId.h:76
static const int kModulesPerSM
Definition: EBDetId.h:140
double energy() const
cluster energy
Definition: CaloCluster.h:149
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
Log< level::Warning, false > LogWarning

◆ energyBasketFractionPhi()

template<bool noZS>
std::vector< float > EcalClusterToolsT< noZS >::energyBasketFractionPhi ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits 
)
static

Definition at line 709 of file EcalClusterTools.h.

References EcalBarrel, reco::CaloCluster::energy(), first, reco::CaloCluster::hitsAndFractions(), mps_fire::i, EBDetId::iphi(), EBDetId::kCrystalsInPhi, EBDetId::kTowersInPhi, EBDetId::MAX_IPHI, EBDetId::positiveZ(), FastTrackerRecHitMaskProducer_cfi::recHits, and jetUpdater_cfi::sort.

710  {
711  std::vector<float> basketFraction(2 * (EBDetId::MAX_IPHI / EBDetId::kCrystalsInPhi));
712  float clusterEnergy = cluster.energy();
713  const std::vector<std::pair<DetId, float>> &v_id = cluster.hitsAndFractions();
714  if (v_id[0].first.subdetId() != EcalBarrel) {
715  edm::LogWarning("EcalClusterToolsT<noZS>::energyBasketFractionPhi")
716  << "Trying to get basket fraction for endcap basic-clusters. Basket fractions can be obtained ONLY for barrel "
717  "basic-clusters. Returning empty vector.";
718  return basketFraction;
719  }
720  for (size_t i = 0; i < v_id.size(); ++i) {
721  basketFraction[(EBDetId(v_id[i].first).iphi() - 1) / EBDetId::kCrystalsInPhi +
723  recHitEnergy(v_id[i].first, recHits) * (noZS ? 1.0 : v_id[i].second) / clusterEnergy;
724  }
725  std::sort(basketFraction.rbegin(), basketFraction.rend());
726  return basketFraction;
727 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
static const int kTowersInPhi
Definition: EBDetId.h:139
static const int kCrystalsInPhi
Definition: EBDetId.h:142
bool positiveZ() const
Definition: EBDetId.h:76
double energy() const
cluster energy
Definition: CaloCluster.h:149
static const int MAX_IPHI
Definition: EBDetId.h:137
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
Log< level::Warning, false > LogWarning

◆ eRight()

template<bool noZS>
float EcalClusterToolsT< noZS >::eRight ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 665 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by GEDPhotonProducer::fillPhotonCollection().

667  {
668  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
669  return matrixEnergy(cluster, recHits, topology, id, {1, 1, 0, 0});
670 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ eTop()

template<bool noZS>
float EcalClusterToolsT< noZS >::eTop ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 673 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by GEDPhotonProducer::fillPhotonCollection().

675  {
676  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
677  return matrixEnergy(cluster, recHits, topology, id, {0, 0, 1, 1});
678 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
Definition: DetId.h:17

◆ f00()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f00 ( double  r)
inlinestaticprivate

Definition at line 317 of file EcalClusterTools.h.

317 { return 1; }

◆ f11()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f11 ( double  r)
inlinestaticprivate

Definition at line 318 of file EcalClusterTools.h.

References alignCSCRings::r.

318 { return r; }

◆ f20()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f20 ( double  r)
inlinestaticprivate

Definition at line 319 of file EcalClusterTools.h.

References alignCSCRings::r.

319 { return 2.0 * r * r - 1.0; }

◆ f22()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f22 ( double  r)
inlinestaticprivate

Definition at line 320 of file EcalClusterTools.h.

References alignCSCRings::r.

320 { return r * r; }

◆ f31()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f31 ( double  r)
inlinestaticprivate

Definition at line 321 of file EcalClusterTools.h.

References alignCSCRings::r.

321 { return 3.0 * r * r * r - 2.0 * r; }

◆ f33()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f33 ( double  r)
inlinestaticprivate

Definition at line 322 of file EcalClusterTools.h.

References alignCSCRings::r.

322 { return r * r * r; }

◆ f40()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f40 ( double  r)
inlinestaticprivate

Definition at line 323 of file EcalClusterTools.h.

References alignCSCRings::r.

323 { return 6.0 * r * r * r * r - 6.0 * r * r + 1.0; }

◆ f42()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f42 ( double  r)
inlinestaticprivate

Definition at line 324 of file EcalClusterTools.h.

References alignCSCRings::r.

324 { return 4.0 * r * r * r * r - 3.0 * r * r; }

◆ f44()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f44 ( double  r)
inlinestaticprivate

Definition at line 325 of file EcalClusterTools.h.

References alignCSCRings::r.

325 { return r * r * r * r; }

◆ f51()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f51 ( double  r)
inlinestaticprivate

Definition at line 326 of file EcalClusterTools.h.

References funct::pow(), and alignCSCRings::r.

326 { return 10.0 * pow(r, 5) - 12.0 * pow(r, 3) + 3.0 * r; }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ f53()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f53 ( double  r)
inlinestaticprivate

Definition at line 327 of file EcalClusterTools.h.

References funct::pow(), and alignCSCRings::r.

327 { return 5.0 * pow(r, 5) - 4.0 * pow(r, 3); }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ f55()

template<bool noZS>
static double EcalClusterToolsT< noZS >::f55 ( double  r)
inlinestaticprivate

Definition at line 328 of file EcalClusterTools.h.

References funct::pow(), and alignCSCRings::r.

328 { return pow(r, 5); }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ factorial()

template<bool noZS>
static double EcalClusterToolsT< noZS >::factorial ( int  n)
inlinestaticprivate

Definition at line 355 of file EcalClusterTools.h.

References mps_fire::i, and dqmiodumpmetadata::n.

355  {
356  double res = 1.;
357  for (int i = 2; i <= n; ++i)
358  res *= i;
359  return res;
360  }
Definition: Electron.h:6

◆ fast_AbsZernikeMoment()

template<bool noZS>
double EcalClusterToolsT< noZS >::fast_AbsZernikeMoment ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
int  n,
int  m,
double  R0,
bool  logW,
float  w0 
)
staticprivate

Definition at line 1172 of file EcalClusterTools.h.

References funct::cos(), MillePedeFileConverter_cfg::e, reco::CaloCluster::energy(), mps_fire::i, visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, PVValHelper::phi, alignCSCRings::r, HLT_2022v12_cff::R0, FastTrackerRecHitMaskProducer_cfi::recHits, funct::sin(), and mathSSE::sqrt().

1179  {
1180  double r, ph, e, Re = 0, Im = 0;
1181  double TotalEnergy = cluster.energy();
1182  int index = (n / 2) * (n / 2) + (n / 2) + m;
1183  std::vector<EcalClusterEnergyDeposition> energyDistribution =
1184  getEnergyDepTopology(cluster, recHits, geometry, logW, w0);
1185  int clusterSize = energyDistribution.size();
1186  if (clusterSize < 3)
1187  return 0.0;
1188 
1189  for (int i = 0; i < clusterSize; i++) {
1190  r = energyDistribution[i].r / R0;
1191  if (r < 1) {
1192  std::vector<double> pol;
1193  pol.push_back(f00(r));
1194  pol.push_back(f11(r));
1195  pol.push_back(f20(r));
1196  pol.push_back(f22(r));
1197  pol.push_back(f31(r));
1198  pol.push_back(f33(r));
1199  pol.push_back(f40(r));
1200  pol.push_back(f42(r));
1201  pol.push_back(f44(r));
1202  pol.push_back(f51(r));
1203  pol.push_back(f53(r));
1204  pol.push_back(f55(r));
1205  ph = (energyDistribution[i]).phi;
1206  e = energyDistribution[i].deposited_energy;
1207  Re = Re + e / TotalEnergy * pol[index] * cos((double)m * ph);
1208  Im = Im - e / TotalEnergy * pol[index] * sin((double)m * ph);
1209  }
1210  }
1211  return sqrt(Re * Re + Im * Im);
1212 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static double f33(double r)
static double f11(double r)
static std::vector< EcalClusterEnergyDeposition > getEnergyDepTopology(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW, float w0)
static double f55(double r)
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static double f40(double r)
static double f31(double r)
static double f44(double r)
double energy() const
cluster energy
Definition: CaloCluster.h:149
static double f00(double r)
static double f53(double r)
static double f42(double r)
static double f51(double r)
static double f20(double r)
static double f22(double r)

◆ getDPhiEndcap()

template<bool noZS>
float EcalClusterToolsT< noZS >::getDPhiEndcap ( const DetId crysId,
float  meanX,
float  meanY 
)
staticprivate

Definition at line 1358 of file EcalClusterTools.h.

References HLT_2022v12_cff::dPhi, PVValHelper::phi, mathSSE::sqrt(), and createJobs::tmp.

1358  {
1359  float iXNorm = getNormedIX(crysId);
1360  float iYNorm = getNormedIY(crysId);
1361 
1362  float hitLocalR2 = (iXNorm - meanX) * (iXNorm - meanX) + (iYNorm - meanY) * (iYNorm - meanY);
1363  float hitR2 = iXNorm * iXNorm + iYNorm * iYNorm;
1364  float meanR2 = meanX * meanX + meanY * meanY;
1365  float hitR = sqrt(hitR2);
1366  float meanR = sqrt(meanR2);
1367 
1368  float tmp = (hitR2 + meanR2 - hitLocalR2) / (2 * hitR * meanR);
1369  if (tmp < -1)
1370  tmp = -1;
1371  if (tmp > 1)
1372  tmp = 1;
1373  float phi = acos(tmp);
1374  float dPhi = hitR * phi;
1375 
1376  return dPhi;
1377 }
T sqrt(T t)
Definition: SSEVec.h:19
static float getNormedIY(const DetId &id)
static float getNormedIX(const DetId &id)
tmp
align.sh
Definition: createJobs.py:716

◆ getEnergyDepTopology()

template<bool noZS>
std::vector< typename EcalClusterToolsT< noZS >::EcalClusterEnergyDeposition > EcalClusterToolsT< noZS >::getEnergyDepTopology ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
bool  logW,
float  w0 
)
staticprivate

Definition at line 731 of file EcalClusterTools.h.

References funct::abs(), EcalClusterToolsT< noZS >::EcalClusterEnergyDeposition::deposited_energy, change_name::diff, EcalRecHit::energy(), reco::CaloCluster::energy(), CaloSubdetectorGeometry::getGeometry(), reco::CaloCluster::hitsAndFractions(), dqm-mbProfile::log, LogDebug, M_PI, SiStripPI::max, EcalClusterToolsT< noZS >::EcalClusterEnergyDeposition::phi, reco::CaloCluster::position(), EcalClusterToolsT< noZS >::EcalClusterEnergyDeposition::r, FastTrackerRecHitMaskProducer_cfi::recHits, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

735  {
736  std::vector<typename EcalClusterToolsT<noZS>::EcalClusterEnergyDeposition> energyDistribution;
737  // init a map of the energy deposition centered on the
738  // cluster centroid. This is for momenta calculation only.
739  CLHEP::Hep3Vector clVect(cluster.position().x(), cluster.position().y(), cluster.position().z());
740  CLHEP::Hep3Vector clDir(clVect);
741  clDir *= 1.0 / clDir.mag();
742  // in the transverse plane, axis perpendicular to clusterDir
743  CLHEP::Hep3Vector theta_axis(clDir.y(), -clDir.x(), 0.0);
744  theta_axis *= 1.0 / theta_axis.mag();
745  CLHEP::Hep3Vector phi_axis = theta_axis.cross(clDir);
746 
747  const std::vector<std::pair<DetId, float>> &clusterDetIds = cluster.hitsAndFractions();
748 
750  EcalRecHit testEcalRecHit;
751  std::vector<std::pair<DetId, float>>::const_iterator posCurrent;
752  // loop over crystals
753  for (posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); ++posCurrent) {
754  EcalRecHitCollection::const_iterator itt = recHits->find((*posCurrent).first);
755  testEcalRecHit = *itt;
756 
757  if (((*posCurrent).first != DetId(0)) && (recHits->find((*posCurrent).first) != recHits->end())) {
758  clEdep.deposited_energy = testEcalRecHit.energy() * (noZS ? 1.0 : (*posCurrent).second);
759  // if logarithmic weight is requested, apply cut on minimum energy of the recHit
760  if (logW) {
761  //double w0 = parameterMap_.find("W0")->second;
762 
763  double weight = std::max(0.0, w0 + log(std::abs(clEdep.deposited_energy) / cluster.energy()));
764  if (weight == 0) {
765  LogDebug("ClusterShapeAlgo") << "Crystal has insufficient energy: E = " << clEdep.deposited_energy
766  << " GeV; skipping... ";
767  continue;
768  } else
769  LogDebug("ClusterShapeAlgo") << "===> got crystal. Energy = " << clEdep.deposited_energy << " GeV. ";
770  }
771  DetId id_ = (*posCurrent).first;
772  const CaloSubdetectorGeometry *geo = geometry->getSubdetectorGeometry(id_);
773  auto this_cell = geo->getGeometry(id_);
774  const GlobalPoint &cellPos = this_cell->getPosition();
775  CLHEP::Hep3Vector gblPos(cellPos.x(), cellPos.y(), cellPos.z()); //surface position?
776  // Evaluate the distance from the cluster centroid
777  CLHEP::Hep3Vector diff = gblPos - clVect;
778  // Important: for the moment calculation, only the "lateral distance" is important
779  // "lateral distance" r_i = distance of the digi position from the axis Origin-Cluster Center
780  // ---> subtract the projection on clDir
781  CLHEP::Hep3Vector DigiVect = diff - diff.dot(clDir) * clDir;
782  clEdep.r = DigiVect.mag();
783  LogDebug("ClusterShapeAlgo") << "E = " << clEdep.deposited_energy << "\tdiff = " << diff.mag()
784  << "\tr = " << clEdep.r;
785  clEdep.phi = DigiVect.angle(theta_axis);
786  if (DigiVect.dot(phi_axis) < 0)
787  clEdep.phi = 2 * M_PI - clEdep.phi;
788  energyDistribution.push_back(clEdep);
789  }
790  }
791  return energyDistribution;
792 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
T z() const
Definition: PV3DBase.h:61
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: weight.py:1
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
#define M_PI
double energy() const
cluster energy
Definition: CaloCluster.h:149
Definition: DetId.h:17
float energy() const
Definition: EcalRecHit.h:68
#define LogDebug(id)

◆ getFraction()

template<bool noZS>
float EcalClusterToolsT< noZS >::getFraction ( const std::vector< std::pair< DetId, float >> &  v_id,
DetId  id 
)
static

Definition at line 381 of file EcalClusterTools.h.

References first, DivergingColor::frac, and mps_fire::i.

381  {
382  if (noZS)
383  return 1.0;
384  float frac = 0.0;
385  for (size_t i = 0; i < v_id.size(); ++i) {
386  if (v_id[i].first.rawId() == id.rawId()) {
387  frac = v_id[i].second;
388  break;
389  }
390  }
391  return frac;
392 }

◆ getIEta()

template<bool noZS>
float EcalClusterToolsT< noZS >::getIEta ( const DetId id)
staticprivate

Definition at line 1258 of file EcalClusterTools.h.

References DetId::Ecal, EcalBarrel, EcalEndcap, EBDetId::ieta(), and mathSSE::sqrt().

1258  {
1259  if (id.det() == DetId::Ecal) {
1260  if (id.subdetId() == EcalBarrel) {
1261  EBDetId ebId(id);
1262  return ebId.ieta();
1263  } else if (id.subdetId() == EcalEndcap) {
1264  float iXNorm = getNormedIX(id);
1265  float iYNorm = getNormedIY(id);
1266 
1267  return std::sqrt(iXNorm * iXNorm + iYNorm * iYNorm);
1268  }
1269  }
1270  return 0.;
1271 }
T sqrt(T t)
Definition: SSEVec.h:19
static float getNormedIY(const DetId &id)
static float getNormedIX(const DetId &id)

◆ getIPhi()

template<bool noZS>
float EcalClusterToolsT< noZS >::getIPhi ( const DetId id)
staticprivate

Definition at line 1278 of file EcalClusterTools.h.

References DetId::Ecal, EcalBarrel, and EBDetId::iphi().

1278  {
1279  if (id.det() == DetId::Ecal) {
1280  if (id.subdetId() == EcalBarrel) {
1281  EBDetId ebId(id);
1282  return ebId.iphi();
1283  }
1284  }
1285  return 0.;
1286 }

◆ getMaximum() [1/2]

template<bool noZS>
std::pair< DetId, float > EcalClusterToolsT< noZS >::getMaximum ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits 
)
static

Definition at line 410 of file EcalClusterTools.h.

References SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

411  {
412  return getMaximum(cluster.hitsAndFractions(), recHits);
413 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)

◆ getMaximum() [2/2]

template<bool noZS>
std::pair< DetId, float > EcalClusterToolsT< noZS >::getMaximum ( const std::vector< std::pair< DetId, float >> &  v_id,
const EcalRecHitCollection recHits 
)
static

Definition at line 395 of file EcalClusterTools.h.

References HCALHighEnergyHPDFilter_cfi::energy, first, mps_fire::i, triggerObjects_cff::id, SiStripPI::max, and FastTrackerRecHitMaskProducer_cfi::recHits.

396  {
397  float max = 0;
398  DetId id(0);
399  for (size_t i = 0; i < v_id.size(); ++i) {
400  float energy = recHitEnergy(v_id[i].first, recHits) * (noZS ? 1.0 : v_id[i].second);
401  if (energy > max) {
402  max = energy;
403  id = v_id[i].first;
404  }
405  }
406  return std::pair<DetId, float>(id, max);
407 }
Definition: DetId.h:17
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)

◆ getNormedIX()

template<bool noZS>
float EcalClusterToolsT< noZS >::getNormedIX ( const DetId id)
staticprivate

Definition at line 1290 of file EcalClusterTools.h.

References DetId::Ecal, EcalEndcap, and EEDetId::ix().

1290  {
1291  if (id.det() == DetId::Ecal && id.subdetId() == EcalEndcap) {
1292  EEDetId eeId(id);
1293  int iXNorm = eeId.ix() - 50;
1294  if (iXNorm <= 0)
1295  iXNorm--;
1296  return iXNorm;
1297  }
1298  return 0;
1299 }

◆ getNormedIY()

template<bool noZS>
float EcalClusterToolsT< noZS >::getNormedIY ( const DetId id)
staticprivate

Definition at line 1303 of file EcalClusterTools.h.

References DetId::Ecal, EcalEndcap, and EEDetId::iy().

1303  {
1304  if (id.det() == DetId::Ecal && id.subdetId() == EcalEndcap) {
1305  EEDetId eeId(id);
1306  int iYNorm = eeId.iy() - 50;
1307  if (iYNorm <= 0)
1308  iYNorm--;
1309  return iYNorm;
1310  }
1311  return 0;
1312 }

◆ getNrCrysDiffInEta()

template<bool noZS>
float EcalClusterToolsT< noZS >::getNrCrysDiffInEta ( const DetId crysId,
const DetId orginId 
)
staticprivate

Definition at line 1316 of file EcalClusterTools.h.

References EcalBarrel, PixelPluginsPhase0_cfi::isBarrel, and DetId::subdetId().

1316  {
1317  float crysIEta = getIEta(crysId);
1318  float orginIEta = getIEta(orginId);
1319  bool isBarrel = orginId.subdetId() == EcalBarrel;
1320 
1321  float nrCrysDiff = crysIEta - orginIEta;
1322 
1323  //no iEta=0 in barrel, so if go from positive to negative
1324  //need to reduce abs(detEta) by 1
1325  if (isBarrel) {
1326  if (crysIEta * orginIEta < 0) { // -1 to 1 transition
1327  if (crysIEta > 0)
1328  nrCrysDiff--;
1329  else
1330  nrCrysDiff++;
1331  }
1332  }
1333  return nrCrysDiff;
1334 }
static float getIEta(const DetId &id)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48

◆ getNrCrysDiffInPhi()

template<bool noZS>
float EcalClusterToolsT< noZS >::getNrCrysDiffInPhi ( const DetId crysId,
const DetId orginId 
)
staticprivate

Definition at line 1338 of file EcalClusterTools.h.

References EcalBarrel, PixelPluginsPhase0_cfi::isBarrel, and DetId::subdetId().

1338  {
1339  float crysIPhi = getIPhi(crysId);
1340  float orginIPhi = getIPhi(orginId);
1341  bool isBarrel = orginId.subdetId() == EcalBarrel;
1342 
1343  float nrCrysDiff = crysIPhi - orginIPhi;
1344 
1345  if (isBarrel) { //if barrel, need to map into 0-180
1346  if (nrCrysDiff > +180) {
1347  nrCrysDiff = nrCrysDiff - 360;
1348  }
1349  if (nrCrysDiff < -180) {
1350  nrCrysDiff = nrCrysDiff + 360;
1351  }
1352  }
1353  return nrCrysDiff;
1354 }
static float getIPhi(const DetId &id)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48

◆ getSeedPosition()

template<bool noZS>
std::vector< int > EcalClusterToolsT< noZS >::getSeedPosition ( const std::vector< std::pair< const EcalRecHit *, float >> &  RH_ptrs)
staticprivate

Definition at line 1884 of file EcalClusterTools.h.

References EcalRecHit::detid(), and EcalRecHit::energy().

Referenced by EcalClusterToolsT< noZS >::roundnessBarrelSuperClustersUserExtended(), and EcalClusterToolsT< noZS >::roundnessSelectedBarrelRecHits().

1885  {
1886  std::vector<int> seedPosition;
1887  float eSeedRH = 0;
1888  int iEtaSeedRH = 0;
1889  int iPhiSeedRH = 0;
1890 
1891  for (auto const &rhf : RH_ptrs_fracs) {
1892  const EcalRecHit *rh_ptr = rhf.first;
1893  //get iEta, iPhi
1894  EBDetId EBdetIdi(rh_ptr->detid());
1895  float rh_energy = rh_ptr->energy() * (noZS ? 1.0 : rhf.second);
1896 
1897  if (eSeedRH < rh_energy) {
1898  eSeedRH = rh_energy;
1899  iEtaSeedRH = EBdetIdi.ieta();
1900  iPhiSeedRH = EBdetIdi.iphi();
1901  }
1902 
1903  } // for loop
1904 
1905  seedPosition.push_back(iEtaSeedRH);
1906  seedPosition.push_back(iPhiSeedRH);
1907  return seedPosition;
1908 }
const DetId & detid() const
Definition: EcalRecHit.h:72
float energy() const
Definition: EcalRecHit.h:68

◆ getSumEnergy()

template<bool noZS>
float EcalClusterToolsT< noZS >::getSumEnergy ( const std::vector< std::pair< const EcalRecHit *, float >> &  RH_ptrs_fracs)
staticprivate

Definition at line 1912 of file EcalClusterTools.h.

Referenced by EcalClusterToolsT< noZS >::cluster2ndMoments(), and EcalClusterToolsT< noZS >::roundnessSelectedBarrelRecHits().

1912  {
1913  float sumE = 0.;
1914  for (const auto &hAndF : RH_ptrs_fracs) {
1915  sumE += hAndF.first->energy() * (noZS ? 1.0 : hAndF.second);
1916  }
1917  return sumE;
1918 }

◆ lat()

template<bool noZS>
std::vector< float > EcalClusterToolsT< noZS >::lat ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
bool  logW = true,
float  w0 = 4.7 
)
static

Definition at line 795 of file EcalClusterTools.h.

References funct::cos(), StorageManager_cfg::e1, mps_fire::i, dqmiodumpmetadata::n, PVValHelper::phi, alignCSCRings::r, FastTrackerRecHitMaskProducer_cfi::recHits, funct::sin(), and createJobs::tmp.

799  {
800  std::vector<EcalClusterToolsT::EcalClusterEnergyDeposition> energyDistribution =
801  getEnergyDepTopology(cluster, recHits, geometry, logW, w0);
802 
803  std::vector<float> lat;
804  double r, redmoment = 0;
805  double phiRedmoment = 0;
806  double etaRedmoment = 0;
807  int n, n1, n2, tmp;
808  int clusterSize = energyDistribution.size();
809  float etaLat_, phiLat_, lat_;
810  if (clusterSize < 3) {
811  etaLat_ = 0.0;
812  lat_ = 0.0;
813  lat.push_back(0.);
814  lat.push_back(0.);
815  lat.push_back(0.);
816  return lat;
817  }
818 
819  n1 = 0;
820  n2 = 1;
821  if (energyDistribution[1].deposited_energy > energyDistribution[0].deposited_energy) {
822  tmp = n2;
823  n2 = n1;
824  n1 = tmp;
825  }
826  for (int i = 2; i < clusterSize; i++) {
827  n = i;
828  if (energyDistribution[i].deposited_energy > energyDistribution[n1].deposited_energy) {
829  tmp = n2;
830  n2 = n1;
831  n1 = i;
832  n = tmp;
833  } else {
834  if (energyDistribution[i].deposited_energy > energyDistribution[n2].deposited_energy) {
835  tmp = n2;
836  n2 = i;
837  n = tmp;
838  }
839  }
840 
841  r = energyDistribution[n].r;
842  redmoment += r * r * energyDistribution[n].deposited_energy;
843  double rphi = r * cos(energyDistribution[n].phi);
844  phiRedmoment += rphi * rphi * energyDistribution[n].deposited_energy;
845  double reta = r * sin(energyDistribution[n].phi);
846  etaRedmoment += reta * reta * energyDistribution[n].deposited_energy;
847  }
848  double e1 = energyDistribution[n1].deposited_energy;
849  double e2 = energyDistribution[n2].deposited_energy;
850 
851  lat_ = redmoment / (redmoment + 2.19 * 2.19 * (e1 + e2));
852  phiLat_ = phiRedmoment / (phiRedmoment + 2.19 * 2.19 * (e1 + e2));
853  etaLat_ = etaRedmoment / (etaRedmoment + 2.19 * 2.19 * (e1 + e2));
854 
855  lat.push_back(etaLat_);
856  lat.push_back(phiLat_);
857  lat.push_back(lat_);
858  return lat;
859 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static std::vector< EcalClusterEnergyDeposition > getEnergyDepTopology(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW, float w0)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static std::vector< float > lat(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW=true, float w0=4.7)
tmp
align.sh
Definition: createJobs.py:716

◆ localCovariances()

template<bool noZS>
std::array< float, 3 > EcalClusterToolsT< noZS >::localCovariances ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
float  w0 = EgammaLocalCovParamDefaults::kRelEnCut,
const EcalPFRecHitThresholds thresholds = nullptr,
float  multEB = 0.0,
float  multEE = 0.0 
)
static

Definition at line 1036 of file EcalClusterTools.h.

References bTagMiniDQMDeepCSV::denominator, HLT_2022v12_cff::dEta, HLT_2022v12_cff::dPhi, EcalBarrel, HCALHighEnergyHPDFilter_cfi::energy, Exception, f, DivergingColor::frac, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), PixelPluginsPhase0_cfi::isBarrel, dqm-mbProfile::log, SiStripPI::max, VarParsing::mult, FastTrackerRecHitMaskProducer_cfi::recHits, DetId::subdetId(), particleFlowZeroSuppressionECAL_cff::thresholds, findQualityFiles::v, and w().

Referenced by PhotonProducer::fillPhotonCollection(), and GEDPhotonProducer::fillPhotonCollection().

1042  {
1043  float e_5x5 = e5x5(cluster, recHits, topology);
1044  float covEtaEta, covEtaPhi, covPhiPhi;
1045 
1046  if (e_5x5 >= 0.) {
1047  //double w0_ = parameterMap_.find("W0")->second;
1048  const std::vector<std::pair<DetId, float>> &v_id = cluster.hitsAndFractions();
1049  std::pair<float, float> mean5x5PosInNrCrysFromSeed = mean5x5PositionInLocalCrysCoord(cluster, recHits, topology);
1050  std::pair<float, float> mean5x5XYPos = mean5x5PositionInXY(cluster, recHits, topology);
1051 
1052  // now we can calculate the covariances
1053  double numeratorEtaEta = 0;
1054  double numeratorEtaPhi = 0;
1055  double numeratorPhiPhi = 0;
1056  double denominator = 0;
1057 
1058  //these allow us to scale the localCov by the crystal size
1059  //so that the localCovs have the same average value as the normal covs
1060  const double barrelCrysSize = 0.01745; //approximate size of crystal in eta,phi in barrel
1061  const double endcapCrysSize = 0.0447; //the approximate crystal size sigmaEtaEta was corrected to in the endcap
1062 
1063  DetId seedId = getMaximum(v_id, recHits).first;
1064 
1065  bool isBarrel = seedId.subdetId() == EcalBarrel;
1066  const double crysSize = isBarrel ? barrelCrysSize : endcapCrysSize;
1067  float mult = isBarrel ? multEB : multEE; // we will multiply PF RecHit threshold by mult.
1068  // mult = 1 should work reasonably well for noise cleaning.
1069  // dedicated studies showed mult=1.25 works best for Run3 in endcap, where noise is high.
1070  // If no noise cleaning is intended then put mult=0.
1071 
1072  CaloRectangle rectangle{-2, 2, -2, 2};
1073  for (auto const &detId : rectangle(seedId, *topology)) {
1074  float frac = getFraction(v_id, detId);
1075  float energy = recHitEnergy(detId, recHits) * frac;
1076 
1077  if ((thresholds == nullptr) && (mult != 0.0)) {
1078  throw cms::Exception("EmptyPFRechHitThresColl")
1079  << "In EcalClusterTools::localCovariances, if EcalPFRecHitThresholds==nulptr, then multEB and multEE "
1080  "should be 0 as well.";
1081  }
1082  float rhThres = 0.0;
1083  if (thresholds != nullptr) {
1084  rhThres = (*thresholds)[detId]; // access PFRechit thresholds for noise cleaning
1085  }
1086 
1087  if (energy <= (rhThres * mult))
1088  continue;
1089 
1090  float dEta = getNrCrysDiffInEta(detId, seedId) - mean5x5PosInNrCrysFromSeed.first;
1091  float dPhi = 0;
1092 
1093  if (isBarrel)
1094  dPhi = getNrCrysDiffInPhi(detId, seedId) - mean5x5PosInNrCrysFromSeed.second;
1095  else
1096  dPhi = getDPhiEndcap(detId, mean5x5XYPos.first, mean5x5XYPos.second);
1097 
1098  double w = std::max(0.0f, w0 + std::log(energy / e_5x5));
1099 
1100  denominator += w;
1101  numeratorEtaEta += w * dEta * dEta;
1102  numeratorEtaPhi += w * dEta * dPhi;
1103  numeratorPhiPhi += w * dPhi * dPhi;
1104  }
1105 
1106  //multiplying by crysSize to make the values compariable to normal covariances
1107  if (denominator != 0.0) {
1108  covEtaEta = crysSize * crysSize * numeratorEtaEta / denominator;
1109  covEtaPhi = crysSize * crysSize * numeratorEtaPhi / denominator;
1110  covPhiPhi = crysSize * crysSize * numeratorPhiPhi / denominator;
1111  } else {
1112  covEtaEta = 999.9;
1113  covEtaPhi = 999.9;
1114  covPhiPhi = 999.9;
1115  }
1116 
1117  } else {
1118  // Warn the user if there was no energy in the cells and return zeroes.
1119  // std::cout << "\ClusterShapeAlgo::Calculate_Covariances: no energy in supplied cells.\n";
1120  covEtaEta = 0;
1121  covEtaPhi = 0;
1122  covPhiPhi = 0;
1123  }
1124  std::array<float, 3> v{{covEtaEta, covEtaPhi, covPhiPhi}};
1125  return v;
1126 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
T w() const
static float getDPhiEndcap(const DetId &crysId, float meanX, float meanY)
static float getFraction(const std::vector< std::pair< DetId, float >> &v_id, DetId id)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
double f[11][100]
static float getNrCrysDiffInEta(const DetId &crysId, const DetId &orginId)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static float getNrCrysDiffInPhi(const DetId &crysId, const DetId &orginId)
static std::pair< float, float > mean5x5PositionInXY(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
Definition: DetId.h:17
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
static std::pair< float, float > mean5x5PositionInLocalCrysCoord(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)

◆ matrixDetId() [1/2]

template<bool noZS>
std::vector< DetId > EcalClusterToolsT< noZS >::matrixDetId ( const CaloTopology topology,
DetId  id,
CaloRectangle  rectangle 
)
static

Definition at line 482 of file EcalClusterTools.h.

References findQualityFiles::v.

Referenced by EcalClusterToolsT< noZS >::matrixDetId().

484  {
485  std::vector<DetId> v;
486  for (auto const &detId : rectangle(id, *topology)) {
487  if (detId != DetId(0))
488  v.push_back(detId);
489  }
490  return v;
491 }
Definition: DetId.h:17

◆ matrixDetId() [2/2]

template<bool noZS>
static std::vector<DetId> EcalClusterToolsT< noZS >::matrixDetId ( const CaloTopology topology,
DetId  id,
int  size 
)
inlinestatic

Definition at line 247 of file EcalClusterTools.h.

References EcalClusterToolsT< noZS >::matrixDetId(), and findQualityFiles::size.

247  {
248  return matrixDetId(topology, id, CaloRectangle{-size, size, -size, size});
249  }
size
Write out results.
static std::vector< DetId > matrixDetId(const CaloTopology *topology, DetId id, CaloRectangle rectangle)

◆ matrixEnergy()

template<bool noZS>
float EcalClusterToolsT< noZS >::matrixEnergy ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
DetId  id,
CaloRectangle  rectangle 
)
static

Definition at line 449 of file EcalClusterTools.h.

References HCALHighEnergyHPDFilter_cfi::energy, reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

453  {
454  float energy = 0;
455  auto const &vId = cluster.hitsAndFractions();
456 
457  for (auto const &detId : rectangle(id, *topology)) {
458  energy += recHitEnergy(detId, recHits) * getFraction(vId, detId);
459  }
460 
461  return energy;
462 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float getFraction(const std::vector< std::pair< DetId, float >> &v_id, DetId id)
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)

◆ matrixSize()

template<bool noZS>
int EcalClusterToolsT< noZS >::matrixSize ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
DetId  id,
CaloRectangle  rectangle 
)
static

Definition at line 465 of file EcalClusterTools.h.

References HCALHighEnergyHPDFilter_cfi::energy, DivergingColor::frac, reco::CaloCluster::hitsAndFractions(), FastTrackerRecHitMaskProducer_cfi::recHits, and mps_fire::result.

469  {
470  int result = 0;
471 
472  for (auto const &detId : rectangle(id, *topology)) {
473  const float energy = recHitEnergy(detId, recHits);
474  const float frac = getFraction(cluster.hitsAndFractions(), detId);
475  if (energy * frac > 0)
476  result++;
477  }
478  return result;
479 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static float getFraction(const std::vector< std::pair< DetId, float >> &v_id, DetId id)
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)

◆ mean5x5PositionInLocalCrysCoord()

template<bool noZS>
std::pair< float, float > EcalClusterToolsT< noZS >::mean5x5PositionInLocalCrysCoord ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
staticprivate

Definition at line 893 of file EcalClusterTools.h.

References HCALHighEnergyHPDFilter_cfi::energy, CastorDataFrameFilter_impl::energySum(), SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

895  {
896  DetId seedId = getMaximum(cluster, recHits).first;
897  float meanDEta = 0.;
898  float meanDPhi = 0.;
899  float energySum = 0.;
900 
901  const std::vector<std::pair<DetId, float>> &hsAndFs = cluster.hitsAndFractions();
902  std::vector<DetId> v_id = matrixDetId(topology, seedId, 2);
903  for (const std::pair<DetId, float> &hAndF : hsAndFs) {
904  for (std::vector<DetId>::const_iterator it = v_id.begin(); it != v_id.end(); ++it) {
905  if (hAndF.first != *it && !noZS)
906  continue;
907  float energy = recHitEnergy(*it, recHits) * hAndF.second;
908  if (energy < 0.)
909  continue; //skipping negative energy crystals
910  meanDEta += energy * getNrCrysDiffInEta(*it, seedId);
911  meanDPhi += energy * getNrCrysDiffInPhi(*it, seedId);
912  energySum += energy;
913  }
914  if (noZS)
915  break;
916  }
917  meanDEta /= energySum;
918  meanDPhi /= energySum;
919  return std::pair<float, float>(meanDEta, meanDPhi);
920 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static std::vector< DetId > matrixDetId(const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
static float getNrCrysDiffInEta(const DetId &crysId, const DetId &orginId)
static float getNrCrysDiffInPhi(const DetId &crysId, const DetId &orginId)
Definition: DetId.h:17
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
double energySum(const DataFrame &df, int fs, int ls)

◆ mean5x5PositionInXY()

template<bool noZS>
std::pair< float, float > EcalClusterToolsT< noZS >::mean5x5PositionInXY ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
staticprivate

Definition at line 929 of file EcalClusterTools.h.

References EcalBarrel, HCALHighEnergyHPDFilter_cfi::energy, CastorDataFrameFilter_impl::energySum(), SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), FastTrackerRecHitMaskProducer_cfi::recHits, and DetId::subdetId().

931  {
932  DetId seedId = getMaximum(cluster, recHits).first;
933 
934  std::pair<float, float> meanXY(0., 0.);
935  if (seedId.subdetId() == EcalBarrel)
936  return meanXY;
937 
938  float energySum = 0.;
939 
940  const std::vector<std::pair<DetId, float>> &hsAndFs = cluster.hitsAndFractions();
941  std::vector<DetId> v_id = matrixDetId(topology, seedId, 2);
942  for (const std::pair<DetId, float> &hAndF : hsAndFs) {
943  for (std::vector<DetId>::const_iterator it = v_id.begin(); it != v_id.end(); ++it) {
944  if (hAndF.first != *it && !noZS)
945  continue;
946  float energy = recHitEnergy(*it, recHits) * hAndF.second;
947  if (energy < 0.)
948  continue; //skipping negative energy crystals
949  meanXY.first += energy * getNormedIX(*it);
950  meanXY.second += energy * getNormedIY(*it);
951  energySum += energy;
952  }
953  if (noZS)
954  break;
955  }
956  meanXY.first /= energySum;
957  meanXY.second /= energySum;
958  return meanXY;
959 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static std::vector< DetId > matrixDetId(const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static float getNormedIY(const DetId &id)
Definition: DetId.h:17
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
double energySum(const DataFrame &df, int fs, int ls)
static float getNormedIX(const DetId &id)

◆ meanClusterPosition()

template<bool noZS>
math::XYZVector EcalClusterToolsT< noZS >::meanClusterPosition ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
const CaloGeometry geometry 
)
staticprivate

Definition at line 862 of file EcalClusterTools.h.

References first, CaloSubdetectorGeometry::getGeometry(), SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), position, FastTrackerRecHitMaskProducer_cfi::recHits, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

865  {
866  // find mean energy position of a 5x5 cluster around the maximum
867  math::XYZVector meanPosition(0.0, 0.0, 0.0);
868  const std::vector<std::pair<DetId, float>> &hsAndFs = cluster.hitsAndFractions();
869  std::vector<DetId> v_id = matrixDetId(topology, getMaximum(cluster, recHits).first, 2);
870  for (const std::pair<DetId, float> &hitAndFrac : hsAndFs) {
871  for (std::vector<DetId>::const_iterator it = v_id.begin(); it != v_id.end(); ++it) {
872  if (hitAndFrac.first != *it && !noZS)
873  continue;
874  const CaloSubdetectorGeometry *geo = geometry->getSubdetectorGeometry(*it);
875  GlobalPoint positionGP = geo->getGeometry(*it)->getPosition();
876  math::XYZVector position(positionGP.x(), positionGP.y(), positionGP.z());
877  meanPosition = meanPosition + recHitEnergy(*it, recHits) * position * hitAndFrac.second;
878  }
879  if (noZS)
880  break;
881  }
882  return meanPosition / e5x5(cluster, recHits, topology);
883 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
T z() const
Definition: PV3DBase.h:61
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
static std::vector< DetId > matrixDetId(const CaloTopology *topology, DetId id, CaloRectangle rectangle)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
static int position[264][3]
Definition: ReadPGInfo.cc:289
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)

◆ n5x5()

template<bool noZS>
int EcalClusterToolsT< noZS >::n5x5 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 547 of file EcalClusterTools.h.

References first, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), and FastTrackerRecHitMaskProducer_cfi::recHits.

549  {
550  DetId id = getMaximum(cluster.hitsAndFractions(), recHits).first;
551  return matrixSize(cluster, recHits, topology, id, {-2, 2, -2, 2});
552 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
static int matrixSize(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, CaloRectangle rectangle)
Definition: DetId.h:17

◆ nrSaturatedCrysIn5x5()

template<bool noZS>
int EcalClusterToolsT< noZS >::nrSaturatedCrysIn5x5 ( const DetId id,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 1839 of file EcalClusterTools.h.

References EcalRecHit::kSaturated, and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by ElectronHEEPIDValueMapProducer::nrSaturatedCrysIn5x5().

1841  {
1842  int nrSat = 0;
1843  CaloRectangle rectangle{-2, 2, -2, 2};
1844  for (auto const &detId : rectangle(id, *topology)) {
1845  auto recHitIt = recHits->find(detId);
1846  if (recHitIt != recHits->end() && recHitIt->checkFlag(EcalRecHit::kSaturated)) {
1847  nrSat++;
1848  }
1849  }
1850  return nrSat;
1851 }

◆ recHitEnergy()

template<bool noZS>
float EcalClusterToolsT< noZS >::recHitEnergy ( DetId  id,
const EcalRecHitCollection recHits 
)
static

Definition at line 416 of file EcalClusterTools.h.

References EcalBarrel, EcalRecHit::kDiWeird, EcalRecHit::kTowerRecovered, EcalRecHit::kWeird, and FastTrackerRecHitMaskProducer_cfi::recHits.

416  {
417  if (id == DetId(0)) {
418  return 0;
419  } else {
421  if (it != recHits->end()) {
422  if (noZS && (it->checkFlag(EcalRecHit::kTowerRecovered) || it->checkFlag(EcalRecHit::kWeird) ||
423  (it->detid().subdetId() == EcalBarrel && it->checkFlag(EcalRecHit::kDiWeird))))
424  return 0.0;
425  else
426  return it->energy();
427  } else {
428  //throw cms::Exception("EcalRecHitNotFound") << "The recHit corresponding to the DetId" << id.rawId() << " not found in the EcalRecHitCollection";
429  // the recHit is not in the collection (hopefully zero suppressed)
430  return 0;
431  }
432  }
433  return 0;
434 }
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: DetId.h:17

◆ roundnessBarrelSuperClusters()

template<bool noZS>
std::vector< float > EcalClusterToolsT< noZS >::roundnessBarrelSuperClusters ( const reco::SuperCluster superCluster,
const EcalRecHitCollection recHits,
int  weightedPositionMethod = 0,
float  energyThreshold = 0.0 
)
static

Definition at line 1628 of file EcalClusterTools.h.

References ClusterTask_cfi::energyThreshold, first, reco::CaloCluster::hitsAndFractions(), mps_fire::i, FastTrackerRecHitMaskProducer_cfi::recHits, EcalClusterToolsT< noZS >::roundnessSelectedBarrelRecHits(), edm::second(), and groupFilesInBlocks::temp.

1632  { //int positionWeightingMethod=0){
1633  std::vector<std::pair<const EcalRecHit *, float>> RH_ptrs_fracs;
1634  const std::vector<std::pair<DetId, float>> &myHitsPair = superCluster.hitsAndFractions();
1635  for (unsigned int i = 0; i < myHitsPair.size(); ++i) {
1636  //get pointer to recHit object
1637  EcalRecHitCollection::const_iterator myRH = recHits.find(myHitsPair[i].first);
1638  if (myRH != recHits.end() && myRH->energy() * (noZS ? 1.0 : myHitsPair[i].second) > energyThreshold) {
1639  //require rec hit to have positive energy
1640  RH_ptrs_fracs.push_back(std::make_pair(&(*myRH), myHitsPair[i].second));
1641  }
1642  }
1643  std::vector<float> temp =
1644  EcalClusterToolsT<noZS>::roundnessSelectedBarrelRecHits(RH_ptrs_fracs, weightedPositionMethod);
1645  return temp;
1646 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
std::vector< EcalRecHit >::const_iterator const_iterator
U second(std::pair< T, U > const &p)
static std::vector< float > roundnessSelectedBarrelRecHits(const std::vector< std::pair< const EcalRecHit *, float >> &rhVector, int weightedPositionMethod=0)

◆ roundnessBarrelSuperClustersUserExtended()

template<bool noZS>
std::vector< float > EcalClusterToolsT< noZS >::roundnessBarrelSuperClustersUserExtended ( const reco::SuperCluster superCluster,
const EcalRecHitCollection recHits,
int  ieta_delta = 0,
int  iphi_delta = 0,
float  energyRHThresh = 0.00000,
int  weightedPositionMethod = 0 
)
static

Definition at line 1653 of file EcalClusterTools.h.

References funct::abs(), first, EcalClusterToolsT< noZS >::getSeedPosition(), reco::CaloCluster::hitsAndFractions(), mps_fire::i, FastTrackerRecHitMaskProducer_cfi::recHits, EcalClusterToolsT< noZS >::roundnessSelectedBarrelRecHits(), and edm::second().

1659  {
1660  std::vector<std::pair<const EcalRecHit *, float>> RH_ptrs_fracs;
1661  const std::vector<std::pair<DetId, float>> &myHitsPair = superCluster.hitsAndFractions();
1662  for (unsigned int i = 0; i < myHitsPair.size(); ++i) {
1663  //get pointer to recHit object
1664  EcalRecHitCollection::const_iterator myRH = recHits.find(myHitsPair[i].first);
1665  if (myRH != recHits.end() && myRH->energy() * (noZS ? 1.0 : myHitsPair[i].second) > energyRHThresh)
1666  RH_ptrs_fracs.push_back(std::make_pair(&(*myRH), myHitsPair[i].second));
1667  }
1668 
1669  std::vector<int> seedPosition = EcalClusterToolsT<noZS>::getSeedPosition(RH_ptrs_fracs);
1670 
1671  for (EcalRecHitCollection::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
1672  EBDetId EBdetIdi(rh->detid());
1673  float the_fraction = 0;
1674  //if(rh != recHits.end())
1675  bool inEtaWindow = (abs(deltaIEta(seedPosition[0], EBdetIdi.ieta())) <= ieta_delta);
1676  bool inPhiWindow = (abs(deltaIPhi(seedPosition[1], EBdetIdi.iphi())) <= iphi_delta);
1677  bool passEThresh = (rh->energy() > energyRHThresh);
1678  bool alreadyCounted = false;
1679 
1680  // figure out if the rechit considered now is already inside the SC
1681  bool is_SCrh_inside_recHits = false;
1682  for (unsigned int i = 0; i < myHitsPair.size(); i++) {
1683  EcalRecHitCollection::const_iterator SCrh = recHits.find(myHitsPair[i].first);
1684  if (SCrh != recHits.end()) {
1685  the_fraction = myHitsPair[i].second;
1686  is_SCrh_inside_recHits = true;
1687  if (rh->detid() == SCrh->detid())
1688  alreadyCounted = true;
1689  }
1690  } //for loop over SC's recHits
1691 
1692  if (is_SCrh_inside_recHits && !alreadyCounted && passEThresh && inEtaWindow && inPhiWindow) {
1693  RH_ptrs_fracs.push_back(std::make_pair(&(*rh), the_fraction));
1694  }
1695 
1696  } //for loop over rh
1697  return EcalClusterToolsT<noZS>::roundnessSelectedBarrelRecHits(RH_ptrs_fracs, weightedPositionMethod);
1698 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
std::vector< EcalRecHit >::const_iterator const_iterator
static int deltaIEta(int seed_ieta, int rh_ieta)
static int deltaIPhi(int seed_iphi, int rh_iphi)
U second(std::pair< T, U > const &p)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static std::vector< int > getSeedPosition(const std::vector< std::pair< const EcalRecHit *, float >> &RH_ptrs)
static std::vector< float > roundnessSelectedBarrelRecHits(const std::vector< std::pair< const EcalRecHit *, float >> &rhVector, int weightedPositionMethod=0)

◆ roundnessSelectedBarrelRecHits()

template<bool noZS>
std::vector< float > EcalClusterToolsT< noZS >::roundnessSelectedBarrelRecHits ( const std::vector< std::pair< const EcalRecHit *, float >> &  rhVector,
int  weightedPositionMethod = 0 
)
static

Definition at line 1704 of file EcalClusterTools.h.

References funct::abs(), bTagMiniDQMDeepCSV::denominator, EcalRecHit::detid(), EcalRecHit::energy(), EcalClusterToolsT< noZS >::getSeedPosition(), EcalClusterToolsT< noZS >::getSumEnergy(), mps_fire::i, dqm-mbProfile::log, SiStripPI::max, groupFilesInBlocks::temp, trackerHitRTTI::vector, and mps_merge::weight.

Referenced by EcalClusterToolsT< noZS >::roundnessBarrelSuperClusters(), and EcalClusterToolsT< noZS >::roundnessBarrelSuperClustersUserExtended().

1706  { //int weightedPositionMethod = 0){
1707  //positionWeightingMethod = 0 linear weighting, 1 log energy weighting
1708 
1709  std::vector<float> shapes; // this is the returning vector
1710 
1711  //make sure photon has more than one crystal; else roundness and angle suck
1712  if (RH_ptrs_fracs.size() < 2) {
1713  shapes.push_back(-3);
1714  shapes.push_back(-3);
1715  return shapes;
1716  }
1717 
1718  //Find highest E RH (Seed) and save info, compute sum total energy used
1719  std::vector<int> seedPosition = EcalClusterToolsT<noZS>::getSeedPosition(RH_ptrs_fracs); // *recHits);
1720  int tempInt = seedPosition[0];
1721  if (tempInt < 0)
1722  tempInt++;
1723  float energyTotal = EcalClusterToolsT<noZS>::getSumEnergy(RH_ptrs_fracs);
1724 
1725  //1st loop over rechits: compute new weighted center position in coordinates centered on seed
1726  float centerIEta = 0.;
1727  float centerIPhi = 0.;
1728  float denominator = 0.;
1729 
1730  for (std::vector<std::pair<const EcalRecHit *, float>>::const_iterator rhf_ptr = RH_ptrs_fracs.begin();
1731  rhf_ptr != RH_ptrs_fracs.end();
1732  rhf_ptr++) {
1733  const EcalRecHit *rh_ptr = rhf_ptr->first;
1734  //get iEta, iPhi
1735  EBDetId EBdetIdi(rh_ptr->detid());
1736  if (fabs(energyTotal) < 0.0001) {
1737  // don't /0, bad!
1738  shapes.push_back(-2);
1739  shapes.push_back(-2);
1740  return shapes;
1741  }
1742  float rh_energy = rh_ptr->energy() * (noZS ? 1.0 : rhf_ptr->second);
1743  float weight = 0;
1744  if (std::abs(weightedPositionMethod) < 0.0001) { //linear
1745  weight = rh_energy / energyTotal;
1746  } else { //logrithmic
1747  weight = std::max(0.0, 4.2 + log(rh_energy / energyTotal));
1748  }
1749  denominator += weight;
1750  centerIEta += weight * deltaIEta(seedPosition[0], EBdetIdi.ieta());
1751  centerIPhi += weight * deltaIPhi(seedPosition[1], EBdetIdi.iphi());
1752  }
1753  if (fabs(denominator) < 0.0001) {
1754  // don't /0, bad!
1755  shapes.push_back(-2);
1756  shapes.push_back(-2);
1757  return shapes;
1758  }
1759  centerIEta = centerIEta / denominator;
1760  centerIPhi = centerIPhi / denominator;
1761 
1762  //2nd loop over rechits: compute inertia tensor
1763  TMatrixDSym inertia(2); //initialize 2d inertia tensor
1764  double inertia00 = 0.;
1765  double inertia01 = 0.; // = inertia10 b/c matrix should be symmetric
1766  double inertia11 = 0.;
1767  int i = 0;
1768  for (std::vector<std::pair<const EcalRecHit *, float>>::const_iterator rhf_ptr = RH_ptrs_fracs.begin();
1769  rhf_ptr != RH_ptrs_fracs.end();
1770  rhf_ptr++) {
1771  const EcalRecHit *rh_ptr = rhf_ptr->first;
1772  //get iEta, iPhi
1773  EBDetId EBdetIdi(rh_ptr->detid());
1774 
1775  if (fabs(energyTotal) < 0.0001) {
1776  // don't /0, bad!
1777  shapes.push_back(-2);
1778  shapes.push_back(-2);
1779  return shapes;
1780  }
1781  float rh_energy = rh_ptr->energy() * (noZS ? 1.0 : rhf_ptr->second);
1782  float weight = 0;
1783  if (std::abs(weightedPositionMethod) < 0.0001) { //linear
1784  weight = rh_energy / energyTotal;
1785  } else { //logrithmic
1786  weight = std::max(0.0, 4.2 + log(rh_energy / energyTotal));
1787  }
1788 
1789  float ieta_rh_to_center = deltaIEta(seedPosition[0], EBdetIdi.ieta()) - centerIEta;
1790  float iphi_rh_to_center = deltaIPhi(seedPosition[1], EBdetIdi.iphi()) - centerIPhi;
1791 
1792  inertia00 += weight * iphi_rh_to_center * iphi_rh_to_center;
1793  inertia01 -= weight * iphi_rh_to_center * ieta_rh_to_center;
1794  inertia11 += weight * ieta_rh_to_center * ieta_rh_to_center;
1795  i++;
1796  }
1797 
1798  inertia[0][0] = inertia00;
1799  inertia[0][1] = inertia01; // use same number here
1800  inertia[1][0] = inertia01; // and here to insure symmetry
1801  inertia[1][1] = inertia11;
1802 
1803  //step 1 find principal axes of inertia
1804  TMatrixD eVectors(2, 2);
1805  TVectorD eValues(2);
1806  //std::cout<<"EcalClusterToolsT<noZS>::showerRoundness- about to compute eVectors"<<std::endl;
1807  eVectors = inertia.EigenVectors(eValues); //ordered highest eV to lowest eV (I checked!)
1808  //and eVectors are in columns of matrix! I checked!
1809  //and they are normalized to 1
1810 
1811  //step 2 select eta component of smaller eVal's eVector
1812  TVectorD smallerAxis(2); //easiest to spin SC on this axis (smallest eVal)
1813  smallerAxis[0] = eVectors[0][1]; //row,col //eta component
1814  smallerAxis[1] = eVectors[1][1]; //phi component
1815 
1816  //step 3 compute interesting quatities
1817  Double_t temp = fabs(smallerAxis[0]); // closer to 1 ->beamhalo, closer to 0 something else
1818  if (fabs(eValues[0]) < 0.0001) {
1819  // don't /0, bad!
1820  shapes.push_back(-2);
1821  shapes.push_back(-2);
1822  return shapes;
1823  }
1824 
1825  float Roundness = eValues[1] / eValues[0];
1826  float Angle = acos(temp);
1827 
1828  if (-0.00001 < Roundness && Roundness < 0)
1829  Roundness = 0.;
1830  if (-0.00001 < Angle && Angle < 0)
1831  Angle = 0.;
1832 
1833  shapes.push_back(Roundness);
1834  shapes.push_back(Angle);
1835  return shapes;
1836 }
Definition: weight.py:1
static int deltaIEta(int seed_ieta, int rh_ieta)
static int deltaIPhi(int seed_iphi, int rh_iphi)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static float getSumEnergy(const std::vector< std::pair< const EcalRecHit *, float >> &RH_ptrs_fracs)
static std::vector< int > getSeedPosition(const std::vector< std::pair< const EcalRecHit *, float >> &RH_ptrs)
const DetId & detid() const
Definition: EcalRecHit.h:72
float energy() const
Definition: EcalRecHit.h:68

◆ scLocalCovariances()

template<bool noZS>
std::array< float, 3 > EcalClusterToolsT< noZS >::scLocalCovariances ( const reco::SuperCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
float  w0 = 4.7 
)
static

Definition at line 1380 of file EcalClusterTools.h.

References bTagMiniDQMDeepCSV::denominator, HLT_2022v12_cff::dEta, HLT_2022v12_cff::dPhi, EcalBarrel, HCALHighEnergyHPDFilter_cfi::energy, f, first, DivergingColor::frac, SiStripPI::getMaximum(), reco::CaloCluster::hitsAndFractions(), mps_fire::i, PixelPluginsPhase0_cfi::isBarrel, dqm-mbProfile::log, SiStripPI::max, FastTrackerRecHitMaskProducer_cfi::recHits, reco::SuperCluster::seed(), DetId::subdetId(), findQualityFiles::v, and w().

1383  {
1384  const reco::BasicCluster bcluster = *(cluster.seed());
1385 
1386  float e_5x5 = e5x5(bcluster, recHits, topology);
1387  float covEtaEta, covEtaPhi, covPhiPhi;
1388 
1389  if (e_5x5 >= 0.) {
1390  const std::vector<std::pair<DetId, float>> &v_id = cluster.hitsAndFractions();
1391  std::pair<float, float> mean5x5PosInNrCrysFromSeed = mean5x5PositionInLocalCrysCoord(bcluster, recHits, topology);
1392  std::pair<float, float> mean5x5XYPos = mean5x5PositionInXY(cluster, recHits, topology);
1393  // now we can calculate the covariances
1394  double numeratorEtaEta = 0;
1395  double numeratorEtaPhi = 0;
1396  double numeratorPhiPhi = 0;
1397  double denominator = 0;
1398 
1399  const double barrelCrysSize = 0.01745; //approximate size of crystal in eta,phi in barrel
1400  const double endcapCrysSize = 0.0447; //the approximate crystal size sigmaEtaEta was corrected to in the endcap
1401 
1402  DetId seedId = getMaximum(v_id, recHits).first;
1403  bool isBarrel = seedId.subdetId() == EcalBarrel;
1404 
1405  const double crysSize = isBarrel ? barrelCrysSize : endcapCrysSize;
1406 
1407  for (size_t i = 0; i < v_id.size(); ++i) {
1408  float frac = getFraction(v_id, v_id[i].first);
1409  float energy = recHitEnergy(v_id[i].first, recHits) * frac;
1410 
1411  if (energy <= 0)
1412  continue;
1413 
1414  float dEta = getNrCrysDiffInEta(v_id[i].first, seedId) - mean5x5PosInNrCrysFromSeed.first;
1415  float dPhi = 0;
1416  if (isBarrel)
1417  dPhi = getNrCrysDiffInPhi(v_id[i].first, seedId) - mean5x5PosInNrCrysFromSeed.second;
1418  else
1419  dPhi = getDPhiEndcap(v_id[i].first, mean5x5XYPos.first, mean5x5XYPos.second);
1420 
1421  double w = 0.;
1422  w = std::max(0.0f, w0 + std::log(energy / e_5x5));
1423 
1424  denominator += w;
1425  numeratorEtaEta += w * dEta * dEta;
1426  numeratorEtaPhi += w * dEta * dPhi;
1427  numeratorPhiPhi += w * dPhi * dPhi;
1428  }
1429 
1430  //multiplying by crysSize to make the values compariable to normal covariances
1431  if (denominator != 0.0) {
1432  covEtaEta = crysSize * crysSize * numeratorEtaEta / denominator;
1433  covEtaPhi = crysSize * crysSize * numeratorEtaPhi / denominator;
1434  covPhiPhi = crysSize * crysSize * numeratorPhiPhi / denominator;
1435  } else {
1436  covEtaEta = 999.9;
1437  covEtaPhi = 999.9;
1438  covPhiPhi = 999.9;
1439  }
1440 
1441  } else {
1442  // Warn the user if there was no energy in the cells and return zeroes.
1443  // std::cout << "\ClusterShapeAlgo::Calculate_Covariances: no energy in supplied cells.\n";
1444  covEtaEta = 0;
1445  covEtaPhi = 0;
1446  covPhiPhi = 0;
1447  }
1448 
1449  std::array<float, 3> v{{covEtaEta, covEtaPhi, covPhiPhi}};
1450  return v;
1451 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
T w() const
static float getDPhiEndcap(const DetId &crysId, float meanX, float meanY)
static float getFraction(const std::vector< std::pair< DetId, float >> &v_id, DetId id)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
double f[11][100]
static float getNrCrysDiffInEta(const DetId &crysId, const DetId &orginId)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static float getNrCrysDiffInPhi(const DetId &crysId, const DetId &orginId)
static std::pair< float, float > mean5x5PositionInXY(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
Definition: DetId.h:17
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
static std::pair< float, float > mean5x5PositionInLocalCrysCoord(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)

◆ zernike20()

template<bool noZS>
double EcalClusterToolsT< noZS >::zernike20 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
double  R0 = 6.6,
bool  logW = true,
float  w0 = 4.7 
)
static

Definition at line 1129 of file EcalClusterTools.h.

References HLT_2022v12_cff::R0, and FastTrackerRecHitMaskProducer_cfi::recHits.

1134  {
1135  return absZernikeMoment(cluster, recHits, geometry, 2, 0, R0, logW, w0);
1136 }
static double absZernikeMoment(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)

◆ zernike42()

template<bool noZS>
double EcalClusterToolsT< noZS >::zernike42 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
double  R0 = 6.6,
bool  logW = true,
float  w0 = 4.7 
)
static

Definition at line 1139 of file EcalClusterTools.h.

References HLT_2022v12_cff::R0, and FastTrackerRecHitMaskProducer_cfi::recHits.

1144  {
1145  return absZernikeMoment(cluster, recHits, geometry, 4, 2, R0, logW, w0);
1146 }
static double absZernikeMoment(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)