Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
getLs.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
10 
11 if do_usage $*; then
12  usage "$script <path> [<detector identifier> [<type> [version [<min run> [<max run> [option]]]]]]"\
13  "\nUtility script to list files in archive."\
14  "\nPossible options short or long."
15 fi
16 
17 case $# in
18  7) set_variable OPTION ${argv[7]};&
19  6) let MAXRUN=" ${argv[6]}";&
20  5) let MINRUN=" ${argv[5]}";&
21  4) set_variable VERSION ${argv[4]};&
22  3) set_variable TYPE ${argv[3]};&
23  2) let ID=" ${argv[2]}";&
24  1) set_variable DIR ${argv[1]:a};;
25  *) fatal "Wrong number of arguments."
26 esac
27 
28 if [[ ! -d $DIR ]]; then
29  fatal "Invalid path $DIR"
30 fi
31 
32 if [[ "$OPTION" != "" ]] && [[ "$OPTION" != "short" ]] && [[ "$OPTION" != "long" ]]; then
33  fatal "Invalid option $OPTION"
34 fi
35 
36 typeset -Z8 ID
37 typeset -Z8 MINRUN
38 typeset -Z8 MAXRUN
39 
40 if (( $# == 1 )); then
41 
42  ls -1 $DIR/ | grep -E ${ANY_ID} | sed -n 's/^0*//p'
43 
44 elif (( $# == 2 )); then
45 
46  ls -1 $DIR/$ID/;
47 
48 elif (( $# == 3 )); then
49 
50  ls -1 $DIR/$ID/$TYPE | sed 's/^_//';
51 
52 elif (( $# == 4 )); then
53 
54  ls -1 $DIR/$ID/$TYPE/_$VERSION | sed -n 's/^0*//p'
55 
56 elif (( $# == 5 )); then
57 
58  ls -1 $DIR/$ID/$TYPE/_$VERSION/$MINRUN | sed -n 's/^0*//p'
59 
60 elif (( $# >= 6 )); then
61 
63 
64  for BUFFER in $(ls -1 $DIR/$ID/$TYPE/_$VERSION/$MINRUN/$MAXRUN); do
65  if [[ "$FILENAME" == "" ]] || (( ${BUFFER:r} > ${FILENAME:r} )); then
66  FILENAME=$BUFFER
67  fi
68  done
69 
70  if [[ -n $FILENAME ]]; then
71  case "_$OPTION" in
72  _) echo "$FILENAME";;
73  _short) echo "$FILENAME";;
74  _long) echo "$DIR/$ID/$TYPE/_$VERSION/$MINRUN/$MAXRUN/$FILENAME";;
75  esac
76  fi
77 fi
&set_variable TYPE
Definition: getLs.sh:22
then usage $script< detector >< run >< outputfile > fi case set_variable OPTION
Definition: JTuna.sh:26
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
data_type r[M+1]
Definition: JPolint.hh:868
then FILENAME
Definition: getLs.sh:62
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
const int n
Definition: JPolint.hh:786
then JCalibrateToT a
Definition: JTuneHV.sh:107
do grep(chi2\[.\]\|gradient\|string:\)" $INPUT_FILE > $WORKDIR/stage.txt awk 'BEGIN
&set_variable VERSION
Definition: getLs.sh:21
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
* usage
then case _ $OPTION in _ echo $FILENAME
Definition: getLs.sh:72
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
&let MAXRUN
Definition: getLs.sh:19
then eval ls $DIR $ID $TYPE _
Definition: getArchive.sh:108
then echo
Definition: JQAQC.sh:92
then elif[["$OPTION"=="count"]]
Definition: JVolume1D.sh:54
then getFile sh $ARCHIVE $DETECTOR_ID $RUN positions $VERSION
Definition: JSpark.sh:47
esac done
Definition: JAddHDE.sh:21
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62