Index: trunk/MagicSoft/Mars/mastro/MAstro.cc
===================================================================
--- trunk/MagicSoft/Mars/mastro/MAstro.cc	(revision 8999)
+++ trunk/MagicSoft/Mars/mastro/MAstro.cc	(revision 9156)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2004
+!   Copyright: MAGIC Software Development, 2000-2008
 !
 !
@@ -46,4 +46,7 @@
 
 ClassImp(MAstro);
+
+const Double_t MAstro::kSynMonth = 29.53058868; // synodic month (new Moon to new Moon)
+const Double_t MAstro::kEpoch0   = 44240.37917; // First full moon after 1980/1/1
 
 Double_t MAstro::RadToHor()
@@ -616,9 +619,18 @@
 Double_t MAstro::GetMoonPeriod(Double_t mjd)
 {
-    const Double_t synmonth = 29.53058868; // synodic month (new Moon to new Moon)
-    const Double_t epoch0   = 44240.37917; // First full moon after 1980/1/1
-
-    const Double_t et = mjd-epoch0; // Ellapsed time
-    return et/synmonth;
+    const Double_t et = mjd-kEpoch0; // Elapsed time
+    return et/kSynMonth;
+}
+
+// --------------------------------------------------------------------------
+//
+// Convert a moon period back to a mjd
+//
+// See also
+//   MAstro::GetMoonPeriod
+//
+Double_t MAstro::GetMoonPeriodMjd(Double_t p)
+{
+    return p*kSynMonth+kEpoch0;
 }
 
@@ -629,5 +641,5 @@
 //   53257.8 --> 53258
 //   53258.3 --> 53258
-// Which is the time between 13h and 12:59h of the following day. To
+// Which is the time between 12h and 11:59h of the following day. To
 // this day-period we assign the moon-period at midnight. To get
 // the MAGIC definition we now substract 284.
@@ -653,4 +665,16 @@
 
     return (Int_t)TMath::Floor(period)-284;
+}
+
+// --------------------------------------------------------------------------
+//
+// Get the start time (12h noon) of the MAGIC period p.
+//
+// See also
+//   MAstro::GetMagicPeriod
+//
+Double_t MAstro::GetMagicPeriodStart(Int_t p)
+{
+    return TMath::Floor(GetMoonPeriodMjd(p+284))+0.5;
 }
 
Index: trunk/MagicSoft/Mars/mastro/MAstro.h
===================================================================
--- trunk/MagicSoft/Mars/mastro/MAstro.h	(revision 8999)
+++ trunk/MagicSoft/Mars/mastro/MAstro.h	(revision 9156)
@@ -16,4 +16,7 @@
 {
 private:
+    static const Double_t kSynMonth; // synodic month (new Moon to new Moon)
+    static const Double_t kEpoch0;   // First full moon after 1980/1/1
+
     static Double_t Round(Double_t val);
     static Double_t Trunc(Double_t val);
@@ -87,5 +90,7 @@
     static Double_t GetMoonPhase(Double_t mjd);
     static Double_t GetMoonPeriod(Double_t mjd);
+    static Double_t GetMoonPeriodMjd(Double_t p);
     static Int_t    GetMagicPeriod(Double_t mjd);
+    static Double_t GetMagicPeriodStart(Int_t p);
 
     static Double_t EstimateCulminationTime(Double_t mjd, Double_t longit, Double_t ra);
