<& /htmlheader &>

<& modelheader &>
<h2>Linking and Orbit Determination Efficiency<br>
Field <% $fieldId %><br>
MJD <% $f->epoch %>
</b>

<h3>Precoveries</h3>
<table border=1 cellspacing=0 cellpadding=2 width="90%">
<tr>
<th class="darkheader"> Event ID </th>
<th class="darkheader"> Timestamp </th>
<th class="darkheader"> Derived<br>Object Name </th>
<th class="darkheader"> SSM<br>Object Name </th>
<th class="darkheader"> Class </th>
<th class="darkheader"> Orbit </th>
<th class="darkheader"> Resid<br>(arcsec) </th>
<th class="darkheader"> Ephemeris Dist<br>(arcsec) </th>
<th class="darkheader"> 1-&#963; Uncertainty<br>(arcsec) </th>
<th class="darkheader"> Details </th>
</tr>

% foreach $h (sort { 
%    ($a->classification cmp $b->classification) || 
%    ($a->orbitCode cmp $b->orbitCode)
% } @{$goo}) {

<tr>

% my $name;
% if ($h->derivedobjectId) {
%    my $do = modcdo_retrieve($inst, derivedobjectId => $h->derivedobjectId);
%    my $orb = ($h->orbitId ? modco_retrieve($inst, orbitId => $h->orbitId) : undef);
%    $name = modcs_ssmId2objectName($inst, $do->ssmId); # $h->ssmId unreliable still
    <td align="center"> <% $h->eventId %> </td>
    <td align="center"> <% $h->eventTime %> </td>
    <td align="center"> <% $do->objectName %> </td>
% if ($do->ssmId) {
    <td align="center"> <a href="ssm.html?ssmId=<% $do->ssmId %>"><% $name %></a> </td>
% } else {
    <td align="center"> N/A </td>
% }
    <td align="center"> <% $MOPS_EFF_DESCS{$h->classification} %> </td>
    <td align="center"> <% $h->orbitCode %> </td>
    <td align="center"> <% $orb ? (sprintf "%.3f", $orb->residual) : 'N/A' %> </td>
    <td align="center"> <% sprintf "%.3f", $h->ephemerisDistance %> </td>
    <td align="center"> <% sprintf "%.3f", $h->ephemerisUncertainty %> </td>
    <td align="center"> <a href="dohist.html?derivedobjectId=<% $do->derivedobjectId %>">History</a></td>
% } 

</tr>
% } # foreach
</table>

<& /htmlfooter &>

<%args>
$fieldId
</%args>

<%init>
my $h;
my $inst = $m->notes('INST');
use PS::MOPS::Constants qw(:all);
use PS::MOPS::DC::DerivedObject;
use PS::MOPS::DC::History::Precovery;
use PS::MOPS::DC::SSM;
use PS::MOPS::DC::Orbit;
use PS::MOPS::DC::Field;
my $goo = modchp_retrieve($inst, fieldId => $fieldId);
my $f = modcf_retrieve($inst, fieldId => $fieldId);
</%init>
