Index: trunk/MagicSoft/Mars/macros/readCT1.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readCT1.C	(revision 2552)
+++ trunk/MagicSoft/Mars/macros/readCT1.C	(revision 2553)
@@ -54,5 +54,4 @@
     MTaskList    tlist;
 
-    plist.AddToList(&geomcam);
     plist.AddToList(&hillas);
     plist.AddToList(&hillasext);
@@ -69,4 +68,5 @@
 
     tlist.AddToList(&read);
+    tlist.AddToList(&geomapl);
     tlist.AddToList(&clone);
     tlist.AddToList(&clean);
Index: trunk/MagicSoft/Mars/mcamera/MCameraCalibration.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraCalibration.h	(revision 2552)
+++ trunk/MagicSoft/Mars/mcamera/MCameraCalibration.h	(revision 2553)
@@ -10,8 +10,8 @@
     friend class MReportCamera;
 private:
-    Bool_t fStatus;           // Monitored status: o=off, 1=on, CamCalib_state
-    Bool_t fStatusCANbus;     // Monitored status: o=off, 1=on, Cal.CanBus_state
-    Bool_t fStatusIO;         // Monitored status: o=off, 1=on, Cal.IO_state
-    Bool_t fStatusLoVoltage;  // Monitored status: o=off, 1=on, Cal.LV_state
+    Byte_t fStatus;           // CaCo monitored calibration state: o=off, 1=on, CamCalib_state
+    Byte_t fStatusCANbus;     // CaCo monitored CANbus state: o=off, 1=on, Cal.CanBus_state
+    Byte_t fStatusIO;         // CaCo monitored I/O state: o=off, 1=on, Cal.IO_state
+    Byte_t fStatusLoVoltage;  // CaCo monitored LV PS state: o=off, 1=on, Cal.LV_state
 
     Bool_t fRequestHiVoltage; // Requested status: o=off, 1=on, bcalib_HV_Off/On
Index: trunk/MagicSoft/Mars/mcamera/MCameraCooling.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraCooling.h	(revision 2552)
+++ trunk/MagicSoft/Mars/mcamera/MCameraCooling.h	(revision 2553)
@@ -10,9 +10,9 @@
     friend class MReportCamera;
 private:
-    Byte_t  fStatus;              // Monitored status: 0-8, Cam.COOLING_state
+    Byte_t  fStatus;              // CaCo Monitored cooling status: 0-9, Cam.COOLING_state
 
     Bool_t  fStatusPressureHi;    // 0=ok,  1=Obstruct
     Bool_t  fStatusPressureLo;    // 0=ok,  1=leakage
-    Bool_t  fStatusPumb;          // 0=off, 1=on
+    Bool_t  fStatusPump;          // 0=off, 1=on
     Bool_t  fStatusRefrigrerator; // 0=off, 1=on
     Bool_t  fStatusValve;         // 0=recirculate, 1=new
@@ -23,7 +23,7 @@
     Float_t fTempWall;            // [deg C] Temperature at the camera wall
     Float_t fTempOptLink;         // [deg C] Temperature at the optical link
-    Float_t fTempWater;           // [deg C] Temperature of the water
+    Float_t fTempWater;           // [deg C] Temperature of the water in the water tank
 
-    Byte_t  fHumAll;              // [%] Relative humidity over all
+    Byte_t  fHumWall;             // [%] Relative humidity at camera wall
     Byte_t  fHumCenter;           // [%] Relative humidity camera center
 
Index: trunk/MagicSoft/Mars/mcamera/MCameraHV.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraHV.h	(revision 2552)
+++ trunk/MagicSoft/Mars/mcamera/MCameraHV.h	(revision 2553)
@@ -14,14 +14,14 @@
     friend class MReportCamera;
 private:
-    Bool_t  fStatus;            // Monitored status of the High Voltage, Cam.HV.PS_state
-    Bool_t  fStatusPowerSupply; // Monitored status of the HV Power supply, Cam.HV_state
+    Byte_t  fStatus;        // CaCo monitored status of the High Voltage [0-9], Cam.HV.PS_state
+    Bool_t  fStatusRamping; // CaCo monitored status of ramping the HV, Cam.HV_state
 
-    Short_t fVoltageA;          // [V] Measured voltage of power supply A, hvps1
-    Short_t fVoltageB;          // [V] Measured voltage of power supply B, hvps2
+    Short_t fVoltageA;      // [V] Measured voltage of power supply A, hvps1
+    Short_t fVoltageB;      // [V] Measured voltage of power supply B, hvps2
 
-    Short_t fCurrentA;          // [A] Measured current of power supply A, curr1
-    Short_t fCurrentB;          // [A] Measured current of power supply B, curr2
+    Byte_t fCurrentA;       // [mA] Measured current of power supply A, curr1
+    Byte_t fCurrentB;       // [mA] Measured current of power supply B, curr2
 
-    TArrayS fHV;                // [V] Measured high Voltages for all PMTs
+    TArrayS fHV;            // [V] Measured high Voltages for all PMTs
 public:
     MCameraHV() : fHV(577) { }
Index: trunk/MagicSoft/Mars/mcamera/MCameraLV.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraLV.h	(revision 2552)
+++ trunk/MagicSoft/Mars/mcamera/MCameraLV.h	(revision 2553)
@@ -14,17 +14,12 @@
     friend class MReportCamera;
 private:
-    Bool_t  fStatus;                    // Monitored status:  , Cam.LV_state
+    Byte_t  fStatus;                    // CaCo monitored LV PS status:  , Cam.LV_state
     Bool_t  fRequestPowerSupply;        // Requested status: o=off, 1=on, blv_ps_status
-    Bool_t  fRequestTemp;               // Requested status: o=off, 1=on, blv_temp
-    Bool_t  fRequestHumidity;           // Requested status: o=off, 1=on, blv_RelativeHumidity
 
-    MCameraPowerSupply fPowerSupplyA;   // power supply A
-    MCameraPowerSupply fPowerSupplyB;   // power supply B
+    Float_t  fStatusTemp;               // Measured status: o=off, 1=on, blv_temp
+    Float_t  fStatusHumidity;           // Measured status: o=off, 1=on, blv_RelativeHumidity
 
-    Float_t fVoltageOptLinkPos12V;      // [V] voltage_opt_link_pos12
-    Float_t fVoltageOptLinkSparePos12V; // [V] voltage_opt_link_spare_pos12
-
-    Float_t fCurrentOptLinkPos12V;      // [A] current_opt_link_pos12
-    Float_t fCurrentOptLinkSparePos12V; // [A] current_opt_link_spare_pos12
+    MCameraPowerSupply fPowerSupplyA;   // power supply camera part A
+    MCameraPowerSupply fPowerSupplyB;   // power supply camera part B
 
 public:
Index: trunk/MagicSoft/Mars/mcamera/MCameraLid.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraLid.h	(revision 2552)
+++ trunk/MagicSoft/Mars/mcamera/MCameraLid.h	(revision 2553)
@@ -10,8 +10,8 @@
     friend class MReportCamera;
 private:
-     Bool_t fLimitTop;         // 0=not active, 1= active
-     Bool_t fLimitBottom;      // 0=not active, 1= active
-     Bool_t fSaftyLimitTop;    // 0=not active, 1= active
-     Bool_t fSaftyLimitBottom; // 0=not active, 1= active
+     Bool_t fLimitOpen;        // 0=not active, 1= active
+     Bool_t fLimitClose;       // 0=not active, 1= active
+     Bool_t fSafetyLimitOpen;  // 0=not active, 1= active
+     Bool_t fSafetyLimitClose; // 0=not active, 1= active
      Byte_t fStatusLid;        // 0=positioning, 1=open, 2=closed
      Byte_t fStatusMotor;      // 0=stopped, 1=opening, 2=closing
Index: trunk/MagicSoft/Mars/mcamera/MCameraLids.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraLids.h	(revision 2552)
+++ trunk/MagicSoft/Mars/mcamera/MCameraLids.h	(revision 2553)
@@ -17,5 +17,5 @@
     MCameraLid fLidB;
 
-    Bool_t fStatus; // [?] Monitored status, Cam.LID_state
+    Byte_t fStatus; // CaCo monitored lid status, Cam.LID_state [0-9]
 public:
     ClassDef(MCameraLids, 0)
Index: trunk/MagicSoft/Mars/mcamera/MCameraPowerSupply.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraPowerSupply.h	(revision 2552)
+++ trunk/MagicSoft/Mars/mcamera/MCameraPowerSupply.h	(revision 2553)
@@ -10,10 +10,14 @@
     friend class MReportCamera;
 private:
-     Float_t fVoltagePos5V;  // [V] voltage_pos5
-     Float_t fVoltagePos12V; // [V] voltage_pos12
-     Float_t fVoltageNeg12V; // [V] voltage_neg12
-     Float_t fCurrentPos5V;  // [A] current_pos5
-     Float_t fCurrentPos12V; // [A] current_pos12
-     Float_t fCurrentNeg12V; // [A] current_neg12
+     Float_t fVoltagePos5V;         // [V] voltage_pos5  (+5V)
+     Float_t fVoltagePos12V;        // [V] voltage_pos12 (+12V)
+     Float_t fVoltageNeg12V;        // [V] voltage_neg12 (-12V)
+     Float_t fVoltageOptLinkPos12V; // [V] volatge_opt_link_pos12 (+12V)
+
+     Float_t fCurrentPos5V;         // [A] current_pos5  (+5V)
+     Float_t fCurrentPos12V;        // [A] current_pos12 (+12V)
+     Float_t fCurrentNeg12V;        // [A] current_neg12 (-12V)
+     Float_t fCurrentOptLinkPos12V; // [V] current_opt_link_pos12 (+12V)
+
 public:
     ClassDef(MCameraPowerSupply, 0)
Index: trunk/MagicSoft/Mars/mreport/MReportCamera.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportCamera.h	(revision 2552)
+++ trunk/MagicSoft/Mars/mreport/MReportCamera.h	(revision 2553)
@@ -5,140 +5,4 @@
 #include "MReport.h"
 #endif
-/*
-class MCameraCooling : public MParContainer
-{
-    friend class MReportCamera;
-private:
-    Bool_t  fStatus;              // Monitored status: , Cam.COOLING_state
-
-    Bool_t  fStatusPressureHi;    // 0=ok,  1=Obstruct
-    Bool_t  fStatusPressureLo;    // 0=ok,  1=leakage
-    Bool_t  fStatusPumb;          // 0=off, 1=on
-    Bool_t  fStatusRefrigrerator; // 0=off, 1=on
-    Bool_t  fStatusValve;         // 0=recirculate, 1=new
-    Bool_t  fStatusResistor;      // 0=off, 1=on
-    Bool_t  fStatusFans;          // 0=off, 1=on
-
-    Float_t fTempCenter;          // [deg C] Temperature at the camera center
-    Float_t fTempWall;            // [deg C] Temperature at the camera wall
-    Float_t fTempOptLink;         // [deg C] Temperature at the optical link
-    Float_t fTempWater;           // [deg C] Temperature of the water
-
-    Byte_t  fHumAll;              // [%] Relative humidity over all
-    Byte_t  fHumCenter;           // [%] Relative humidity camera center
-
-public:
-    ClassDef(MCameraCooling, 0)
-};
-class MCameraLid : public MParContainer
-{
-    friend class MReportCamera;
-private:
-     Bool_t fLimitTop;         // 0=not active, 1= active
-     Bool_t fLimitBottom;      // 0=not active, 1= active
-     Bool_t fSaftyLimitTop;    // 0=not active, 1= active
-     Bool_t fSaftyLimitBottom; // 0=not active, 1= active
-     Byte_t fStatusLid;        // 0=positioning, 1=open, 2=closed
-     Byte_t fStatusMotor;      // 0=stopped, 1=opening, 2=closing
-public:
-    ClassDef(MCameraLid, 0)
-};
-class MCameraLids : public MParContainer
-{
-    friend class MReportCamera;
-private:
-    MCameraLid *fLidA;
-    MCameraLid *fLidB;
-
-    Bool_t fStatus; // [?] Monitored status, Cam.LID_state
-public:
-    ClassDef(MCameraLids, 0)
-};
-
-class MCameraPowerSupply : public MParContainer
-{
-    friend class MReportCamera;
-private:
-     Float_t fVoltagePos5V;  // [V] voltage_pos5
-     Float_t fVoltagePos12V; // [V] voltage_pos12
-     Float_t fVoltageNeg12V; // [V] voltage_neg12
-     Float_t fCurrentPos5V;  // [A] current_pos5
-     Float_t fCurrentPos12V; // [A] current_pos12
-     Float_t fCurrentNeg12V; // [A] current_neg12
-public:
-    ClassDef(MCameraPowerSupply, 0)
-};
-
-class MCameraLV : public MParContainer
-{
-    friend class MReportCamera;
-private:
-    Bool_t  fStatus;                    // Monitored status:  , Cam.LV_state
-    Bool_t  fRequestPowerSupply;        // Requested status: o=off, 1=on, blv_ps_status
-    Bool_t  fRequestTemp;               // Requested status: o=off, 1=on, blv_temp
-    Bool_t  fRequestHumidity;           // Requested status: o=off, 1=on, blv_RelativeHumidity
-
-    MCameraPowerSupply fPowerSupplyA;  // power supply A
-    MCameraPowerSupply fPowerSupplyB;  // power supply B
-
-    Float_t fVoltageOptLinkPos12V;      // [V] voltage_opt_link_pos12
-    Float_t fVoltageOptLinkSparePos12V; // [V] voltage_opt_link_spare_pos12
-
-    Float_t fCurrentOptLinkPos12V;      // [A] current_opt_link_pos12
-    Float_t fCurrentOptLinkSparePos12V; // [A] current_opt_link_spare_pos12
-
-public:
-    ClassDef(MCameraLV, 0)
-};
-
-class MCameraAUX : public MParContainer
-{
-    friend class MReportCamera;
-private:
-    Bool_t fRequestCaosLEDs; // Requested status: o=off, 1=on, bAux_CaOsLEDs_Off/On
-    Bool_t fRequestFansFADC; // Requested status: o=off, 1=on, bAux_FADC_FANs_Off/On
-    Bool_t fStatusCaosLEDs;  // Monitored status: o=off, 1=on, Cam.CaOs.LED_state
-    Bool_t fStatusFansFADC;  // Monitored status: o=off, 1=on, Cam.FADC.Fans_state
-public:
-    ClassDef(MCameraAUX, 0)
-};
-
-class MCameraCalibration : public MParContainer
-{
-    friend class MReportCamera;
-private:
-    Bool_t fStatus;           // Monitored status: o=off, 1=on, CamCalib_state
-    Bool_t fStatusCANbus;     // Monitored status: o=off, 1=on, Cal.CanBus_state
-    Bool_t fStatusIO;         // Monitored status: o=off, 1=on, Cal.IO_state
-    Bool_t fStatusLoVoltage;  // Monitored status: o=off, 1=on, Cal.LV_state
-
-    Bool_t fRequestHiVoltage; // Requested status: o=off, 1=on, bcalib_HV_Off/On
-    Bool_t fRequestLoVoltage; // Requested status: o=off, 1=on, bcalib_LV_Off/On
-    Bool_t fRequestContLight; // Requested status: o=off, 1=on, bcalib_ContinuousLight_Off/On
-    Bool_t fRequestPinDiode;  // Requested status: o=off, 1=on, bcalib_PinDiode_Off/On
-
-public:
-    ClassDef(MCameraCalibration, 0)
-};
-#include <TArrayS.h>
-class MCameraHV : public MParContainer
-{
-    friend class MReportCamera;
-private:
-    Bool_t  fStatus;            // Monitored status of the High Voltage, Cam.HV.PS_state
-    Bool_t  fStatusPowerSupply; // Monitored status of the HV Power supply, Cam.HV_state
-
-    Short_t fVoltageA;          // [V] Measured voltage of power supply A, hvps1
-    Short_t fVoltageB;          // [V] Measured voltage of power supply B, hvps2
-
-    Short_t fCurrentA;          // [A] Measured current of power supply A, curr1
-    Short_t fCurrentB;          // [A] Measured current of power supply B, curr2
-
-    TArrayS fHV;                // [V] Measured high Voltages for all PMTs
-public:
-    MCameraHV() : fHV(577) { }
-    ClassDef(MCameraHV, 0)
-};
-*/
 
 class MCameraCooling;
@@ -151,6 +15,6 @@
 {
 private:
-    Bool_t fStatus;   // [?] Monitored status of the sentinel, Sentinel_state
-    Bool_t fStatusDC; // [?] Monitored status of the DC currents, Cam.DC_state
+    Byte_t fStatus;   // CaCo monitored status of the sentinel (0-9), Sentinel_state
+    Byte_t fStatusDC; // CaCo monitored status of the DC currents (0-9), Cam.DC_state
 
     MCameraCooling     *fCooling;
Index: trunk/MagicSoft/Mars/mtools/MAstro.cc
===================================================================
--- trunk/MagicSoft/Mars/mtools/MAstro.cc	(revision 2553)
+++ trunk/MagicSoft/Mars/mtools/MAstro.cc	(revision 2553)
@@ -0,0 +1,202 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MAstro
+// ------
+//
+////////////////////////////////////////////////////////////////////////////
+#include "MAstro.h"
+
+ClassImp(MAstro);
+
+Double_t MAstro::Trunc(Double_t val)
+{
+    /* dint(A) - truncate to nearest whole number towards zero (double) */
+    return val<0 ? TMath::Ceil(val) : TMath::Floor(val);
+}
+
+Double_t MAstro::Round(Double_t val)
+{
+    /* dnint(A) - round to nearest whole number (double) */
+    return val<0 ? TMath::Ceil(val-0.5) : TMath::Floor(val+0.5);
+}
+
+Double_t MAstro::Hms2Sec(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
+{
+    const Double_t rc = TMath::Sign((60.0 * (60.0 * (Double_t)TMath::Abs(deg) + (Double_t)min) + sec), (Double_t)deg);
+    return sgn=='-' ? -rc : rc;
+}
+
+Double_t MAstro::Dms2Rad(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
+{
+    /* pi/(180*3600):  arcseconds to radians */
+#define DAS2R 4.8481368110953599358991410235794797595635330237270e-6
+    return Hms2Sec(deg, min, sec, sgn)*DAS2R;
+}
+
+Double_t MAstro::Hms2Rad(Int_t hor, UInt_t min, Double_t sec, Char_t sgn)
+{
+    /* pi/(12*3600):  seconds of time to radians */
+#define DS2R 7.2722052166430399038487115353692196393452995355905e-5
+    return Hms2Sec(hor, min, sec, sgn)*DS2R;
+}
+
+Double_t MAstro::Dms2Deg(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
+{
+    return Hms2Sec(deg, min, sec, sgn)/3600.;
+}
+
+Double_t MAstro::Hms2Deg(Int_t hor, UInt_t min, Double_t sec, Char_t sgn)
+{
+    return Hms2Sec(hor, min, sec, sgn)/240.;
+}
+
+Double_t MAstro::Dms2Hor(Int_t deg, UInt_t min, Double_t sec, Char_t sgn)
+{
+    return Hms2Sec(deg, min, sec, sgn)/15.;
+}
+
+Double_t MAstro::Hms2Hor(Int_t hor, UInt_t min, Double_t sec, Char_t sgn)
+{
+    return Hms2Sec(hor, min, sec, sgn)/3600.;
+}
+
+void MAstro::Day2Hms(Double_t day, Char_t &sgn, UShort_t &hor, UShort_t &min, UShort_t &sec)
+{
+    /* Handle sign */
+    sgn = day<0?'-':'+';
+
+    /* Round interval and express in smallest units required */
+    Double_t a = Round(86400. * TMath::Abs(day)); // Days to seconds
+
+    /* Separate into fields */
+    const Double_t ah = Trunc(a/3600.);
+    a -= ah * 3600.;
+    const Double_t am = Trunc(a/60.);
+    a -= am * 60.;
+    const Double_t as = Trunc(a);
+
+    /* Return results */
+    hor = (UShort_t)ah;
+    min = (UShort_t)am;
+    sec = (UShort_t)as;
+}
+
+void MAstro::Rad2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Day2Hms(rad/(TMath::Pi()*2), sgn, deg, min, sec);
+}
+
+void MAstro::Rad2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Rad2Hms(rad*15, sgn, deg, min, sec);
+}
+
+void MAstro::Deg2Dms(Double_t d, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Day2Hms(d/24, sgn, deg, min, sec);
+}
+
+void MAstro::Deg2Hms(Double_t d, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Rad2Hms(d/360, sgn, deg, min, sec);
+}
+
+void MAstro::Hor2Dms(Double_t h, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Day2Hms(h*15/24, sgn, deg, min, sec);
+}
+
+void MAstro::Hor2Hms(Double_t h, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec)
+{
+    Day2Hms(h/24, sgn, deg, min, sec);
+}
+
+void MAstro::Day2Hm(Double_t day, Char_t &sgn, UShort_t &hor, Double_t &min)
+{
+    /* Handle sign */
+    sgn = day<0?'-':'+';
+
+    /* Round interval and express in smallest units required */
+    Double_t a = Round(86400. * TMath::Abs(day)); // Days to seconds
+
+    /* Separate into fields */
+    const Double_t ah = Trunc(a/3600.);
+    a -= ah * 3600.;
+
+    /* Return results */
+    hor = (UShort_t)ah;
+    min = a/60.;
+}
+
+void MAstro::Rad2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Day2Hm(rad/(TMath::Pi()*2), sgn, deg, min);
+}
+
+void MAstro::Rad2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Rad2Hm(rad*15, sgn, deg, min);
+}
+
+void MAstro::Deg2Dm(Double_t d, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Day2Hm(d/24, sgn, deg, min);
+}
+
+void MAstro::Deg2Hm(Double_t d, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Rad2Hm(d/360, sgn, deg, min);
+}
+
+void MAstro::Hor2Dm(Double_t h, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Day2Hm(h*15/24, sgn, deg, min);
+}
+
+void MAstro::Hor2Hm(Double_t h, Char_t &sgn, UShort_t &deg, Double_t &min)
+{
+    Day2Hm(h/24, sgn, deg, min);
+}
+
+Bool_t MAstro::String2Angle(TString &str, Double_t &ret)
+{
+    Char_t  sgn;
+    Int_t   d, len;
+    UInt_t  m;
+    Float_t s;
+
+    // Skip whitespaces before %c and after %f
+    int n=sscanf(str.Data(), " %c %d %d %f %n", &sgn, &d, &m, &s, &len);
+
+    if (n!=4 || (sgn!='+' && sgn!='-'))
+        return kFALSE;
+
+    str.Remove(0, len);
+
+    ret = Dms2Deg(d, m, s, sgn);
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/mtools/MAstro.h
===================================================================
--- trunk/MagicSoft/Mars/mtools/MAstro.h	(revision 2553)
+++ trunk/MagicSoft/Mars/mtools/MAstro.h	(revision 2553)
@@ -0,0 +1,44 @@
+#ifndef MARS_MAstro
+#define MARS_MAstro
+
+#ifndef ROOT_TROOT
+#include <TROOT.h>
+#endif
+
+class MAstro
+{
+private:
+    static Double_t Round(Double_t val);
+    static Double_t Trunc(Double_t val);
+
+public:
+    static Double_t Hms2Sec(Int_t deg, UInt_t min, Double_t sec, char sgn='+');
+    static Double_t Dms2Rad(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
+    static Double_t Hms2Rad(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
+    static Double_t Dms2Deg(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
+    static Double_t Hms2Deg(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
+    static Double_t Dms2Hor(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
+    static Double_t Hms2Hor(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
+
+    static void Day2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Rad2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Rad2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Deg2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Deg2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Hor2Dms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+    static void Hor2Hms(Double_t rad, Char_t &sgn, UShort_t &deg, UShort_t &min, UShort_t &sec);
+
+    static void Day2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Rad2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Rad2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Deg2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Deg2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Hor2Dm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+    static void Hor2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
+
+    static Bool_t String2Angle(TString &str, Double_t &ret);
+
+    ClassDef(MAstro, 0)
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mtools/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mtools/Makefile	(revision 2552)
+++ trunk/MagicSoft/Mars/mtools/Makefile	(revision 2553)
@@ -34,4 +34,5 @@
            MagicDomino.cc \
            MagicCivilization.cc \
+           MAstro.cc \
            MineSweeper.cc
 
Index: trunk/MagicSoft/Mars/mtools/ToolsLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mtools/ToolsLinkDef.h	(revision 2552)
+++ trunk/MagicSoft/Mars/mtools/ToolsLinkDef.h	(revision 2553)
@@ -5,4 +5,5 @@
 #pragma link off all functions;
 
+#pragma link C++ class MAstro+;
 #pragma link C++ class MChisqEval+;
 #pragma link C++ class MineSweeper+;
