
The Legacy survey is restricted
to high latitudes, and \photo\  is adequate everywhere
there.  But at lower latitudes, when the density of stars brighter
than $r=21$ grows above 5000 deg$^{-2}$, the pipeline
is known to fail, due to a combination of being unable to find
sufficiently isolated stars to measure an accurate PSF and limitations
of the deblender.   Many of the SEGUE scans probe these low
latitudes (Figure~\ref{fig:skydist}), and we therefore adapted an
alternative stellar photometry code developed by the Pan-STARRS team
(Kaiser 2002) to be used for these runs.

Magnier (2006) has developed this code, PSPhot, to be used for the
Pan-STARRS project; like, e.g., DOPHOT {\bf ref}, it begins with the
assumption that every object is unresolved, and therefore does a
better job in crowded stellar regions.  It uses an analytical model as
to describe the basic PSF shape, with parameters which may vary across
the field of the image to follow the PSF variations.  The software may
use any of several functions to describe the radial profile (Gaussian;
polynomial Gaussian approximation; and other power-law models), all of
which are implemented as a 2D model using an elliptical contour.  The
{\bf ??} model was used for the SEGUE scans.

In addition to the analytical model, PSPhot uses a pixel-based
representation of the residuals between the PSF objects and the
analytical model, with the residual pixel contribution also varying
across the field of the image.

Candidate PSF stars are selected from the collection of bright objects
in the frame by examining the distribution of the second moments of
the objects and searching for a tight clump representing the PSF.  The
candidate stars are fitted independently to the PSF model function,
with all of the parameters fitted.  Poorly fitting objects are then
excluded, and the fit parameters for the remaining objects are used to
constrain the 2D variations in the PSF model.

Note that unlike \photo, the code processes each frame separately
(without any requirement of continuity of PSF estimation across frame
boundaries), and each filter separately (without any requirement that
the list of objects between the separate filters agree).  The pipeline
outputs positions and PSF magnitudes (and errors) for each detected
object.  The resulting photometry is then matched between filters
using a $1^{\prime\prime}$ {\bf ??} radius.
