3 #include <utl/Vector.h>
5 #include <utl/CoordinateSystemPtr.h>
6 #include <utl/AugerUnits.h>
7 #include <utl/UTCDate.h>
9 #include <utl/AugerException.h>
10 #include <utl/Reader.h>
12 #include <fwk/CentralConfig.h>
13 #include <fwk/CoordinateSystemRegistry.h>
42 model.GetChild(
"BaseYear").GetData(year);
44 model.GetChild(
"Order").GetData(order);
47 model.GetChild(
"G").GetData(g);
48 model.GetChild(
"H").GetData(h);
59 changeModel.GetChild(
"G").GetData(g);
60 changeModel.GetChild(
"H").GetData(h);
72 return (90*
utl::degree - GetMagneticFieldVector(position, time).GetPhi(cs));
80 return (GetMagneticFieldVector(position, time).GetTheta(cs) - 90*
utl::degree);
87 return instance().ModelForTime(time).Get(position);
94 int days[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
96 int leap_year = (((year % 4) == 0) && (((year % 100) != 0) || ((year % 400) == 0)));
98 double day_in_year = (days[month - 1] + day + (month > 2 ? leap_year : 0));
101 return ((
double) year + (day_in_year / (365.0 + leap_year)));
112 return ModelForYear(decimalYear(year, month, day));
119 if (year < firstYear)
121 std::ostringstream msg;
122 msg <<
"No magnet field information before year " << year <<
"\n";
129 double lastYear = fModels.back().GetBaseYear();
132 return fChangeModel ->
Extrapolate (year - lastYear, fModels.back());
135 std::vector<ParametricGeoMagneticField>::iterator modelit = fModels.begin();
146 while (modelit != fModels.end());
148 ERROR(
"This point should never be reached."); abort();
double Extrapolate(const TH2D &h, double rmax, double r, double zeta)
static double GetInclination(const utl::Point &position, const utl::TimeStamp &time)
returns inclination in radians
Rate-of-change model for spherical harmonics parametrisation of geomagnetic field.
ParametricGeoMagneticField Interpolate(const double year, const ParametricGeoMagneticField &later) const
Interpolate between two models Given a time as decimal year, interpolate coefficients between this an...
static double GetDeclination(const utl::Point &position, const utl::TimeStamp &time)
returns declination in radians
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
double GetBaseYear() const
A TimeStamp holds GPS second and nanosecond for some event.
Branch GetNextSibling() const
Get next sibling of this branch.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Class representing a document branch.
static MagneticFieldModel & instance()
static utl::Vector GetMagneticFieldVector(const utl::Point &position, const utl::TimeStamp &time)
returns the magnetic field at a specific place at a specific time
void GetData(bool &b) const
Overloads of the GetData member template function.
ParametricGeoMagneticField ModelForTime(const utl::UTCDate &date)
ParametricGeoMagneticField ModelForYear(double year)
Spherical harmonics parametrisation of geomagnetic field.
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
Get the magnetic field of the earth dependent on location and time.
double decimalYear(int year, int month, int day)
Branch GetFirstChild() const
Get first child of this Branch.
static Policy::type Create(const utl::Point &theOrigin)
Create the standard local coordinate system for a Point.
#define ERROR(message)
Macro for logging error messages.
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)