Page MenuHomeHEPForge

fulltest.pl.in
No OneTemporary

fulltest.pl.in

#!@PERL@
# Run WHIZARD with low statistics for all processes in configuration file
#
# Output: screen and whizard.log
#
# Example: ./fulltest.pl
# Iterations:
$it1 = 1;
$it2 = 1;
$it3 = 1;
# Number of calls
$calls0 = 100;
$calls1 = $calls0;
$calls2 = $calls0;
$calls3 = $calls0;
$calls4 = $calls0;
$calls5 = $calls0;
# Configuration file
$config = "@CONFIG@";
# Input file
$in = "@PRG@.in";
# Output file
$out = "@PRG@.log";
# Executable
$prg = "@PRG@";
# Methods
@method = ("omega", "mad", "chep");
@ext = ("o", "m", "c");
# Start reading from configuration file
open(CONFIG, $config) or die "Can't open configuration file $config";
# Read the CompHEP model
LINE: while (<CONFIG>) {
next LINE if /^\s*$/; # skip blank lines
next LINE if /^\s*#/; # skip comment lines
($key, $model, $rest) = split;
$key eq "model" or die "No model specified in configuration file";
last LINE;
}
# Read the list of processes (only O'Mega versions)
LINE: while (<CONFIG>) {
next LINE if /^\s*$/; # skip blank lines
next LINE if /^\s*#/; # skip comment lines
($key, $in_state, $out_state, $rest) = split;
last LINE unless $key =~ /_o$/;
$key =~ s/_o$//;
push @proc, $key;
$in_state{$key} = $in_state;
$out_state{$key} = $out_state;
}
# ----------------------------------------------------------------------
# Main loop
open (OUT, ">$out") or die "Can't open $out for writing";
foreach $proc (@proc) {
@proc_id = ();
foreach $ext (@ext) {
push @proc_id, $proc."_".$ext;
}
$proc_text = "$proc: $in_state{$proc} -> $out_state{$proc}";
$mesg = "Running WHIZARD for process $proc_text\n";
print STDOUT $mesg;
print OUT $mesg;
run_whizard ($proc_text, @proc_id);
print OUT "\n";
}
print STDOUT "Failed processes (see above; details in \'$out\'):\n";
print OUT "############################################################\n";
print OUT "# Failed processes:\n";
if ($results_failed) {
print STDOUT $proc_failed;
print OUT $results_failed;
} else {
print STDOUT " None.\n";
print OUT " None.\n";
}
close (OUT);
close (CONFIG);
# ------------------------------------------------------------------------
# Subroutines
# Run WHIZARD
sub run_whizard (@) {
my ($proc_text, @proc_id) = @_;
my @result = ();
my @number = ();
my $failed = 0;
$proc_id = join " ", @proc_id;
$proc_pat = join "|", @proc_id;
$prgexe = "./$prg -p\'process_id=\"$proc_id\"\'";
open (PRG, "$prgexe |") or die "Can\'t run: $prgexe";
while (<PRG>) {
if (/^\s*($proc_pat)\s+(\S+)/) {
push @result, $_;
push @number, $2;
}
print OUT $_;
}
if ($number[0] eq $number[1]) {
if ($number[2] ne $number[0]) {
substr($result[2],1,2) = "**"; $failed = $method[2];
}
} elsif ($number[0] eq $number[2]) {
if ($number[1] ne $number[0]) {
substr($result[1],1,2) = "**"; $failed = $method[1];
}
} elsif ($number[1] eq $number[2]) {
if ($number[0] ne $number[1]) {
substr($result[0],1,2) = "**"; $failed = $method[0];
}
} else {
for ($i=0; $i<3; $i++) {
substr($result[$i],1,2) = "**"; $failed = "all";
}
}
if ($failed) {
$proc_failed .= " $proc_text ($failed)\n";
$results_failed .= "$proc_text\n";
foreach $result (@result) {
print STDOUT $result;
$results_failed .= $result;
}
} else {
foreach $result (@result) {
print STDOUT $result;
}
}
close (PRG) or warn "$prg returned with exit status $?";
}
### Local variables:
### mode:perl
### End:

File Metadata

Mime Type
text/plain
Expires
Sat, May 3, 6:28 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4983044
Default Alt Text
fulltest.pl.in (3 KB)

Event Timeline