#!/usr/bin/perl 

use strict;
use warnings;

my $rungrp=$ARGV[0];
my $valplt="prdwww/cdfprd_cal/Status/Valid_Plots";
my $htmDir="/$valplt/$rungrp/beamlines";
my $pltDir="/cdf/$htmDir";
my $sdate=`date`;

print "<html><head><title>Beamline Validation: $rungrp</title></head>\n";
print "<body>\n";
print "<h2 align=center>Beamline Validation: $rungrp ($sdate)</center></h2>\n";
makePlot("fitcode_svx", "Fit codes");
makePlot("fitcode_cot", "Fit codes");
makePlot("svx", "SVX");
makePlot("cot", "COT");
makePlot("diff", "Diff");
makePlot("pulls", "Pulls");
makePlot("pulls_distr", "Pull Histograms");

	       
print "</body></html>\n";


sub makePlot {
  system "rm -f $pltDir/$_[0]\_$rungrp.gif";
  system "convert $pltDir/$_[0]\_$rungrp.eps $pltDir/$_[0]\_$rungrp.gif";
  print "<h4>$_[1]</h4>\n";
  print "<a href=$htmDir/$_[0]\_$rungrp.eps><img width=48% 
             src=$htmDir/$_[0]\_$rungrp.gif /></a> &nbsp";
  print "<br><br>\n";
}

exit;

