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