Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
JSTDevK40.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 if [ -z $JPP_DIR ]; then
10  echo "Variable JPP_DIR undefined."
11  exit
12 fi
13 
14 source $JPP_DIR/setenv.sh $JPP_DIR
15 
16 zmodload zsh/mathfunc
17 
18 set_variable DEBUG 2
19 set_variable WORKDIR `pwd`
20 set_variable OUTPUT_FILE $WORKDIR/stdev.root
21 set_variable DIR $JPP_DIR/examples/JCalibrate/
22 set_variable: ZMAX CALIBRATION_ZMAX -3.0
23 set_variable: ZMIN CALIBRATION_ZMIN +3.0
24 set_variable: OPTION CALIBRATION_OPTION address
25 set_variable: FORMAT GRAPHICS_FORMAT gif
26 set_variable+ BATCH GRAPHICS_BATCH -B
27 
28 
29 if do_usage $*; then
30  usage "$script <detector file> <input file> <input file>" \
31  "\nThe 1st input file corresponds to the output of JMergeCalibrateK40 and the 2nd to the output of JFitK40."
32 fi
33 
34 if (( $# != 3 )); then
35  fatal "Wrong number of parameters."
36 fi
37 
38 set_variable DETECTOR $argv[1]
39 set_array INPUT_FILES $argv[2,-1]
40 
41 $DIR/JSTDevK40 \
42  -a $DETECTOR \
43  -f"$INPUT_FILES[1] $INPUT_FILES[2]" \
44  -o $OUTPUT_FILE \
45  -O $OPTION
46 
47 eval `JPrintDetector -a $DETECTOR -O SUMMARY`
48 
49 set_variable FIRST_FLOOR 1
50 
51 kill_child_processes_at_exit
52 
53 attach getModule -a $DETECTOR
54 
55 typeset -Z 4 STRING
56 typeset -Z 2 FLOOR
57 
58 for STRING in $STRINGS[*]; do
59 
60  echo -n "Creating graphics for string $STRING.."
61 
62  for (( FLOOR = $FIRST_FLOOR; $FLOOR <= $LAST_FLOOR; FLOOR += 1 )); do
63 
64  sput $STRING $FLOOR
65  sget MODULE
66 
67  JTestRange2D \
68  -f ${OUTPUT_FILE}:$MODULE.2X \
69  -z "$((-1 * fabs($ZMIN))) $((+1 * fabs($ZMIN)))" \
70  -d 3 |& grep -E failed
71 
72  JPlot2D \
73  -f ${OUTPUT_FILE}:$MODULE.2X \
74  -> "PMT" \
75  -< "PMT" \
76  -z "$ZMIN $ZMAX" \
77  -O COLZ \
78  -G X \
79  -G Y \
80  -T "(${STRING},${FLOOR})" \
81  -o ${TMPDIR:-/tmp}/M_${STRING}_${FLOOR}.$FORMAT $BATCH
82  done
83 
84  montage \
85  -tile 6x3 \
86  -geometry +0+0 \
87  ${TMPDIR:-/tmp}/M_${STRING}_{01..18}.$FORMAT \
88  $WORKDIR/M_${STRING}.$FORMAT >& /dev/null
89 
90  echo " => $WORKDIR/M_${STRING}.$FORMAT"
91 done
92 
93 detach
94 
95 rm -f ${TMPDIR:-/tmp}/M_*_*.$FORMAT