Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
archive-put-pmt.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 script=${0##*/}
3 
4 if [ -z $JPP_DIR ]; then
5  echo "Variable JPP_DIR undefined."
6  exit
7 fi
8 
9 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
10 
11 set_variable: DEBUG ARCHIVE_DEBUG 2
12 set_variable: WORKDIR ARCHIVE_WORKDIR ${TMPDIR:-/tmp}/
14 
15 if do_usage $*; then
16  usage "$script <source directory> <detector identifier> <suffix> <archive> <version>"\
17  "\nAuxiliary script to download online detector files from database and to store these in archive."\
18  "\nNote that the given suffix and version should match with that in the file names."
19 fi
20 
21 if (( $# == 5 )); then
25  set_variable ARCHIVE $argv[4]
27 else
28  fatal "Wrong number of arguments."
29 fi
30 
31 set_variable DETECTOR_ID $(getDetector -D $DETECTOR_ID -O int)
32 set_variable PREFIX KM3NeT_${(l:8::0::0:)DETECTOR_ID}
34 
35 typeset -A DATABASE
36 typeset -T BUFFER ARRAY _
37 
38 for FILE_NAME in `ls ${DIR}/${PREFIX}_*\.${SUFFIX}.txt`; do
39 
40  BUFFER=${${FILE_NAME:t}%%\.*}
41 
42  let "ID = $ARRAY[2]"
43  let "RUN = $ARRAY[3]"
44 
45  DATABASE[$RUN]=$FILE_NAME
46 done
47 
48 if (( ${#DATABASE} == 0 )); then
49  fatal "No input files at ${DIR}/${PREFIX}_*\.${SUFFIX}.txt."
50 fi
51 
52 MINRUN=`echo ${(k)DATABASE} | tr ' ' '\n' | sort -g | head -n 1`
53 MAXRUN=`echo ${(k)DATABASE} | tr ' ' '\n' | sort -g | tail -n 1`
54 
55 for (( i0 = $MINRUN; $i0 <= $MAXRUN; )); do
56 
57  if (( ${+DATABASE[$i0]} == 1 )); then
58 
59  notice "Run $i0 $DATABASE[$i0]"
60 
61  grep -E -v "^#" $DATABASE[$i0] > $WORKDIR/i0.txt
62 
63  for (( i1 = $i0 + 1; $i1 <= $MAXRUN; i1 += 1 )); do
64 
65  if (( ${+DATABASE[$i1]} == 0 )); then
66  continue
67  fi
68 
69  notice "Run $i1 $DATABASE[$i1]"
70 
71  grep -E -v "^#" $DATABASE[$i1] > $WORKDIR/i1.txt
72 
73  diff $WORKDIR/i0.txt $WORKDIR/i1.txt >& /dev/null
74 
75  if (( $? != 0 )); then
76  break
77  fi
78  done
79 
80  putFile.sh ${DATABASE[$i0]} $ARCHIVE $DETECTOR_ID $i0 $(($i1 - 1)) $TYPE $VERSION
81 
82  let "i0 = $i1"
83  else
84 
85  let "i0 = $i0 + 1"
86  fi
87 done
88 
89 rm -f $WORKDIR/i{0,1}.txt
&set_variable TYPE
Definition: getLs.sh:22
then usage $script< detector identifier >< startdate\"YYYY-MM-DDHH:MM:SS\"><finaldate\"YYYY-MM-DDHH:MM:SS\"><QA/QCfile> fi case set_variable QAQC_TXT $argv[4]
Definition: JDataMonitor.sh:24
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition: JMuonPostfit.sh:40
esac done BUFFER
Definition: JMakePDF.sh:83
&let MINRUN
Definition: getLs.sh:20
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O SUMMARY JPrintDAQHeader f $INPUT_FILE read A DAQ_HEADER set_variable DETECTOR_ID
Definition: JSquid.sh:28
exit
Definition: JPizza.sh:36
then
Definition: datalogs.sh:34
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
Definition: JDBToolkit.hh:378
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable DETECTOR_ID set_array RUNS if do_usage *then usage $script< source directory > nThe source directory corresponds to a pre calibrated D0ARCA009 detector fi case set_variable DIR
set_variable SUFFIX
const int n
Definition: JPolint.hh:786
then rm
Definition: sftpput.zsh:30
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR if do_usage *then usage $script[(input file)+] fi set_variable DEBUG set_variable WORKDIR TMPDIR
do grep(chi2\[.\]\|gradient\|string:\)" $INPUT_FILE > $WORKDIR/stage.txt awk 'BEGIN
&set_variable VERSION
Definition: getLs.sh:21
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable DEBUG set_variable WORKDIR
Definition: JLegolas.sh:20
* usage
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
Definition: JDrawPDF.sh:45
do set_variable INPUT_FILE $WORKDIR KM3NeT_
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
&let MAXRUN
Definition: getLs.sh:19
then JHobbit a $DETECTOR f
then eval ls $DIR $ID $TYPE _
Definition: getArchive.sh:108
data_type v[N+1][M+1]
Definition: JPolint.hh:866
then echo
Definition: JQAQC.sh:92
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
then getFile sh $ARCHIVE $DETECTOR_ID $RUN positions $VERSION
Definition: JSpark.sh:47
then getFile sh $JPP_ARCHIVE $DETECTOR_ID $RUNS[1] $KEY $VERSION $WORKDIR
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
esac done
Definition: JAddHDE.sh:21
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62