25 if( !cluster.
seed() ) {
27 <<
" Found a cluster with no seed: " << cluster;
31 double cl_timeweight=0.0;
41 if( refhit->detId() == cluster.
seed() ) refseed = refhit;
42 const double rh_fraction = rhf.fraction();
43 const double rh_rawenergy = refhit->energy();
44 const double rh_energy = rh_rawenergy * rh_fraction;
47 <<
"rechit " << refhit->detId() <<
" has a NaN energy... "
48 <<
"The input of the particle flow clustering seems to be corrupted.";
50 cl_energy += rh_energy;
55 int cell_layer = (int)refhit->layer();
62 cl_time += rh_fraction*refhit->time()/res2;
63 cl_timeweight += rh_fraction/res2;
66 const double rh_rawenergy2 = rh_rawenergy*rh_rawenergy;
67 cl_timeweight+=rh_rawenergy2*rh_fraction;
68 cl_time += rh_rawenergy2*rh_fraction*refhit->time();
71 if( rh_energy > max_e ) {
73 max_e_layer = rhf.recHitRef()->layer();
77 cluster.
setTime(cl_time/cl_timeweight);
80 double position_norm = 0.0;
81 double x(0.0),
y(0.0),
z(0.0);
85 seedNeighbours = &refseed->neighbours4();
88 seedNeighbours = &refseed->neighbours8();
100 if( pos == seedNeighbours->
end() )
continue;
103 const double rh_energy = refhit->energy() * ((float)rhf.fraction());
108 x += rhpos_xyz.X() * norm;
109 y += rhpos_xyz.Y() * norm;
110 z += rhpos_xyz.Z() * norm;
111 position_norm += norm;
115 <<
"PFCluster too far from seeding cell: set position to (0,0,0).";
119 const double norm_inverse = 1.0/position_norm;
const double _logWeightDenom
void setLayer(PFLayer::Layer layer)
set layer
std::unique_ptr< ECALRecHitResolutionProvider > _timeResolutionCalcEndcap
void setPosition(const math::XYZPoint &p)
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
void setEnergy(double energy)
const_iterator end() const
Termination of iteration.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const_iterator begin() const
Initialize an iterator over the RefVector.
void setTime(double time)
const T & max(const T &a, const T &b)
void calculatePositionREP()
computes posrep_ once and for all
const double _minAllowedNorm
DetId seed() const
return DetId of seed
XYZPointD XYZPoint
point in space with cartesian internal representation
const float _minFractionInCalc
const int _posCalcNCrystals
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
std::unique_ptr< ECALRecHitResolutionProvider > _timeResolutionCalcBarrel