-
Notifications
You must be signed in to change notification settings - Fork 0
/
jobsim_complete.sh
executable file
·139 lines (102 loc) · 2.93 KB
/
jobsim_complete.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
# Lustre
LUSTRE_HOME="/lustre/panda/"$USER
nyx=$LUSTRE_HOME"/pandaml"
tmpdir="/tmp/"$USER
_target=$nyx"/data"
# PandaRoot
. $LUSTRE_HOME"/DEBIAN/v13.0.0-install/bin/config.sh" -p
# Default Inputs
nevt=1000
prefix=mumu
# SBoxGEN, DBoxGEN, FTF, PYTHIA, EvtGEN, etc.
#gen=SBoxGEN
#gen=DBoxGEN
#gen=ftf
#gen=pythia8
gen=llbar_fwp.dec
pBeam=1.642 # llbar: 1.642, xibarxi1820: 4.6, J/Psi: 6.231552
flag="WithIdeal" # With/Without IdealTrackFinder to Fill fParticles CSV
seed=$RANDOM
run=$SLURM_ARRAY_TASK_ID
# User Inputs
if test "$1" != ""; then
nevt=$1
fi
if test "$2" != ""; then
prefix=$2
fi
if test "$3" != ""; then
gen=$3
fi
# Prepend Absolute Path to '.DEC' File
if [[ $gen == *".dec"* ]]; then
if [[ $gen != \/* ]] ; then
gen=$nyx"/"$gen
fi
fi
if [[ $gen == *".DEC"* ]]; then
if [[ $gen != \/* ]] ; then
gen=$nyx"/"$gen
fi
fi
# IF ARRAY_TASK Used
if test "$SLURM_ARRAY_TASK_ID" == ""; then
tmpdir="/tmp/"$USER
run=0
outprefix=$tmpdir"/"$prefix"_"$run
seed=$run
else
tmpdir="/tmp/"$USER"_"$SLURM_JOB_ID
run=$SLURM_ARRAY_TASK_ID
outprefix=$tmpdir"/"$prefix"_"$run
seed=$run
fi
# Make sure `$_target` Exists
if [ ! -d $_target ]; then
mkdir -p $_target;
echo -e "\nThe data dir. at '$_target' created."
else
echo -e "\nThe data dir. at '$_target' exists."
fi
# Make sure $tempdir exists
if [ ! -d $tmpdir ]; then
mkdir -p $tmpdir;
echo -e "The temporary dir. at '$tmpdir' created."
else
echo -e "The temporary dir. at '$tmpdir' exists."
fi
#*** Print Flags ***
echo -e "\nLustre Home : $LUSTRE_HOME"
echo -e "Working Dir. : $nyx"
echo -e "Storage Dir. : $tmpdir"
echo -e "Target Dir. : $_target"
echo -e "\nEvents : $nevt"
echo -e "Prefix : $outprefix"
echo -e "Decay : $gen"
echo -e "pBeam : $pBeam"
echo -e "Seed : $seed"
echo -e "Run : $run"
# Terminate Script for Testing.
# exit 0;
#*** Initiate Simulaton ***
echo -e "\nStarted Simulating..."
root -l -b -q $nyx"/"sim_complete.C\($nevt,\"$outprefix\",\"$gen\",$pBeam,$seed\) > $outprefix"_sim.log" 2>&1
echo "Started Digitization..."
root -l -b -q $nyx"/"digi_complete.C\($nevt,\"$outprefix\"\) > $outprefix"_digi.log" 2>&1
# echo "Started Skewed Correction..."
# root -l -b -q $nyx"/"skew_complete.C\($nevt,\"$outprefix\"\) > $outprefix"_skew.log" 2>&1
echo "Started Ideal Reconstruction..."
root -l -b -q $nyx"/"recoideal_complete.C\($nevt,\"$outprefix\"\) > $outprefix"_reco.log" 2>&1
echo "Started CSV Generator..."
root -l -b -q $nyx"/"data_complete.C\($nevt,\"$outprefix\",\"$tmpdir\",\"$flag\",$run\) > $outprefix"_data.log" 2>&1
echo -e "Finished Simulating..."
#*** Storing Files ***
echo -e "\nMoving Files from '$tmpdir' to '$_target'"
# Move everything
mv $tmpdir"/"*.root $_target
mv $tmpdir"/"*.log $_target
mv $tmpdir"/"*.csv $_target
#*** Tidy Up ***
rm -rf $tmpdir
echo -e "The Script has Finished wit SLURM_JOB_ID: $run."