Skip to content

Commit

Permalink
import scan script from development
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Apr 11, 2016
1 parent bf4ff65 commit bfb5f5a
Showing 1 changed file with 62 additions and 5 deletions.
67 changes: 62 additions & 5 deletions utils/scan-slha.sh
Expand Up @@ -21,6 +21,7 @@

output=
scan_range=
sg_type=FlexibleSUSY
slha_input=
slha_input_file=
spectrum_generator=
Expand Down Expand Up @@ -55,7 +56,10 @@ BEGIN {
# expects block entry keys in the form x or x:y or x:y:z etc.
print_block_entry_awk='
{
split(keys,k,":");
if ($0 ~ /^B/) # skip block head
next
len = split(keys,k,":");
matches = 1;
Expand All @@ -65,7 +69,7 @@ print_block_entry_awk='
}
if (matches == 1)
print $(length(k)+1)
print $(len + 1)
}
'

Expand Down Expand Up @@ -105,6 +109,8 @@ Options:
read from stdin .
--spectrum-generator= Spectrum generator executable
--step-size= the step size (linear or log)
--type= Spectrum generator type (default: ${sg_type})
Possible values: FlexibleSUSY SPheno
--help,-h Print this help message
Examples:
Expand All @@ -130,6 +136,53 @@ Examples:
EOF
}

#_____________________________________________________________________
run_flexiblesusy() {
local sg="$1"
local input="$2"

echo "$input" | $sg --slha-input-file=- 2>/dev/null
}

#_____________________________________________________________________
run_spheno() {
local sg="$1"
local input="$2"
local tmp_in="$$.in"
local tmp_out="$$.spc"

rm -f "$tmp_out" "$tmp_in"
echo "$input" > "$tmp_in"

$sg "$tmp_in" "$tmp_out" > /dev/null 2>&1

if test "x$?" = "x0" -a -f "$tmp_out" ; then
cat "$tmp_out"
fi

rm -f "$tmp_out" "$tmp_in" Messages.out SPheno.out \
WHIZARD.par.* effC.dat BR_t.dat BR_Hplus.dat BR_H_NP.dat \
LEP_HpHm_CS_ratios.dat MH_GammaTot.dat MHplus_GammaTot.dat fort.10
}

#_____________________________________________________________________
run_sg() {
local type="$1"
local sg="$2"
local input="$3"
local func=

case "$type" in
FlexibleSUSY) func=run_flexiblesusy ;;
SPheno) func=run_spheno ;;
*)
echo "Error: unknown spectrum generator type: $type"
exit 1
esac

${func} "$sg" "$input"
}

trap do_actions_at_exit 0
trap "exit 1" INT QUIT TERM

Expand All @@ -146,6 +199,7 @@ if test $# -gt 0 ; then
--slha-input-file=*) slha_input_file=$optarg ;;
--spectrum-generator=*) spectrum_generator=$optarg ;;
--step-size=*) step_size=$optarg ;;
--type=*) sg_type=$optarg ;;
--help|-h) help; exit 0 ;;
*) echo "Invalid option '$1'. Try $0 --help" ; exit 1 ;;
esac
Expand Down Expand Up @@ -214,14 +268,17 @@ EOF
exit 1 ;;
esac
# run the spectrum generator
slha_output=$(
# create input data
slha_input=$(
{ echo "$slha_input" ; \
cat <<EOF
Block $block # added by `basename $0`
$entry $value
EOF
} | $spectrum_generator --slha-input-file=- 2>/dev/null)
})
# run the spectrum generator
slha_output=$(run_sg "$sg_type" "$spectrum_generator" "$slha_input")
printfstr=" "
args=
Expand Down

0 comments on commit bfb5f5a

Please sign in to comment.