casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GBTMSPointingFiller.h
Go to the documentation of this file.
00001 //# GBTMSPointingFiller.h: GBTMSPointingFiller fills the MSPointing table for GBT fillers
00002 //# Copyright (C) 2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id$
00028 
00029 #ifndef NRAO_GBTMSPOINTINGFILLER_H
00030 #define NRAO_GBTMSPOINTINGFILLER_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/Arrays/Vector.h>
00034 #include <casa/Containers/SimOrdMap.h>
00035 #include <scimath/Mathematics/StatAcc.h>
00036 #include <measures/Measures/MDirection.h>
00037 #include <casa/Quanta/MVTime.h>
00038 #include <tables/Tables/ArrayColumn.h>
00039 #include <tables/Tables/ScalarColumn.h>
00040 #include <measures/TableMeasures/ArrayMeasColumn.h>
00041 #include <ms/MeasurementSets/MSPointing.h>
00042 
00043 //# Forward Declarations
00044 namespace casa { //# NAMESPACE CASA - BEGIN
00045 class MSPointingColumns;
00046 class MeasurementSet;
00047 } //# NAMESPACE CASA - END
00048 
00049 #include <casa/namespace.h>
00050 
00051 class GBTAntennaDAPFiller;
00052 class GBTAntennaFile;
00053 class GBTPointModelFiller;
00054 class GBTMeanFocusFiller;
00055 
00056 // <summary>
00057 // GBTMSPointingFiller fills the MSPointing table for GBT fillers
00058 // </summary>
00059 
00060 // <use visibility=local>
00061 
00062 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00063 // </reviewed>
00064 
00065 // <prerequisite>
00066 //   <li> MeasurementSets
00067 //   <li> GBT FITS files
00068 // </prerequisite>
00069 //
00070 // <etymology>
00071 // This class puts GBT data (fills) into the MSPointing table.
00072 // </etymology>
00073 //
00074 // <synopsis>
00075 // This class puts the appropriate values for the GBT in an MSPointing
00076 // table (which has been previously created as part of a MeasurementSet).
00077 // On each fill() any necessary additions to the MSPointing are made.  
00078 // Each fill() adds a new row to the MSPointing table.
00079 // 
00080 // The pointingId is available to be used by 
00081 // other GBTMS*Fillers as other subtables are filled in turn.
00082 //
00083 // </synopsis>
00084 //
00085 // <example>
00086 // </example>
00087 //
00088 // <motivation>
00089 // Writing a filler is a daunting task.  There are various dependencies
00090 // between the subtables.  It helps to encapsulate the knowlege and
00091 // task of filling a specific subtable to separate classes.
00092 // </motivation>
00093 //
00094 //#! <thrown>
00095 //#! A list of exceptions thrown if errors are discovered in the function.
00096 //#! This tag will appear in the body of the header file, preceding the
00097 //#! declaration of each function which throws an exception.
00098 //#! </thrown>
00099 
00100 class GBTMSPointingFiller
00101 {
00102 public:
00103 
00104     // The default ctor.  No MSPointing table has been attached yet.
00105     // Calling fill on such a filler will throw an exception.
00106     // It is present so that this object can be instantiated before
00107     // an MSPointing has been created.
00108     GBTMSPointingFiller();
00109 
00110     // A filler attached to an MSPointing table
00111     GBTMSPointingFiller(MSPointing &msPointing);
00112 
00113     ~GBTMSPointingFiller();
00114 
00115     // attach it to an MSPointing
00116     void attach(MSPointing &msPointing);
00117 
00118     // Use the indicated antenna DAP filler to get the antenna positions
00119     // from.  This class is not responsible for deleting this pointer.
00120     void setAntennaDAPFiller(GBTAntennaDAPFiller *antennaDAPFiller);
00121 
00122     // Use the indicated antenna file to get the antenna positions.
00123     // This class is not responsible for deleting this pointer.
00124     // If there is an attached antenna file, this always takes precendence
00125     // over any attached antenna DAP filler.
00126     void setAntennaFile(GBTAntennaFile *antennaFile);
00127 
00128     // fill using the indicated sourceId and using the times to get the
00129     // appropriate antenna positions at those times to be stored in the MSPointing table.
00130     // Each fill() call adds times.nelements() rows to MSPointing IF there are antenna
00131     // positions, otherwise just a single row will be added.  This assumes that
00132     // same integration interval applies to all times in a given fill.
00133     void fill(MeasurementSet &ms, Int antennaId, const Vector<Double> &times, Double interval);
00134 
00135     // this is the row numbers of the most recently "filled" MSPointing row
00136     // it returns an empty vector if nothing has been filled yet
00137     const Vector<Int> &pointingId() const {return pointingId_p;}
00138 
00139     // flush the underlying MS subtable and the model and focus fillers
00140   void flush();
00141 
00142 private:
00143     MSPointing *msPointing_p;
00144     MSPointingColumns *msPointingCols_p;
00145 
00146     Vector<Int> pointingId_p;
00147 
00148     GBTAntennaDAPFiller *antDAPFiller_p;
00149     GBTAntennaFile *antennaFile_p;
00150 
00151     GBTPointModelFiller *modelFiller_p;
00152     // this ultimately belongs in the FEED table, I think.
00153     GBTMeanFocusFiller *focusFiller_p;
00154 
00155     // NRAO_GBT_USER_DIRECTION column - this is a ArrayMeasColumn<MDirection>
00156     // where the number of elements is given by NUM_POLY as with the DIRECTION
00157     // column but where the reference frame may vary from row to row.
00158     ArrayMeasColumn<MDirection> userDirection_p;
00159 
00160     // hacks until I know how to really set the user-defined coordinate system
00161     ScalarColumn<Double> userEquinox_p;
00162     ScalarColumn<Bool> userDefined_p;
00163 
00164     // NRAO_GBT_MEAN_FOCUS_ID column, id to mean focus table
00165     ScalarColumn<Int> meanFocusId_p;
00166 
00167     StatAcc<Double> raStatAcc_p, decStatAcc_p;
00168 
00169     // to be used when filling the TIME column
00170     MVTime j2000_p;
00171 
00172     // initialize the above for the first time
00173     void init(MSPointing &msPointing);
00174 
00175     // undefined and unavailable
00176     GBTMSPointingFiller(const GBTMSPointingFiller &other);
00177     void operator=(const GBTMSPointingFiller &other);
00178 };
00179 
00180 #endif
00181 
00182