Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
getArchive.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author mdejong
4 #
5 script=${0##*/}
6 
7 source ${0%${script}}ulib.sh
8 
9 set_variable: DEBUG ARCHIVE_DEBUG 2
11 
12 if do_usage $*; then
13  usage "$script <path> [<detector identifier> [<run> [<type> [version]]]]"\
14  "\nUtility script to list files in archive."
15 fi
16 
17 case $# in
19  4) set_variable TYPE $argv[4];&
20  3) let RUN=" $argv[3]";&
21  2) let ID=" $argv[2]";&
23  *) fatal "Wrong number of arguments."
24 esac
25 
26 
27 if [[ ! -d $DIR ]]; then
28  fatal "Invalid path $argv[1]"
29 fi
30 
31 
32 setopt extendedglob
33 
34 typeset -Z8 ID
35 
36 
37 #
38 # print file properties
39 #
40 # \param 1 file name
41 #
42 function archive()
43 {
44  typeset -T BUFFER ARRAY /
45 
46  BUFFER=$1
47 
48  set_variable A_ID ${ARRAY[-6]}
49  set_variable A_TYPE ${ARRAY[-5]}
50  set_variable A_VERSION ${ARRAY[-4]#_}
51  let A_MINRUN=" ${ARRAY[-3]}"
52  let A_MAXRUN=" ${ARRAY[-2]}"
53  set_variable A_FILENAME ${ARRAY[-1]}
54 
55  let A_COUNTER="${A_FILENAME:r}"
56 
57  if (( $RUN >= $A_MINRUN && $RUN <= $A_MAXRUN )); then
58 
59  if [[ $(uname) == "Darwin" ]]; then
60  ls -l $BUFFER
61  else
62  ls -l --author $BUFFER
63  fi
64 
65  if (( $DEBUG >= 3 )); then
66  echo "identifier: $(($A_ID))"
67  echo "type: $A_TYPE"
68  echo "version: $A_VERSION"
69  echo "minimal run: $(($A_MINRUN))"
70  echo "maximal run: $(($A_MAXRUN))"
71  echo
72  fi
73  fi
74 
75 }
76 
77 
78 if (( $# == 1 )); then
79  ls -1 $DIR/ | grep -E ${ANY_ID}; return
80 fi
81 
82 
83 if (( $ID == 0 )); then
84  fatal "Invalid detector identifier $argv[2]"
85 fi
86 
87 
88 if (( $# == 2 )); then
89  ls -1 $DIR/$ID/; return
90 fi
91 
92 
93 if (( $RUN == 0 )); then
94  fatal "Invalid run $argv[3]"
95 fi
96 
97 
98 if (( $# == 3 )); then
99 
100  eval ls -1 $DIR/$ID/\*/_\*/\*/\*/\* 2> /dev/null | while read BUFFER; do
101  archive $BUFFER
102  done
103 fi
104 
105 
106 if (( $# >= 4 )); then
107 
108  eval ls -1 $DIR/$ID/$TYPE/_${VERSION}/\*/\*/\* 2> /dev/null | while read BUFFER; do
109  archive $BUFFER
110  done
111 fi
&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
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
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
then
Definition: datalogs.sh:34
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
do set_variable A_ID
Definition: getFile.sh:57
then fatal Invalid path $argv[1] fi setopt extendedglob typeset Z8 ID function archive()
Definition: getArchive.sh:42
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 rm i $OUTPUT_FILE fi let RUN
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
* usage
then ls $DIR $ID
Definition: getArchive.sh:89
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonStart.sh:47
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
then eval ls $DIR $ID $TYPE _
Definition: getArchive.sh:108
then echo
Definition: JQAQC.sh:92
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