Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
pre-calibration.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3
4script=${0##*/}
5
6echo JPP_DIR IS $JPP_DIR
7
8if [ -z $JPP_DIR ]; then
9 echo "Variable JPP_DIR undefined."
10 exit
11fi
12
13source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
14
15set_variable DEBUG 2
16set_variable WORKDIR `pwd`
17set_variable ACOUSTICS_THREADS 32
18
19if do_usage $*; then
20 usage "$script [version]"\
21 "\nAuxiliary script to run pre-calibrations of all detectors,"\
22 "\nincluding automatic disabling of 'bad' transmissions (see JAcousticsDisable.sh)."
23fi
24
25if (( $# == 1 )); then
26 VERSION=${1}
27else
28 fatal "Wrong number of arguments."
29fi
30
31WORKDIR=`pwd`
32# -----------------------------------------------------------------------------------------------
33# Run pre-calibration of given detector with optional inputs.
34# The last directory corresponds to the target detector and
35# the optional preceding directories to the source detectors.
36#
37# \param 1-N directories
38# -----------------------------------------------------------------------------------------------
39fuction run()
40{
41 DETECTORS=($argv[1,-2])
42 DETECTOR=$argv[-1]
43
44 if [[ ! -f $JPP_DIR/software/JAcoustics/pre-calibration_${DETECTOR}.sh ]]; then
45 fatal "No calibration for detector $DETECTOR."
46 fi
47
48 DIR=$WORKDIR/${DETECTOR}.${VERSION}.A # without disabled transmissions
49
50 if [[ ! -d $DIR ]]; then
51
52 mkdir -p $DIR
53 pushd $DIR
54
55 JMergeDisable -f$WORKDIR/${^DETECTORS}.${VERSION}.B/disable.txt -o disable.log
56
57 # replace disabled transmissions by those of input detectors
58
59 sed '/cat>disable.txt<<EOF/,/EOF/ccat>disable.txt<<EOF\n# disable transmissions\nEOF' \
60 $JPP_DIR/software/JAcoustics/pre-calibration_${DETECTOR}.sh > pre-calibration_${DETECTOR}.sh
61 sed -i '/disable transmissions/r disable.log' pre-calibration_${DETECTOR}.sh
62
63 chmod +x pre-calibration_${DETECTOR}.sh
64
65 ./pre-calibration_${DETECTOR}.sh $WORKDIR/${^DETECTORS}.${VERSION}.B >& pre-calibration.log
66
67
68 # disable transmissions
69 eval `JPrintDetector -a detector.datx -O IDENTIFIER`
70 JPrintDetector -a detector.datx -O IDENTIFIER
71 echo Disabling the acoustics
72 echo The files to Disable are KM3NeT_${(l:8::0::0:)DETECTOR_ID}_*_event.root
73 JAcousticsDisable.sh detector.datx KM3NeT_${(l:8::0::0:)DETECTOR_ID}_*_event.root disable.log
74 echo Acoustics disabled
75 popd
76
77 fi
78
79 DIR=$WORKDIR/${DETECTOR}.${VERSION}.B # with disabled transmissions
80
81 if [[ ! -d $DIR ]]; then
82
83 mkdir -p $DIR
84 pushd $DIR
85
86 cp $WORKDIR/${DETECTOR}.${VERSION}.A/disable.log .
87
88 # introduce disabled transmissions
89
90 sed '/cat>disable.txt<<EOF/,/EOF/ccat>disable.txt<<EOF\n# disable transmissions\nEOF' \
91 $JPP_DIR/software/JAcoustics/pre-calibration_${DETECTOR}.sh > pre-calibration_${DETECTOR}.sh
92 sed -i '/disable transmissions/r disable.log' pre-calibration_${DETECTOR}.sh
93
94 chmod +x pre-calibration_${DETECTOR}.sh
95
96 ./pre-calibration_${DETECTOR}.sh $WORKDIR/${^DETECTORS}.${VERSION}.B >& pre-calibration.log
97
98 popd
99 fi
100}
101
102# -----------------------------------------------------------------------------------------------
103# Run 'empty' pre-calibration of given detector with required inputs.
104# The last directory corresponds to the target detector and
105# the required preceding directories to the source detectors.
106#
107# \param 1-N directories
108# -----------------------------------------------------------------------------------------------
109fuction fcc()
110{
111 DETECTORS=($argv[1,-2])
112 DETECTOR=$argv[-1]
113
114 DIR=$WORKDIR/${DETECTOR}.${VERSION}.B
115
116 if [[ ! -d $DIR ]]; then
117
118 mkdir -p $DIR
119 pushd $DIR
120
121 $JPP_DIR/software/JAcoustics/pre-calibration_${DETECTOR}.sh $WORKDIR/${^DETECTORS}.${VERSION}.B >& pre-calibration.B.log
122
123 popd
124 fi
125}
126
127# ORCA
128
129run D_ORCA006
130run D_ORCA006 D0ORCA010
131run D0ORCA010 D1ORCA011
132fcc D0ORCA010 D1ORCA011 D0ORCA007
133fcc D0ORCA010 D1ORCA011 D0ORCA011
134fcc D0ORCA010 D1ORCA011 D1ORCA013
135run D1ORCA011 D0ORCA015
136run D0ORCA015 D1ORCA015
137run D1ORCA015 D0ORCA018
138run D1ORCA015 DBORCA018
139run DBORCA018 D0ORCA023
140run DBORCA018 D1ORCA023
141run DBORCA018 D1ORCA024
142run DBORCA018 D2ORCA024
143
144## ARCA
145
146run D0ARCA006
147run D0ARCA006 D0ARCA009
148run D0ARCA009 D0ARCA021
149fcc D0ARCA021 D0ARCA020
150run D0ARCA021 D0ARCA028
151run D0ARCA028 D0ARCA030
152run D0ARCA030 D0ARCW003
153run D0ARCA030 D1ARCA030