17 double numeratorEtaWidth = 0.;
18 double numeratorPhiWidth = 0.;
19 double sclusterE = 0.;
25 unsigned int nclust= pfclust.size();
35 for(
unsigned int icl=0; icl<nclust; ++icl) {
36 const std::vector< reco::PFRecHitFraction >& PFRecHits = pfclust[icl]->recHitFractions();
38 for ( std::vector< reco::PFRecHitFraction >::const_iterator it = PFRecHits.begin();
39 it != PFRecHits.end(); ++it) {
42 double energyHit = RefPFRecHit->energy()*it->fraction();
44 sclusterE += energyHit;
45 posX += energyHit*RefPFRecHit->position().x();
46 posY += energyHit*RefPFRecHit->position().y();
47 posZ += energyHit*RefPFRecHit->position().z();
60 double scEta = pflowSCPos.eta();
61 double scPhi = pflowSCPos.phi();
63 double SeedClusEnergy = -1.;
64 unsigned int SeedDetID = 0;
68 for(
unsigned int icl=0; icl<nclust; ++icl) {
69 const auto & PFRecHits = pfclust[icl]->recHitFractions();
71 for (
auto it = PFRecHits.begin();
72 it != PFRecHits.end(); ++it) {
75 double energyHit = RefPFRecHit->energy()*it->fraction();
79 if (energyHit > SeedClusEnergy) {
80 SeedClusEnergy = energyHit;
81 SeedEta = RefPFRecHit->position().eta();
82 SeedDetID = RefPFRecHit->detId();
87 double dEta = RefPFRecHit->positionREP().eta() - scEta;
88 numeratorEtaWidth += energyHit * dEta * dEta;
89 numeratorPhiWidth += energyHit * dPhi *
dPhi;
94 const auto & PFRecHits = pfclust[0]->recHitFractions();
95 for (
auto it = PFRecHits.begin();
96 it != PFRecHits.end(); ++it) {
97 const auto & RefPFRecHit = it->recHitRef();
98 if(!RefPFRecHit.isAvailable())
100 double energyHit = RefPFRecHit->energy();
101 if (RefPFRecHit->detId() != SeedDetID) {
102 float diffEta = RefPFRecHit->positionREP().eta() - SeedEta;
103 sigmaEtaEta_ += (diffEta*diffEta) * (energyHit/SeedClusEnergy);
106 if (sigmaEtaEta_ == 0.) sigmaEtaEta_ = 0.00000001;
108 etaWidth_ =
std::sqrt(numeratorEtaWidth / denominator);
109 phiWidth_ =
std::sqrt(numeratorPhiWidth / denominator);
double dPhi(double phi1, double phi2)
double deltaPhi(double phi1, double phi2)
PFClusterWidthAlgo(const std::vector< const reco::PFCluster * > &pfclust)
XYZPointD XYZPoint
point in space with cartesian internal representation