Jpp 19.3.0
the software that should make you happy
Loading...
Searching...
No Matches
JASTRONOMY::JAstronomy Class Reference

Auxiliary class to make coordinate transformations for a specific geographical location of the detector. More...

#include <JAstronomy.hh>

Inheritance diagram for JASTRONOMY::JAstronomy:
JASTRONOMY::JGeographicalLocation JASTRONOMY::JEllipsoid JASTRONOMY::angle_type_rad JASTRONOMY::angle_type JLANG::JEquals< JFirst_t, JSecond_t >

Public Member Functions

 JAstronomy (const JGeographicalLocation &location, const JEllipsoid &ellipsoid=EARTH_WGS84)
 Constructor.
 
JNeutrinoDirection getNeutrinoDirection (const double t1_s, const JSourceLocation &pos) const
 Get direction pointing to source given time and source location.
 
JSourceLocation getSourceLocation (const double t1_s, const JNeutrinoDirection &dir) const
 Get location of source given time and neutrino direction.
 
const JGeographicalLocationgetGeographicalLocation () const
 Get geographical location.
 
 operator JAngle3D () const
 Type conversion operator.
 
double getLatitude () const
 Get latitude.
 
double getLongitude () const
 Get longitude.
 
double getDot (const JGeographicalLocation &location) const
 Dot product.
 
void set (const angle_type_deg &angle)
 Convert angle.
 
bool equals (const angle_type &angle, const double precision=std::numeric_limits< double >::min()) const
 Check equality.
 
const JEllipsoidgetEllipsoid () const
 Get ellipsoid.
 

Public Attributes

double radius_m
 Ellipsoid radius [m];.
 
double eccentricity
 Ellipsoid eccentricity squared.
 

Protected Attributes

double _theta_
 
double _phi_
 

Detailed Description

Auxiliary class to make coordinate transformations for a specific geographical location of the detector.

Note that SLALIB reference system corresponds to (x,y,z) = (N,E,up).

Definition at line 991 of file JAstronomy.hh.

Constructor & Destructor Documentation

◆ JAstronomy()

JASTRONOMY::JAstronomy::JAstronomy ( const JGeographicalLocation & location,
const JEllipsoid & ellipsoid = EARTH_WGS84 )
inline

Constructor.

Parameters
locationlocation of detector
ellipsoidEarth ellipsoid

Definition at line 1003 of file JAstronomy.hh.

1003 :
1004 JGeographicalLocation(location),
1005 JEllipsoid(ellipsoid)
1006 {}
static Ellipsoid ellipsoid[]
JGeographicalLocation()
Default constructor.

Member Function Documentation

◆ getNeutrinoDirection()

JNeutrinoDirection JASTRONOMY::JAstronomy::getNeutrinoDirection ( const double t1_s,
const JSourceLocation & pos ) const
inline

Get direction pointing to source given time and source location.

Parameters
t1_stime since MJD [s]
possource location
Returns
direction of neutrino

Definition at line 1016 of file JAstronomy.hh.

1017 {
1018 double longitude = this->getLongitude();
1019 double latitude = this->getLatitude();
1020
1021 // Convert current mjd (UTC) to local sidereal time,
1022 // taking into account the Equation of the Equinoxes:
1023 // Note: LST = GMST + local longitude, where l.l. is +/- if east/west of prime meridian
1024
1025 double mjd = t1_s / NUMBER_OF_SECONDS_PER_DAY; // [days]
1026
1027 double gmst = slaGmst(mjd); // gmst = Greenwich mean sidereal time
1028 double eqeqx = slaEqeqx(mjd); // Note: Equation of the Equinoxes < 1.15 secs
1029 double lst = gmst + longitude + eqeqx;
1030
1031 // Transform time-independent equatorial coordinates to time-dependent equatorial coordinates (i.e.\ ra->ha):
1032
1033 double dec = pos.getDeclination();
1034 double ra = pos.getRightAscension();
1035 double ha = lst - ra;
1036
1037 // Convert time-dependent equatorial coordinates to local horizontal coordinates:
1038 // Note: azimuth: [0,2pi] and elevation: [-pi,pi]
1039
1040 double azimuth;
1041 double elevation;
1042
1043 slaDe2h(ha, dec, latitude, &azimuth, &elevation);
1044
1045 double theta = -elevation + PI/2.0;
1046 double phi = -azimuth + PI/2.0;
1047
1049
1050 // invert direction
1051
1052 theta = PI - theta;
1053 phi = phi + PI;
1054
1055 if (phi > PI) {
1056 phi -= 2.0*PI;
1057 }
1058
1059 return JNeutrinoDirection(theta, phi);
1060 }
double getMeridianConvergenceAngle(const JGeographicalLocation &location)
Get Meridian convergence angle.
static const double NUMBER_OF_SECONDS_PER_DAY
Definition JAstronomy.hh:44
const JEllipsoid & getEllipsoid() const
Get ellipsoid.
Definition JAstronomy.hh:64
double getLongitude() const
Get longitude.
const JGeographicalLocation & getGeographicalLocation() const
Get geographical location.
double getLatitude() const
Get latitude.

◆ getSourceLocation()

JSourceLocation JASTRONOMY::JAstronomy::getSourceLocation ( const double t1_s,
const JNeutrinoDirection & dir ) const
inline

Get location of source given time and neutrino direction.

Parameters
t1_stime since MJD [s]
dirdirection of neutrino
Returns
source location

Definition at line 1070 of file JAstronomy.hh.

1071 {
1072 double longitude = this->getLongitude();
1073 double latitude = this->getLatitude();
1074
1075 double theta = dir.getZenith();
1076 double phi = dir.getAzimuth();
1077
1078 // invert direction
1079
1080 theta = PI - theta;
1081 phi = phi - PI;
1082
1083 if (phi < PI) {
1084 phi += 2.0*PI;
1085 }
1086
1088
1089 double elevation = -theta + PI/2.0;
1090 double azimuth = -phi + PI/2.0;
1091
1092 double ha;
1093 double dec;
1094
1095 slaDh2e(azimuth, elevation, latitude, &ha, &dec);
1096
1097 double mjd = t1_s / NUMBER_OF_SECONDS_PER_DAY; // [days]
1098
1099 double gmst = slaGmst(mjd); // gmst = Greenwich mean sidereal time
1100 double eqeqx = slaEqeqx(mjd); // Note: Equation of the Equinoxes < 1.15 secs
1101 double lst = gmst + longitude + eqeqx;
1102 double ra = lst - ha;
1103
1104 return JSourceLocation(dec, ra);
1105 }

◆ getGeographicalLocation()

const JGeographicalLocation & JASTRONOMY::JGeographicalLocation::getGeographicalLocation ( ) const
inlineinherited

Get geographical location.

Returns
geographical location

Definition at line 881 of file JAstronomy.hh.

882 {
883 return static_cast<const JGeographicalLocation&>(*this);
884 }

◆ operator JAngle3D()

JASTRONOMY::JGeographicalLocation::operator JAngle3D ( ) const
inlineinherited

Type conversion operator.

Returns
polar angles [rad]

Definition at line 892 of file JAstronomy.hh.

893 {
894 return JAngle3D(PI/2 - _theta_, _phi_);
895 }

◆ getLatitude()

double JASTRONOMY::JGeographicalLocation::getLatitude ( ) const
inlineinherited

Get latitude.

Definition at line 898 of file JAstronomy.hh.

◆ getLongitude()

double JASTRONOMY::JGeographicalLocation::getLongitude ( ) const
inlineinherited

Get longitude.

Definition at line 899 of file JAstronomy.hh.

◆ getDot()

double JASTRONOMY::JGeographicalLocation::getDot ( const JGeographicalLocation & location) const
inlineinherited

Dot product.

Parameters
locationlocation
Returns
dot product

Definition at line 908 of file JAstronomy.hh.

909 {
910 return
911 sin(this->_theta_) * sin(location._theta_) +
912 cos(this->_theta_) * cos(location._theta_) * cos(this->_phi_ - location._phi_);
913 }

◆ set()

void JASTRONOMY::angle_type_rad::set ( const angle_type_deg & angle)
inlineinherited

Convert angle.

Parameters
angleangle [rad]

Definition at line 293 of file JAstronomy.hh.

294 {
295 static_cast<angle_type_rad&>(*this) = angle_type_rad(angle);
296 }
angle_type_rad()
Default constructor.

◆ equals()

bool JASTRONOMY::angle_type::equals ( const angle_type & angle,
const double precision = std::numeric_limits<double>::min() ) const
inlineinherited

Check equality.

Parameters
anglepair of angles
precisionprecision
Returns
true if angles are equal; else false

Definition at line 194 of file JAstronomy.hh.

196 {
197 return (fabs(this->_theta_ - angle._theta_) <= precision &&
198 fabs(this->_phi_ - angle._phi_) <= precision);
199 }

◆ getEllipsoid()

const JEllipsoid & JASTRONOMY::JEllipsoid::getEllipsoid ( ) const
inlineinherited

Get ellipsoid.

Returns
Earth ellipsoid

Definition at line 64 of file JAstronomy.hh.

65 {
66 return static_cast<const JEllipsoid&>(*this);
67 }

Member Data Documentation

◆ _theta_

double JASTRONOMY::angle_type::_theta_
protectedinherited

Definition at line 250 of file JAstronomy.hh.

◆ _phi_

double JASTRONOMY::angle_type::_phi_
protectedinherited

Definition at line 251 of file JAstronomy.hh.

◆ radius_m

double JASTRONOMY::JEllipsoid::radius_m
inherited

Ellipsoid radius [m];.

Definition at line 69 of file JAstronomy.hh.

◆ eccentricity

double JASTRONOMY::JEllipsoid::eccentricity
inherited

Ellipsoid eccentricity squared.

Definition at line 70 of file JAstronomy.hh.


The documentation for this class was generated from the following file: