Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JTriggerProcessor.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3# \author mdejong
4#
5version=1.0
6script=${0##*/}
7
8# ------------------------------------------------------------------------------------------
9#
10# Utility script to test JTriggerProcessor.
11#
12# ------------------------------------------------------------------------------------------
13
14
15if [ -z $JPP_DIR ]; then
16 echo "Variable JPP_DIR undefined."
17 exit
18fi
19
20source $JPP_DIR/setenv.sh $JPP_DIR
21
22set_variable DEBUG 2
23set_variable WORKDIR $JPP_DATA/
24set_variable DETECTOR $JPP_DATA/km3net_reference.detx
25set_variable TRIGGER $JPP_DATA/trigger_parameters_arca.txt
26set_variable BACKGROUND_HZ 5e3 500 50 5 0.5
27set_variable RECYCLING 10 100e3
28set_variable numberOfSlices 10
29
30if do_usage $*; then
31 usage "$script [detector file [trigger file [working directory]]]"
32fi
33
34case $# in
35 3) set_variable WORKDIR $3;&
36 2) set_variable TRIGGER $2;&
37 1) set_variable DETECTOR $1;;
38esac
39
40set_variable INPUT_FILE $WORKDIR/timeslice.root
41set_variable OUTPUT_FILE $WORKDIR/trigger_processor.root
42
43if [[ ! -f $DETECTOR ]]; then
44 JDetector.sh $DETECTOR
45fi
46
47if ( ! reuse_file $INPUT_FILE ); then
48
49 echo "Generating random background."
50
51 print_variable DETECTOR INPUT_FILE BACKGROUND_HZ
52 check_input_file $DETECTOR
53 check_output_file $INPUT_FILE
54
55 timer_start
56
57 JRandomTimesliceWriter \
58 -a $DETECTOR \
59 -o $INPUT_FILE \
60 -n $numberOfSlices \
61 -B "$BACKGROUND_HZ" \
62 -N "$RECYCLING" \
63 -d $DEBUG
64
65 timer_stop
66 timer_print
67
68fi
69
70if ( ! reuse_file $OUTPUT_FILE ); then
71
72 echo "Processing data."
73
74 print_variable DETECTOR TRIGGER INPUT_FILE OUTPUT_FILE
75 check_input_file $DETECTOR $TRIGGER $INPUT_FILE
76 check_output_file $OUTPUT_FILE
77
78 timer_start
79
80 JTriggerProcessor \
81 -a $DETECTOR \
82 -f $INPUT_FILE \
83 -o $OUTPUT_FILE \
84 -@ $TRIGGER \
85 -C JDAQTimesliceL0 \
86 -P \
87 -d $DEBUG
88
89 timer_stop
90 timer_print
91
92fi
93
94JPrintTree -f $OUTPUT_FILE