7 std::vector<size_t> idx(v.
size());
11 std::sort(idx.begin(), idx.end(), [&
v](
size_t i1,
size_t i2) {
return (*v[i1]) > (*v[i2]); });
17 return (a->x() - to[0]) * (a->x() - to[0]) + (a->y() - to[1]) * (a->y() - to[1]);
23 unsigned int es_size =
es.size();
24 for (
unsigned int i = 0;
i < es_size; ++
i) {
27 float x = thecls[
es[
i]]->x();
28 float y = thecls[
es[
i]]->y();
29 float z = thecls[
es[
i]]->z();
31 if (
zees[layer] == 0.) {
52 std::vector<reco::HGCalMultiCluster> thePreClusters;
54 std::vector<KDTree> hit_kdtree(2 * (
maxlayer + 1));
55 for (
unsigned int i = 0;
i <= 2 *
maxlayer + 1; ++
i) {
57 hit_kdtree[
i].build(
points[i], bounds);
59 std::vector<int> vused(
es.size(), 0);
60 unsigned int used = 0;
62 unsigned int es_size =
es.size();
63 for (
unsigned int i = 0;
i < es_size; ++
i) {
67 vused[
i] = (thecls[
es[
i]]->z() > 0) ? 1 : -1;
70 std::array<double, 3> from{{thecls[
es[
i]]->x(), thecls[
es[
i]]->y(), thecls[
es[
i]]->z()}};
71 unsigned int firstlayer = int(thecls[
es[i]]->
z() > 0) * (
maxlayer + 1);
72 unsigned int lastlayer = firstlayer +
maxlayer + 1;
73 for (
unsigned int j = firstlayer;
j < lastlayer; ++
j) {
78 std::array<double, 3> to{{0., 0.,
zees[
j]}};
81 j > maxlayer ? (
j - (maxlayer + 1)) :
j;
87 float radius2 = radius *
radius;
89 float(to[0]) - radius,
float(to[0]) + radius,
float(to[1]) - radius,
float(to[1]) + radius);
90 std::vector<ClusterRef>
found;
92 hit_kdtree[
j].search(search_box, found);
94 for (
unsigned int k = 0;
k < found.size();
k++) {
95 if (vused[found[
k].ind] == 0 && distReal2(thecls[
es[found[
k].ind]], to) < radius2) {
97 vused[found[
k].ind] = vused[
i];
108 thePreClusters.push_back(temp);
109 auto &back = thePreClusters.back();
110 back.setPosition(position);
111 back.setEnergy(
clusterTools->getMultiClusterEnergy(back));
116 return thePreClusters;
121 to[0] = from[0] / from[2] * to[2];
122 to[1] = from[1] / from[2] * to[2];
size_type size() const
Size of the RefVector.
std::vector< std::vector< KDNode > > points
std::vector< double > radii
void organizeByLayer(const reco::HGCalMultiCluster::ClusterCollection &)
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< float > zees
unsigned int size() const
void layerIntersection(std::array< double, 3 > &to, const std::array< double, 3 > &from) const
void push_back(const edm::Ptr< reco::BasicCluster > &b)
std::vector< size_t > sorted_indices(const std::vector< T > &v)
Abs< T >::type abs(const T &t)
std::vector< std::array< float, 2 > > maxpos
std::vector< std::array< float, 2 > > minpos
XYZPointD XYZPoint
point in space with cartesian internal representation
std::unique_ptr< hgcal::ClusterTools > clusterTools
hgcal::RecHitTools rhtools_
static int position[264][3]
std::vector< reco::HGCalMultiCluster > makeClusters(const reco::HGCalMultiCluster::ClusterCollection &)