-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunEvents.sh
executable file
·65 lines (54 loc) · 1.74 KB
/
runEvents.sh
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
PREFIX="rcb"
ptRange=$(awk 'BEGIN{for(i=5;i<=60;i+=0.5)print i}')
threshRange=$(awk 'BEGIN{for(j=0.1;j<=0.1;j+=0.1)print j}')
echo "Simulating $PARTICLE events."
# Require that user specify particle type.
if [ $# -eq 0 ]; then
echo "Error: didn't specify EMinus, Gamma, or Pi0. Exiting."
exit
elif [ $# -eq 1 ] && [ "$1" == "test" ]; then
echo "Starting a test run . . . "
echo "Enter test particle type (EMinus, Gamma, Pi0)"
read TEST_PARTICLE
echo "Enter desired particle pT: "
read TEST_PT
echo "Enter seed threshold: "
read TEST_THRESH
cd ~/macros/g4simulations;
root -b -q "Fun4All_G4_sPHENIX.C(1, ${TEST_PT}, ${TEST_THRESH}, \"${TEST_PARTICLE}\", 0)"
exit
fi
# Store desired simulated particle type.
PARTICLE="$1"
# Run single-particle events for genPT from 5 - 60GeV.
cd ~/macros/g4simulations;
EVENT_NUM=0
for seedThresh in $threshRange; do
EVENT_NUM=0
for genPT in $ptRange; do
root -b -q "Fun4All_G4_sPHENIX.C(1, $genPT, $seedThresh, \"${PARTICLE}\", $EVENT_NUM)"
echo "Finished event with genPT = $genPT . . . "
EVENT_NUM=$((EVENT_NUM+1))
done
# Combine root files
# and place the leftover individual files in their own folder.
cd ~/bmckinz/RawClusterBuilderIA/rootFiles
TARGET=${PREFIX}_${seedThresh}_${PARTICLE}.root
if [ -f $TARGET ]; then
echo "Removing existing $TARGET . . . "
rm $TARGET
fi
hadd ${TARGET} *${PARTICLE}_*
mv *${PARTICLE}_* $PARTICLE/
cd -
done
cd ~/bmckinz/RawClusterBuilderIA/rootFiles
TARGET=${PREFIX}${PARTICLE}.root
if [ -f $TARGET ]; then
echo "Removing existing $TARGET . . . "
rm $TARGET
fi
hadd ${TARGET} *_${PARTICLE}.root
mv *_${PARTICLE}.root $PARTICLE/
cd -;