10 std::vector<size_t>
idx(v.
size());
11 for (
size_t i = 0;
i !=
idx.size(); ++
i)
idx[
i] =
i;
14 std::sort(
idx.begin(),
idx.end(),
15 [&
v](
size_t i1,
size_t i2) {
return (*v[i1]) > (*v[i2]);});
29 float tanTheta =
tan(2*atan(
exp(-1*a->eta())));
30 float ax = b->z()*tanTheta*
cos(a->phi());
31 float ay = b->z()*tanTheta*
sin(a->phi());
32 return (ax-b->x())*(ax-b->x()) + (ay-b->y())*(ay-b->y());
38 std::vector<reco::HGCalMultiCluster> thePreClusters;
40 std::vector<int> vused(es.size(),0);
41 unsigned int used = 0;
43 for(
unsigned int i = 0;
i < es.size(); ++
i) {
47 vused[
i]=(thecls[es[
i]]->z()>0)? 1 : -1;
49 for(
unsigned int j = i+1; j < es.size(); ++j) {
51 float distanceCheck = 9999.;
52 if(
realSpaceCone ) distanceCheck = distAxisCluster2(thecls[es[i]],thecls[es[j]]);
53 else distanceCheck = dist2(thecls[es[i]],thecls[es[j]]);
54 DetId detid = thecls[es[j]]->hitsAndFractions()[0].first();
56 float radius2 = 9999.;
58 else if(layer <=
lastLayerFH) radius2 = radii[1]*radii[1];
59 else if(layer <=
lastLayerBH) radius2 = radii[2]*radii[2];
60 else assert(radius2<100. &&
"nonsense layer value - cannot assign multicluster radius");
61 if( distanceCheck<radius2 &&
int(thecls[es[j]]->
z()*vused[i])>0 ) {
69 thePreClusters.push_back(temp);
70 auto& back = thePreClusters.back();
71 back.setPosition(
clusterTools->getMultiClusterPosition(back));
72 back.setEnergy(
clusterTools->getMultiClusterEnergy(back));
79 return thePreClusters;
size_type size() const
Size of the RefVector.
static const unsigned int lastLayerBH
std::vector< reco::HGCalMultiCluster > makePreClusters(const reco::HGCalMultiCluster::ClusterCollection &) const
Sin< T >::type sin(const T &t)
std::unique_ptr< hgcal::ClusterTools > clusterTools
unsigned int size() const
void push_back(const edm::Ptr< reco::BasicCluster > &b)
Cos< T >::type cos(const T &t)
std::vector< size_t > sorted_indices(const std::vector< T > &v)
Tan< T >::type tan(const T &t)
std::vector< float > radii
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static const unsigned int lastLayerEE
static const unsigned int lastLayerFH