Index: /trunk/MagicSoft/Cosy/Changelog
===================================================================
--- /trunk/MagicSoft/Cosy/Changelog	(revision 7793)
+++ /trunk/MagicSoft/Cosy/Changelog	(revision 7794)
@@ -1,3 +1,38 @@
                                                                   -*-*- END -*-*-
+
+ 2006/07/16 Thomas Bretz
+
+   * leds.txt:
+     - new values
+
+   * gui/MGCoordinate.cc:
+     - increased size of output text to display sign
+
+   * gui/MGCosy.cc:
+     - named MACS correctly MACS
+
+   * gui/MGNumStars.cc:
+     - changed color for correlated stars from magenta to cyan
+
+   * main/MStarguider.cc:
+     - changed starguider angle to -0.2
+     - changed pixsize to 48.9
+     - update num stars only if starguider is switched on
+     - removed bug which caused the rotation angle in fact to
+       be always 0
+     - reimplemented the algorithm which only takes the n-th brightest
+       stars from the catalog if n is the number of detected stars
+       (otherwise the catalog might be so crowded with stars that
+        one spot is correlated with many catalog stars)
+     - decreased the search region for the LEDs
+     - some things are not done anymore if not necesarry
+
+   * videodev/FilterLed.[h,cc]:
+     - cleaned up
+     - changed the interface of the ClusterFinder slightly to
+       allow it beeing used for the TPoint spot of the star
+
+
+
  2006/07/16 Daniela Dorner
 
Index: /trunk/MagicSoft/Cosy/gui/MGCoordinate.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGCoordinate.cc	(revision 7793)
+++ /trunk/MagicSoft/Cosy/gui/MGCoordinate.cc	(revision 7794)
@@ -60,7 +60,7 @@
     const int ypos = (flag==1?56:26)-offset;
 
-    fLabelDeg = new TGLabel(this, "****");
-    fLabelMin = new TGLabel(this, "***");
-    fLabelSec = new TGLabel(this, "***");
+    fLabelDeg = new TGLabel(this, "*****");
+    fLabelMin = new TGLabel(this, "****");
+    fLabelSec = new TGLabel(this, "****");
     fLabelDeg->SetTextJustify(kTextRight);
     fLabelMin->SetTextJustify(kTextRight);
Index: /trunk/MagicSoft/Cosy/gui/MGCosy.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 7793)
+++ /trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 7794)
@@ -253,6 +253,6 @@
     fStopping  = new TGLabel(f, "Stopping");
     fStopped   = new TGLabel(f, "Stopped");
-    fAvailMac1 = new TGLabel(f, "- MAC1 -");
-    fAvailMac2 = new TGLabel(f, "- MAC2 -");
+    fAvailMac1 = new TGLabel(f, "- MACS1 -");
+    fAvailMac2 = new TGLabel(f, "- MACS2 -");
     //fAvailMac3 = new TGLabel(f, "- MAC3 -");
     fAvailSe1  = new TGLabel(f, "-SE/Zd1-");
@@ -281,16 +281,16 @@
     fStopped->SetBackgroundColor(color);
 
-    fArmed   ->MoveResize(10,  25,        60, 20);
-    fError   ->MoveResize(10,  25+25,     60, 20);
-    fMoving  ->MoveResize(10,  25+25+20,  60, 20);
-    fTracking->MoveResize(10,  25+25+40,  60, 20);
-    fStopping->MoveResize(10,  25+25+60,  60, 20);
-    fStopped ->MoveResize(10,  25+25+80,  60, 20);
-    fAvailMac1->MoveResize(10, 25+25+120, 60, 20);
-    fAvailMac2->MoveResize(10, 25+25+140, 60, 20);
+    fArmed   ->MoveResize(10,  25,        70, 20);
+    fError   ->MoveResize(10,  25+25,     70, 20);
+    fMoving  ->MoveResize(10,  25+25+20,  70, 20);
+    fTracking->MoveResize(10,  25+25+40,  70, 20);
+    fStopping->MoveResize(10,  25+25+60,  70, 20);
+    fStopped ->MoveResize(10,  25+25+80,  70, 20);
+    fAvailMac1->MoveResize(10, 25+25+120, 70, 20);
+    fAvailMac2->MoveResize(10, 25+25+140, 70, 20);
     //fAvailMac3->Move(10, 25+160);
-    fAvailSe1->MoveResize(10,  25+25+200, 60, 20);
-    fAvailSe2->MoveResize(10,  25+25+220, 60, 20);
-    fAvailSe3->MoveResize(10,  25+25+180, 60, 20);
+    fAvailSe1->MoveResize(10,  25+25+200, 70, 20);
+    fAvailSe2->MoveResize(10,  25+25+220, 70, 20);
+    fAvailSe3->MoveResize(10,  25+25+180, 70, 20);
 
     fList->Add(fArmed);
Index: /trunk/MagicSoft/Cosy/gui/MGNumStars.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGNumStars.cc	(revision 7793)
+++ /trunk/MagicSoft/Cosy/gui/MGNumStars.cc	(revision 7794)
@@ -89,5 +89,5 @@
 
     InitGraph(fGraph1, kBlue);
-    InitGraph(fGraph2, kMagenta);
+    InitGraph(fGraph2, kCyan);
 
     InitText();
Index: /trunk/MagicSoft/Cosy/main/MStarguider.cc
===================================================================
--- /trunk/MagicSoft/Cosy/main/MStarguider.cc	(revision 7793)
+++ /trunk/MagicSoft/Cosy/main/MStarguider.cc	(revision 7794)
@@ -130,5 +130,6 @@
 
     fGStarg->Update(fPos, fD);   
-    fGNumStars->Update(fNumStarsDetected, fNumStarsCorrelated);
+    if (fDisplay->IsEntryChecked(IDM_kStarguider))
+        fGNumStars->Update(fNumStarsDetected, fNumStarsCorrelated);
  
     return kTRUE;
@@ -445,5 +446,5 @@
 
     // Set input box for rotation angle
-    const Double_t angle = -0.4;
+    const Double_t angle = -0.2;
     fSao->SetRotationAngle(angle);
     
@@ -458,8 +459,7 @@
 
     // Set input box for pixel size
-    const Double_t pixsize = 48.8; // used to be 23.4
+    const Double_t pixsize = 48.9; // used to be 23.4
 
     fSao->SetPixSize(pixsize);
-    fSao->SetRotationAngle(0);
 
     txt = "";
@@ -519,4 +519,5 @@
     fCRaDec->UnmapWindow();
     fCZdAz->UnmapWindow();
+    fCZdAzText->UnmapWindow();
     fPZdAz->UnmapWindow();
     fPZdAzText->UnmapWindow();
@@ -723,5 +724,4 @@
         fDisplay->CheckEntry(IDM_kCatalog);
         fCRaDec->MapWindow();
-        fCRaDecText-MapWindow();
         fCZdAz->MapWindow();
         fCZdAzText->MapWindow();
@@ -771,5 +771,4 @@
         //catalog
         fCRaDec->UnmapWindow();
-        fCRaDecText-UnmapWindow();
         fCZdAz->UnmapWindow();
         fCZdAzText->UnmapWindow();
@@ -1408,4 +1407,5 @@
 {
     num = leds.GetEntries();
+    //cout << "Num: " << num << endl;
     if (num < 3) //was 1
     {
@@ -1416,4 +1416,5 @@
     }
 
+    //cout << "Cat: " << stars.GetRealEntries() << endl;
     if (stars.GetRealEntries() < 3)
     {
@@ -1437,8 +1438,9 @@
 
     // FIXME: Is predefined value 3 a good idea?
+    Int_t cnt=0;
 
     MStar *star;
     MStarListIter NextStar(&stars);
-    while ((star=NextStar()))
+    while ((star=NextStar()) && cnt<num+5)
     {
         TIter NextSp(&leds);
@@ -1457,5 +1459,6 @@
             x.AddAt(dpos.X(), idx);
             y.AddAt(dpos.Y(), idx);
-            mag.AddAt(spot->GetMag()/star->GetMag(), idx);
+            mag.AddAt(log(spot->GetMag())/star->GetMag(), idx);
+
 #ifdef EXPERT
             if (fout)
@@ -1463,5 +1466,5 @@
                 fout << spot->GetX() << " "
                     << spot->GetY()  << " "
-                    << spot->GetMag()  << " "
+                    << -2.5*log(spot->GetMag())  << " "
                     << star->GetX() << " "
                     << star->GetY()  << " "
@@ -1471,4 +1474,5 @@
 #endif
         }
+        cnt++;
     }
 
@@ -1477,4 +1481,6 @@
     if (numcor<1)
         return 0;
+
+    //cout << "Cor: " << numcor << endl;
 
     fDZdAz->SetCoordinates(d);
@@ -1829,5 +1835,5 @@
         if (fCosy)
             pos = fCosy->GetPointingPos();
-        center = fCaos->Run(img, printl, printr, pos, t, 50, 3.0);
+        center = fCaos->Run(img, printl, printr, pos, t, 19, 3.0);
 	cout << "Caos Filter Camera center position: " << center.GetX() << " " << center.GetY() << endl;
 
@@ -1835,5 +1841,6 @@
 
     // Find Star at Center---for Tpoint Procedure
-    if (fDisplay->IsEntryChecked(IDM_kFindStar))
+    if (fDisplay->IsEntryChecked(IDM_kFindStar) &&
+        center.GetX()>0 && center.GetY()>0)
     {
         // SCALE FACTOR ASSUMED TO BE 70
@@ -1888,5 +1895,6 @@
 	     << sgcenter.GetY()-293.6<< "pix" << endl; 	
 #endif
-        if (fDisplay->IsEntryChecked(IDM_kStargFindStar))
+        if (fDisplay->IsEntryChecked(IDM_kStargFindStar) &&
+            sgcenter.GetX()>0 && sgcenter.GetY()>0)
         {
             star = FindStar(f, f2, sgcenter, t, 4.5, 30, 267/161.9); // [deg]
@@ -1972,11 +1980,11 @@
         MTime time(*tm);
 
-	XY xy = fCRaDec->GetCoordinates();
-	fRaDec->Set(xy.X()*360/24, xy.Y());
+	XY xy = fCRaDec->GetCoordinates();  //[h,  deg]
+	fRaDec->Set(xy.X()*360/24, xy.Y()); //[deg,deg]
 
 	UpdatePosZoom();
 
 	// Always call SetMjd first!
-  	fSao->SetPointing(time.GetMjd(), *fRaDec);
+        fSao->SetPointing(time.GetMjd(), *fRaDec);
   	fCZdAz->SetCoordinates(fSao->GetZdAz());
 
@@ -2048,5 +2056,5 @@
             const Int_t rc = CalcTrackingError(spots, stars, fD, t, bright, numstars);
 
-            const Bool_t monitoring = brightnessisvalid && centerisvalid;
+            const Bool_t monitoring = brightnessisvalid && centerisvalid && fNumStarsCorrelated>2;
 
             fStatus = monitoring ? MDriveCom::kMonitoring : MDriveCom::kError;
@@ -2082,11 +2090,4 @@
             f2.DrawHexagon(skycenter, 2.06/ap, 0x0a);
             f2.DrawHexagon(skycenter, 3.50/ap, 0x0a);
-
-            /*
-             f2.DrawCircle(skycenter, 2.06*.5*74.0, 0x0a);
-             f2.DrawCircle(skycenter, 2.32*.5*74.0, 0x0a);
-             f2.DrawCircle(skycenter, 3.50*.5*74.0, 0x0a);
-             f2.DrawCircle(skycenter, 3.84*.5*74.0, 0x0a);
-             */
         }
 
@@ -2094,5 +2095,6 @@
 
     // Draw Circles around center of Camera
-    if (fDisplay->IsEntryChecked(IDM_kCaosFilter))
+    if (fDisplay->IsEntryChecked(IDM_kCaosFilter) &&
+        center.GetX()>0 && center.GetY()>0)
     {
         f2.DrawCircle(center, 0x0a);
@@ -2104,5 +2106,6 @@
     }
 
-    if (fDisplay->IsEntryChecked(IDM_kStargCaosFilter))
+    if (fDisplay->IsEntryChecked(IDM_kStargCaosFilter) &&
+        sgcenter.GetX()>0 && sgcenter.GetY()>0)
     {
         f2.DrawCircle(sgcenter, 0x0a);
@@ -2110,13 +2113,4 @@
                       fDisplay->IsEntryChecked(IDM_kFindStar)?3:0xb0);
     }
-
-//      if (fDisplay->IsEntryChecked(IDM_kCatalog))
-//      {
-//          fSao->PaintImg(cimg, 768, 576);
-//          const float r = 60*60/fSao->GetPixSize();
-//  	f2.DrawCircle(0.5*r, 0x0a);
-//  	f2.DrawCircle(1.0*r, 0x0a);
-//  	f2.DrawCircle(1.5*r, 0x0a);
-//      }
 
     if (fDisplay->IsEntryChecked(IDM_kCaosFilter) ||
Index: /trunk/MagicSoft/Cosy/videodev/FilterLed.cc
===================================================================
--- /trunk/MagicSoft/Cosy/videodev/FilterLed.cc	(revision 7793)
+++ /trunk/MagicSoft/Cosy/videodev/FilterLed.cc	(revision 7794)
@@ -11,4 +11,137 @@
 
 ClassImp(FilterLed);
+
+class ClusterFinder
+{
+private:
+    byte *fImg;
+
+    UInt_t fW;
+    UInt_t fH;
+
+    Int_t fX0;
+    Int_t fX1;
+
+    Int_t fY0;
+    Int_t fY1;
+
+    UInt_t fLimitingSize;
+
+    UInt_t fCount;
+    Float_t fSumX;
+    Float_t fSumY;
+
+    Float_t FindCluster(Int_t x, Int_t y)
+    {
+        // if edge is touched stop finding cluster
+        if (x<fX0 || x>=fX1 || y<fY0 || y>=fY1)
+            return -1;
+
+        if (fCount>fLimitingSize)
+            return -2;
+
+        // get the value
+        Float_t val = fImg[y*fW+x];
+
+        // if its empty we have found the border of the cluster
+        if (val==0)
+            return 0;
+
+        // mark the point as processed
+        fImg[y*fW+x] = 0;
+
+        fSumX += x*val; // sumx
+        fSumY += y*val; // sumy
+        fCount++;
+
+        Float_t rc[4];
+        rc[0] = FindCluster(x+1, y  );
+        rc[1] = FindCluster(x,   y+1);
+        rc[2] = FindCluster(x-1, y  );
+        rc[3] = FindCluster(x,   y-1);
+
+        for (int i=0; i<4; i++)
+        {
+            if (rc[i]<0) // check if edge is touched
+                return rc[i];
+
+            val += rc[i];
+        }
+
+        return val;
+    }
+
+public:
+    ClusterFinder(byte *img, UInt_t w, UInt_t h) : fLimitingSize(999)
+    {
+        fW = w;
+        fH = h;
+
+        fX0 = 0;
+        fY0 = 0;
+        fX1 = fW;
+        fY1 = fH;
+
+        fImg = new byte[fW*fH];
+
+        memcpy(fImg, img, fW*fH);
+    }
+
+    ~ClusterFinder()
+    {
+        delete fImg;
+    }
+    Double_t GetSumX() const { return fSumX; }
+    Double_t GetSumY() const { return fSumY; }
+
+    UInt_t GetCount() const { return fCount; }
+
+    void SetLimitingSize(UInt_t lim) { fLimitingSize=lim; }
+
+    Float_t FindClusterAt(Int_t x, Int_t y)
+    {
+        fCount = 0;
+        fSumX  = 0;
+        fSumY  = 0;
+
+        return FindCluster(x, y);
+    }
+
+    void SetRange(Int_t x0=0, Int_t y0=0, Int_t x1=0, Int_t y1=0)
+    {
+        fX0 = x0;
+        fY0 = y0;
+        fX1 = x1==0?fW:x1;
+        fY1 = y1==0?fH:y1;
+    }
+
+    void FindCluster(Leds &leds, Int_t x0=0, Int_t y0=0, Int_t x1=0, Int_t y1=0)
+    {
+        fX0 = x0;
+        fY0 = y0;
+        fX1 = x1==0?fW:x1;
+        fY1 = y1==0?fH:y1;
+
+        for (Int_t x=fX0; x<fX1; x++)
+            for (Int_t y=fY0; y<fY1; y++)
+            {
+                const byte &b = fImg[y*fW+x];
+                if (b==0)
+                    continue;
+
+                const Float_t mag = FindClusterAt(x, y);
+                if (fCount>999)
+                {
+                    cout << "ERROR - Spot with Size>999 detected..." << endl;
+                    return;
+                }
+
+                if (mag>0 && fCount>6)
+                    leds.Add(fSumX/mag, fSumY/mag, 0, 0, mag);
+            }
+        leds.Compress();
+    }
+};
+
 
 void FilterLed::DrawBox(const int x1, const int y1,
@@ -33,9 +166,19 @@
 void FilterLed::MarkPoint(const Led &led) const
 {
+    /*
+    Int_t M = (int)(log(led.GetMag())*20);
+
+    cout << led.GetMag() << endl;
+
+    if (M>0xff)
+        M=0xff;
+    if (M<0xc0)
+        M=0xc0;
+        */
+
     const int x = (int)(led.GetX()+.5);
     const int y = (int)(led.GetY()+.5);
-    const int m = (int)(led.GetMag());
-
-    MarkPoint(x, y, m);
+
+    MarkPoint(x, y, 0xff);
 }
 
@@ -164,5 +307,5 @@
             maxx=dx;
             maxy=dy;
-            max =sum;
+            max =sumloc;
 	}
     }
@@ -170,28 +313,14 @@
     // 2. Calculate mean position inside a circle around
     // the highst cross-signal with radius of 6 pixels.
-    unsigned int sumx=0;
-    unsigned int sumy=0;
-
-    const int rad = 17;
-
-    x0 = TMath::Max(x-box,   maxx-rad);
-    y0 = TMath::Max(y-box,   maxy-rad);
-
-    x1 = TMath::Min(x+box+1, maxx+rad+1);
-    y1 = TMath::Min(y+box+1, maxy+rad+1);
-
-    sum=0;
-    for (int dx=x0; dx<x1; dx++)
-        for (int dy=y0; dy<y1; dy++)
-        {
-            const byte &m = fImg[dy*fW+dx];
-
-            sumx += m*dx;
-            sumy += m*dy;
-            sum  += m;
-        }
-
-    mx = (float)sumx/sum;
-    my = (float)sumy/sum;
+    ClusterFinder find(fImg, fW, fH);
+    find.SetLimitingSize(9999);
+    find.SetRange(x0, y0, x1, y1);
+
+    const Float_t mag = find.FindClusterAt(maxx, maxy);
+
+    mx = find.GetSumX()/mag;
+    my = find.GetSumY()/mag;
+
+    sum = (int)(mag+0.5);
 
     return (int)my*fW + (int)mx;
@@ -204,107 +333,4 @@
     unsigned int sum;
     return GetMeanPositionBox(x, y, box, mx, my, sum);
-}
-
-
-/*
-void FilterLed::RemoveTwins(Leds &leds, Double_t radius)
-{
-    for (int i=first; i<leds.GetEntriesFast(); i++)
-    {
-        const Led &led1 = leds(i);
-
-        const Double_t x1 = led1.GetX();
-        const Double_t y1 = led1.GetY();
-
-        for (int j=first; j<leds.GetEntriesFast(); j++)
-        {
-            if (j==i)
-                continuel
-
-            const Led &led2 = leds(j);
-
-            const Double_t x2 = led2.GetX();
-            const Double_t y2 = led2.GetY();
-
-            const Double_t dx = x2-x1;
-            const Double_t dy = y2-y1;
-
-            if (dx*dx+dy*dy<radius*radius)
-            {
-                // FIXME: Interpolation
-                leds.Remove(led2);
-            }
-        }
-    }
-}
-*/
-void FilterLed::RemoveTwinsInterpol(Leds &leds, Int_t first, Double_t radius) const
-{
-    const Int_t num=leds.GetEntriesFast();
-
-    for (int i=first; i<num; i++)
-    {
-        Led *led1 = (Led*)leds.UncheckedAt(i);
-        if (!led1)
-            continue;
-
-        const Double_t x1 = led1->GetX();
-        const Double_t y1 = led1->GetY();
-
-        Double_t mag = led1->GetMag();
-        Double_t x = x1*mag;
-        Double_t y = y1*mag;
-
-        Double_t sqm = mag*mag;
-        Double_t sqx = x*x;
-        Double_t sqy = y*y;
-
-        Int_t n=1;
-
-        for (int j=first; j<num; j++)
-        {
-            if (i==j)
-                continue;
-
-            Led *led2 = (Led*)leds.UncheckedAt(j);
-            if (!led2)
-                continue;
-
-            Double_t x2 = led2->GetX();
-            Double_t y2 = led2->GetY();
-
-            const Double_t dx = x2-x1;
-            const Double_t dy = y2-y1;
-
-            if (dx*dx+dy*dy>radius*radius)
-                continue;
-
-            // Multiply with weihgt
-            const Double_t w = led2->GetMag();
-            x2 *= w;
-            y2 *= w;
-
-            x   += x2;
-            y   += y2;
-            mag += w;
-
-            sqx += x2*x2;
-            sqy += y2*y2;
-            sqm += w*w;
-
-            n++;
-            leds.Remove(led2);
-        }
-
-        x /= mag;
-        y /= mag;
-
-        sqx /= sqm;
-        sqy /= sqm;
-
-        leds.Add(x, y, 0/*sqrt(sqx-x*x)*/, 0/*sqrt(sqy-y*y)*/, mag/n);
-        leds.Remove(led1);
-    }
-    leds.Compress();
 }
 
@@ -344,114 +370,4 @@
 }
 
-class ClusterFinder
-{
-private:
-    byte *fImg;
-
-    UInt_t fW;
-    UInt_t fH;
-
-    Int_t fX0;
-    Int_t fX1;
-
-    Int_t fY0;
-    Int_t fY1;
-
-    UInt_t fCount;
-    Float_t fSumX;
-    Float_t fSumY;
-
-    Float_t FindCluster(Int_t x, Int_t y)
-    {
-        // if edge is touched stop finding cluster
-        if (x<fX0 || x>=fX1 || y<fY0 || y>=fY1)
-            return -1;
-
-        if (fCount>999)
-            return -1;
-
-        // get the value
-        Float_t val = fImg[y*fW+x];
-
-        // if its empty we have found the border of the cluster
-        if (val==0)
-            return 0;
-
-        // mark the point as processed
-        fImg[y*fW+x] = 0;
-
-        fSumX += x*val; // sumx
-        fSumY += y*val; // sumy
-        fCount++;
-
-        Float_t rc[4];
-        rc[0] = FindCluster(x+1, y  );
-        rc[1] = FindCluster(x,   y+1);
-        rc[2] = FindCluster(x-1, y  );
-        rc[3] = FindCluster(x,   y-1);
-
-        for (int i=0; i<4; i++)
-        {
-            if (rc[i]<0) // check if edge is touched
-                return -1;
-
-            val += rc[i];
-        }
-
-        return val;
-    }
-public:
-    ClusterFinder(byte *img, UInt_t w, UInt_t h)
-    {
-        fW = w;
-        fH = h;
-
-        fImg = new byte[fW*fH];
-
-        memcpy(fImg, img, fW*fH);
-    }
-
-    ~ClusterFinder()
-    {
-        delete fImg;
-    }
-    void FindCluster(Leds &leds, Int_t x0=0, Int_t y0=0, Int_t x1=0, Int_t y1=0)
-    {
-        fX0 = x0;
-        fY0 = y0;
-        fX1 = x1==0?fW:x1;
-        fY1 = y1==0?fH:y1;
-
-        for (Int_t x=fX0; x<fX1; x++)
-            for (Int_t y=fY0; y<fY1; y++)
-            {
-                const byte &b = fImg[y*fW+x];
-                if (b==0)
-                    continue;
-
-                fCount = 0;
-                fSumX  = 0;
-                fSumY  = 0;
-
-                const Float_t mag = FindCluster(x, y);
-                if (fCount>999)
-                {
-                    cout << "ERROR - Spot with Size>999 detected..." << endl;
-                    return;
-                }
-
-                if (mag>0 && fCount>6)
-                {
-                    Float_t M = mag/0xff;
-                    if (M>0xf0)
-                        M=0xf0;
-
-                    leds.Add(fSumX/mag, fSumY/mag, 0, 0, 0xf0);
-                }
-            }
-        leds.Compress();
-    }
-};
-
 void FilterLed::Execute(Leds &leds, int xc, int yc, double &bright) const
 {
@@ -506,113 +422,4 @@
 }
 
-/*
-void FilterLed::Execute(Leds &leds, int xc, int yc, double &bright) const
-{
-    const int x0 = TMath::Max(xc-fBox, 0);
-    const int y0 = TMath::Max(yc-fBox, 0);
-    const int x1 = TMath::Min(xc+fBox, fW);
-    const int y1 = TMath::Min(yc+fBox, fH);
-
-    const int wx = x1-x0;
-    const int hy = y1-y0;
-
-    double sum = 0;
-    double sq  = 0;
-
-    for (int x=x0; x<x1; x++)
-        for (int y=y0; y<y1; y++)
-        {
-            byte &b = fImg[y*fW+x];
-
-            sum += b;
-            sq  += b*b;
-        }
-
-    sum /= wx*hy;
-    sq  /= wx*hy;
-
-    bright=sum;
-
-    
-    // 254 because b<=max and not b<max
-    const double sdev = sqrt(sq-sum*sum);
-    const byte   max  = sum+fCut*sdev>254 ? 254 : (byte)(sum+fCut*sdev);
-
-    //
-    // clean image from noise
-    // (FIXME: A lookup table could accelerate things...
-    //
-    for (int x=x0; x<x1; x++)
-        for (int y=y0; y<y1; y++)
-        {
-            byte &b = fImg[y*fW+x];
-            if (b<=max)
-                b = 0;
-        }
-
-    //
-    // find mean points
-    //
-    const int maxpnt = wx*hy>0x4000?0x4000:wx*hy;
-
-    int  pos[maxpnt]; // (Use 'new' instead for big numbers!)
-    byte mag[maxpnt]; // (Use 'new' instead for big numbers!)
-
-    const int r = 5;
-
-    int cnt = 0;
-    for (int x=x0+r; x<x1-r; x++)
-        for (int y=y0+r; y<y1-r; y++)
-        {
-            byte &b = fImg[y*fW+x];
-            if (b==0)
-                continue;
-
-            const int ipos = GetMeanPosition(x, y, r);
-
-            int j;
-            for (j=0; j<cnt; j++)
-            {
-                if (pos[j]==ipos)
-                {
-                    if (mag[j]<0xff)
-                        mag[j]++;  // how often found (area)
-                    break;
-                }
-            }
-            if (cnt && j<cnt)
-                continue;
-
-            pos[cnt] = ipos;
-            mag[cnt] = 1;
-
-            cnt++;
-            if (cnt==0x4000)
-                return;
-        }
-
-    if (cnt>1000)
-        cout << "FIXME: Cnt>1000." << endl;
-
-    //
-    // Add found positions to array
-    //
-    const int first=leds.GetEntriesFast();
-
-    for (int i=0; i<cnt; i++)
-    {
-        if (mag[i]<=7)
-            continue;
-
-        Float_t mx, my;
-        unsigned int sum;
-        GetMeanPosition(pos[i]%fW, pos[i]/fW, r, mx, my, sum);
-
-        leds.Add(mx, my, 0, 0, 0);//mag[i]*10);
-    }
-
-    RemoveTwinsInterpol(leds, first, r);
-}
-*/
 void FilterLed::FindStar(Leds &leds, int xc, int yc, bool box) const
 {
@@ -714,6 +521,6 @@
         return;
 
-    cout << "Mean=" << sum << "  SDev=" << sdev << "  :  ";
-    cout << "Sum/n = " << sum << "/" << n << " = " << (n==0?0:mag/n) << endl;
+    //    cout << "Mean=" << sum << "  SDev=" << sdev << "  :  ";
+    //    cout << "Sum/n = " << sum << "/" << n << " = " << (n==0?0:mag/n) << endl;
 
     leds.Add(mx, my, 0, 0, -2.5*log10((float)mag)+13.7);
Index: /trunk/MagicSoft/Cosy/videodev/FilterLed.h
===================================================================
--- /trunk/MagicSoft/Cosy/videodev/FilterLed.h	(revision 7793)
+++ /trunk/MagicSoft/Cosy/videodev/FilterLed.h	(revision 7794)
@@ -34,5 +34,4 @@
                             unsigned int &sum) const;
 
-    void RemoveTwinsInterpol(Leds &leds, Int_t first, Double_t radius) const;
     void DrawBox(const int x1, const int y1,
                  const int x2, const int y2,
