Page MenuHomeHEPForge

pdfplot_hessian.pl
No OneTemporary

pdfplot_hessian.pl

#!/usr/bin/perl
use CGI qw(param header p);
print header('text/html');
print "<head>";
print "<style type='text/css'>";
print " .table, .table TD, .table TH, body";
print " {";
print " font-family:Helvetica;";
print " font-size:10pt;";
print " background-color:which;";
print " margin-left:20pt;";
print " }";
print " #mysubmit { background-color: #cfc; font-size: 100%; padding: 0px; font-weight: bold; }";
print " #myparton { background-color: #cfc; font-size: 100%; padding: 0px; font-weight: bold; }";
print "</style>";
print "</head> ";
print "<body>";
@types = qw(all up down upbar downbar strange charm bottom gluon upv downv);
@plcis = qw( 0 1 2 4 3 5 6 7 8 9 );
$ENV{'LD_LIBRARY_PATH'} = "/home/whalley/local/lib";
$ENV{'LHAPATH'} = "/home/whalley/pdfsets";
$first = 1;
$xmin = param("xmin");
$xmax = param("xmax");
if ($xmax eq '1') { $xmax = 0.999; }
if ($xmax eq '1.') { $xmax = 0.999; }
if ($xmax eq '1.0') { $xmax = 0.999; }
if ($xmax eq '1.00') { $xmax = 0.999; }
if ($xmax eq '1.000') { $xmax = 0.999; }
$xinc = param("xinc");
$qscale = param("scale");
$xbinning = param("binning");
$ymax = param("ymax");
$numplot = param("numplot");
foreach $n (1...3){
$plot[$n] = param("plot$n");
$typ[$n] = param("typ$n");
if($n == 3) { $typ[3] = $typ[1];}
# $which[$n] = param("Which$n");
$which[$n] = param("Which$n");
if($which[$n] =~ m/\//){ ($text[$n],$which[$n],$member[$n]) = split /\//,$which[$n],3;}
else{ $member[$n] = 0; $text[$n] = $which[$n]; }
$sf[$n] = param("sf$n");
}
print "<h2><font color='blue'> $which[1] PDF Error Limits\n";
if ($plot[2] eq 'on') {
print "<br>and comparison with $which[2] PDF Error Limits";
}
if ($plot[3] eq 'on') {
print "<br>and comparison with $which[3] PDF";
}
print "</font></h2>";
$tempdir = `/home/whalley/bin/mktmp`;
chomp $tempdir;
foreach $n (1...3){
if($plot[$n] eq 'on'){
foreach $i(0...10){
if($typ[$n] eq $types[$i]) {$iqtype = $i;}
}
if($iqtype == 0){
system("/home/whalley/pdf-cgi/pdfplotallE $which[$n] $xmin $xmax $xinc $qscale $xbinning $ymax $numplot $sf[1]");
exit();
}
#
# next section first time through only
#
if ($first == 1){
$first = 0;
system("mkdir $tempdir");
open KUMAC,">$tempdir/temp.kumac";
print KUMAC "opt zfl1\n";
print KUMAC "opt nbox\n";
print KUMAC "opt ndat\n";
print KUMAC "opt ngri\n";
print KUMAC "opt liny\n";
print KUMAC "opt linx\n";
print KUMAC "size 20 30\n";
print KUMAC "zone 1 2 1\n";
if ($xbinning == 1){
print KUMAC "opt linx\n";
print KUMAC "null 0 1.0 0.0 $ymax\n";
}
else {
print KUMAC "opt logx\n";
print KUMAC "null $xmin $xmax 0.0 $ymax\n";
}
print KUMAC "ticks\n";
print KUMAC "set asiz 0.4\n";
print KUMAC "atitle x xf(x,Q2)\n";
$npoint = `echo $xbinning $xmin $xmax $xinc | /home/whalley/bin/findbin`;
$npoint++;
}
else {
print KUMAX "zone 1 2 1 s\n";
if( $xbinning == 1) {
print KUMAC "opt linx\n";
print KUMAC "null 0 1.0 0.0 $ymax\n";
}
else {
print KUMAC "opt logx\n";
print KUMAC "null $xmin $xmax 0.0 $ymax\n";
}
}
#
# end of first time through
#
# get output files from pdf programmes
#
# first the error and the normal ones programmes
#
chdir "/home/whalley/pdflib/lhapdf";
if ($n == 3) {
$temp = `echo "$which[$n] $member[$n] $xmin $xmax $xinc $qscale $xbinning $iqtype 1" | ./pdf | ./noheader >> $tempdir/temp.dat$n`;
}
else {
$temp = `echo "$which[$n] $xmin $xmax $xinc $qscale $xbinning $iqtype" | ./pdfE | ./noheader >> $tempdir/temp.dat$n`;
}
#
#end of getting pdf files
#
system("echo ' ' >> $tempdir/temp.dat$n");
system("echo ' ' >> $tempdir/temp.dat$n");
system("mv $tempdir/temp.dat$n $tempdir/temp.dat$n_temp");
system("cat $tempdir/temp.dat$n_temp | grep -v WARNING > $tempdir/temp.dat$n");
system("rm $tempdir/temp.dat$n_temp");
#
print KUMAC "ve/cr q($npoint)\n";
#read in the data file
chdir $tempdir;
if ($n == 3) {
$times_temp = `echo $n | /home/whalley/bin/pdfmod`;
}
else {
$times_temp = `echo $n | /home/whalley/bin/pdfmodE`;
}
print KUMAC "$times_temp\n";
#
print KUMAC "ve/co v(1,1:$npoint) x\n";
print KUMAC "ve/co v(3,1:$npoint) y\n";
if ($n != 3) {
print KUMAC "ve/co v(4,1:$npoint) ey\n";
print KUMAC "ve/co v(5,1:$npoint) eyp\n";
print KUMAC "ve/co v(6,1:$npoint) eyn\n";
}
if($n == 1) { print KUMAC "sigma yref = y\n"; }
print KUMAC "igset plci $plcis[$n]\n";
print KUMAC "igset lwid 3\n";
print KUMAC "igset ltyp $n\n";
#
if ($n != 3) {
print KUMAC "sigma ysave = y\n";
print KUMAC "sigma ytemp = y + ey\n";
print KUMAC "graph $npoint x ytemp c\n";
print KUMAC "sigma ytemp = y - ey\n";
print KUMAC "graph $npoint x ytemp c\n";
}
else {
print KUMAC "graph $npoint x y c\n";
}
print KUMAC "opt linx\n";
print KUMAC "null 0 1 0 1 as\n";
if ($n != 3) {
print KUMAC "fbox 0.04 0.15 0.92 0.97 0.035 0.155 0.915 0.975\n";
print KUMAC "text 0.055 0.95 HEPDATA 0.2\n";
print KUMAC "text 0.05 0.93 Databases 0.2\n";
$ypos = 0.85;
print KUMAC "text 0.5 0.9 Q**2= 0.3\n";
print KUMAC "text 0.62 0.9 $qscale 0.3\n";
print KUMAC "text 0.75 0.9 GeV**2 0.3\n";
}
if ($n == 3) {$ypos = 0.75;}
if ($n == 2) {$ypos = 0.8;}
print KUMAC "line 0.5 $ypos 0.55 $ypos\n";
print KUMAC "text 0.57 $ypos $typ[$n] 0.3\n";
print KUMAC "text 0.7 $ypos $which[$n] 0.3\n";
print KUMAC "zone 1 2 2 s\n";
print KUMAC "igset plci $plcis[$n]\n";
print KUMAC "igset lwid 3.0\n";
print KUMAC "igset ltyp $n\n";
if ($n != 3) {
if ($xbinning == 1) {
print KUMAC "opt linx\n";
print KUMAC "null 0 1.0 -sf[1] $sf[1]\n";
}
else {
print KUMAC "opt logx\n";
print KUMAC "null $xmin $xmax -$sf[1] $sf[1]\n";
}
print KUMAC "atitle 'x' 'percentage.error'\n";
print KUMAC "ticks\n";
print KUMAC "igset ltype 1\n";
if($n == 1) {
print KUMAC "sigma pct = 100*eyp/y\n";
print KUMAC "graph $npoint x pct c\n";
print KUMAC "sigma pct = -100*eyn/y\n";
print KUMAC "graph $npoint x pct c\n";
}
elsif($n == 2) {
# print KUMAC "sigma pct = 100*(1-(y+eyp)/yref)\n";
print KUMAC "sigma pct = 100*eyp/y\n";
print KUMAC "sigma pct = pct+(100*(y-yref)/yref)\n";
print KUMAC "graph $npoint x pct c\n";
# print KUMAC "sigma pct = 100*(1-(y-eyn)/yref)\n";
print KUMAC "sigma pct = -100*eyn/y\n";
print KUMAC "sigma pct = pct+(100*(y-yref)/yref)\n";
print KUMAC "graph $npoint x pct c\n";
}
print KUMAC "opt linx\n";
print KUMAC "null 0 1 0 1 as\n";
print KUMAC "ve/de v q y ey ytemp x\n";
print KUMAC 'text 0.225 0.85 "A# 0.3',"\n";
if($which[$n] =~ m/^a02m/ || $which[$n] =~ m/^abkm/) {
}
elsif($which[$n] =~ m/^NNPDF/){
print KUMAC "text 0.25 0.875 1 0.3\n";
print KUMAC "text 0.25 0.85 - 0.3\n";
print KUMAC "text 0.25 0.825 10 0.3\n";
}
else {
print KUMAC "text 0.25 0.875 1 0.3\n";
print KUMAC "text 0.25 0.85 - 0.3\n";
print KUMAC "text 0.25 0.825 2 0.3\n";
}
print KUMAC 'text 0.28 0.85 "R# 0.55',"\n";
print KUMAC "text 0.325 0.85 [S] 0.55\n";
if($which[$n] =~ m/^a02m/ || $which[$n] =~ m/^abkm/) {
print KUMAC "text 0.35 0.86 ([s](i))^2! 0.35\n";
}
elsif($which[$n] =~ m/^NNPDF/){
print KUMAC "text 0.35 0.86 ([s](i)-[s](0))^2! 0.35\n";
}
else{
print KUMAC "text 0.35 0.86 ([s](2i-1)-[s](2i))^2! 0.35\n";
}
print KUMAC "text 0.325 0.815 i=1 0.25\n";
# print KUMAC "text 0.325 0.915 20 0.25\n";
if($which[$n] =~ m/^MRST/) {
print KUMAC "text 0.325 0.915 15 0.25\n";
} elsif ($which[$n] =~ m/^MSTW/) {
print KUMAC "text 0.325 0.915 20 0.25\n";
} elsif ($which[$n] =~ m/^ZEUS/) {
print KUMAC "text 0.325 0.915 11 0.25\n";
} elsif ($which[$n] =~ m/^HERAPDF/) {
print KUMAC "text 0.325 0.915 10 0.25\n";
} elsif ($which[$n] =~ m/^H12000/) {
print KUMAC "text 0.325 0.915 10 0.25\n";
} elsif ($which[$n] =~ m/^a02m/) {
print KUMAC "text 0.325 0.915 17 0.25\n";
} elsif ($which[$n] =~ m/^abkm/) {
print KUMAC "text 0.325 0.915 25 0.25\n";
} elsif ($which[$n] =~ m/^CT10/) {
print KUMAC "text 0.325 0.915 26 0.25\n";
} elsif ($which[$n] =~ m/^cteq66/) {
print KUMAC "text 0.325 0.915 22 0.25\n";
} elsif ($which[$n] =~ m/^cteq6/) {
print KUMAC "text 0.325 0.915 20 0.25\n";
} elsif ($which[$n] =~ m/^NNPDF/) {
print KUMAC "text 0.325 0.915 100 0.25\n";
} else {
print KUMAC "text 0.325 0.915 20 0.25\n";
}
}
else {
if ($xbinning == 1) {
print KUMAC "opt linx\n";
print KUMAC "null 0 1.0 -$sf[1] $sf[1]\n";
}
else {
##this is the single comparison pdf on the bottom plot
print KUMAC "opt logx\n";
print KUMAC "null $xmin $xmax -$sf[1] $sf[1]\n";
print KUMAC "sigma pct = 100*(y-ysave)/ysave\n";
print KUMAC "graph $npoint x pct c\n";
}
}
}
}
close KUMAC;
if ($numplot eq plot) {
open KUMAC2,">$tempdir/temp2.kumac";
print KUMAC2 "Macro plot_file\n";
print KUMAC2 "For/File 1 $tempdir/plotpaw.ps\n";
print KUMAC2 "Metafile -1 -111\n";
close KUMAC2;
system("cat $tempdir/temp.kumac >> $tempdir/temp2.kumac");
open KUMAC2,">>$tempdir/temp2.kumac";
print KUMAC2 "close 1\n";
print KUMAC2 "exit\n";
close KUMAC2;
print "<body>\n";
print "<table class='table'>\n";
print "<td>\n" ;
system("cat $tempdir/temp2.kumac | sed 's/</{L#/g' | sed 's/>/{G#/g' | tr '\173' '\042' > $tempdir/plot_file.kumac");
system("/usr/bin/paw -n -b $tempdir/temp2 > /dev/null");
system("cp $tempdir/plotpaw.ps /var/www/plots/");
system("/usr/bin/convert $tempdir/plotpaw.ps /var/www/plots/plotpaw.png > /dev/null");
print "<a href=/pdf-plots/plotpaw.ps><font face=helvetia,sans-serif color='blue'> (postscript version)</font></a>";
print "<a href=/pdf-plots/plotpaw.ps><img src=/pdf-plots/plotpaw.png></a>";
print "<tr><td><font face=helvetia,sans-serif><b> ";
print "The percentage errors are calculated from the error analyses as decribed by the ";
print " authors of $which[1] by summing over the pdfs given in the";
print " eigenvector grids, in the following way:<br><br>";
if ($which[1] =~ m/^a02m/) { print "<b>pdf(central) +- sqrt[sum_i=1,17 {pdf(i)}^2</b> ]"; }
elsif($which[1] =~ m/^abkm/) { print "<b>pdf(central) +- sqrt[sum_i=1,25 {pdf(i)}^2</b> ]"; }
elsif($which[1] =~ m/^MRST/) { print "<b>pdf(central) +- 1/2 sqrt[sum_i=1,15 {pdf(2i-1) - pdf(2i)}^2</b> ]"; }
elsif($which[1] =~ m/^MSTW/) { print "<b>pdf(central) +- 1/2 sqrt[sum_i=1,20 {pdf(2i-1) - pdf(2i)}^2</b> ]"; }
elsif($which[1] =~ m/^ZEUS/) { print "<b>pdf(central) +- 1/2 sqrt[sum_i=1,11 {pdf(2i-1) - pdf(2i)}^2</b> ]"; }
elsif($which[1] =~ m/^HERA/) { print "<b>pdf(central) +- 1/2 sqrt[sum_i=1,10 {pdf(2i-1) - pdf(2i)}^2</b> ]"; }
elsif($which[1] =~ m/^H120/) { print "<b>pdf(central) +- 1/2 sqrt[sum_i=1,10 {pdf(2i-1) - pdf(2i)}^2</b> ]"; }
elsif($which[1] =~ m/^CT10/) { print "<b>pdf(central) +- 1/2 sqrt[sum_i=1,26 {pdf(2i-1) - pdf(2i)}^2</b> ]"; }
elsif($which[1] =~ m/^cteq66/) { print "<b>pdf(central) +- 1/2 sqrt[sum_i=1,22 {pdf(2i-1) - pdf(2i)}^2</b> ]"; }
elsif($which[1] =~ m/^cteq6/) { print "<b>pdf(central) +- 1/2 sqrt[sum_i=1,20 {pdf(2i-1) - pdf(2i)}^2</b> ]"; }
elsif($which[1] =~ m/^NNPDF/) { print "<b>pdf(central) +- 1/10 sqrt[sum_i=1,100 {pdf(i) - pdf(0)}^2</b> ]"; }
else{}
if($plot[2] eq 'on'){
print "<br><br> For the comparison with the second PDF, $which[3], the percentage difference from the";
print " central value of the error set, $which[1], is plotted.";
}
print "</font>";
print "</td> </table>";
}
if ($numplot eq kumac) {
print '<xmp>';
system("cat $tempdir/temp.kumac");
foreach $n (1,2){
if($plot[$n] eq 'on'){
print "**********************************************************\n";
print "Next follows the file temp.dat$n\n";
print "**********************************************************\n";
system("cat temp.dat$n\n");
}
}
print '</xmp>';
}
exit;

File Metadata

Mime Type
text/html
Expires
Sun, Feb 23, 2:48 PM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4485156
Default Alt Text
pdfplot_hessian.pl (13 KB)

Event Timeline