edepsim-export-geometry.sh
Go to the documentation of this file.
1 #!/bin/bash
2 #
3 # Export an MC geometry to a geometry file. This prepares a file that
4 # is ready to be used in the reconstruction.
5 #
6 # USAGE: ./edepsim-export-geometry.sh <control-file> <1.0> ...
7 #
8 # Make a temporary macro file.
9 MACRO=`mktemp -t edepsim.XXXXXXXXXX` || exit 1
10 
11 haveControl=""
12 
13 # write the control lines.
14 while true; do
15  CTRL=$1
16  if [ x$CTRL == x ]; then
17  break;
18  fi
19 
20  shift
21  CTRLVERS=$1
22  if [ x$CTRLVERS == x ]; then
23  echo Missing control file
24  rm $MACRO
25  exit 1
26  fi
27 
28  haveControl=${haveControl}"-"${CTRL}
29 
30  echo /edep/control ${CTRL} ${CTRLVERS} >> $MACRO
31  shift
32 done
33 
34 if [ x$haveControl == x ]; then
35  echo Missing control file
36  rm $MACRO
37  exit 1
38 fi
39 
40 OUTPUT=export-geometry${haveControl}.root
41 cat >> $MACRO <<EOF
42 # /edep/validateGeometry
43 /edep/update
44 /edep/export $OUTPUT
45 EOF
46 
47 set -e
48 
49 edep-sim -C $MACRO
50 
51 rm $MACRO
52