Index: trunk/MagicSoft/Cosy/catalog/StarCatalog.cc
===================================================================
--- trunk/MagicSoft/Cosy/catalog/StarCatalog.cc	(revision 6867)
+++ trunk/MagicSoft/Cosy/catalog/StarCatalog.cc	(revision 7764)
@@ -142,25 +142,40 @@
 }
 
+/*
 void StarCatalog::CalcStars(MStarList &list)
 {
     // full FOV
-    fBox=768;
-    CalcStars(list, 0, 576, 0, 0);
-}
+    fBox=768/2;
+    CalcStars(list, 768/2, 576/2, 0, 0);
+}
+*/
 
 void StarCatalog::CalcStars(MStarList &list, int xc, int yc, 
 			    int xo, int yo) const
 {
+    // For an apropriate unit conversion to pixels [pix/rad]
+    const Double_t scale = TMath::RadToDeg()*sqrt(768*768 + 576*576)/(fAstro->GetRadiusFOV()*2);
+
+    // Offsets to shift [-n/2;n/2] to [0;n] and to
+    // move the stars in the counterdirection of the LEDs
+    const Float_t offx = 768/2 + xo;
+    const Float_t offy = 576/2 + yo;
+
+    // Allow catalog stars to be a bit outside [0.2deg] of the
+    // monitored window. To get the std behaviour set offset=0
+    const Int_t offset = TMath::Nint(0.2*TMath::DegToRad()*scale);
+    const Int_t box    = fBox+offset;
 
     // CalcStars flips the picture in X defaultwise now
-    int x0 = (768-xc)-fBox;
-    int x1 = (768-xc)+fBox;
-    int y0 = yc-fBox;
-    int y1 = yc+fBox;
-
-    if (x0<0) x0=0;
-    if (y0<0) y0=0;
-    if (x1>fW) x1=fW;
-    if (y1>fH) y1=fH;
+    // This defined the box in which stars are really returned
+    int x0 = (768-xc)-box;
+    int x1 = (768-xc)+box;
+    int y0 = yc-box;
+    int y1 = yc+box;
+
+    if (x0<  -offset) x0=  -offset;
+    if (y0<  -offset) y0=  -offset;
+    if (x1>fW+offset) x1=fW+offset;
+    if (y1>fH+offset) y1=fH+offset;
 
     // Align stars into telescope system
@@ -171,7 +186,4 @@
     align.RotateZ(TMath::Pi()/2);
 
-    // For an apropriate unit conversion to pixels
-    const Double_t scale = TMath::RadToDeg()*sqrt(768*768 + 576*576)/(fAstro->GetRadiusFOV()*2);
-
     // Get List of stars from catalog
     TIter Next(fAstro->GetList());
@@ -213,14 +225,15 @@
 
         // Rotate by the rotation angle of the video camera
-        Float_t xx = loc.X()*fCosAngle - loc.Y()*fSinAngle;
-        Float_t yy = loc.X()*fSinAngle + loc.Y()*fCosAngle;
-
-        if (xx<(x0-768/2) || xx >=(x1-768/2) 
-	    || yy<(y0-(576/2+yo)) || yy>=(y1-(576/2+yo)))
+        // and add the offsets on both axis
+        Float_t xx = loc.X()*fCosAngle - loc.Y()*fSinAngle  +  offx;
+        Float_t yy = loc.X()*fSinAngle + loc.Y()*fCosAngle  +  offy;
+
+        // Check if the resulting star is in the
+        // search box for the real stars
+        if (rx<x0 || rx>=x1 || ry<y0 || ry>=y1)
             continue;
 
         // Store pixel coordinates of star in list
-        list.Add(xx+768/2+xo, yy+576/2+yo, -2.5*log10(mag));
-
+        list.Add(rx, ry, -2.5*log10(mag));
     }
 }
Index: trunk/MagicSoft/Cosy/catalog/StarCatalog.h
===================================================================
--- trunk/MagicSoft/Cosy/catalog/StarCatalog.h	(revision 6867)
+++ trunk/MagicSoft/Cosy/catalog/StarCatalog.h	(revision 7764)
@@ -76,6 +76,6 @@
     }
 
+    //void   CalcStars(MStarList &list);
     void   CalcStars(MStarList &list, int xc, int yc, int xo, int yo) const;
-    void   CalcStars(MStarList &list);
     static void DrawStars(MStarList &list, byte *img);
 
