25 if( !cluster.
seed() ) {
27 <<
" Found a cluster with no seed: " << cluster;
31 double cl_timeweight=0.0;
43 if( refhit->detId() == cluster.
seed() ) refseed = refhit;
44 const double rh_fraction = rhf.fraction();
45 const double rh_rawenergy = refhit->energy();
46 const double rh_energy = rh_rawenergy * rh_fraction;
49 <<
"rechit " << refhit->detId() <<
" has a NaN energy... "
50 <<
"The input of the particle flow clustering seems to be corrupted.";
52 cl_energy += rh_energy;
56 int cell_layer = (int)refhit->layer();
63 cl_time += rh_fraction*refhit->time()/res2;
64 cl_timeweight += rh_fraction/res2;
67 const double rh_rawenergy2 = rh_rawenergy*rh_rawenergy;
68 cl_timeweight+=rh_rawenergy2*rh_fraction;
69 cl_time += rh_rawenergy2*rh_fraction*refhit->time();
72 if( rh_energy > max_e ) {
74 max_e_layer = rhf.recHitRef()->layer();
78 cluster.
setTime(cl_time/cl_timeweight);
83 double position_norm = 0.0;
84 double x(0.0),
y(0.0),
z(0.0);
88 seedNeighbours = &refseed->neighbours4();
91 seedNeighbours = &refseed->neighbours8();
103 if( pos == seedNeighbours->
end() )
continue;
106 const double rh_energy = refhit->energy() * ((float)rhf.fraction());
111 x += rhpos_xyz.X() * norm;
112 y += rhpos_xyz.Y() * norm;
113 z += rhpos_xyz.Z() * norm;
114 depth += refhit->depth()*norm;
116 position_norm += norm;
120 <<
"PFCluster too far from seeding cell: set position to (0,0,0).";
124 const double norm_inverse = 1.0/position_norm;
128 depth *= norm_inverse;
const double _logWeightDenom
void setLayer(PFLayer::Layer layer)
set layer
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)
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
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalcBarrel
const float _minFractionInCalc
const int _posCalcNCrystals
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalcEndcap
void setDepth(double depth)
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions