12#include "MucCalib/MucMark.h"
13#include "MucCalib/MucStructConst.h"
30 if (
this == &other )
return true;
32 if ( ( *this ).Part() == other.Part() && ( *this ).Segment() == other.Segment() &&
33 ( *this ).Layer() == other.Layer() && ( *this ).Strip() == other.Strip() )
40 if ( part > PART_MAX || part < 0 )
42 cout <<
"part overflow:\t" << part << endl;
53 if ( segment > ( ( m_Part == BRID ) ? B_SEG_NUM : E_SEG_NUM ) || segment < 0 )
55 cout <<
"segment overflow:\t" << segment << endl;
66 if ( layer > ( ( m_Part == BRID ) ? B_LAY_NUM : E_LAY_NUM ) || layer < 0 )
68 cout <<
"layer overflow:\t" << layer << endl;
79 if ( strip > STRIP_INBOX_MAX || strip < 0 )
81 cout <<
"strip overflow:\t" << strip << endl;
99 for (
unsigned int i = 0; i < aCol.size(); i++ )
101 if ( part == aCol[i]->
Part() && segment == aCol[i]->
Segment() &&
102 layer == aCol[i]->
Layer() && strip == aCol[i]->
Strip() )
110 for (
unsigned int i = 0; i < aCol.size(); i++ )
112 if ( ( *
this ) == ( *aCol[i] ) )
return i;
119 for (
unsigned int i = 0; i < aClusterCol.size(); i++ )
121 if ( ( *this ).IsInCol( aClusterCol[i] ) )
return i;
131 for (
unsigned int i = 0; i < aCol.size(); i++ )
133 if ( ( *
this ) == ( *aCol[i] ) )
num++;
141 if ( ( *this ).Part() == other.Part() && ( *this ).Segment() == other.Segment() )
148 if ( ( *this ).Part() == other.Part() && ( *this ).Segment() == other.Segment() &&
149 ( *this ).Layer() == other.Layer() )
156 if ( ( *this ).Part() == other.Part() && ( *this ).Segment() == other.Segment() &&
157 ( *this ).Layer() == other.Layer() && fabs( ( *this ).Strip() - other.Strip() ) == 1 )
164 for (
unsigned int i = 0; i < aCluster.size(); i++ )
166 if ( ( *this ).IsNeighborWith( ( *aCluster[i] ) ) )
return true;
174 vector<mark_col> aClusterCol;
178 unsigned int circle = 0;
180 for (
unsigned int i = 0; i < aMarkCol.size(); i++ )
183 for (
unsigned int j = 0; j < aClusterCol.size(); j++ )
185 if ( ( *aMarkCol[i] ).
IsInCol( aClusterCol[j] ) != -1 )
192 aClusterCol[j].push_back( aMarkCol[i] );
198 if ( recordFlag == 0 )
201 aCluster.push_back( aMarkCol[i] );
202 aClusterCol.push_back( aCluster );
207 for (
unsigned int j = i + 1; j < aMarkCol.size(); j++ )
209 if ( ( *aMarkCol[j] ).
IsInCol( aClusterCol.back() ) != -1 )
continue;
211 aClusterCol.back().push_back( aMarkCol[j] );
213 }
while ( circle < aMarkCol.size() - i - 1 );
221 vector<mark_col> aClusterCol;
224 unsigned int circle = 0;
225 for (
unsigned int i = 0; i < aMarkCol.size(); i++ )
227 if ( ( *aMarkCol[i] ).
IsInCol( checkedMarkCol ) != -1 )
continue;
230 aCluster.push_back( aMarkCol[i] );
231 aClusterCol.push_back( aCluster );
232 checkedMarkCol.push_back( aMarkCol[i] );
236 for (
unsigned int j = i + 1; j < aMarkCol.size(); j++ )
238 if ( ( *aMarkCol[j] ).
IsInCol( checkedMarkCol ) != -1 )
continue;
241 aClusterCol.back().push_back( aMarkCol[j] );
242 checkedMarkCol.push_back( aMarkCol[j] );
246 }
while ( circle < aMarkCol.size() - i - 1 );
254 vector<mark_col> aClusterCol;
256 copyMarkCol = aMarkCol;
258 mark_col::iterator it1;
259 while ( copyMarkCol.size() != 0 )
261 it1 = copyMarkCol.begin();
263 aCluster.push_back( copyMarkCol[0] );
264 aClusterCol.push_back( aCluster );
266 copyMarkCol.erase( it1 );
267 unsigned int circle = 0;
268 unsigned int size = 0;
269 unsigned int beginsize = copyMarkCol.size();
270 while ( circle < beginsize )
272 mark_col::iterator it2;
273 size = copyMarkCol.size();
274 for (
unsigned int j = 0, headNum = 0; j < size; j++ )
276 it2 = copyMarkCol.begin() + headNum;
277 if ( ( copyMarkCol[headNum] )->
IsNeighborWith( aClusterCol.back() ) )
279 aClusterCol.back().push_back( ( copyMarkCol[headNum] ) );
280 copyMarkCol.erase( it2 );
294 vector<mark_col> aClusterCol;
296 bool recordFlag =
false;
297 unsigned int circle = 0;
299 for (
unsigned int i = 0; i < aMarkCol.size(); i++ )
302 for (
int j = aClusterCol.size() - 1; j > -1; j-- )
304 if ( ( *aMarkCol[i] ).
IsInCol( aClusterCol[j] ) != -1 )
311 aClusterCol[j].push_back( aMarkCol[i] );
317 if ( recordFlag ==
false )
320 aCluster.push_back( aMarkCol[i] );
321 aClusterCol.push_back( aCluster );
326 for (
unsigned int j = i + 1; j < aMarkCol.size(); j++ )
328 if ( ( *aMarkCol[j] ).
IsInCol( aClusterCol.back() ) != -1 )
continue;
330 aClusterCol.back().push_back( aMarkCol[j] );
332 }
while ( circle < aMarkCol.size() - i - 1 );
340 vector<mark_col> aClusterCol;
347 default:
return ( aClusterCol );
353 cout <<
"prt: " << m_Part <<
"\tseg: " << m_Segment <<
"\tlay: " << m_Layer
354 <<
"\tstr: " << m_Strip << endl;
358 for (
unsigned int i = 0; i < aMarkCol.size(); i++ ) aMarkCol[i]->
Print();
362 for (
unsigned int i = 0; i < aClusterCol.size(); i++ )
363 for (
unsigned int j = 0; j < aClusterCol[i].size(); j++ ) { aClusterCol[i][j]->Print(); }
vector< MucMark * > mark_col
bool IsInBoxWith(MucMark &other)
vector< mark_col > CreateClusterCol_A(mark_col &aMarkCol)
int NumInCol(mark_col &aCol)
bool IsNeighborWith(MucMark &other)
bool IsInSegWith(MucMark &other)
vector< mark_col > CreateClusterCol_C(mark_col &aMarkCol)
bool SetSegment(int segment)
vector< mark_col > CreateClusterCol(int buildMode, mark_col &aMarkCol)
bool operator==(MucMark &other)
vector< mark_col > CreateClusterCol_D(mark_col &aMarkCol)
vector< mark_col > CreateClusterCol_B(mark_col &aMarkCol)
int IsInCol(int part, int segment, int layer, int strip, mark_col &aCol)