Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hydrophone-phi:run.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 
12 set_variable WORKDIR ${ACOUSTICS_WORKDIR:-./}
13 
14 if ( do_usage $* ); then
15  usage "$script <string identifier> <detector file> <input file> <toashort file>"
16 fi
17 
18 if (( ${#} < 4 || ${#}%2 != 0 )); then
19  fatal "Wrong number of arguments."
20 fi
21 
22 let N="(${#} - 2) / 2"
23 
26 set_array INPUT_FILES $argv[3,2+$N]
27 set_array TOASHORT_FILES $argv[-$N,-1]
28 
29 eval `JPrintDetector -a $DETECTOR -O IDENTIFIER`
30 eval `JPrintDetector -a $DETECTOR -O SUMMARY`
31 
32 source JAcoustics.sh $DETECTOR_ID
33 
34 getModule -a $DETECTOR -L "$STRINGS[1] 0" >& /dev/null
35 
36 if (( $? != 0 )); then
37 
38  JCookie.sh
39 
40  JDetectorDB \
41  -a $DETECTOR \
42  -o $DETECTOR \
43  -W --!
44 fi
45 
46 if [[ -z "${STRINGS[(r)$STRING]}" ]]; then
47  fatal "Invalid string $STRING; "\
48  "possible values: ${STRINGS[*]}"
49 fi
50 
51 set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"`
52 set_variable HYDROPHONE_TXT $WORKDIR/hydrophonephi_${STRING}.txt
53 set_variable TMPDIR $WORKDIR/.$$
54 set_variable PI 3.1415927
55 mkdir -p $TMPDIR
56 
57 for (( PHI = -$PI; $PHI <= +$PI; PHI += 0.05 )); do
58 
59  cp hydrophone.txt $TMPDIR/.
60 
61  JEditHydrophone -f $TMPDIR/hydrophone.txt -S "$STRING rot $PHI"
62 
63  eval $JPP_DIR/examples/JAcoustics/JHydrophone \
64  -a $DETECTOR \
65  -f \"$INPUT_FILES[*]\" \
66  -i \"$TOASHORT_FILES[*]\" \
67  -o $TMPDIR/hydrophone.root \
68  -H $TMPDIR/hydrophone.txt \
69  -T `print_tripods` \
70  -V `print_velocity` \
71  -d $DEBUG --!
72 
73  JOpera1D \
74  -f "$TMPDIR/hydrophone.root:\[${MODULE}\..*\]" \
75  -o $TMPDIR/opera.root \
76  -u Add
77 
78  set_variable RMS `JPrintResult -f "$TMPDIR/opera.root:Add" -F "GetRMS * 1.0e3"`
79 
80  printf "%7.3f %12.8f\n" $PHI $RMS >> $HYDROPHONE_TXT
81 
82 done
83 
84 rm -rf $TMPDIR
void set_variable(const std::string &name, const std::string &value)
Set environment variable.
clean eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY set_variable STRING
exit
Definition: JPizza.sh:36
do set_array DAQHEADER JPrintDAQHeader f
Definition: JTuneHV.sh:79
then echo
static const double PI
Mathematical constants.
do $DIR JTransitTime o
Definition: JTransitTime.sh:44
* usage
then fatal Not enough arguments fi set_variable DETECTOR $argv[1] INPUT_FILES
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable ACOUSTICS_DEBUG
Definition: JAcoustics.sh:17
*set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2,-2] set_variable OUTPUT_FILE $argv[-1]
Definition: JDomino.sh:39
do set_variable SIGMA_NS set_variable OUTLIERS set_variable OUTPUT_FILE matrix[${ALPHA_DEG}\deg\] root $JPP JMatrixNZ a $DETECTOR f $INPUT_FILE o $OUTPUT_FILE S
Definition: JMatrixNZ.sh:56
then $JPP_DIR software JCalibrate JCalibrateToT a
Definition: JTuneHV.sh:108
then display $WORKDIR
Definition: plot-Domino.sh:127
then cp
set_variable DETECTOR
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37
script
Definition: JAcoustics.sh:2
then usage $script< detector file >< inputfile > fi case set_variable WORKDIR
Definition: JLegolas.sh:28
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
const JModule & getModule(const JDetector &detector, const JModuleLocation &location)
find module with a given string and floor number
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62