mlog2db now invokes musrfit with the option '--keep-mn2-output' if called with the option '-k'

This commit is contained in:
Bastian M. Wojek 2008-09-08 15:44:31 +00:00
parent c106294e32
commit ef50169deb

View File

@ -11,9 +11,9 @@ if [ $# -lt 3 ] ; then
"musrfit-mlog to db converter" "musrfit-mlog to db converter"
USAGE: mlog2db FIRSTRUN# LASTRUN# BLABLA [noheader | fit-TEMPLATERUN# | -oDB_OUTPUT_FILE] USAGE: mlog2db FIRSTRUN# LASTRUN# BLABLA [noheader | fit-TEMPLATERUN# | -oDB_OUTPUT_FILE | -k]
OR OR
mlog2db \[LIST OF RUNS\] BLABLA [noheader | fit-TEMPLATERUN# | -oDB_OUTPUT_FILE] mlog2db \[LIST OF RUNS\] BLABLA [noheader | fit-TEMPLATERUN# | -oDB_OUTPUT_FILE | -k]
This small script converts subsequent musrfit output files (mlog) into one db file using bash/awk. This small script converts subsequent musrfit output files (mlog) into one db file using bash/awk.
@ -41,6 +41,7 @@ mlog2db 200 220 _tf_h13 -oABC.db fit-199
This will fit the runs 200 to 220 using musrfit. The file 199_tf_h13.mlog (or if that is not available: 199_tf_h13.msr) is used as This will fit the runs 200 to 220 using musrfit. The file 199_tf_h13.mlog (or if that is not available: 199_tf_h13.msr) is used as
template for the first musrfit input file. The results of the fits will be written to ABC.db. template for the first musrfit input file. The results of the fits will be written to ABC.db.
For keeping the MINUIT2 output files after calling musrfit, i.e. invoke musrfit with the option "--keep-mn2-output" just pass the option "-k" to mlog2db. If you pass this option to mlog2db but do not fit any data, the option will just be ignored.
CAUTION: CAUTION:
The "indexing number" of the .mlog has to be at the begin of the filename. The "indexing number" of the .mlog has to be at the begin of the filename.
@ -88,6 +89,7 @@ if [ "${1:0:1}" == "[" ]; then
OPT_PAR_ONE=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 2 )) ]} OPT_PAR_ONE=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 2 )) ]}
OPT_PAR_TWO=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 3 )) ]} OPT_PAR_TWO=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 3 )) ]}
OPT_PAR_THREE=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 4 )) ]} OPT_PAR_THREE=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 4 )) ]}
OPT_PAR_FOUR=${RUNARRAY[ (( LASTRUN + EMPTYENTRY + 5 )) ]}
else # start and end-runs are given else # start and end-runs are given
for (( j=0; j<=$2-$1; j++ )); for (( j=0; j<=$2-$1; j++ ));
@ -100,6 +102,7 @@ else # start and end-runs are given
OPT_PAR_ONE=$4 OPT_PAR_ONE=$4
OPT_PAR_TWO=$5 OPT_PAR_TWO=$5
OPT_PAR_THREE=$6 OPT_PAR_THREE=$6
OPT_PAR_FOUR=$7
fi fi
# Check if fitting should be done # Check if fitting should be done
@ -109,6 +112,9 @@ else if [ "${OPT_PAR_TWO:0:3}" == "fit" ]; then
TEMP=${OPT_PAR_TWO:4} TEMP=${OPT_PAR_TWO:4}
else if [ "${OPT_PAR_THREE:0:3}" == "fit" ]; then else if [ "${OPT_PAR_THREE:0:3}" == "fit" ]; then
TEMP=${OPT_PAR_THREE:4} TEMP=${OPT_PAR_THREE:4}
else if [ "${OPT_PAR_FOUR:0:3}" == "fit" ]; then
TEMP=${OPT_PAR_FOUR:4}
fi
fi fi
fi fi
fi fi
@ -160,8 +166,12 @@ if [ "$TEMP" != "" ]; then
else print $0 >> nextinput else print $0 >> nextinput
}' $TEMPLATE }' $TEMPLATE
fi fi
musrfit $COUNT$EXTENSION.msr -k if [ "${OPT_PAR_ONE}" == "-k" ] || [ "${OPT_PAR_TWO}" == "-k" ] || [ "${OPT_PAR_THREE}" == "-k" ] || [ "${OPT_PAR_FOUR}" == "-k" ]; then
MUSRFITPARAM="-k"
fi
musrfit $COUNT$EXTENSION.msr $MUSRFITPARAM
if [ "$NEXTCOUNT" != "${RUNARRAY[$LASTRUN]}" ]; then if [ "$NEXTCOUNT" != "${RUNARRAY[$LASTRUN]}" ]; then
awk -v count=$COUNT -v nextcount=$NEXTCOUNT -v nextinput=$NEXTINPUT '{ awk -v count=$COUNT -v nextcount=$NEXTCOUNT -v nextinput=$NEXTINPUT '{
@ -222,12 +232,13 @@ fi
fi fi
awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_THREE '{ awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_THREE -v optPARfour=$OPT_PAR_FOUR '{
outfile="out.db" outfile="out.db"
if(optPARone ~ /^-o/) outfile = substr(optPARone,3) if(optPARone ~ /^-o/) outfile = substr(optPARone,3)
if(optPARtwo ~ /^-o/) outfile = substr(optPARtwo,3) if(optPARtwo ~ /^-o/) outfile = substr(optPARtwo,3)
if(optPARthree ~ /^-o/) outfile = substr(optPARthree,3) if(optPARthree ~ /^-o/) outfile = substr(optPARthree,3)
if(optPARfour ~ /^-o/) outfile = substr(optPARfour,3)
FS = " " FS = " "
OFS = " " OFS = " "
@ -294,7 +305,7 @@ awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_
if("'"$TEMPERATURE"'" != "") { if("'"$TEMPERATURE"'" != "") {
if("'"$COUNT"'" == "'"${RUNARRAY[0]}"'" && optPARone != "noheader" && optPARtwo != "noheader" && optPARthree != "noheader"){ if("'"$COUNT"'" == "'"${RUNARRAY[0]}"'" && optPARone != "noheader" && optPARtwo != "noheader" && optPARthree != "noheader" && optPARfour != "noheader"){
print "TITLE" >> outfile print "TITLE" >> outfile
print ">>>Put your title here<<<\n" >> outfile print ">>>Put your title here<<<\n" >> outfile
print "Abstract" >> outfile print "Abstract" >> outfile
@ -345,7 +356,7 @@ awk -v optPARone=$OPT_PAR_ONE -v optPARtwo=$OPT_PAR_TWO -v optPARthree=$OPT_PAR_
# If we do not have the information from the summary file # If we do not have the information from the summary file
else { else {
if("'"$COUNT"'" == "'"${RUNARRAY[0]}"'" && optPARone != "noheader" && optPARtwo != "noheader" && optPARthree != "noheader"){ if("'"$COUNT"'" == "'"${RUNARRAY[0]}"'" && optPARone != "noheader" && optPARtwo != "noheader" && optPARthree != "noheader" && optPARfour != "noheader"){
print "TITLE" >> outfile print "TITLE" >> outfile
print ">>>Put your title here<<<\n" >> outfile print ">>>Put your title here<<<\n" >> outfile
print "Abstract" >> outfile print "Abstract" >> outfile