#!/usr/bin/perl

printf("<html><head>\n");

printf("<title> TOF Calibration results </title>");
$datestring=`date`;
chop($datestring);
printf("</head><body><h1>TOF Calibration</h1><br>Generated: $datestring<br>\n");
$runs=`cat runs.list`;
printf("<h2>Runs: [<font color=blue size=2>$runs</font>]\n</h2><br><hr>");

@txt = `ls files*txt`;

foreach $f (@txt)
{
    chop($f);
    printf("Calibration results: <a href=\"$f\">$f</a><br>\n");
}

@logs = ("run.log");

foreach $f (@logs) 
{
    #chop($f);
    printf("Logfile: <a href=\"$f\">$f</a><br>\n");
}

@plots = `ls files_*.list`;

foreach $f (@plots) 
{
    chop($f);
   # ($n,$ext) = split(".gif",$f);
    printf("<a href=\"$f\_qmip.eps\"><img src=\"$f\_qmip.gif\"></a><br>\n");
    printf("<a href=\"$f\_speed.eps\"><img src=\"$f\_speed.gif\"></a><br>\n");
    printf("<a href=\"$f\_walk.eps\"><img src=\"$f\_walk.gif\"></a><br>\n");
    printf("<a href=\"$f\_slope.eps\"><img src=\"$f\_slope.gif\"></a><br>\n");
    printf("<a href=\"$f\_res.eps\"><img src=\"$f\_res.gif\"></a><br>\n");
    printf("<a href=\"$f\_sigma.eps\"><img src=\"$f\_sigma.gif\"></a><br>\n");   
}

$files = `cat files.list`;

printf("<hr><br>List of files used:<pre>$files</pre>\n");
printf("</html>");

