Index: trunk/FACT++/drive/Ring.cc
===================================================================
--- trunk/FACT++/drive/Ring.cc	(revision 18619)
+++ trunk/FACT++/drive/Ring.cc	(revision 18620)
@@ -6,109 +6,80 @@
 
 #include "Led.h"
-#include "Leds.h"
-
-#include "Rings.h"
-#include "MString.h"
-
-ClassImp(Ring);
 
 using namespace std;
 
-Ring::Ring(Double_t x, Double_t y) :
-    fX(x), fY(y), fR(0), fPhi(0), fDx(-1), fDy(-1), fDr(-1), fDphi(-1)
+Ring::Ring(double x, double y) :
+    fX(x), fY(y), fR(0), fPhi(0)
 {
 }
 
-bool Ring::CalcCenter(const Leds &leds, Int_t i, Int_t j, Int_t k)
+bool Ring::CalcCenter(Led i, Led j, Led k)
 {
-    if (leds.At(i)==NULL)
-    {
-        cout << "Ring::CalcCenter: Led i=" << i << " is NULL." << endl;
-        return kFALSE;
-    }
-    if (leds.At(j)==NULL)
-    {
-        cout << "Ring::CalcCenter: Led j=" << j << " is NULL." << endl;
-        return kFALSE;
-    }
-    if (leds.At(k)==NULL)
-    {
-        cout << "Ring::CalcCenter: Led k=" << k << " is NULL." << endl;
-        return kFALSE;
-    }
-
-    Double_t h1 = leds(i).GetY()- leds(j).GetY();
+    double h1 = i.GetY() - j.GetY();
 
     if (h1==0)
     {
-        Swap(j, k);
-        h1 = leds(i).GetY()- leds(j).GetY();
+        std::swap(j, k);
+        h1 = i.GetY() - j.GetY();
         if (h1==0)
         {
             cout << "Ring::CalcCenter: h1==0" <<endl;
-            return kFALSE;
+            return false;
         }
     }
 
-    Double_t h2 = leds(j).GetY() - leds(k).GetY();
+    double h2 = j.GetY() - k.GetY();
 
     if (h2==0)
     {
-        Swap(i, j);
-        h2 = leds(j).GetY() - leds(k).GetY();
+        std::swap(i, j);
+        h2 = j.GetY() - k.GetY();
         if (h2==0)
         {
             cout << "Ring::CalcCenter: h2==0" << endl;
-            return kFALSE;
+            return false;
         }
     }
 
-    const Double_t w1 = leds(i).GetX() - leds(j).GetX();
-    const Double_t w2 = leds(j).GetX() - leds(k).GetX();
+    const double w1 = i.GetX() - j.GetX();
+    const double w2 = j.GetX() - k.GetX();
 
-    const Double_t m1 = -w1/h1;
-    const Double_t m2 = -w2/h2;
+    const double m1 = -w1/h1;
+    const double m2 = -w2/h2;
 
-    if (m2-m1==0)
+    if (m2 - m1==0)
     {
         cout << "Ring::CalcCenter: All three points in a row! (m2-m1==0)" << endl;
-        return kFALSE;
+        return false;
     }
 
-    fX = ((m2*(leds(j).GetX() + leds(k).GetX()) + leds(i).GetY() - leds(k).GetY()       -m1*(leds(i).GetX() + leds(j).GetX()))/(m2-m1)/2);
-    fY = ((m2*(leds(i).GetY() + leds(j).GetY()) +m1*m2*(leds(k).GetX() - leds(i).GetX())-m1*(leds(j).GetY() + leds(k).GetY()))/(m2-m1)/2);
+    fX = ((m2*(j.GetX() + k.GetX()) + i.GetY() - k.GetY()        -m1*(i.GetX() + j.GetX()))/(m2-m1)/2);
+    fY = ((m2*(i.GetY() + j.GetY()) + m1*m2*(k.GetX() - i.GetX())-m1*(j.GetY() + k.GetY()))/(m2-m1)/2);
 
-    fR = hypot(fX-leds(i).GetX(), fY-leds(i).GetY());
+    fR = hypot(fX - i.GetX(), fY - i.GetY());
 
-    fMag = (leds(i).GetMag() + leds(j).GetMag() + leds(k).GetMag())/3;
+    fMag = (i.GetMag() + j.GetMag() + k.GetMag())/3;
 
-    return kTRUE;
+    return true;
 }
 
-void Ring::InterpolCenters(const Rings &rings)
+void Ring::InterpolCenters(const vector<Ring> &rings)
 {
-    const int n=rings.GetEntries();
-
     fX = 0;
     fY = 0;
     fR = 0;
 
-    fDx=0;
-    fDy=0;
-    fDr=0;
-
     fMag=0;
 
-    if (n<1)
+    const int n=rings.size();
+    if (n==0)
         return;
 
-    for (int i=0; i<n; i++)
+    for (auto it=rings.begin(); it!=rings.end(); it++)
     {
-        const Ring &ring = rings(i);
-
-        fX   += ring.GetX();
-        fY   += ring.GetY();
-        fR   += ring.GetR();
-        fMag += ring.GetMag();
+        fX   += it->GetX();
+        fY   += it->GetY();
+        fR   += it->GetR();
+        fMag += it->GetMag();
     }
 
@@ -117,32 +88,3 @@
     fR   /= n;
     fMag /= n;
-
-    if (n<2)
-        return;
-
-    //
-    // deviation of x- and y coordinate and radius
-    //
-    for (int i=0; i<n; i++)
-    {
-        const Ring &ring = rings(i);
-
-        fDx += sqr(ring.GetX()-fX);
-        fDy += sqr(ring.GetY()-fY);
-        fDr += sqr(ring.GetR()-fR);
-    }
-
-    fDx=sqrt(fDx)/n;
-    fDy=sqrt(fDy)/n;
-    fDr=sqrt(fDr)/n;
 }
-
-void Ring::Print(Option_t *o) const
-{
-    cout << "Ring: ";
-    cout << "x="   << MString::Format("%5.1f", fX) << "+-" << MString::Format("%.1f", fDx) << ", ";
-    cout << "y="   << MString::Format("%5.1f", fY) << "+-" << MString::Format("%.1f", fDy) << ", ";
-    cout << "r="   << MString::Format("%5.1f", fR) << "+-" << MString::Format("%.1f", fDr) << ", ";
-    cout << "phi=" << fPhi              << "+-" << fDphi << endl;
-}
-
Index: trunk/FACT++/drive/Ring.h
===================================================================
--- trunk/FACT++/drive/Ring.h	(revision 18619)
+++ trunk/FACT++/drive/Ring.h	(revision 18620)
@@ -2,53 +2,37 @@
 #define COSY_Ring
 
-#ifndef ROOT_TObject
-#include <TObject.h>
-#endif
+#include <vector>
 
-class Leds;
+#include "Led.h"
+
 class Rings;
 
-class Ring : public TObject
+class Ring
 {
 private:
-    Double_t fX;
-    Double_t fY;
-    Double_t fR;
-    Double_t fPhi;
+    double fX;
+    double fY;
+    double fR;
+    double fPhi;
 
-    Double_t fDx;
-    Double_t fDy;
-    Double_t fDr;
-    Double_t fDphi;
+    double fMag;
 
-    Double_t fMag;
-
-    Double_t sqr(Double_t x) { return x*x; }
-
-    void Swap(int &m, int &n)
-    {
-        int dummy = m;
-        m = n;
-        n = dummy;
-    }
+    double sqr(double x) { return x*x; }
 
 public:
-    Ring(Double_t x=0, Double_t y=0);
+    Ring(double x=0, double y=0);
 
-    void SetXY(Double_t x=0, Double_t y=0) { fX=x; fY=y; }
+    void SetXY(double x=0, double y=0) { fX=x; fY=y; }
+    void SetPhi(double phi) { fPhi=phi; }
 
-    Double_t GetX() const   { return fX; }
-    Double_t GetY() const   { return fY; }
-    Double_t GetR() const   { return fR; }
-    Double_t GetPhi() const { return fPhi; }
+    double GetX() const   { return fX; }
+    double GetY() const   { return fY; }
+    double GetR() const   { return fR; }
+    double GetPhi() const { return fPhi; }
 
-    Double_t GetMag() const { return fMag; }
+    double GetMag() const { return fMag; }
 
-    bool CalcCenter(const Leds &leds, Int_t i, Int_t j, Int_t k);
-    void InterpolCenters(const Rings &rings);
-
-    void Print(Option_t *o=NULL) const;
-
-    ClassDef(Ring, 1)
+    bool CalcCenter(Led, Led, Led);
+    void InterpolCenters(const std::vector<Ring> &rings);
 };
 
