Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
putMechanics-print.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2script=${0##*/}
3
4if [ -z $JPP_DIR ]; then
5 echo "Variable JPP_DIR undefined."
6 exit
7fi
8
9source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
10
11set_variable WORKDIR ${TMPDIR:-/tmp}
12set_variable: DEBUG ACOUSTICS_DEBUG 2
13
14if do_usage $*; then
15 usage "$script <archive>"\
16 "\nAuxiliary script to list numbers of files of type \"positions\" (a.k.a. \"katoomba\") in archive that require mechanical data."\
17 "\nThe columns files, count and errors correspond to number of files in the archive, "\
18 "\nthose requiring mechanical data and those missing mechanical data in \$JPP_ARCHIVE."
19fi
20
21if (( $# != 1 )); then
22 fatal "Wrong number of arguments."
23fi
24
25set_variable ARCHIVE $argv[1]
26
27set_variable TYPE positions
28
29
30function clean()
31{
32 rm -f $WORKDIR/mechanics.txt >& /dev/null
33 rm -f $WORKDIR/$TYPE.root >& /dev/null
34 rm -f $WORKDIR/mechanics.root >& /dev/null
35}
36
37BACKGROUND=(">& /dev/null"
38 ">& /dev/null"
39 "")
40
41printf "%-10s %8s %-10s %6s/%6s/%6s\n" detector number version files counts errors
42
43for IDENTIFIER in `getLs.sh $ARCHIVE`; do
44
45 for VERSION in `getLs.sh $ARCHIVE $IDENTIFIER $TYPE 2> /dev/null`; do
46
47 COUNTS=(0 0)
48 ERRORS=(0)
49
50 for RUN in `getLs.sh $ARCHIVE $IDENTIFIER $TYPE $VERSION`; do
51
52 clean
53
54 eval getFile.sh $ARCHIVE $IDENTIFIER $RUN $TYPE $VERSION $WORKDIR/$TYPE $BACKGROUND[$DEBUG]
55
56 let "COUNTS[1] += 1"
57
58 # check if file does not contain mechanical data
59
60 if [[ -z `JPrintName -f $WORKDIR/$TYPE.root:JDetectorMechanics_t 2> /dev/null` ]]; then
61
62 let "COUNTS[2] += 1"
63
64 getFile.sh $JPP_ARCHIVE $IDENTIFIER $RUN mechanics \* $WORKDIR/mechanics >& /dev/null
65
66 if (( $? != 0)) || [[ ! -f $WORKDIR/mechanics.txt ]]; then
67 let "ERRORS[1] += 1"
68 fi
69 fi
70 done
71
72 printf "%-10s %8d %-10s %6d/%6d/%6d\n" `getDetector -D $IDENTIFIER -O string` $IDENTIFIER $VERSION $COUNTS[*] $ERRORS[*]
73 done
74done
75
76clean