16 return ( a->row() < b->row() );
22 const std::vector< Ref_Phase2TrackerDigi_ > &
input,
29 std::map< unsigned int, std::vector< Ref_Phase2TrackerDigi_ > > mapHitsByColumn;
32 typename std::vector< Ref_Phase2TrackerDigi_ >::const_iterator inputIterator;
33 inputIterator = input.begin();
34 while ( inputIterator != input.end() )
36 mapHitsByColumn[(**inputIterator).column()].push_back(*inputIterator);
41 std::map< std::pair< unsigned int, unsigned int >, std::vector< Ref_Phase2TrackerDigi_ > > map1DCluByColRow;
44 typename std::map< unsigned int, std::vector< Ref_Phase2TrackerDigi_ > >::iterator mapIterHbC;
45 mapIterHbC = mapHitsByColumn.begin();
46 while ( mapIterHbC != mapHitsByColumn.end() )
50 typename std::vector< Ref_Phase2TrackerDigi_ >::iterator inputIterator;
51 inputIterator = mapIterHbC->second.begin();
54 while( inputIterator != mapIterHbC->second.end() )
56 std::vector< Ref_Phase2TrackerDigi_ >
temp;
57 temp.push_back(*inputIterator);
58 inputIterator = mapIterHbC->second.erase(inputIterator);
59 typename std::vector< Ref_Phase2TrackerDigi_ >::iterator inputIterator2;
60 inputIterator2 = inputIterator;
63 while( inputIterator2 != mapIterHbC->second.end() )
66 if( (temp.back()->column() == (**inputIterator2).column()) &&
67 ((**inputIterator2).row() - temp.back()->row() == 1) )
69 temp.push_back(*inputIterator2);
70 inputIterator2 = mapIterHbC->second.erase(inputIterator2);
78 std::sort( temp.begin(), temp.end(), CompareClusters );
81 map1DCluByColRow.insert( std::make_pair( std::make_pair( mapIterHbC->first, temp.at(0)->row() ), temp ) );
83 inputIterator = inputIterator2;
92 typename std::map< std::pair< unsigned int, unsigned int>, std::vector< Ref_Phase2TrackerDigi_ > >::iterator mapIter1DCbCR0;
93 typename std::map< std::pair< unsigned int, unsigned int>, std::vector< Ref_Phase2TrackerDigi_ > >::iterator mapIter1DCbCR1;
94 mapIter1DCbCR0 = map1DCluByColRow.begin();
95 unsigned int lastCol = mapIter1DCbCR0->first.first;
97 while ( mapIter1DCbCR0 != map1DCluByColRow.end() )
100 std::vector< Ref_Phase2TrackerDigi_ > candCluster;
101 candCluster.insert( candCluster.end(), mapIter1DCbCR0->second.begin(), mapIter1DCbCR0->second.end() );
106 mapIter1DCbCR1 = map1DCluByColRow.begin();
108 while ( mapIter1DCbCR1 != map1DCluByColRow.end() )
111 if ( mapIter1DCbCR1 == mapIter1DCbCR0 )
118 if (
std::abs( (
int)(mapIter1DCbCR1->first.first) - (
int)lastCol ) != 1 )
127 lastCol = mapIter1DCbCR1->first.first;
131 unsigned int iRow0 = mapIter1DCbCR0->first.second;
132 unsigned int iRow1 = mapIter1DCbCR1->first.second;
135 unsigned int jRow0 = mapIter1DCbCR0->second.back()->row();
136 unsigned int jRow1 = mapIter1DCbCR1->second.back()->row();
139 if ( ( iRow1 >= iRow0 && iRow1 <= jRow0 ) ||
140 ( jRow1 >= iRow0 && jRow1 <= jRow0 ) )
143 candCluster.insert( candCluster.end(), mapIter1DCbCR1->second.begin(), mapIter1DCbCR1->second.end() );
144 map1DCluByColRow.erase( mapIter1DCbCR1++ );
152 map1DCluByColRow.erase( mapIter1DCbCR0++ );
156 std::sort( candCluster.begin(), candCluster.end(), CompareClusters );
164 if (
std::abs( static_cast<int>(candCluster.at(0)->row() - candCluster.back()->row()) ) < mWidthCut ||
167 output.push_back( candCluster );
172 map1DCluByColRow.erase( mapIter1DCbCR0++ );
176 std::sort( candCluster.begin(), candCluster.end(), CompareClusters );
178 if (
std::abs( static_cast<int>(candCluster.at(0)->row() - candCluster.back()->row()) ) < mWidthCut ||
181 output.push_back( candCluster );
static bool CompareClusters(const T &a, const T &b)
Cluster max width.
static std::string const input
Abs< T >::type abs(const T &t)
void Cluster(std::vector< std::vector< T > > &output, const std::vector< T > &input, bool isPS) const
Clustering operations.