Jpp  debug
the software that should make you happy
JAlignDetector.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 script=${0##*/}
3 
4 # --------------------------------------------------------------------------------------------
5 #
6 # Auxiliary script to align two detectors after acoustic-fit.sh procedure.
7 #
8 # --------------------------------------------------------------------------------------------
9 
10 if [ -z $JPP_DIR ]; then
11  echo "Variable JPP_DIR undefined."
12  exit
13 fi
14 
15 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
16 
17 set_variable: DEBUG ACOUSTICS_DEBUG 2
18 set_variable: WORKDIR ACOUSTICS_WORKDIR ${TMPDIR:-/tmp}
19 set_variable: FORMAT GRAPHICS_FORMAT gif
20 set_variable+ BATCH GRAPHICS_BATCH -B
21 set_variable SIGMA_M 0.2
22 
23 if 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."
27 fi
28 
29 if (( $# != 2 )); then
30  fatal "Wrong number of arguments."
31 fi
32 
33 set_variable DIR_A $1
34 set_variable DIR_B $2
35 
36 JConvertDetectorFormat -a $DIR_A/detector.datx -o $WORKDIR/detector_a.datx
37 JConvertDetectorFormat -a $DIR_B/detector.datx -o $WORKDIR/detector_b.datx
38 cp $DIR_A/tripod.txt $WORKDIR/tripod_a.txt
39 cp $DIR_B/tripod.txt $WORKDIR/tripod_b.txt
40 
41 eval `JPrintDetector -a $WORKDIR/detector_a.datx -O SUMMARY`
42 
43 
44 JAlignDetector \
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 
52 for 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 
59 done
60 
61 echo "Output stored at $WORKDIR/detector_a.datx and $WORKDIR/tripod_a.txt."
62 
63 
64 JDrawDetector2D \
65  -a $WORKDIR/detector_a.datx \
66  -a $WORKDIR/detector_b.datx \
67  -L BL \
68  -o detector.$FORMAT $BATCH
69 
70 JDrawDetector2D \
71  -T $WORKDIR/tripod_a.txt \
72  -T $WORKDIR/tripod_b.txt \
73  -L BL \
74  -o tripod.$FORMAT $BATCH
75 
76 JCompareDetector \
77  -a $WORKDIR/detector_a.datx \
78  -b $WORKDIR/detector_b.datx \
79  -o $WORKDIR/abc.root >& /dev/null
80 
81 for 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 
91 done