|
|
Go to the documentation of this file.
9 #include <boost/function_output_iterator.hpp>
11 #include "vdt/vdtMath.h"
14 inline bool isBarrel(
int cell_layer) {
31 if (!cluster.
seed()) {
32 throw cms::Exception(
"ClusterWithNoSeed") <<
" Found a cluster with no seed: " << cluster;
36 double cl_timeweight = 0.0;
46 auto const recHitCollection =
57 auto k =
hf.recHitRef().key();
58 auto p = recHitCollection +
k;
64 for (
auto const& rhf :
hits) {
68 const auto rh_fraction = rhf.fraction;
69 const auto rh_rawenergy = rhf.energy;
70 const auto rh_energy = rh_rawenergy * rh_fraction;
74 throw cms::Exception(
"PFClusterAlgo") <<
"rechit " << refhit.
detId() <<
" has a NaN energy... "
75 <<
"The input of the particle flow clustering seems to be corrupted.";
78 cl_energy += rh_energy;
82 int cell_layer = (
int)refhit.
layer();
85 cl_time += rh_fraction * refhit.
time() * res2;
86 cl_timeweight += rh_fraction * res2;
88 const double rh_rawenergy2 = rh_rawenergy * rh_rawenergy;
89 cl_timeweight += rh_rawenergy2 * rh_fraction;
90 cl_time += rh_rawenergy2 * rh_fraction * refhit.
time();
93 if (rh_energy > max_e) {
95 max_e_layer = refhit.
layer();
100 cluster.
setTime(cl_time / cl_timeweight);
108 double position_norm = 0.0;
109 double x(0.0),
y(0.0),
z(0.0);
110 if (
nullptr !=
mySeed.hit) {
111 auto seedNeighbours =
mySeed.hit->neighbours();
114 seedNeighbours =
mySeed.hit->neighbours4();
117 seedNeighbours =
mySeed.hit->neighbours8();
123 auto compute = [&](LHit
const& rhf) {
126 int cell_layer = (
int)refhit.
layer();
139 const auto rh_energy = rhf.energy * rhf.fraction;
142 const auto rhpos_xyz = refhit.
position() * norm;
147 position_norm += norm;
151 std::sort(
hits.begin(),
hits.end(), [](LHit
const&
a, LHit
const&
b) {
return a.hit <
b.hit; });
154 for (
auto const& rhf :
hits)
160 for (
auto k : seedNeighbours) {
161 nei.push_back(recHitCollection +
k);
163 std::sort(nei.begin(), nei.end());
168 std::set_intersection(
169 hits.begin(),
hits.end(), nei.begin(), nei.end(), boost::make_function_output_iterator(
compute), LHitLess());
173 <<
"Cluster seed hit is null, something is wrong with PFlow RecHit!";
177 edm::LogError(
"WeirdClusterNormalization") <<
"PFCluster too far from seeding cell: set position to (0,0,0).";
181 const double norm_inverse = 1.0 / position_norm;
185 depth *= norm_inverse;
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
const float _minFractionInCalc
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalcBarrel
void calculateAndSetPositionActual(reco::PFCluster &) const
void setTime(float time, float timeError=0)
const int _posCalcNCrystals
constexpr bool isNotFinite(T x)
void setLayer(PFLayer::Layer layer)
set layer
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
void calculateAndSetPosition(reco::PFCluster &) override
std::tuple< std::vector< int >, std::vector< int >, std::vector< float > > _logWeightDenom
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalcEndcap
int depth() const
depth for segemntation
#define declareDynArray(T, n, x)
const float _minAllowedNorm
void setPosition(const math::XYZPoint &p)
XYZPointD XYZPoint
point in space with cartesian internal representation
void calculateAndSetPositions(reco::PFClusterCollection &) override
void calculatePositionREP()
computes posrep_ once and for all
DetId seed() const
return DetId of seed
float time() const
timing for cleaned hits
unsigned detId() const
rechit detId
void setEnergy(double energy)
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
void setTimeError(float timeError)
PositionType const & position() const
rechit cell centre x, y, z
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
PFLayer::Layer layer() const
rechit layer
void setDepth(double depth)
#define unInitDynArray(T, n, x)