5 #ifndef PARTICLESINCONETOOLS_IPARTICLELOOKUPTABLE_H
6 #define PARTICLESINCONETOOLS_IPARTICLELOOKUPTABLE_H
74 m_phiBinnedLookUpTable.clear();
80 m_phiBinnedLookUpTable.resize(m_nphiBins);
85 for(
unsigned int i=0;
i<
size;++
i ){
88 m_phiBinnedLookUpTable[
index].push_back(
i);
92 for(
auto&
vec : m_phiBinnedLookUpTable ) {
93 if(
vec.empty() )
continue;
94 std::stable_sort(
vec.begin(),
vec.end(),[&](
int i,
int j) { return (*m_container)[i]->eta() < (*m_container)[j]->eta(); });
103 template<
class T>
template<
class O>
107 if( m_phiBinnedLookUpTable.empty() )
return false;
110 auto compEta1 = [&](
int i,
double val ) {
return (*m_container)[
i]->eta() <
val; };
111 auto compEta2 = [&](
double val,
int i ) {
return val < (*m_container)[
i]->eta(); };
118 std::vector< std::pair<int,int> >
ranges;
119 if( indexMin > indexMax ) {
120 ranges.push_back( std::make_pair(0,indexMax) );
121 ranges.push_back( std::make_pair(indexMin,m_nphiBins-1) );
123 ranges.push_back( std::make_pair(indexMin,indexMax) );
126 float dr2Cut =
dr*
dr;
130 indexMin =
range.first;
131 indexMax =
range.second;
132 for( ; indexMin <= indexMax; ++indexMin ){
134 const std::vector< int >& tps = m_phiBinnedLookUpTable[indexMin];
135 auto it_min = std::lower_bound (tps.begin(),tps.end(),eta-
dr,compEta1 );
136 auto it_max = std::upper_bound (it_min,tps.end(),eta+
dr,compEta2 );
139 for( ;it_min!=it_max;++it_min ){
140 const T*
entry = (*m_container)[*it_min];
141 float deta = eta-
entry->eta();
143 float dr2 = deta*deta + dphi*dphi;
145 if( dr2 < dr2Cut ) addEntry( *it_min,
output );
154 output.push_back( (*m_container)[
i]);