Index: trunk/MagicSoft/Cosy/main/MBending.cc
===================================================================
--- trunk/MagicSoft/Cosy/main/MBending.cc	(revision 7795)
+++ trunk/MagicSoft/Cosy/main/MBending.cc	(revision 8376)
@@ -59,6 +59,6 @@
 #include "MBending.h"
 
-#include <fstream.h>
-#include <iomanip.h>
+#include <fstream>
+#include <iomanip>
 #include <TVector3.h>
 
@@ -68,4 +68,6 @@
 
 ClassImp(MBending);
+
+using namespace std;
 
 #undef DEBUG
Index: trunk/MagicSoft/Cosy/main/MCaos.cc
===================================================================
--- trunk/MagicSoft/Cosy/main/MCaos.cc	(revision 7795)
+++ trunk/MagicSoft/Cosy/main/MCaos.cc	(revision 8376)
@@ -1,5 +1,5 @@
 #include "MCaos.h"
 
-#include <iostream>
+#include <fstream>
 #include <iomanip>
 
@@ -21,5 +21,7 @@
 #include "coord.h"
 
-void MCaos::ReadResources(const char *name="leds.txt")
+using namespace std;
+
+void MCaos::ReadResources(const char *name)
 {
     ifstream fin(name);
@@ -242,6 +244,6 @@
     c->Update();
 
-    const Int_t n1 = (Int_t)(sqrt(fPositions.GetEntriesFast())+1.0);
-    const Int_t n2 = (Int_t)(sqrt(fPositions.GetEntriesFast())+0.5);
+    const Int_t n1 = (Int_t)(TMath::Sqrt(fPositions.GetEntriesFast())+1.0);
+    const Int_t n2 = (Int_t)(TMath::Sqrt(fPositions.GetEntriesFast())+0.5);
 
     TCanvas *c1 = new TCanvas("cpos", "Led Positions", 800, 600);
@@ -330,5 +332,5 @@
 }
 
-Ring MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t, Double_t box, Double_t cut)
+Ring MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t, Int_t box, Double_t cut)
 {
     Leds &leds = *fLeds;
@@ -355,5 +357,5 @@
         // Try to find Led in this area
         const Led &l0 = fPositions(i);
-        f.Execute(leds, l0.GetX(), l0.GetY());
+        f.Execute(leds, TMath::FloorNint(l0.GetX()), TMath::FloorNint(l0.GetY()));
 
         // Loop over newly found Leds
Index: trunk/MagicSoft/Cosy/main/MCaos.h
===================================================================
--- trunk/MagicSoft/Cosy/main/MCaos.h	(revision 7795)
+++ trunk/MagicSoft/Cosy/main/MCaos.h	(revision 8376)
@@ -89,5 +89,5 @@
 
     Ring Run(byte *img, bool printl, bool printr, const ZdAz &pos, 
-	     const MTime &t, Double_t box, Double_t cut);
+	     const MTime &t, Int_t box, Double_t cut);
 };
 
Index: trunk/MagicSoft/Cosy/main/MCosy.cc
===================================================================
--- trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 7795)
+++ trunk/MagicSoft/Cosy/main/MCosy.cc	(revision 8376)
@@ -1,7 +1,6 @@
 #include "MCosy.h"
 
-#include <iomanip.h>
-#include <fstream.h>
-#include <iostream.h>
+#include <iomanip>
+#include <fstream>
 
 #include <TROOT.h>
@@ -30,4 +29,6 @@
 
 ClassImp(MCosy);
+
+using namespace std;
 
 typedef struct tm tm_t;
@@ -493,9 +494,9 @@
     {
 #ifdef EXPERT
-        fMac1->SetDeceleration(0.5*fMac1->GetVelRes());
-        fMac2->SetDeceleration(0.5*fMac2->GetVelRes());
+        fMac1->SetDeceleration(TMath::Nint(0.5*fMac1->GetVelRes()));
+        fMac2->SetDeceleration(TMath::Nint(0.5*fMac2->GetVelRes()));
 #else
-        fMac1->SetDeceleration(0.3*fMac1->GetVelRes());
-        fMac2->SetDeceleration(0.3*fMac2->GetVelRes());
+        fMac1->SetDeceleration(TMath::Nint(0.3*fMac1->GetVelRes()));
+        fMac2->SetDeceleration(TMath::Nint(0.3*fMac2->GetVelRes()));
 #endif
         fMac1->SetRpmMode(FALSE);
Index: trunk/MagicSoft/Cosy/main/MPointing.cc
===================================================================
--- trunk/MagicSoft/Cosy/main/MPointing.cc	(revision 7795)
+++ trunk/MagicSoft/Cosy/main/MPointing.cc	(revision 8376)
@@ -6,4 +6,6 @@
 
 ClassImp(MPointing);
+
+using namespace std;
 
 //#define EXPERT
@@ -30,11 +32,11 @@
     if (ratio<1)
     {
-        fCosy->fMac1->SetVelocity(vel);
-        fCosy->fMac2->SetVelocity(vel*ratio);
+        fCosy->fMac1->SetVelocity(TMath::Nint(vel));
+        fCosy->fMac2->SetVelocity(TMath::Nint(vel*ratio));
     }
     else
     {
-        fCosy->fMac1->SetVelocity(vel/ratio);
-        fCosy->fMac2->SetVelocity(vel);
+        fCosy->fMac1->SetVelocity(TMath::Nint(vel/ratio));
+        fCosy->fMac2->SetVelocity(TMath::Nint(vel));
     }
 }
@@ -56,6 +58,6 @@
     fCosy->SetStatus(MDriveCom::kMoving);
 
-    if (axe1) fCosy->fMac2->StartRelPos(rd.Zd());
-    if (axe2) fCosy->fMac1->StartRelPos(rd.Az());
+    if (axe1) fCosy->fMac2->StartRelPos(TMath::Nint(rd.Zd()));
+    if (axe2) fCosy->fMac1->StartRelPos(TMath::Nint(rd.Az()));
 #ifdef EXPERT
     cout << "Waiting for positioning..." << flush;
@@ -73,6 +75,6 @@
 {
     const int vr = mac->GetVelRes();
-    mac->SetAcceleration(acc*vr);
-    mac->SetDeceleration(dec*vr);
+    mac->SetAcceleration(TMath::Nint(acc*vr));
+    mac->SetDeceleration(TMath::Nint(dec*vr));
     return !mac->IsZombieNode();
 }
Index: trunk/MagicSoft/Cosy/main/MStargHistograms.cc
===================================================================
--- trunk/MagicSoft/Cosy/main/MStargHistograms.cc	(revision 7795)
+++ trunk/MagicSoft/Cosy/main/MStargHistograms.cc	(revision 8376)
@@ -22,4 +22,6 @@
 
 #include "coord.h"
+
+using namespace std;
 
 void MStargHistograms::OpenFile()
Index: trunk/MagicSoft/Cosy/main/MStarguider.cc
===================================================================
--- trunk/MagicSoft/Cosy/main/MStarguider.cc	(revision 7795)
+++ trunk/MagicSoft/Cosy/main/MStarguider.cc	(revision 8376)
@@ -4,7 +4,7 @@
 #include "MStarguider.h"
 
-#include <fstream.h>    // ifstream
-#include <iostream.h>   // cout
-#include <iomanip.h>   // cout
+#include <fstream>    // ifstream
+#include <iostream>   // cout
+#include <iomanip>    // cout
 
 #include <TH2F.h>
@@ -57,4 +57,6 @@
 
 ClassImp(MStarguider);
+
+using namespace std;
 
 enum {
@@ -1457,9 +1459,9 @@
 	    
             const Int_t idx = x.GetSize();
-	    
+
             x.Set(idx+1);
             y.Set(idx+1);
             mag.Set(idx+1);
-	    
+
             x.AddAt(dpos.X(), idx);
             y.AddAt(dpos.Y(), idx);
@@ -1507,5 +1509,4 @@
     fPZdAz->SetCoordinates(cpos);
 
-
     // Check StargTPoint data set request
     if (!fStargTPoint->IsDown())
@@ -1575,5 +1576,5 @@
 }
 
-XY MStarguider::FindRoqueLamp(FilterLed &f, FilterLed &f2, Ring &CameraCenter, MTime &t, Double_t cut, Double_t box, XY SearchCenter)
+XY MStarguider::FindRoqueLamp(FilterLed &f, FilterLed &f2, Ring &CameraCenter, MTime &t, Double_t cut, Int_t box, XY SearchCenter)
 {
     // Set search Paremeters (FIXME: Get them from user input!)
@@ -1611,5 +1612,5 @@
 }
 
-ZdAz MStarguider::FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t, Double_t cut, Double_t box, Double_t scalefactor = 1.0)
+ZdAz MStarguider::FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t, Double_t cut, Int_t box, Double_t scalefactor = 1.0)
 {
     // Set search Paremeters (FIXME: Get them from user input!)
@@ -1850,5 +1851,5 @@
     {
         // SCALE FACTOR ASSUMED TO BE 70
-        FindStar(f, f2, center, t, 3.5, 70);
+        FindStar(f, f2, center, t, 3/*3.5*/, 70);
         SendAmcTrigger("TPoint");
     }
@@ -1920,5 +1921,5 @@
 
         Double_t imageclean = 1.5;
-        Double_t boxradius = 60;
+        Int_t    boxradius = 60;
 	//Double_t scalefactor = 1;
 	XY searchcenter(768/2-1,576/2+25);
@@ -1947,5 +1948,5 @@
 
         Double_t imageclean = 5;
-	Double_t boxradius = 60;
+	Int_t    boxradius = 60;
 	//Double_t scalefactor = 1;
 	//	XY searchcenter(sgcenter.GetX(),sgcenter.GetY());
@@ -2016,5 +2017,5 @@
                      sgcenter.GetY()-293.6+28.5);
 
-        fSao->CalcStars(stars, 530, 292, off.X(), off.Y());
+        fSao->CalcStars(stars, 530, 292, TMath::FloorNint(off.X()), TMath::FloorNint(off.Y()));
 	fSao->DrawStars(stars, cimg);
 
