Changeset 4564 for trunk


Ignore:
Timestamp:
08/10/04 16:19:37 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mastro
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mastro/MAstro.cc

    r4563 r4564  
    503503// after Jan 1st 1980 (which was @ MJD=44240.37917)
    504504//
    505 // In a addition to this calculation an offset of 284 periods is substracted.
    506 // Taking this offset into account you get the Period as it is defined
    507 // for the MAGIC observations. If you want to get the MAGIC observation
    508 // period number make sure that your Mjd is a integer without a floating
    509 // point reminder.
     505Double_t MAstro::GetMoonPeriod(Double_t mjd)
     506{
     507    const Double_t synmonth = 29.53058868; // synodic month (new Moon to new Moon)
     508    const Double_t epoch0   = 44240.37917; // First full moon after 1980/1/1
     509
     510    const Double_t et = mjd-epoch0; // Ellapsed time
     511    return TMath::Floor(et/synmonth);
     512}
     513
     514// --------------------------------------------------------------------------
     515//
     516// To get the moon period as defined for MAGIC observation we take the
     517// nearest integer mjd, eg:
     518//   53257.8 --> 53258
     519//   53258.3 --> 53258
     520// Which is the time between 13h and 12:59h of the following day. To
     521// this day-period we assign the moon-period at midnight. To get
     522// the MAGIC definition we now substract 284.
    510523//
    511524// For MAGIC observation period do eg:
    512 //   GetMoonPeriod(53257)
     525//   GetMagicPeriod(53257.91042)
    513526// or
    514527//   MTime t;
    515 //   t.SetMjd(53257);
    516 //   GetMoonPeriod(t.GetMjd());
     528//   t.SetMjd(53257.91042);
     529//   GetMagicPeriod(t.GetMjd());
    517530// or
    518531//   MTime t;
    519 //   t.Set(2004, 1, 1, 0);
    520 //   GetMoonPeriod(t.GetMjd());
    521 // or
    522 //   MTime t;
    523 //   t.Now();
    524 //   GetMoonPeriod(TMath::Floor(t.GetMjd()));
    525 //
    526 Double_t MAstro::GetMoonPeriod(Double_t mjd, Int_t offset)
    527 {
    528     const Double_t synmonth = 29.53058868; // synodic month (new Moon to new Moon)
    529     const Double_t epoch0   = 44240.37917; // First full moon after 1980/1/1
    530 
    531     const Double_t et = mjd-epoch0; // Ellapsed time
    532     return TMath::Floor(et/synmonth) + offset;
    533 }
     532//   t.Set(2004, 1, 1, 12, 32, 11);
     533//   GetMagicPeriod(t.GetMjd());
     534//
     535Double_t MAstro::GetMagicPeriod(Double_t mjd)
     536{
     537    return GetMoonPeriod(TMath::Nint(mjd))-284;
     538}
  • trunk/MagicSoft/Mars/mastro/MAstro.h

    r4563 r4564  
    5757
    5858    static Double_t GetMoonPhase(Double_t mjd);
    59     static Double_t GetMoonPeriod(Double_t mjd, Int_t offset=-284);
     59    static Double_t GetMoonPeriod(Double_t mjd);
     60    static Double_t GetMagicPeriod(Double_t mjd);
    6061
    6162    ClassDef(MAstro, 0)
Note: See TracChangeset for help on using the changeset viewer.