Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JConvertDusj.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3# \author mdejong
4#
5script=${0##*/}
6
7# ------------------------------------------------------------------------------------------
8#
9# Auxiliary script to convert files to DUSJ format.
10#
11# ------------------------------------------------------------------------------------------
12
13if [ -z $JPP_DIR ]; then
14 echo "Variable JPP_DIR undefined."
15 exit
16fi
17
18source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
19
20set_variable DEBUG 2
21set_variable WORKDIR ${TMPDIR:-/tmp}/
22
23if do_usage $*; then
24 usage "$script <input file> <detector file> <output file> [working directory]"
25fi
26
27case $# in
28 4) set_variable WORKDIR $4;&
29 3) set_variable OUTPUT_FILE $3;
30 set_variable DETECTOR $2;
31 set_variable INPUT_FILE $1;;
32 *) fatal "Wrong number of arguments."
33esac
34
35if [[ ${OUTPUT_FILE##*\.} == "evt" ]]; then
36
37 JConvertDusj \
38 -f $INPUT_FILE \
39 -a $DETECTOR \
40 -o $WORKDIR/dusj.evt \
41 -d $DEBUG
42
43 awk '
44 /primarylepton:/ { $1="track_in:"; print $0; next }
45 /weights:/ { if (NF > 1) print $0; next }
46 /w2list:/ { if (NF > 1) print $0; next }
47 /w3list:/ { if (NF > 1) print $0; next }
48 // { print $0; next }
49 ' $WORKDIR/dusj.evt > $OUTPUT_FILE
50
51 rm -f $WORKDIR/dusj.evt
52
53else
54
55 JConvertDusj \
56 -f $INPUT_FILE \
57 -a $DETECTOR \
58 -o $OUTPUT_FILE \
59 -d $DEBUG
60
61fi