Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JAlignDetector.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2script=${0##*/}
3
4# --------------------------------------------------------------------------------------------
5#
6# Auxiliary script to align two detectors after acoustic-fit.sh procedure.
7#
8# --------------------------------------------------------------------------------------------
9
10if [ -z $JPP_DIR ]; then
11 echo "Variable JPP_DIR undefined."
12 exit
13fi
14
15source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
16
17set_variable: DEBUG ACOUSTICS_DEBUG 2
18set_variable: WORKDIR ACOUSTICS_WORKDIR ${TMPDIR:-/tmp}
19set_variable: FORMAT GRAPHICS_FORMAT gif
20set_variable+ BATCH GRAPHICS_BATCH -B
21set_variable SIGMA_M 0.2
22
23if do_usage $*; then
24 usage "$script <directory A> <directory B>"\
25 "\nIn each directory, there should be a file \"detector.datx\" and \"tripod.txt\","\
26 "\nconform the result of script acoustic-fit.sh."
27fi
28
29if (( $# != 2 )); then
30 fatal "Wrong number of arguments."
31fi
32
33set_variable DIR_A $1
34set_variable DIR_B $2
35
36JConvertDetectorFormat -a $DIR_A/detector.datx -o $WORKDIR/detector_a.datx
37JConvertDetectorFormat -a $DIR_B/detector.datx -o $WORKDIR/detector_b.datx
38cp $DIR_A/tripod.txt $WORKDIR/tripod_a.txt
39cp $DIR_B/tripod.txt $WORKDIR/tripod_b.txt
40
41eval `JPrintDetector -a $WORKDIR/detector_a.datx -O SUMMARY`
42
43
44JAlignDetector \
45 -a $WORKDIR/detector_a.datx \
46 -b $WORKDIR/detector_b.datx \
47 -A \
48 -T $WORKDIR/tripod_a.txt \
49 -s $SIGMA_M \
50 -d $DEBUG --!
51
52for STRING in $STRINGS[*]; do
53
54 set_variable MODULE `getModule -a $WORKDIR/detector_a.datx -L "$STRING 0"`
55
56 JEditDetector -a $WORKDIR/detector_a.datx -M "$MODULE setz 1.0" -o $WORKDIR/detector_a.datx
57 JEditDetector -a $WORKDIR/detector_b.datx -M "$MODULE setz 1.0" -o $WORKDIR/detector_b.datx
58
59done
60
61echo "Output stored at $WORKDIR/detector_a.datx and $WORKDIR/tripod_a.txt."
62
63
64JDrawDetector2D \
65 -a $WORKDIR/detector_a.datx \
66 -a $WORKDIR/detector_b.datx \
67 -L BL \
68 -o detector.$FORMAT $BATCH
69
70JDrawDetector2D \
71 -T $WORKDIR/tripod_a.txt \
72 -T $WORKDIR/tripod_b.txt \
73 -L BL \
74 -o tripod.$FORMAT $BATCH
75
76JCompareDetector \
77 -a $WORKDIR/detector_a.datx \
78 -b $WORKDIR/detector_b.datx \
79 -o $WORKDIR/abc.root >& /dev/null
80
81for KEY in X Y Z; do
82
83 JPlot2D \
84 -f $WORKDIR/abc.root:${KEY} \
85 -> "string" \
86 -< "floor" \
87 -T "$KEY" \
88 -O COLZ \
89 -o ${KEY}.$FORMAT $BATCH
90
91done