Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
examples/JReconstruction/compare-detector.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2
3if [ -z $JPP_DIR ]; then
4 echo "Variable JPP_DIR undefined."
5 exit
6fi
7
8source $JPP_DIR/setenv.sh $JPP_DIR
9
10zmodload zsh/mathfunc
11
12set_variable DEBUG 2
13set_variable WORKDIR ${TMPDIR:-/tmp}/
14set_variable: PRECISION RECONSTRUCTION_PRECISION 1.0
15set_variable: FORMAT GRAPHICS_FORMAT gif
16set_variable+ BATCH GRAPHICS_BATCH -B
17
18if do_usage $*; then
19 usage "$script <detector file> <detector file>"
20fi
21
22if (( $# != 2 )); then
23 fatal "Wrong number of arguments."
24fi
25
26DETECTOR=($argv[1] $argv[2])
27
28JConvertDetectorFormat \
29 -a $DETECTOR[2] \
30 -o $WORKDIR/detector.datx
31
32# correct global time offset
33
34let "T = 0.0"
35
36for (( i = 0; $i != 2; ++i )); do
37
38 JCompareDetector \
39 -a $DETECTOR[1] \
40 -b $WORKDIR/detector.datx \
41 -o $WORKDIR/compare.root \
42 -d0 >& /dev/null
43
44 JPrintResult -f $WORKDIR/compare.root:T2 -F "GetMinimum" | read ZMIN
45 JPrintResult -f $WORKDIR/compare.root:T2 -F "GetMaximum" | read ZMAX
46
47 let "Z = 0.5 * ($ZMIN + $ZMAX)"
48 let "T += $Z"
49
50 JEditDetector \
51 -a $WORKDIR/detector.datx \
52 -o $WORKDIR/detector.datx \
53 -s "-1 add $Z" \
54 -d 0 >& /dev/null
55done
56
57printf "Correct global time offset %9.6f [ns].\n" $T
58printf "Test with precision %9.6f [ns].\n" $PRECISION
59
60JCompareDetector \
61 -a $DETECTOR[1] \
62 -b $WORKDIR/detector.datx \
63 -o $WORKDIR/compare.root \
64 -p "tcal = $PRECISION" \
65 -d1
66
67JPlot2D \
68 -w 1200x600 \
69 -f $WORKDIR/compare.root:T2 \
70 -> "string" \
71 -< "floor" \
72 -O COLZ \
73 -T "#Deltat [ns]" \
74 -o detector.$FORMAT $BATCH