ROOTPWA
generatePhaseSpace.sh
Go to the documentation of this file.
1 #!/bin/bash
2 #
3 #//
4 #// Copyright 2009 Sebastian Neubert
5 #//
6 #// This file is part of rootpwa
7 #//
8 #// rootpwa is free software: you can redistribute it and/or modify
9 #// it under the terms of the GNU General Public License as published by
10 #// the Free Software Foundation, either version 3 of the License, or
11 #// (at your option) any later version.
12 #//
13 #// rootpwa is distributed in the hope that it will be useful,
14 #// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 #// GNU General Public License for more details.
17 #//
18 #// You should have received a copy of the GNU General Public License
19 #// along with rootpwa. If not, see <http://www.gnu.org/licenses/>.
20 #//
21 #
22 
23 NMB_EVENTS=20000
24 GEN_CONFIG_FILE=${ROOTPWA}/generators/3pinDiffractive2008.conf
25 
26 # construct array of mass bins in ascending order
27 MASS_BINS=( $(find ${ROOTPWA_DATA_DIR} -type d -regex '.*/[0-9]+.[0-9]+' -printf '%f\n' | sort -n) )
28 MASS_BIN_IDX=$(( MASS_BIN_IDX - 1 )) # SGE task IDs are 1 based
29 
30 for (( i=0; i<"${#MASS_BINS[@]}"; i++ ))
31 do
32  # get mass range for bin
33  MASS_BIN=${MASS_BINS[i]}
34  MASS_BIN_M_MIN=${MASS_BIN%.*}
35  MASS_BIN_M_MAX=${MASS_BIN#*.}
36  MASS_BIN_WIDTH=$(( MASS_BIN_M_MAX-MASS_BIN_M_MIN ))
37  MASS_BIN_MC_DIR="${ROOTPWA_DATA_DIR}/${MASS_BIN}/MC"
38  if [[ ! -d "${MASS_BIN_MC_DIR}" ]]
39  then
40  mkdir --parents --verbose ${MASS_BIN_MC_DIR}
41  fi
42  echo ">>> info: generating phase space data for mass bin ${MASS_BIN_M_MIN}.${MASS_BIN_M_MAX}"
43  CMD="genpw -n ${NMB_EVENTS} -o ${MASS_BIN_MC_DIR}/${MASS_BIN_M_MIN}.${MASS_BIN_M_MAX}.genbod.root -r ${GEN_CONFIG_FILE} -M ${MASS_BIN_M_MIN} -B ${MASS_BIN_WIDTH}"
44  echo ${CMD}
45  #time eval ${CMD}
46 
47  # convert .evt file into ROOTPWA .root format
48  EVT_FILE=${MASS_BIN_MC_DIR}/${MASS_BIN_M_MIN}.${MASS_BIN_M_MAX}.genbod.evt
49  ROOT_FILE=${ROOTPWA_DATA_DIR}/${MASS_BIN}/${MASS_BIN_M_MIN}.${MASS_BIN_M_MAX}.ps.root
50  echo ">>> info: converting '${EVT_FILE}' to '${ROOT_FILE}'"
51  CMD="root -b -q ${ROOTPWA}/amplitude/rootlogon.C ${ROOTPWA}/amplitude/convertEvtToTree.C+\(\\\"${EVT_FILE}\\\",\\\"${ROOT_FILE}\\\"\)"
52  echo ${CMD}
53  time eval ${CMD}
54  echo
55 
56 done