Jpp  19.1.0-rc.1
the software that should make you happy
pre-calibration.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 script=${0##*/}
3 
4 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
5 
6 set_variable DEBUG 2
7 set_variable WORKDIR `pwd`
8 set_variable ACOUSTICS_THREADS 10
9 
10 if do_usage $*; then
11  usage "$script [version]"\
12  "\nAuxiliary script to run pre-calibrations of all detectors,"\
13  "\nincluding automatic disabling of 'bad' transmissions (see JAcousticsDisable.sh)."
14 fi
15 
16 if (( $# == 1 )); then
17  VERSION=${1}
18 else
19  fatal "Wrong number of arguments."
20 fi
21 
22 
23 # -----------------------------------------------------------------------------------------------
24 # Run pre-calibration of given detector with optional inputs.
25 # The last directory corresponds to the current detector and
26 # the preceding directories to the input detectors.
27 #
28 # \param 1-N directories
29 # -----------------------------------------------------------------------------------------------
30 fuction run()
31 {
32  DETECTORS=($argv[1,-2])
33  DETECTOR=$argv[-1]
34 
35  DIR=$WORKDIR/${DETECTOR}.${VERSION}.A # without disabled transmissions
36 
37  mkdir -p $DIR
38  pushd $DIR
39 
40  JMergeDisable -f$WORKDIR/${^DETECTORS}.${VERSION}.B/disable.txt -o disable.log
41  #JMergeDisable -o disable.log
42 
43  # replace disabled transmissions by those of input detectors
44 
45  sed '/cat>disable.txt<<EOF/,/EOF/ccat>disable.txt<<EOF\n# disable transmissions\nEOF' \
46  $JPP_DIR/software/JAcoustics/pre-calibration_${DETECTOR}.sh > pre-calibration_${DETECTOR}.sh
47  sed -i '/disable transmissions/r disable.log' pre-calibration_${DETECTOR}.sh
48 
49  chmod +x pre-calibration_${DETECTOR}.sh
50 
51  ./pre-calibration_${DETECTOR}.sh $WORKDIR/${^DETECTORS}.${VERSION}.B >& pre-calibration.log
52 
53 
54  # disable transmissions
55 
56  eval `JPrintDetector -a detector.datx -O IDENTIFIER`
57 
58  JAcousticsDisable.sh detector.datx KM3NeT_${(l:8::0::0:)DETECTOR_ID}_*_event.root disable.log
59 
60  popd
61 
62 
63  DIR=$WORKDIR/${DETECTOR}.${VERSION}.B # with disabled transmissions
64 
65  mkdir -p $DIR
66  pushd $DIR
67 
68  cp $WORKDIR/${DETECTOR}.${VERSION}.A/disable.log .
69 
70  # introduce disabled transmissions
71 
72  sed '/cat>disable.txt<<EOF/,/EOF/ccat>disable.txt<<EOF\n# disable transmissions\nEOF' \
73  $JPP_DIR/software/JAcoustics/pre-calibration_${DETECTOR}.sh > pre-calibration_${DETECTOR}.sh
74  sed -i '/disable transmissions/r disable.log' pre-calibration_${DETECTOR}.sh
75 
76  chmod +x pre-calibration_${DETECTOR}.sh
77 
78  ./pre-calibration_${DETECTOR}.sh $WORKDIR/${^DETECTORS}.${VERSION}.B >& pre-calibration.log
79 
80  popd
81 }
82 
83 
84 # ORCA
85 
86 run D_ORCA006
87 run D_ORCA006 D0ORCA010
88 run D0ORCA010 D1ORCA011
89 run D1ORCA011 D0ORCA015
90 run D0ORCA015 D1ORCA015
91 run D1ORCA015 D0ORCA018
92 
93 
94 # ARCA
95 
96 run D0ARCA006
97 run D0ARCA006 D0ARCA009
98 run D0ARCA009 D0ARCA021
99 run D0ARCA021 D0ARCA028
100