Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
acoustics-Zmul.sh File Reference

Go to the source code of this file.

Functions

then usage $script< detector
specific pre-calibration
script >< option > nAuxiliary
script to make scan of pre
stretching of detector 
strings (see JEditDetector)." "\nPossible options
 

Variables

 script
 
then echo Variable JPP_DIR
undefined exit fi source
$JPP_DIR setenv sh $JPP_DIR
&dev null 
set_variable
 

Function Documentation

then usage $script<detector specific pre-calibration script><option> nAuxiliary script to make scan of pre stretching of detector strings ( see  JEditDetector)

Definition at line 20 of file acoustics-Zmul.sh.

21  : run, plot or fit."
22 fi
23 
24 if (( $# < 1 || $# > 2)); then
25  fatal "Wrong number of arguments."
26 fi
27 
28 # global variables
29 
30 set_variable SCRIPT $argv[1]
31 set_variable OPTION $argv[-1]
32 
33 if [[ $OPTION != "run" && $OPTION != "plot" && $OPTION != "fit" ]]; then
34  fatal "Invalid option $OPTION."
35 fi
36 
37 if [[ $OPTION == "run" ]]; then
38 
39  for MUL in $MULS[*]; do
40 
41  set_variable DIR $WORKDIR/mul=$MUL
42 
43  mkdir -p $DIR
44  cd $DIR
45 
46  # set varibales in script
47 
48  set_variable ACOUSTICS_MUL $MUL
49 
50  nohup $SCRIPT >& all.log &
51  done
52 fi
53 
54 if [[ $OPTION == "plot" || $OPTION == "fit" ]]; then
55 
56  set_variable ACOUSTICS_ZMUL_TXT ${TMPDIR:-/tmp}/acoustics-zmul.txt
57  set_variable ACOUSTICS_ZMUL_ROOT ${TMPDIR:-/tmp}/acoustics-zmul.root
58 
59  rm -f $ACOUSTICS_ZMUL_TXT >& /dev/null
60 
61  for MUL in $MULS[*]; do
62 
63  set_variable DIR $WORKDIR/mul=$MUL
64  set_variable FILE `ls $DIR/stage-(1|A).log`
65 
66  tail -1 $FILE | grep "Elapsed time" >& /dev/null
67 
68  if (( $? == 0 )); then
69 
70  set_array RESULT `grep -v "warning" $FILE | tail -2 | head -1`
71 
72  printf "%4.1e %6.3f\n" $MUL $RESULT[-1] >> $ACOUSTICS_ZMUL_TXT
73  fi
74  done
75 
76  JGraph \
77  -f $ACOUSTICS_ZMUL_TXT \
78  -o $ACOUSTICS_ZMUL_ROOT
79 
80  XMIN=`sort -k1g $ACOUSTICS_ZMUL_TXT | head -1 | awk '{ print $1 }'`
81  XMAX=`sort -k1g $ACOUSTICS_ZMUL_TXT | tail -1 | awk '{ print $1 }'`
82 
83  let "XMIN = $XMIN - 1.0e-3"
84  let "XMAX = $XMAX + 1.0e-3"
85 
86  if [[ $OPTION == "fit" ]]; then
87 
88  sort -gr -k2gr $ACOUSTICS_ZMUL_TXT | tail -1 | read X Y
89 
90  JFit \
91  -f ${ACOUSTICS_ZMUL_ROOT}:\.\* \
92  -o ${TMPDIR:-/tmp}/fit.root \
93  -F "$FORMULA" \
94  -@ "p0 = $Y" \
95  -@ "p1 = 0.1" \
96  -@ "p2 = $X" \
97  -@ "p3 = 0.002" \
98  -d $DEBUG
99 
100  set_array P2 `JPrintFit -f ${TMPDIR:-/tmp}/fit.root:\.\* -@p2`
101 
102  printf "Optimal stretching factor %8.2e\n" $P2[1]
103 
104  mv ${TMPDIR:-/tmp}/fit.root $ACOUSTICS_ZMUL_ROOT
105 
106  fi
107 
108  JPlot1D \
109  -f $ACOUSTICS_ZMUL_ROOT:\.\* \
110  -x "$XMIN $XMAX" \
111  -> "M" \
112  -\^ "#chi^{2}/NDF" \
then usage $script< option > nPossible plot
Definition: JMatrixNZ.sh:34
TPaveText * p1
*fatal Wrong number of arguments
then let XMIN
*fatal Wrong option $OPTION
p3
Definition: module-Z:fit.sh:74

Variable Documentation

script
Initial value:
=${0##*/}
if [ -z $JPP_DIR ]
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
Definition: JDrawPDF.sh:45

Definition at line 2 of file acoustics-Zmul.sh.

then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR& dev null set_variable

Definition at line 18 of file acoustics-Zmul.sh.