Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
## Generates different configurations from the master configuration
## for both electron and muon decay channels
echo "Generating generator configuration files for J/psi -> e+e- and mu+mu-"
CONFIG=
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-c|--config)
CONFIG="$2"
shift # past argument
shift # past value
;;
*) # unknown option
echo "unknown option"
exit 1
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [[ -z ${CONFIG} ]] ; then
echo " ERROR: need argument -c/--config <config file> "
exit 1
fi
if [[ ! -f ${CONFIG} ]] ; then
echo " ERROR: cannot find config input file ${CONFIG}"
exit 1
fi
CONFIG_BASE=`basename ${CONFIG} .json.in`
echo "Generating ${CONFIG_BASE}_el.json"
sed "s/@TAG@/electron/" ${CONFIG} | \
sed "s/@DECAY_LEPTON@/11/" | sed "s/@BRANCHING@/0.05971/" > ${CONFIG_BASE}_el.json
echo "Generating ${CONFIG_BASE}_mu.json"
sed "s/@TAG@/muon/" ${CONFIG} | \
sed "s/@DECAY_LEPTON@/13/" | sed "s/@BRANCHING@/0.05961/" > ${CONFIG_BASE}_mu.json
echo "Configuration generation finished."