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;
57 for(
unsigned int icl=0; icl<nclust; ++icl) {
58 const std::vector< reco::PFRecHitFraction >& PFRecHits = pfclust[icl]->recHitFractions();
61 for ( std::vector< reco::PFRecHitFraction >::const_iterator it = PFRecHits.begin();
62 it != PFRecHits.end(); ++it) {
67 if(ebRecHits && eeRecHits )
70 unsigned index=it-PFRecHits.begin();
71 DetId id=pfclust[icl]->hitsAndFractions()[
index].first;
76 if(itcheck!=ebRecHits->
end())
77 energyHit= itcheck->energy();
84 if(itcheck!=eeRecHits->
end())
85 energyHit= itcheck->energy();
91 energyHit = RefPFRecHit->energy();
95 if (energyHit > SeedClusEnergy) {
96 SeedClusEnergy = energyHit;
97 SeedEta = RefPFRecHit->position().eta();
98 SeedDetID = RefPFRecHit->detId();
103 double dPhi = RefPFRecHit->position().phi() - scPhi;
106 double dEta = RefPFRecHit->position().eta() - scEta;
107 if ( energyHit > 0 ) {
108 numeratorEtaWidth += energyHit * dEta * dEta;
109 numeratorPhiWidth += energyHit * dPhi *
dPhi;
115 const std::vector< reco::PFRecHitFraction >& PFRecHits = pfclust[0]->recHitFractions();
116 for ( std::vector< reco::PFRecHitFraction >::const_iterator it = PFRecHits.begin();
117 it != PFRecHits.end(); ++it) {
121 double energyHit = RefPFRecHit->energy();
122 if (RefPFRecHit->detId() != SeedDetID) {
123 float diffEta = RefPFRecHit->position().eta() - SeedEta;
124 sigmaEtaEta_ += (diffEta*diffEta) * (energyHit/SeedClusEnergy);
127 if (sigmaEtaEta_ == 0.) sigmaEtaEta_ = 0.00000001;
129 etaWidth_ =
sqrt(numeratorEtaWidth / denominator);
130 phiWidth_ =
sqrt(numeratorPhiWidth / denominator);
std::vector< EcalRecHit >::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)