Index: trunk/MagicSoft/Mars/mbase/MMath.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MMath.cc	(revision 8543)
+++ trunk/MagicSoft/Mars/mbase/MMath.cc	(revision 8544)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.31 2007-05-10 12:14:54 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.32 2007-06-11 15:35:14 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -567,5 +567,5 @@
     if (r==0)
     {
-        x1 = -a/2;
+        x1 = x2 = -a/2;
         return 1;
     }
@@ -710,4 +710,16 @@
         const Double_t rq    = R/TMath::Abs(Q);
 
+        const Double_t t = TMath::ACos(rq/sqrtq)/3;
+
+        static const Double_t sqrt3 = TMath::Sqrt(3.);
+
+        const Double_t s = TMath::Sin(t)*sqrt3;
+        const Double_t c = TMath::Cos(t);
+
+        x1 = 2*sqrtq *      c  - a/3;
+        x2 =  -sqrtq * (s + c) - a/3;
+        x3 =   sqrtq * (s - c) - a/3;
+
+        /* --- Easier to understand but slower ---
         const Double_t th1 = TMath::ACos(rq/sqrtq);
         const Double_t th2 = th1 + TMath::TwoPi();
@@ -717,5 +729,5 @@
         x2 = 2.*sqrtq * TMath::Cos(th2/3.) - a/3.;
         x3 = 2.*sqrtq * TMath::Cos(th3/3.) - a/3.;
-
+        */
         return 3;
     }
Index: trunk/MagicSoft/Mars/mbase/MMath.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MMath.h	(revision 8543)
+++ trunk/MagicSoft/Mars/mbase/MMath.h	(revision 8544)
@@ -70,5 +70,5 @@
     inline Int_t ModF(Double_t dbl, Double_t &frac) { Double_t rc; frac = modf(dbl, &rc); return TMath::Nint(rc); }
 
-    inline Double_t Sqrt3(Double_t x) { return TMath::Sign(TMath::Power(TMath::Abs(x), 1./3), x); }
+    inline Double_t Sqrt3(Double_t x) { return cbrt(x); }
 
     inline Double_t Sgn(Double_t d) { return d<0 ? -1 : 1; }
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 8543)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 8544)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCalc.cc,v 1.180 2007-05-11 10:25:44 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCalc.cc,v 1.181 2007-06-11 15:35:14 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -750,4 +750,11 @@
             }
 
+            if (res==0)
+            {
+                *fLog << warn << "Pixel  " << setw(4) << i << ": Abs-time rms==0." << endl;
+                (*fBadPixels)[i].SetUncalibrated(MBadPixelsPix::kDeviatingTimeResolution);
+                continue;
+            }
+
             // Now compare to a lower and upper limit
             if (res<=lolim || res>=hilim)
Index: trunk/MagicSoft/Mars/sponde.cc
===================================================================
--- trunk/MagicSoft/Mars/sponde.cc	(revision 8543)
+++ trunk/MagicSoft/Mars/sponde.cc	(revision 8544)
@@ -209,4 +209,9 @@
     //
     MEnv env(kConfig);
+    if (!env.IsValid())
+    {
+        gLog << err << "Configuration file " << kConfig << " not found." << endl;
+        return 0xfe;
+    }
 
     MJSpectrum job(Form("MJSpectrum #%d", seq.GetNumAnalysis()));
