13 double numeratorEtaWidth = 0.;
14 double numeratorPhiWidth = 0.;
15 double sclusterE = 0.;
21 unsigned int nclust = pfclust.size();
29 for (
unsigned int icl = 0; icl <
nclust; ++icl) {
30 const std::vector<reco::PFRecHitFraction>& PFRecHits = pfclust[icl]->recHitFractions();
32 for (std::vector<reco::PFRecHitFraction>::const_iterator it = PFRecHits.begin(); it != PFRecHits.end(); ++it) {
35 double energyHit = RefPFRecHit->energy() * it->fraction();
37 sclusterE += energyHit;
38 posX += energyHit * RefPFRecHit->position().x();
39 posY += energyHit * RefPFRecHit->position().y();
40 posZ += energyHit * RefPFRecHit->position().z();
52 double scEta = pflowSCPos.eta();
53 double scPhi = pflowSCPos.phi();
55 double SeedClusEnergy = -1.;
56 unsigned int SeedDetID = 0;
60 for (
unsigned int icl = 0; icl <
nclust; ++icl) {
61 const auto& PFRecHits = pfclust[icl]->recHitFractions();
63 for (
auto it = PFRecHits.begin(); it != PFRecHits.end(); ++it) {
66 double energyHit = RefPFRecHit->energy() * it->fraction();
70 if (energyHit > SeedClusEnergy) {
71 SeedClusEnergy = energyHit;
72 SeedEta = RefPFRecHit->position().eta();
73 SeedDetID = RefPFRecHit->detId();
78 double dEta = RefPFRecHit->positionREP().eta() - scEta;
79 numeratorEtaWidth += energyHit *
dEta *
dEta;
80 numeratorPhiWidth += energyHit *
dPhi *
dPhi;
85 const auto& PFRecHits = pfclust[0]->recHitFractions();
86 for (
auto it = PFRecHits.begin(); it != PFRecHits.end(); ++it) {
87 const auto& RefPFRecHit = it->recHitRef();
88 if (!RefPFRecHit.isAvailable())
90 double energyHit = RefPFRecHit->energy();
91 if (RefPFRecHit->detId() != SeedDetID) {
92 float diffEta = RefPFRecHit->positionREP().eta() - SeedEta;
93 sigmaEtaEta_ += (diffEta * diffEta) * (energyHit / SeedClusEnergy);
96 if (sigmaEtaEta_ == 0.)
97 sigmaEtaEta_ = 0.00000001;
constexpr double deltaPhi(double phi1, double phi2)
PFClusterWidthAlgo(const std::vector< const reco::PFCluster *> &pfclust)
XYZPointD XYZPoint
point in space with cartesian internal representation