#ifndef TS_TARGET_H
#define TS_TARGET_H

#include <sdb.h>
#include <arChunk.h>
#include <arObject.h>
#include <arObjectList.h>
#include <arTrans.h>
#include <arPTrans.h>
#include <arPSCalib.h>
#include <arFrameStat.h>
#include <arAstromCalib.h>
#include <arFinalPhotoCalib.h>
#include <dervish.h>
#include <taCalibObj.h>
#include <taQuasars.h>
#include <taGalaxies.h>
#include <taStars.h>
#include <taSerendipity.h>
#include <taStandards.h>
#include <taTarget.h>
#include <taCatalogs.h>
#include <taRosat.h>

// Function declarations
RET_CODE
tsObjCalibrate(const ooHandle(arObject)& in,
	       TA_CALIB_OBJ *out,
	       const TA_PTRANS *ptrans,
	       const TRANS *trans[5],
	       const TRANS *transPhoto[5],
	       double node,
	       double incl,
	       char refFilter,
	       double expTime);

RET_CODE
tsSegmentCalibrate(ooHandle(arSegment)& segment,
		   ooHandle(arFramesPipeRun)& fpr,
		   int field0Proc,
		   int nFieldsProc,
		   int export,
		   int parents,
		   int split,
		   int select,
		   int force,
		   int noUpdate,
		   const char *outputDir,
		   const ooHandle(ooContObj) *targetCluster = NULL,
		   const ooHandle(ooContObj) *firstCluster = NULL,
		   const ooHandle(ooContObj) *rosatCluster = NULL,
		   const TA_GALAXIES_PARAMS *galaxiesParams = NULL,
		   const TA_QUASARS_PARAMS *quasarsParams = NULL,
		   const TA_SERENDIPITY_PARAMS *serendipityParams = NULL,
		   const TA_ROSAT_PARAMS *rosatParams = NULL,
		   const TA_STARS_PARAMS *starsParams = NULL,
		   const TA_STANDARDS_PARAMS *standardsParams = NULL,
		   TA_FIRST_CATALOG *first = NULL,
		   TA_ROSAT_CATALOG *rosat = NULL,
		   TA_USNO_CATALOG *usno = NULL);
RET_CODE tsSegmentTargetUnselect(ooHandle(arSegment)& segment);
TBLCOL *tsFieldTblColInit(int nRows);
RET_CODE tsFieldTblColSet(TBLCOL *tblCol,
			  int row,
			  int field,
			  double expTime,
			  const arFieldPTrans& fieldPTrans,
			  const int32 *numStars,
			  const TRANS& uTrans,
			  const TRANS& gTrans,
			  const TRANS& rTrans,
			  const TRANS& iTrans,
			  const TRANS& zTrans,
			  const arFieldPhotoTrans psTrans,
			  const arFieldPhotoTrans2 psTrans2,
			  const ooHandle(arObjectList)& objList
			  );

void tsGenericChainDestroy(CHAIN *chain);
#endif
