Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
examples/JTimeslice/JRandomTimesliceWriter.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 #
4 # \author mdejong
5 #
6 version=1.0
7 script=${0##*/}
8 
9 # ------------------------------------------------------------------------------------------
10 #
11 # Utility script to test JRadomTimesliceWriter.
12 #
13 # ------------------------------------------------------------------------------------------
14 
15 if [ -z $JPP_DIR ]; then
16  echo "Variable JPP_DIR undefined."
17  exit
18 fi
19 
20 source $JPP_DIR/setenv.sh $JPP_DIR
21 
22 set_variable DEBUG 2
23 set_variable DIR $JPP_DIR/examples/JTimeslice/
24 set_variable WORKDIR ${TMPDIR:-/tmp}/
25 
26 if do_usage $*; then
27  usage "$script [working directory]"
28 fi
29 
30 case $# in
31  1) set_variable WORKDIR $1;;
32 esac
33 
34 set_variable BACKGROUND_HZ 10e3
35 set_variable numberOfSlices 1000
36 set_variable RECYCLING 5 100e3
37 
38 if ( ! reuse_file $WORKDIR/timeslice.root); then
39 
40  $DIR/JRandomTimesliceWriter \
41  -o $WORKDIR/timeslice.root \
42  -B "$BACKGROUND_HZ" \
43  -n $numberOfSlices \
44  -N "$RECYCLING" \
45  -d $DEBUG --!
46 fi
47 
48 for (( N = 1; $N <= $RECYCLING[1]; ++N )); do
49 
50  JPlot1D \
51  -w 1200x600 \
52  -f "$WORKDIR/timeslice.root:h0\[0\]" \
53  -f "$WORKDIR/timeslice.root:h0\[${N}\]" \
54  -> "time [ns]" \
55  -\^ "number of hits [a.u.]" \
56  -T "$N"
57 done