~maddevelopers/mg5amcnlo/3.0.2-alpha0

« back to all changes in this revision

Viewing changes to Template/bin/gen_jpeg-pl

Added Template and HELAS into bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
 
 
3
 
 
4
#---------------------------------------------------------------------
 
5
# Run GS to create jpeg files defined as $gs
 
6
#---------------------------------------------------------------------
 
7
  system("/bin/bash -c \"rm -f matrix*.jpg\" ");
 
8
  system "/bin/bash -c \"nice gs  \-sDEVICE\=jpeg \-sOutputFile\=matrix\%00d.jpg \-q \-dNOPAUSE \-dBATCH matrix.ps\" ";
 
9
 
 
10
#--------------------------------------------------------------------------------
 
11
# not sure how many jpegs produced so we need to loop
 
12
# file still in cgi directory at this point
 
13
#--------------------------------------------------------------------------------
 
14
      $max_jpg = 13;
 
15
      $i=1;      
 
16
      while(-e "matrix$i.jpg" && $i < $max_jpg){
 
17
           $i++;
 
18
      }#end of while
 
19
      
 
20
      #reduce it by one  
 
21
      $pages=$i-1;
 
22
 
 
23
   open(PAGE,"> diagrams.html") || die "Error creating diagrams.html";
 
24
   print PAGE "\<HTML\> \n";
 
25
   print PAGE "\<HEAD\> \n";
 
26
   print PAGE "\<TITLE\>Feynman Diagrams \<\/TITLE\> \n";
 
27
   print PAGE "\<\/HEAD\> \n";
 
28
   print PAGE "\<BODY\> \n";
 
29
#   print PAGE "\<H1 id=\"TOP\" \>MadGraph ll\<\/H1\> \n";
 
30
 
 
31
#   print PAGE "<P>\<A HREF\=\"results.html\"\> Results \<\/A\> \<BR\> \n";
 
32
   print PAGE "<P>\<A HREF\=\"matrix.ps\"\> Postscript Diagrams \<\/A\> \<BR\> \n";
 
33
#   print PAGE "\<H2\>Diagrams: \<\/H2/> \n";
 
34
   for($j=1;$j<$pages+1;$j++){
 
35
#       print PAGE "\<P>\<A NAME=\"matrix$j\" \> \<B\>Page $j of $pages \<\/B\> \<BR\> \n";
 
36
#       print PAGE "\<A HREF=\"\#TOP\" onMouseOver=\"window\.status=\'Back to top of page\'\; return true\" onMouseOut=\"window.status=\'  \'\; return true\"  \>back to top of page<\/A\> \<BR\> \n";
 
37
       print PAGE "\<IMG SRC=\"matrix$j.jpg\" ALT=\"Page $j of $pages \" \> \<BR\> \n";
 
38
   }#end of for
 
39
#
 
40
#   In case I didn't include all of the diagrams as jpeg, warn user
 
41
#
 
42
   if (-e "matrix$max_jpg.jpg" ) {
 
43
       print PAGE "<P> <H3> To save bandwidth not all diagrams were converted to jpeg.";
 
44
       print PAGE "<P> To view all diagrams click on ";
 
45
       print PAGE "\<A HREF\=\"matrix.ps\"\> postscript. \<\/A\> \<BR\> \n";
 
46
       print PAGE "\<\/H3\> \n";
 
47
#
 
48
#    Delete files which aren't included in diagrams.html
 
49
#
 
50
      $i = $max_jpg;       
 
51
      while(-e "matrix$i.jpg"){
 
52
#         print "Deleting matrix$i.jpg";
 
53
          system ("/bin/bash -c \"rm -f matrix$i.jpg\" ");
 
54
           $i++;
 
55
      }#end of while
 
56
 
 
57
    }
 
58
   print PAGE
 
59
   print PAGE "\<\/BODY\> \n";
 
60
   print PAGE "\<\/HTML\> \n";
 
61
   close(PAGE);
 
62
#
 
63
#  Now create jpeg file for card
 
64
#
 
65
    system ("/bin/bash -c \"head -339 matrix.ps >& junk.ps\" ");
 
66
    open(PAGE,">> junk.ps") || die "Error opening junk.ps";  
 
67
  
 
68
    print PAGE "-20 -390 translate \n";
 
69
    print PAGE "0.7 0.7 scale \n";
 
70
    close(PAGE);
 
71
 
 
72
    system ("/bin/bash -c \"cat matrix.ps | sed 1,339d >> junk.ps\" ");
 
73
 
 
74
    system "/bin/bash -c \"nice gs  \-sDEVICE\=jpeg \-sOutputFile\=card.jpg \-q \-dNOPAUSE \-dBATCH \-g180x150 junk.ps; rm -f junk.ps; cp -p card.jpg ../../card.jpg\" ";