Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hydrophone-t0:fit.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 zmodload zsh/mathfunc
12 
13 set_variable: DEBUG ACOUSTICS_DEBUG 2
14 set_variable: WORKDIR ACOUSTICS_WORKDIR ./
15 set_variable+ BACKGROUND ACOUSTICS_BACKGROUND: -B
16 
17 if do_usage $*; then
18  usage "$script <detector file> <string identifier> [<detector file>]"
19 fi
20 
21 if (( $# == 0 || $# > 3 )); then
22  fatal "Wrong number of arguments."
23 fi
24 
27 set_array QUANTILES 0.333 0.666
28 set_variable FORMULA "[0] * exp(-0.5 * (x-[1])*(x-[1]) / ([2]*[2]))"
29 set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"`
30 
31 typeset -Z 4 STRING
32 
33 JOpera1D \
34  -f hydrophone.root:$MODULE \
35  -o /tmp/H\[${STRING}\].root \
36  -u Add -d 0
37 
38 JPrintQuantiles \
39  -f /tmp/H\[${STRING}\].root:Add \
40  -Q "$QUANTILES[*]" \
41  -d 0 | read -A RESULT
42 
43 P1=$((0.5*($RESULT[-1] + $RESULT[1]))) # average
44 P2=$((1.5*($RESULT[-1] - $RESULT[1]))) # width
45 
46 JFit \
47  -f /tmp/H\[${STRING}\].root:Add \
48  -o /tmp/F\[${STRING}\].root \
49  -F "$FORMULA" \
50  -@"p0 = GetMaximum * 0.8" \
51  -@"p1 = $P1" \
52  -@"p2 = $P2" \
53  -d $DEBUG
54 
55 printf "string %4d %9.6f +/- %9.6f\n" $STRING `JPrintFit -f /tmp/F\[${STRING}\].root:Add -@p1`
56 
57 if (( ${#} == 3 )); then
58 
60 
61  eval `JPrintDetector -a $DETECTOR -O SUMMARY`
62 
63  set_array P1 `JPrintFit -f /tmp/F\[${STRING}\].root:Add -@p1`
64 
65  let TIME_OFFSET_NS="$P1[1] * 1.0e9"
66 
67  printf "Add time offset %12.6d to hydrophone.\n" $TIME_OFFSET_NS
68 
69  JEditDetector \
70  -a $DETECTOR \
71  -o $DETECTOR \
72  -M "$MODULE SUB $TIME_OFFSET_NS" \
73  -d $DEBUG
74 fi
75 
76 JPlot1D \
77  -f /tmp/F\[${STRING}\].root:Add \
78  -x "-0.002 +0.002" \
79  -\> "#Deltat [s]" \
80  -\^ "number of events [a.u.]" \
81  -N "X 505" \
82  -T "$STRING" \
83  -o hydrophonet0_${STRING}.gif $BACKGROUND
Q(UTCMax_s-UTCMin_s)-livetime_s
TPaveText * p1
do $JPP JMEstimator M
Definition: JMEstimator.sh:37
clean eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY set_variable STRING
bool read(Vec &v, std::istream &is)
Read a Vec(tor) from a stream.
Definition: io_ascii.hh:141
static const double H
Planck constant [eV s].
exit
Definition: JPizza.sh:36
then JPizza f
Definition: JPizza.sh:46
then echo
then fatal Invalid string $STRING
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:20
do set_variable OUTPUT_DIRECTORY $WORKDIR T
do $DIR JTransitTime o
Definition: JTransitTime.sh:44
then awk F
* usage
*set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2,-2] set_variable OUTPUT_FILE $argv[-1]
Definition: JDomino.sh:39
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:45
then JCalibrateToT a
Definition: JTuneHV.sh:116
then set_variable MODULE getModule a $DETECTOR L $STRING $FLOOR JEditDetector a $DETECTOR M $MODULE add $X o $DETECTOR else echo No update of detector $DETECTOR
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable DEBUG set_variable WORKDIR tmp set_variable JDAQ_TIMESLICE JDAQTimeslice if do_usage *then usage $script< detector file >< inputfile > fi case set_variable WORKDIR
Definition: JLegolas.sh:23
set_variable DETECTOR
double u[N+1]
Definition: JPolint.hh:739
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:35
script
Definition: JAcoustics.sh:2
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A
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
then QUANTILES