9 std::vector<size_t>
idx(v.
size());
13 std::sort(
idx.begin(),
idx.end(),
14 [&
v](
size_t i1,
size_t i2) {
return (*v[i1]) > (*v[i2]);});
20 const std::array<double,3> &
to) {
21 return (a->x()-to[0])*(a->x()-to[0]) + (a->y()-to[1])*(a->y()-to[1]);
27 unsigned int es_size =
es.size();
28 for(
unsigned int i = 0;
i < es_size; ++
i) {
31 float x = thecls[
es[
i]]->x();
32 float y = thecls[
es[
i]]->y();
33 float z = thecls[
es[
i]]->z();
53 std::vector<reco::HGCalMultiCluster> thePreClusters;
55 std::vector<KDTree> hit_kdtree(2*(
maxlayer+1));
59 hit_kdtree[
i].build(
points[i],bounds);
61 std::vector<int> vused(
es.size(),0);
62 unsigned int used = 0;
64 unsigned int es_size =
es.size();
65 for(
unsigned int i = 0;
i < es_size; ++
i) {
69 vused[
i]=(thecls[
es[
i]]->z()>0)? 1 : -1;
72 std::array<double,3> from{ {thecls[
es[
i]]->x(),thecls[
es[
i]]->y(),thecls[
es[
i]]->z()} };
74 unsigned int lastlayer = firstlayer+
maxlayer+1;
75 for(
unsigned int j = firstlayer; j < lastlayer; ++j) {
80 std::array<double,3> to{ {0.,0.,
zees[j]} };
82 unsigned int layer = j > maxlayer ? (j-(maxlayer+1)) : j;
87 else assert(radius<100. &&
"nonsense layer value - cannot assign multicluster radius");
88 float radius2 = radius*
radius;
89 KDTreeBox search_box(
float(to[0])-radius,
float(to[0])+radius,
90 float(to[1])-radius,
float(to[1])+radius);
91 std::vector<KDNode>
found;
93 hit_kdtree[j].search(search_box,found);
95 for(
unsigned int k = 0;
k < found.size();
k++){
96 if(vused[found[
k].
data.ind]==0 && distReal2(thecls[
es[found[
k].
data.ind]],to)<radius2){
98 vused[found[
k].data.ind]=vused[
i];
105 thePreClusters.push_back(temp);
106 auto& back = thePreClusters.back();
107 back.setPosition(
clusterTools->getMultiClusterPosition(back));
108 back.setEnergy(
clusterTools->getMultiClusterEnergy(back));
115 return thePreClusters;
120 const std::array<double,3> &from)
124 to[0]=from[0]/from[2]*to[2];
125 to[1]=from[1]/from[2]*to[2];
size_type size() const
Size of the RefVector.
std::vector< std::array< float, 2 > > maxpos
std::vector< double > radii
void organizeByLayer(const reco::HGCalMultiCluster::ClusterCollection &)
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)
static const unsigned int lastLayerFH
std::unique_ptr< hgcal::ClusterTools > clusterTools
std::vector< std::vector< KDNode > > points
char data[epos_bytes_allocation]
hgcal::RecHitTools rhtools_
std::vector< reco::HGCalMultiCluster > makeClusters(const reco::HGCalMultiCluster::ClusterCollection &)
static const unsigned int lastLayerEE
std::vector< std::array< float, 2 > > minpos
static const unsigned int maxlayer
static const unsigned int lastLayerBH