ROOTPWA
step7.sh
Go to the documentation of this file.
1 # this script creates and runs/submits scripts
2 # for the calculation of the amplitudes and integrals
3 # should be called by run_X_PWA_analysis.sh script
4 # author: P.Jasinski Promme@web.de , jasinski@kph.uni-mainz.de
5 
6 source ${ROOTPWA}/scripts/pwa_Kpipi_example/set_workspace_var.sh
7 
8 echo -e "\n **************** part 7 ******************"
9 echo " *${STEP_NAME[6]}*"
10 echo -e " ******************************************\n"
11 
12 cd ${ROOTPWA}/scripts # there are other scripts used here
13 export KEYDIR=${KPIPI_KEYFILE_DIR} # needed in doamps.sh script
14 
15 for BIN in ${KPIPI_WORK_DIR}/*
16 do
17  _BIN=$(basename ${BIN}) # get the directory name
18  BINHIGH=${_BIN#*.} # the number behind the "." is the high bound
19  BINLOW=${_BIN%.*} # the number in front of the "." is the low bound
20  # not everything in ./* is always a valid folder. Check the name to have numbers
21  if echo ${BINLOW} | grep "^[0-9]*$">/tmp/aux
22  then
23  echo -e "\n attempting to calculate amplitudes in "
24  echo " PROCESSING MASS BIN: ${BIN}";
25  # echo " Starting time: ";
26  # date;
27 
28  if [ "${KPIPI_CALC_AMP_FARM}" == 'mainz' ]
29  then
30  # write and submit a scrip for data amplitude calculation
31  export AMPDIR=${BIN}/AMPS;
32  export FILE="${BIN}/${BINLOW}.${BINHIGH}.evt";
33  echo " input: ${FILE}";
34  export BATCHFILE="${BIN}/calcamp_batch_${KPIPI_CALC_AMP_FARM}.evt.sh"
35 
36 cat > ${BATCHFILE} << EOF
37 #!/bin/bash
38 #
39 #PBS -N calcampJob
40 #PBS -j oe
41 #PBS -o ${BATCHFILE}.out
42 #PBS -V
43 #PBS -l nodes=1:x86_64
44 
45 export PATH=\$PBS_O_PATH
46 cd \$PBS_O_WORKDIR
47 ./doamps.sh ${FILE}
48 
49 EOF
50  echo " submitting batchscript ${BATCHFILE}"
51  qsub ${BATCHFILE}
52 
53  # write and submit a script for monte carlo amplitude calculation
54  export FILE=${FILE/evt/genbod.evt};
55  export AMPDIR=${BIN}/PSPAMPS;
56  echo " mc-input: ${FILE}";
57  export BATCHFILE="${BIN}/calcamp_batch_${KPIPI_CALC_AMP_FARM}.genbod.evt.sh"
58 
59 cat > ${BATCHFILE} << EOF
60 #!/bin/bash
61 #
62 #PBS -N calcmcampJob
63 #PBS -j oe
64 #PBS -o ${BATCHFILE}.out
65 #PBS -V
66 #PBS -l nodes=1:x86_64
67 
68 export PATH=\$PBS_O_PATH
69 cd \$PBS_O_WORKDIR
70 ./doamps.sh ${FILE}
71 cd ${AMPDIR}
72 int *.amp > norm.int;
73 
74 EOF
75  echo " submitting batchscript ${BATCHFILE}"
76  qsub ${BATCHFILE}
77 
78  # write and submit a script for monte carlo accepted calculation
79  export FILE=${FILE/genbod.evt/acc.evt};
80  export AMPDIR=${BIN}/ACCAMPS;
81  echo " acc-input: ${FILE}";
82  export BATCHFILE="${BIN}/calcamp_batch_${KPIPI_CALC_AMP_FARM}.acc.evt.sh"
83 
84 cat > ${BATCHFILE} << EOF
85 #!/bin/bash
86 #
87 #PBS -N calcmcaccampJob
88 #PBS -j oe
89 #PBS -o ${BATCHFILE}.out
90 #PBS -V
91 #PBS -l nodes=1:x86_64
92 
93 export PATH=\$PBS_O_PATH
94 cd \$PBS_O_WORKDIR
95 ./doamps.sh ${FILE}
96 cd ${AMPDIR}
97 int *.amp > norm.int;
98 
99 EOF
100  echo " submitting batchscript ${BATCHFILE}"
101  qsub ${BATCHFILE}
102 
103  else # if mainz
104  if [ "${KPIPI_CALC_AMP_FARM}" == 'local' ]
105  then
106  # data amplitude calculation
107  export AMPDIR=${BIN}/AMPS;
108  export FILE="${BIN}/${BINLOW}.${BINHIGH}.evt";
109  echo " input: ${FILE}";
110  ./doamps.sh ${FILE};
111 
112  # monte carlo amplitude calculation
113  export FILE=${FILE/evt/genbod.evt};
114  echo "---- mc-input: ${FILE}";
115  export AMPDIR=${BIN}/PSPAMPS;
116  ./doamps.sh ${FILE};
117 
118  # Do integration
119  cd ${AMPDIR}
120  int *.amp > norm.int;
121  cd -;
122 
123  # monte carlo accepted calculation
124  export FILE=${FILE/genbod.evt/acc.evt};
125  echo "---- acc-input: ${FILE}";
126  export AMPDIR=${BIN}/ACCAMPS;
127  ./doamps.sh ${FILE};
128 
129  # Do integration
130  cd ${AMPDIR}
131  int *.amp > norm.int;
132  cd -;
133  else # if local
134  echo " amplitude analysis for ${KPIPI_CALC_AMP_FARM} not implemented yet! "
135  fi # if local
136  fi # if mainz
137  else
138  echo -e "\n skipping ${BIN}"
139  fi
140  rm /tmp/aux
141 done
142 
143 cd ${_PWD}