| Line | |
|---|
| 1 | #include "MStarList.h"
|
|---|
| 2 |
|
|---|
| 3 | void MStarList::RemoveTwins(Double_t radius)
|
|---|
| 4 | {
|
|---|
| 5 | MStarList stars;
|
|---|
| 6 |
|
|---|
| 7 | Int_t numfirst=0;
|
|---|
| 8 |
|
|---|
| 9 | while (1)
|
|---|
| 10 | {
|
|---|
| 11 | int idx;
|
|---|
| 12 | MStar *first=NULL;
|
|---|
| 13 | for (idx=numfirst; idx<GetMax(); idx++)
|
|---|
| 14 | if ((first = (*this)[idx]))
|
|---|
| 15 | break;
|
|---|
| 16 |
|
|---|
| 17 | if (!first)
|
|---|
| 18 | return;
|
|---|
| 19 |
|
|---|
| 20 | MStarListIter Next(this, *first, radius);
|
|---|
| 21 | Delete(idx);
|
|---|
| 22 |
|
|---|
| 23 | MStar *pos;
|
|---|
| 24 | Float_t mx=0;
|
|---|
| 25 | Float_t my=0;
|
|---|
| 26 | Int_t cnt=0;
|
|---|
| 27 | while ((pos=Next()))
|
|---|
| 28 | {
|
|---|
| 29 | mx += pos->GetX();
|
|---|
| 30 | my += pos->GetY();
|
|---|
| 31 | Delete(pos);
|
|---|
| 32 | cnt++;
|
|---|
| 33 | }
|
|---|
| 34 | mx /= cnt;
|
|---|
| 35 | my /= cnt;
|
|---|
| 36 |
|
|---|
| 37 | AddAt(idx, mx, my, cnt);
|
|---|
| 38 | numfirst = idx+1;
|
|---|
| 39 | }
|
|---|
| 40 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.