18 double numeratorEtaWidth = 0.;
19 double numeratorPhiWidth = 0.;
20 double sclusterE = 0.;
26 unsigned int nclust= pfclust.size();
34 for(
unsigned int icl=0;icl<nclust;++icl) {
35 double e = pfclust[icl]->energy();
37 posX += e * pfclust[icl]->position().X();
38 posY += e * pfclust[icl]->position().Y();
39 posZ += e * pfclust[icl]->position().Z();
50 double scEta = pflowSCPos.eta();
51 double scPhi = pflowSCPos.phi();
53 double SeedClusEnergy = -1.;
54 unsigned int SeedDetID = 0;
58 for(
unsigned int icl=0; icl<nclust; ++icl) {
59 const std::vector< reco::PFRecHitFraction >& PFRecHits = pfclust[icl]->recHitFractions();
62 for ( std::vector< reco::PFRecHitFraction >::const_iterator it = PFRecHits.begin();
63 it != PFRecHits.end(); ++it) {
68 if(ebRecHits && eeRecHits )
71 unsigned index=it-PFRecHits.begin();
72 DetId id=pfclust[icl]->hitsAndFractions()[
index].first;
77 if(itcheck!=ebRecHits->
end())
78 energyHit= itcheck->energy();
85 if(itcheck!=eeRecHits->
end())
86 energyHit= itcheck->energy();
92 energyHit = RefPFRecHit->energy();
96 if (energyHit > SeedClusEnergy) {
97 SeedClusEnergy = energyHit;
98 SeedEta = RefPFRecHit->position().eta();
99 SeedPhi = RefPFRecHit->position().phi();
100 SeedDetID = RefPFRecHit->detId();
105 double dPhi = RefPFRecHit->position().phi() - scPhi;
108 double dEta = RefPFRecHit->position().eta() - scEta;
109 if ( energyHit > 0 ) {
110 numeratorEtaWidth += energyHit * dEta * dEta;
111 numeratorPhiWidth += energyHit * dPhi *
dPhi;
117 const std::vector< reco::PFRecHitFraction >& PFRecHits = pfclust[0]->recHitFractions();
118 for ( std::vector< reco::PFRecHitFraction >::const_iterator it = PFRecHits.begin();
119 it != PFRecHits.end(); ++it) {
123 double energyHit = RefPFRecHit->energy();
124 if (RefPFRecHit->detId() != SeedDetID) {
125 float diffEta = RefPFRecHit->position().eta() - SeedEta;
126 sigmaEtaEta_ += (diffEta*diffEta) * (energyHit/SeedClusEnergy);
129 if (sigmaEtaEta_ == 0.) sigmaEtaEta_ = 0.00000001;
131 etaWidth_ =
sqrt(numeratorEtaWidth / denominator);
132 phiWidth_ =
sqrt(numeratorPhiWidth / denominator);
std::vector< T >::const_iterator const_iterator
double dPhi(double phi1, double phi2)
PFClusterWidthAlgo(const std::vector< const reco::PFCluster * > &pfclust, const EBRecHitCollection *ebRecHits=0, const EERecHitCollection *eeRecHits=0)
const_iterator end() const
XYZPointD XYZPoint
point in space with cartesian internal representation
iterator find(key_type k)