4if [ -z $JPP_DIR ]; then
5 echo "Variable JPP_DIR undefined."
9source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
11set_variable: DEBUG ARCHIVE_DEBUG 2
12set_variable: WORKDIR ARCHIVE_WORKDIR ${TMPDIR:-/tmp}/
13set_variable TYPE online
16 usage "$script <archive> <version> <detector identifier> (run[-run])+"\
17 "\nAuxiliary script to download online detector files from database and to store these in archive."
21 set_variable ARCHIVE $argv[1]
22 set_variable VERSION $argv[2]
23 set_variable DETECTOR_ID $argv[3]
24 set_array RUNS $argv[4,-1]
26 fatal "Wrong number of arguments."
31set_variable DETECTOR_ID $(getDetector -D $DETECTOR_ID -O int)
32set_variable DETECTOR $WORKDIR/detector.detx
34for RANGE in $RUNS[*]; do
36 let "MINRUN = ${RANGE%%-*}"
37 let "MAXRUN = ${RANGE##*-}"
39 for (( i0 = $MINRUN; $i0 <= $MAXRUN; )); do
47 -F RUN | read TCAL_0 PCAL_0 RCAL_0 RUN_0
49 if (( $? != 0 )) || [[ "$RUN_0" == "" ]] || (( $RUN_0 != $i0 )); then
56 notice "Run $RUN_0 $TCAL_0 $PCAL_0 $RCAL_0"
58 for (( i1 = $i0 + 1; $i1 <= $MAXRUN; i1 += 1 )); do
66 -F RUN | read TCAL_1 PCAL_1 RCAL_1 RUN_1
68 if (( $? != 0 )) || [[ "$RUN_1" == "" ]] || (( $RUN_1 != $i1 )); then
72 notice "Run $RUN_1 $TCAL_1 $PCAL_1 $RCAL_1"
74 if [[ "$TCAL_0" != "$TCAL_1" || "$PCAL_0" != "$PCAL_1" || "$RCAL_0" != "$RCAL_1" ]] then
87 if (( $? == 0 )); then
88 putFile.sh $DETECTOR $ARCHIVE $DETECTOR_ID $i0 $(($i1 - 1)) $TYPE $VERSION
90 error "Failure in downloading detector from database."
93 if (( $? == 0 )); then
96 fatal "$DETECTOR not stored in archive $ARCHIVE."