#include <SkyDir.h>
Public Types | |
| enum | CoordSystem { GALACTIC, CELESTIAL } |
Public Methods | |
| SkyDir (double param1=0, double param2=0, CoordSystem inputType=CELESTIAL) | |
| Constructors(l,b) or (Ra, Dec) instantiation. More... | |
| SkyDir (Hep3Vector) | |
| Hep3Vector & | operator() () |
| return methods. More... | |
| double | l () const |
| double | b () const |
| double | ra () const |
| double | dec () const |
| const Hep3Vector & | dir () const |
| double | SkyDir::difference (const SkyDir &other) const |
| to return the opening angle (in radians) between two objects:. More... | |
Private Methods | |
| std::pair< double, double > | setGalCoordsFromDir () const |
Private Attributes | |
| Hep3Vector | m_dir |
Static Private Attributes | |
| HepRotation | s_celestialToGalactic = HepRotation().rotateZ(-282.25*M_PI/180).rotateX(-62.6*M_PI/180).rotateZ(33.*M_PI/180) |
Definition at line 19 of file SkyDir.h.
|
|
Definition at line 22 of file SkyDir.h. 00022 {
00023 GALACTIC,
00024 CELESTIAL
00025 };
|
|
||||||||||||||||
|
Constructors(l,b) or (Ra, Dec) instantiation.
Definition at line 7 of file SkyDir.cxx. 00007 {
00008 if(inputType == GALACTIC){
00009 double l = param1*M_PI/180;
00010 double b = param2*M_PI/180;
00011
00012 //here we construct the cartesian galactic vector
00013 Hep3Vector gamgal( cos(l)*cos(b) , sin(l)*cos(b) , sin(b) );
00014
00015 //get the transformation matrix from galactic to celestial coordinates.
00016 HepRotation galToCel = s_celestialToGalactic.inverse();
00017 //and do the transform to get the cartesian celestial vector
00018 m_dir = galToCel*gamgal;
00019
00020 }else if(inputType == CELESTIAL){
00021 double ra = param1*M_PI/180;
00022 double dec = param2*M_PI/180;
00023
00024 //here we construct the cartesian celestial vector
00025 m_dir = Hep3Vector( cos(ra)*cos(dec), sin(ra)*cos(dec) , sin(dec) );
00026
00027 }else{
00028 //improper coordinate system declaration - default things and say so.
00029 throw("Improper coordinate System declaration in SkyDir" );
00030
00031 m_dir = Hep3Vector(0,0,1);
00032 }
00033 }
|
|
|
Definition at line 35 of file SkyDir.cxx. 00035 : 00036 m_dir(dir){ 00037 } |
|
|
to return the opening angle (in radians) between two objects:.
|
|
|
Definition at line 63 of file SkyDir.cxx. 00063 {
00064 return setGalCoordsFromDir().second;
00065 }
|
|
|
Definition at line 75 of file SkyDir.cxx. Referenced by main().
00075 {
00076 return asin(m_dir.z())*180/M_PI;
00077 }
|
|
|
Definition at line 37 of file SkyDir.h. 00037 {return m_dir;}
|
|
|
Definition at line 59 of file SkyDir.cxx. 00059 {
00060 return setGalCoordsFromDir().first;
00061 }
|
|
|
return methods.
Definition at line 32 of file SkyDir.h. 00032 {return m_dir;}
|
|
|
Definition at line 67 of file SkyDir.cxx. Referenced by main().
00067 {
00068 double ra=atan2(m_dir.y(), m_dir.x())*180/M_PI;
00069 //fold RA into the range (0,360)
00070 while(ra < 0) ra+=360.;
00071 while(ra > 360) ra -= 360.;
00072 return ra;
00073 }
|
|
|
Definition at line 41 of file SkyDir.cxx. 00041 {
00042
00043 //do the transform to get the galactic celestial vector
00044 Hep3Vector pointingin(s_celestialToGalactic*m_dir);
00045
00046 // pointingin is the galactic cartesian pointing vector,
00047 //where yhat points at the galactic origin.
00048 // we want to make this into l and b now.
00049 double l = atan2(pointingin.y(), pointingin.x());
00050 double b = asin(pointingin.z());
00051
00052 l *= 360./M_2PI;
00053 b *= 360./M_2PI;
00054
00055 return std::make_pair<double,double>(l,b);
00056 }
|
|
|
|
|
|
Definition at line 39 of file SkyDir.cxx. |
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001