This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIRF.generate_lookup_table_parts.sh
executable file
·136 lines (108 loc) · 3.92 KB
/
IRF.generate_lookup_table_parts.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
#!/bin/bash
# script to run over all noise levels and create lookup tables (queue submit)
# qsub parameters
h_cpu=03:29:00; h_vmem=4000M; tmpdir_size=1G
if [[ $# -lt 7 ]]; then
# begin help message
echo "
IRF generation: create partial (for one point in the parameter space) lookup
tables from MC evndisp ROOT files
IRF.generate_lookup_table_parts.sh <epoch> <atmosphere> <zenith> <offset angle> <NSB level> <Rec ID> [particle]
required parameters:
<epoch> array epoch (e.g., V4, V5, V6)
V4: array before T1 move (before Fall 2009)
V5: array after T1 move (Fall 2009 - Fall 2012)
V6: array after camera update (after Fall 2012)
<atmosphere> atmosphere model (61 = winter, 62 = summer)
<zenith> zenith angle of simulations [deg]
<offset angle> offset angle of simulations [deg]
<NSB level> NSB level of simulations [MHz]
<Rec ID> reconstruction ID
(see EVNDISP.reconstruction.runparameter)
optional parameters:
[particle] gamma / gamma_diffuse / electron / proton
(default: gamma)
--------------------------------------------------------------------------------
"
#end help message
exit
fi
# Run init script
bash $(dirname "$0")"/helper_scripts/UTILITY.script_init.sh"
[[ $? != "0" ]] && exit 1
# EventDisplay version
"$EVNDISPSYS"/bin/mscw_energy --version >/dev/null 2>/dev/null
if (($? == 0))
then
EDVERSION=`"$EVNDISPSYS"/bin/mscw_energy --version | tr -d .`
else
EDVERSION="g500"
fi
# Parse command line arguments
EPOCH=$1
ATM=$2
ZA=$3
WOBBLE=$4
NOISE=$5
RECID=$6
[[ "${7}" ]] && PARTICLE_TYPE=${7} || PARTICLE_TYPE="gamma"
[[ "${8}" ]] && SMALLCAM=${8} || SMALLCAM="0"
SIMTYPE="CARE"
if [[ ${SMALLCAM} == "1" ]]; then
CAMERA="SmallCamera"
echo "Small camera? Yes."
else
CAMERA="FullCamera"
echo "Small camera? No."
fi
# input directory containing evndisp products
if [[ -n "$VERITAS_IRFPRODUCTION_DIR" ]]; then
INDIR="$VERITAS_IRFPRODUCTION_DIR/$EDVERSION/$SIMTYPE/${CAMERA}/${EPOCH}_ATM${ATM}_${PARTICLE_TYPE}/ze${ZA}deg_offset${WOBBLE}deg_NSB${NOISE}MHz"
fi
if [[ ! -d $INDIR ]]; then
echo "Error, could not locate input directory. Locations searched:"
echo "$INDIR"
exit 1
fi
echo "Input file directory: $INDIR"
# Output file directory
if [[ ! -z $VERITAS_IRFPRODUCTION_DIR ]]; then
ODIR="$VERITAS_IRFPRODUCTION_DIR/$EDVERSION/$SIMTYPE/${CAMERA}/${EPOCH}_ATM${ATM}_${PARTICLE_TYPE}/Tables"
fi
echo "Output file directory: $ODIR"
mkdir -p "$ODIR"
chmod g+w "$ODIR"
# run scripts and output are written into this directory
DATE=`date +"%y%m%d"`
LOGDIR="$VERITAS_USER_LOG_DIR/$DATE/MSCW.MAKETABLES"
echo -e "Log files will be written to:\n $LOGDIR"
mkdir -p "$LOGDIR"
SUBSCRIPT="$EVNDISPSYS/scripts/pSCT/helper_scripts/IRF.lookup_table_parallel_sub"
# loop over all zenith angles, wobble offsets, and noise bins
echo "Processing Zenith = $ZA, Wobble = $WOBBLE, Noise = $NOISE"
FSCRIPT="$LOGDIR/$EPOCH-MK-TBL.$DATE.MC-$ZA-$WOBBLE-$NOISE-$EPOCH-$ATM-$RECID-$(date +%s)"
rm -f "$FSCRIPT.sh"
sed -e "s|ZENITHANGLE|$ZA|" \
-e "s|WOBBLEOFFSET|$WOBBLE|" \
-e "s|SIMNOISE|$NOISE|" \
-e "s|ARRAYEPOCH|$EPOCH|" \
-e "s|ATMOSPHERE|$ATM|" \
-e "s|RECONSTRUCTIONID|$RECID|" \
-e "s|SIMULATIONTYPE|$SIMTYPE|" \
-e "s|INPUTDIR|$INDIR|" \
-e "s|OUTPUTDIR|$ODIR|" "$SUBSCRIPT.sh" > "$FSCRIPT.sh"
chmod u+x "$FSCRIPT.sh"
echo "$FSCRIPT.sh"
# run locally or on cluster
SUBC=`"$EVNDISPSYS"/scripts/pSCT/helper_scripts/UTILITY.readSubmissionCommand.sh`
SUBC=`eval "echo \"$SUBC\""`
if [[ $SUBC == *"ERROR"* ]]; then
echo "$SUBC"
exit
fi
if [[ $SUBC == *qsub* ]]; then
$SUBC $FSCRIPT.sh
elif [[ $SUBC == *parallel* ]]; then
echo "$FSCRIPT.sh &> $FSCRIPT.log" >> "$LOGDIR/runscripts.dat"
fi
exit