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
#!/bin/bash
#git clone --depth 1 https://eicweb.phy.anl.gov/EIC/datasets.git
export DAWN_PS_PREVIEWER="ls "
export G4DAWNFILE_VIEWER="ls -lrth "
export G4DAWNFILE_PS_VIEWER="ls "
function print_the_help {
echo "USAGE: ${0} [-s <skip_events>] -d <dawn_run_dir> "
echo " OPTIONS: "
echo " -D,--detector-only Only generate the prim files for the detector geometry."
echo " -s,--skip <skip_events> Required run number"
echo " -i,--input <input_file> Input hepmc file"
echo " -d,--dawn-dir <dawn_run_dir> Directory with the .DAWN files and a generate script "
echo " -t,--tag <file_tag> Output file tag"
exit
}
function yes_or_no {
while true; do
read -p "$* [y/n]: " yn
case $yn in
[Yy]*) return 0 ;;
[Nn]*) echo "No entered" ; return 1 ;;
esac
done
}
if [[ $# -eq 0 ]] ; then
print_the_help
exit
fi
SKIP_EVENTS=0
DETECTOR_ONLY=0
FILE_TAG="view"
DAWN_RUN_DIR="scripts/view1"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-c|--compact-file)
DETECTOR_FILE="$2"
shift # past argument
shift # past value
;;
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
-s|--skip)
SKIP_EVENTS="$2"
shift # past argument
shift # past value
;;
-i|--input)
INPUT_FILE="$2"
shift # past argument
shift # past value
;;
-o|--ouput-dir)
OUTPUT_DIR="$2"
shift # past argument
shift # past value
;;
-D|--detector-only)
DETECTOR_ONLY=1
shift # past argument
#shift # past value
;;
-d|--dawn-dir)
DAWN_RUN_DIR=$2
shift # past argument
shift # past value
;;
-t|--tag)
FILE_TAG=$2
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
rm -f *.prim
if [ "${DETECTOR_ONLY}" -eq "1" ] ; then
# timeout --preserve-status --signal=SIGTERM 120s \
./scripts/run_detector_simulation.py \
-i scripts/input_data/few_events.hepmc \
--ui csh --vis -b -m macro/dawn_picture.mac &
timeout=200
while [ $timeout -ge 0 ] && [ ! -f "g4_0000.prim" ]
do
echo "terminating in $timeout secs ..."
sleep 5
((timeout=timeout-5))
done
kill %1
else
echo " Running simulation for tracks"
# timeout --preserve-status --signal=SIGTERM 120s \
./scripts/run_detector_simulation.py \
-i scripts/input_data/few_events.hepmc \
-o derp.root -s ${SKIP_EVENTS} -n 1 \
--ui csh --vis -b -m macro/dawn_picture2.mac &
sleep 40
kill %1
fi
#./scripts/run_detector_simulation.py -i scripts/input_data/few_events.hepmc \
# -o derp.root -s 2 -n 1 \
# --ui csh --vis -b -m macro/dawn_picture2.mac &
#
#sleep 20
#kill %1
#./scripts/run_detector_simulation.py -i scripts/input_data/few_events.hepmc \
# -o derp.root -s 5 -n 1 \
# --ui csh --vis -b -m macro/dawn_picture2.mac &
#
#sleep 20
#kill %1
#
#./scripts/run_detector_simulation.py -i scripts/input_data/few_events.hepmc \
# -o derp.root -s 6 -n 1 \
# --ui csh --vis -b -m macro/dawn_picture2.mac &
#
#sleep 20
#kill %1
[[ -f "g4_0000.prim" ]] || exit -1
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
echo "simulating done"
#npsim --runType vis \
# -v WARNING \
# --macroFile macro/dawn_picture.mac \
# --numberOfEvents 1 \
# --compactFile topside.xml \
# --inputFiles scripts/input_data/few_events.hepmc \
# --outputFile derp.root \
# --dumpSteeringFile >> derp.out
ls -lrth
mkdir -p images
#mkdir -p images/prim
pushd ${DAWN_RUN_DIR}
if [ "${DETECTOR_ONLY}" -eq "1" ] ; then
./generate_eps -t ${FILE_TAG} -i ../../g4_0000.prim
else
./generate_eps -t ${FILE_TAG} -i ../../g4_0000.prim
fi
ls -lrth
cp *.pdf ../../images/.
cp *.png ../../images/.
#cp *.prim ../../images/prim/.
popd