GalacticCoords.hxx

Go to the documentation of this file.
00001 
00002 
00003 
00004 //-----------------------------------------------------------------------------
00005 // CVS: $Revision: 4695 $, $Date: 2008-04-09 16:18:42 +0100 (Wed, 09 Apr 2008) $, $Author: EckhardSutorius $
00006 //-----------------------------------------------------------------------------
00007 #ifndef GALACTICCOORDS_H
00008 #define GALACTICCOORDS_H
00009 
00010 extern "C"
00011 {
00012   #include "slalib.h"
00013 }
00014 
00015 #include "Constants.h"
00016 #include "Converter.h"
00017 #include "DataMethod.hxx"
00018 #include "StringOps.h"
00019 //-----------------------------------------------------------------------------
00023 template<typename DataType>
00024 class GalacticCoords : public DataMethod<DataType>
00025 {
00026 public:
00028   GalacticCoords() { DataMethod<DataType>::methodName = "GalacticCoords"; }
00029 
00031   virtual ~GalacticCoords() { }
00032 
00033   //---------------------------------------------------------------------------
00035   void setSource(IntMap& tbls, IntMap& cols, StringMap units)
00036   {
00037     raColno  = cols[0];
00038     decColno = cols[1];
00039 
00040     // Require radians for the calculation
00041     mDecFact = converter.getFactor(units[0], "RADIANS");
00042     mRAFact  = converter.getFactor(units[1], "RADIANS");
00043   }
00044   //---------------------------------------------------------------------------
00046   void setTarget(IntMap& cols, StringMap units)
00047   {
00048     lColno = cols[0];
00049     bColno = cols[1];
00050 
00051     // Check required output units for (l,b)
00052     mlFact = converter.getFactor("RADIANS", units[0]);
00053     mbFact = converter.getFactor("RADIANS", units[1]);
00054   }
00055   //---------------------------------------------------------------------------
00057   void doit(TableData<DataType>& data, int row1, int row2)
00058   {
00059     for (int rowNo = row1; rowNo < row2; ++rowNo)
00060     {
00061       // Input RA and DEC
00062       double ra, dec;
00063       data.value(raColno, rowNo, ra);
00064       data.value(decColno, rowNo, dec);
00065 
00066       double dl, db;
00067       // Get l and b (2000J) from slalib
00068       cslaEqgal(ra*mRAFact, dec*mDecFact, &dl, &db);
00069 
00070       // Convert to required units
00071       dl *= mlFact;
00072       db *= mbFact;
00073 
00074       // Assign to correct columns
00075       data.assign(lColno, rowNo, dl);
00076       data.assign(bColno, rowNo, db);
00077     }
00078   }
00079 
00080   // No data from raw data included
00081   void doit2(TableData<DataType>& rawData, TableData<DataType>& data, int row1, int row2) { }
00082   //---------------------------------------------------------------------------
00083 private:
00084   int lColno;
00085   int bColno;
00086   int raColno;
00087   int decColno;
00088   double mDecFact;
00089   double mRAFact;
00090   double mlFact;
00091   double mbFact;
00092   Converter converter;
00093 };
00094 //-----------------------------------------------------------------------------
00095 #endif
00096 //-----------------------------------------------------------------------------
00097 // Change log:
00098 //
00099 // 27-May-2004,  IAB: Original version.
00100 // 22-Mar-2007,  RSC: Robustified against dodgy WCS values.
00101 //  2-May-2007,  RSC: Reverted to original design of allowing dodgy WCS values.
00102 //  7-Apr-2008, ETWS: Upgraded to use new detection table layout.

Generated on Thu Apr 2 21:52:16 2009 for WfcamSrc by  doxygen 1.5.2