ROOTPWA
step9.sh
Go to the documentation of this file.
1 # this script calls the fitting procedure
2 # should be called by run_X_PWA_analysis.sh script
3 # author: P.Jasinski Promme@web.de , jasinski@kph.uni-mainz.de
4 
5 source ${ROOTPWA}/scripts/pwa_Kpipi_example/set_workspace_var.sh
6 
7 echo -e "\n **************** part 9 ******************"
8 echo " *${STEP_NAME[8]}*"
9 echo -e " ******************************************\n"
10 
11 if which pwafit >/dev/null; then
12  echo -e "\n pwafit found"
13 else
14  echo -e "\E[37;31m \n pwa fitter pwafit not found:"; tput sgr0
15  echo -e "\E[37;31m Please compile rootpwa according to "
16  echo -e "\E[37;34m ${ROOTPWA}/INSTALL "
17  echo -e "\E[37;31m instructions "; tput sgr0
18  echo -e "\n Aborting this script"; tput sgr0
19  return 0
20 fi
21 
22 RANK=1 # 1,2 or 3
23 
24 OVERRIDE_FIT="N"
25 for BIN in ${KPIPI_WORK_DIR}/*
26 do
27  _BIN=$(basename ${BIN}) # get the directory name
28  BINHIGH=${_BIN#*.} # the number after the "." is the high bound
29  BINLOW=${_BIN%.*} # the number in front of the "." is the low bound
30  # not everything in ./* is always a valid folder. Check the name to have numbers
31  if echo ${BINLOW} | grep "^[0-9]*$">/tmp/aux
32  then
33  OUTFILE=${KPIPI_FIT_DIR}/${_BIN}.result.root
34  if [ -e ${OUTFILE} ];
35  then
36  if [ ${OVERRIDE_FIT}=="N" ]; # ask once to override if file exists already
37  then
38  echo -e "\E[37;31m \n fit result"
39  echo -e "\E[37;34m ${OUTFILE}"
40  echo -e "\E[37;31m already exists! Override all? (Y/N) "; tput sgr0
41  read OVERRIDE_FIT
42  fi
43  rm ${OUTFILE}
44  fi
45 
46  if [ -e ${OUTFILE} ]; # perform only if the file does not exist or was removed previously
47  then
48  echo -e "\E[37;31m \n skipping existing bin fit! "
49  echo -e "\E[37;34m ${OUTFILE}"; tput sgr0
50  else
51  echo -e " \n fitting ${BIN}"
52  echo -e " into ${OUTFILE}"
53  echo -e " Starting time: ";
54  date;
55  cd ${BIN}/AMPS;
56  NORM="../PSPAMPS/norm.int"
57  if [ -e norm.int ];
58  then
59  echo -e " Default normalization integral already existent. "
60  else
61  echo -e " using ${NORM} for normalization ->\E[37;31m no acceptance correction! "; tput sgr0
62  cp ${NORM} ./
63  fi
64  pwafit -q -w ${KPIPI_WAVE_LIST} -o ${OUTFILE} -r ${RANK} -l ${BINLOW} -N -u ${BINHIGH} -n ${NORM}
65  fi
66  else
67  echo -e "\n skipping ${BIN}"
68  fi
69  rm /tmp/aux
70 done
71 
72 cd ${_PWD}