#!/usr/bin/perl -w $server = $ENV{'SERVER_NAME'}; my($interaction, $model, $qcdOrder, $qedOrder); # # Make sure we are in the main directory, not bin # if (-d "bin") { # print "We are in main directory \n"; } else{ # print "Not in correct directory \n"; chdir("../"); if (-d "bin") { # print "We are in main directory \n"; } else{ print "Error gen_indexhtml-pl must be run from main or bin directory \n"; exit; } } # # get the name of the directory # my $fullname=qx(pwd); my @temp=split /\//,$fullname; my @couplings; # foreach $ciccio (@temp){ # if( $ciccio =~ /p*__*/){ # $procname=$ciccio; # } # chomp $procname; # print $procname; # # Writes out html page index.html with links to results # and code. # if (-e "SubProcesses/procdef_mg5.dat"){ open (INCARD,"SubProcesses/procdef_mg5.dat") || die "Error reading file procdef_mg5.dat"; @incard=; close (INCARD); } else { open (INCARD,"Cards/proc_card.dat") || exit; @incard=; close (INCARD); } # process $listpos = 0; until($listpos>$#incard){ if($incard[$listpos] =~ /^#(\s+)Begin(\s+)PROCESS/) {$ini=$listpos}; if($incard[$listpos] =~ /^#(\s+)End(\s+)PROCESS/) {$end=$listpos}; $listpos = $listpos + 1; } $listpos=$ini; $numcoup=0; while($listpos < $end){ if($incard[$listpos] =~ /^#/) {$listpos = $listpos + 1; next;}; if($incard[$listpos] =~ ">") {$interaction=$incard[$listpos]}; if($incard[$listpos] =~ "=") { $numcoup++; $couplings[$numcoup]=$incard[$listpos]; } if($incard[$listpos] =~ "end_coup"){$listpos = $end;} $listpos = $listpos + 1; } ($interaction, $junk)=split(/#/ , $interaction); ($interaction, $junk)=split(/\@/ , $interaction); for($couppos=1;$couppos<=$numcoup;$couppos++){ ($couplings[$couppos], $junk)=split(/#/, $couplings[$couppos]); chomp($couplings[$couppos]); } #model $listpos = 0; until($listpos>$#incard){ if($incard[$listpos] =~ /^#(\s+)Begin(\s+)MODEL/) {$ini=$listpos}; if($incard[$listpos] =~ /^#(\s+)End(\s+)MODEL/) {$end=$listpos}; $listpos = $listpos + 1; } # ($model, $junk) =split(/#/ , $incard[$ini+1]); chomp($interaction); # chomp($qcdOrder); # chomp($qedOrder); chomp($model); $htfile = "index"."\.html"; #name the file open(PAGE,"> $htfile" )|| die "Error writing $htfile"; print PAGE "\ \n"; print PAGE "\ \n"; print PAGE "\MadEvent Card for $interaction \<\/TITLE\> \n"; if (! -e "SubProcesses/done"){ print PAGE " \n"; } if ( -e "RunWeb"){ print PAGE " \n"; } print PAGE ""; print PAGE "\<\/HEAD\> \n"; print PAGE " \n"; print PAGE " \n"; print PAGE "
\n"; print PAGE "

MadEvent Card for $interaction

\n "; print PAGE " Created: "; my ($created) = "Unknown"; if (open FILE, "CREATED") { $created = ; chomp $created; } close FILE; print PAGE " $created \n "; print PAGE " \n"; print PAGE " \n"; print PAGE " \n \n \n"; print PAGE " \n
\n"; print PAGE "
\n"; print PAGE " \n \n"; print PAGE " \n"; for($couppos=1;$couppos<=$numcoup;$couppos++){ print PAGE " \n"; } print PAGE " \n"; print PAGE " \n
Process: $interaction
$couplings[$couppos]
Model: $model
\n
\n"; print PAGE "
\n"; print PAGE "\"\" \n"; print PAGE " \n"; print PAGE "
\n"; print PAGE " \n"; print PAGE " \n"; # # Process information # my($options) = "'toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes,resizeable=yes,width=600,height=525'"; print PAGE " \n"; if (-e "./generating") { print PAGE ""; print PAGE " \n"; print PAGE " \n"; print PAGE " \n"; } }else { if (-e "SubProcesses/subproc.mg") { print PAGE "Generation Complete \n"; }else { print PAGE "No Diagrams Exist! \n"; $failed = 1; } } print PAGE " \n"; # # Download code # if (!-e "./madevent.tar.gz") { print PAGE "\n"; print PAGE " \n"; }else { print PAGE "\n"; print PAGE " \n"; } # # On-Line Event Generation # print PAGE " \n"; if ($failed == 0) { my($options2) = "'toolbar=yes, location=yes, directories=no, status=yes, menubar=yes, scrollbars=yes,resizeable=yes,width=600,height=525'"; if (-e "Online") { print PAGE " \n"; }else { print PAGE "Running \n"; } } else { print PAGE " \n"; } # # Results and Event Data base # print PAGE " \n"; print PAGE " \n"; }else { print PAGE "$nfound "; print PAGE " runs available \n"; } } print PAGE " \n"; # my @keywords = &GetKeyInfo( $interaction, $model) ; # my @keywords = {}; print PAGE "
Links \n"; print PAGE " Status \n"; print PAGE "
\n "; print PAGE "Process Information \n"; print PAGE " "; my($failed) = 0; if (!-e "./SubProcesses/done") { $created = " "; if (open FILE, "./SubProcesses/status") { $created = ; chomp $created; } close FILE; print PAGE "Generating Process $created
"; print PAGE "Code Download Not Available "; print PAGE "Code Download Available
\n "; print PAGE "On-line Event Generation \n"; print PAGE " "; if (!-e "./RunWeb") { print PAGE "Available (access restricted) \n "; print PAGE "On-line Event Generation\n"; print PAGE " "; print PAGE "Only available from the web
\n "; print PAGE "Results and Event Database \n"; print PAGE " "; $nfound = 0; chdir("./HTML"); @files = <*>; foreach $file (@files) { if (-d $file) { $nfound = $nfound + 1; } } if ($nfound == "0") { print PAGE "No runs available
\n"; print PAGE "
\n"; # print PAGE "Keywords: @keywords \n"; print PAGE "Notes: \n"; # print "@keywords \n"; print PAGE " \n
\n

\n"; my($today) = `date`; print PAGE " Last Update: $today"; print PAGE "

\n \n \n"; close PAGE; sub GetKeyInfo { my($process, $model)= @_; #------------------------------------------- # start keyword generation # result is an array of keywords (@keywords) #------------------------------------------- #get rid of spaces $process =~ s/\s+//g; #set everything to lowercase $process =~ s/(.)/\L$1/g; # divide it into initial, intermediate and final state ($process, my $forbid) = split /\//, $process; my @splitprocess = split />/, $process; my $k= @splitprocess; my $in= $splitprocess[0]; my $out=$splitprocess[$k-1]; if ($k > 2) { my $inter=$splitprocess[$k-2]; }; my @keywords=(); ## start filling the keyowords array # initial state classification (trivial) push @keywords, "$in-collision"; # final state particle content extraction $out =~ s/(.)/$1 /gi; $out =~ s/( ~)/~/gi; $out =~ s/( \+)/\+/gi; $out =~ s/( \-)/\-/gi; $out =~ s/(t a\+)/ta\+/gi; $out =~ s/(t a\-)/ta\-/gi; $out =~ s/(m u\-)/mu\-/gi; $out =~ s/(m u\+)/mu\+/gi; $out =~ s/(l e)/le/gi; $out =~ s/(v l e )/vle /gi; $out =~ s/(v )/v/gi; # count the number of final-state particles my @entries= split /\s+/, $out; my $nfinal= @entries; print " final state particles: @entries\n"; push @keywords, "2->$nfinal"; #loop over particles my $njets=0; my $neutrinos=0; my $cleptons=0; my $top=0; my $bottom=0; my $higgs=0; my $wb=0; foreach (@entries){ if (substr($_,0,1) eq "v") { $neutrinos=1; }; if (substr($_,0,1) eq "e" || substr($_,0,2) eq "mu" || substr($_,0,2) eq "ta" || substr($_,0,1) eq "l" ) { $cleptons=1; }; if (substr($_,1,1) =~ /([udcsgj])/) { $njets=$njets+1 }; if ($_ eq "t" || $_ eq "t~") { $top=1; }; if ($_ eq "b" || $_ eq "b~") { $bottom=1; }; if ($_ eq "w+" || $_ eq "w-" || $_ eq "z") { $wb=1; }; if ($_ eq "h") { $higgs=1; }; }; if ($njets gt 1){push @keywords, "multi-jet";}; if ($top) {push @keywords, "top";}; if ($bottom) {push @keywords, "bottom";}; if ($higgs) {push @keywords, "higgs";}; if ($wb) {push @keywords, "weak-boson";}; if ($neutrinos) {push @keywords, "missing-energy";}; if ($cleptons) {push @keywords, "charged-lepton";}; # model push @keywords, $model; #------------------------- # end keyword generation #------------------------- # final result @keywords; }