Skip to content

Commit 02966fd

Browse files
committed
long time, no commit
1 parent f4d71d0 commit 02966fd

25 files changed

+693
-69
lines changed

changeGroup

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
set -o errexit # abort on nonzero exitstatus
4+
set -o pipefail # don't hide errors within pipes
5+
6+
echo "Starting changeGroup"
7+
8+
# shellcheck disable=SC1091,SC1090
9+
source "util.sh"
10+
11+
atm="summer"
12+
zenith=""
13+
wobble=""
14+
n_min=0 # min run
15+
n_max=200001 # max run (100000)
16+
source_dir=${PWD}
17+
readonly runs_per_job=100
18+
readonly do_submit="true"
19+
readonly force="false"
20+
readonly n_mail=5
21+
22+
# shellcheck disable=SC2068
23+
collect_arguments 4 atm zenith wobble n_max $@
24+
25+
all_n=$(seq "${n_min}" "${n_max}")
26+
27+
atm=$(validate_atm "${atm}")
28+
zenith=$(validate_zenith "${zenith}")
29+
all_wobble="0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 2.8"
30+
31+
# shellcheck disable=SC2086
32+
for wobble in ${all_wobble}; do
33+
echo "Starting wobble ${wobble}"
34+
35+
gro_file=$(groptics_file "10" "${zenith}" "${atm}" "${wobble}")
36+
gro_dir=$(dirname "${gro_file}")
37+
if [ ! -d "${gro_dir}" ]; then
38+
echo "Directory ${gro_dir} does not exist - skipping"
39+
continue
40+
fi
41+
42+
for n in ${all_n}; do
43+
run=$(compute_run "${zenith}" "${n}")
44+
gro_file=$(groptics_file "${run}" "${zenith}" "${atm}" "${wobble}")
45+
if [ -f "${gro_file}" ]; then
46+
chgrp veritas "${gro_file}"
47+
fi
48+
done
49+
50+
done

checkShowerPars.py

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#!/usr/bin/python3
2+
3+
import matplotlib.pyplot as plt
4+
import numpy as np
5+
import argparse
6+
import math
7+
import os.path
8+
from matplotlib.backends.backend_pdf import PdfPages
9+
10+
import ROOT
11+
12+
labelsize = 15
13+
plt.rc('font', family='serif', size=labelsize)
14+
plt.rc('xtick', labelsize=labelsize)
15+
plt.rc('ytick', labelsize=labelsize)
16+
plt.rc('text', usetex=True)
17+
18+
19+
def check_woff(atm, zenith, wobble, nsb, pdf):
20+
print('check_woff({}, {}, {}, {})'.format(atm, zenith, wobble, nsb))
21+
22+
woff_rad = list()
23+
for i_split in range(10):
24+
run = str(961201 + i_split)
25+
try:
26+
filename = (
27+
'/lustre/fs23/group/veritas/V6_DESY/EffAreaTesting/v501/CARE/V6_ATM'
28+
+ str(atm) + '_gamma_ze' + str(zenith)
29+
+ '_TL5035MA20/ze' + str(zenith) + 'deg_offset' + str(wobble) + 'deg_NSB'
30+
+ str(nsb) + 'MHz/' + run + '.root'
31+
)
32+
33+
if not os.path.isfile(filename):
34+
# print('File {} does not exists'.format(filename))
35+
continue
36+
37+
try:
38+
file = ROOT.TFile.Open(filename)
39+
except:
40+
print('Could not open file {}'.format(filename))
41+
continue
42+
43+
for entry in file.showerpars:
44+
if float(entry.Xoff[0]) > -99 and not float(entry.Xoff[0]) == 0.:
45+
woff_rad.append(math.sqrt(entry.Xoff[0]**2 + entry.Yoff[0]**2))
46+
except:
47+
print('Could not read file for run {}'.format(run))
48+
continue
49+
50+
mean_woff = np.sum(woff_rad) / len(woff_rad)
51+
diff = math.fabs(mean_woff - float(wobble))
52+
sigma = np.std(woff_rad)
53+
54+
fig = plt.figure(figsize=(8, 6), tight_layout=True)
55+
56+
ax = plt.gca()
57+
ax.set_title('NSB = {}, mu = {:.3f}, sigma = {:.3f}'.format(nsb, mean_woff, sigma))
58+
ax.set_xlabel('Woff')
59+
60+
ax.hist(woff_rad, bins=np.linspace(0.0, 2.5, 100))
61+
62+
pdf.savefig(fig)
63+
plt.close()
64+
65+
return
66+
67+
68+
if __name__ == '__main__':
69+
70+
parser = argparse.ArgumentParser(
71+
description='Plot Eff Area for a certain zenith angle simulation set.'
72+
)
73+
parser.add_argument(
74+
'-z',
75+
'--zenith',
76+
help='Zenith angle (in deg)',
77+
type=str,
78+
required=True,
79+
choices=['00', '20', '30', '35', '40', '45', '50', '55', '60']
80+
)
81+
parser.add_argument(
82+
'-a',
83+
'--atm',
84+
help='Atm (61 or 62)',
85+
type=str,
86+
required=True,
87+
choices=['61', '62']
88+
)
89+
parser.add_argument(
90+
'-w',
91+
'--wobble',
92+
help='Wobble offset',
93+
type=float,
94+
required=False,
95+
choices=[0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0]
96+
)
97+
zenith = parser.parse_args().zenith
98+
atm = parser.parse_args().atm
99+
wob = parser.parse_args().wobble
100+
101+
if wob is None:
102+
all_wobble = [0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0]
103+
figName = 'figures/Woff_atm{}_ze{}.pdf'.format(atm, zenith)
104+
else:
105+
all_wobble = [wob]
106+
figName = 'figures/Woff_atm{}_ze{}_wob{}.pdf'.format(atm, zenith, wob)
107+
108+
all_nsb = [50, 75, 100, 130, 160, 200, 250, 300, 350, 400, 450]
109+
# all_nsb = [400]
110+
111+
with PdfPages(figName) as pdf:
112+
for nsb in all_nsb:
113+
for wob in all_wobble:
114+
check_woff(atm, zenith, wob, nsb, pdf)

compareEffArea.py

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#!/usr/bin/python3
2+
3+
import matplotlib.pyplot as plt
4+
import numpy as np
5+
import argparse
6+
import os.path
7+
import sys
8+
import math
9+
from matplotlib.backends.backend_pdf import PdfPages
10+
11+
import ROOT
12+
13+
labelsize = 15
14+
plt.rc('font', family='serif', size=labelsize)
15+
plt.rc('xtick', labelsize=labelsize)
16+
plt.rc('ytick', labelsize=labelsize)
17+
plt.rc('text', usetex=True)
18+
19+
20+
def get_eff_area(filename, azimuth=0, index=2.0):
21+
lge, eff, eff_err = list(), list(), list()
22+
23+
if not os.path.isfile(filename):
24+
print('File {} does not exists'.format(filename))
25+
return None, None, None
26+
27+
file = ROOT.TFile.Open(filename)
28+
for entry in file.fEffArea:
29+
if (entry.az == azimuth and entry.index == index):
30+
lge = list(entry.e0)
31+
eff = list(entry.eff)
32+
eff_err = list(entry.eff_error)
33+
return lge, eff, eff_err
34+
else:
35+
continue
36+
print('get_eff_area failed')
37+
return None, None, None
38+
39+
40+
if __name__ == '__main__':
41+
42+
if len(sys.argv) != 3:
43+
print('Wrong number of args')
44+
exit()
45+
46+
lge0, eff0, eff_err0 = get_eff_area(sys.argv[1])
47+
lge1, eff1, eff_err1 = get_eff_area(sys.argv[2])
48+
49+
print(lge0)
50+
print(lge1)
51+
52+
diff = list()
53+
rel_err0, rel_err1 = list(), list()
54+
for i in range(len(lge0)):
55+
d = (eff0[i] - eff1[i]) / math.sqrt(eff_err0[i]*eff_err0[i] + eff_err1[i]*eff_err1[i])
56+
diff.append(d)
57+
rel_err0.append(eff_err0[i] / eff0[i])
58+
rel_err1.append(eff_err1[i] / eff1[i])
59+
60+
figName = 'figures/EffArea_testingSplit.pdf'
61+
with PdfPages(figName) as pdf:
62+
fig = plt.figure(figsize=(8, 6), tight_layout=True)
63+
ax = plt.gca()
64+
ax.set_yscale('log')
65+
ax.set_xlabel(r'log$_{10}$($E$/TeV)')
66+
ax.set_ylabel(r'$A_\mathrm{eff}$ (cm$^2$)')
67+
68+
ax.errorbar(
69+
lge0,
70+
eff0,
71+
yerr=eff_err0,
72+
marker='o',
73+
linestyle='none'
74+
)
75+
ax.errorbar(
76+
lge1,
77+
eff1,
78+
yerr=eff_err1,
79+
marker='s',
80+
linestyle='none',
81+
markersize=15,
82+
fillstyle='none'
83+
)
84+
85+
ax.set_ylim(1, 1e6)
86+
ax.set_xlim(-1.5, 2.5)
87+
88+
pdf.savefig(fig)
89+
plt.close()
90+
91+
fig = plt.figure(figsize=(8, 6), tight_layout=True)
92+
ax = plt.gca()
93+
ax.set_xlabel(r'log$_{10}$($E$/TeV)')
94+
ax.set_ylabel(r'$\sigma$ / A')
95+
96+
ax.errorbar(
97+
lge0,
98+
rel_err0,
99+
marker='o',
100+
linestyle='none'
101+
)
102+
ax.errorbar(
103+
lge1,
104+
rel_err1,
105+
marker='s',
106+
linestyle='none',
107+
markersize=15,
108+
fillstyle='none'
109+
)
110+
111+
ax.set_ylim(0, 0.5)
112+
ax.set_xlim(-1.5, 2.5)
113+
114+
pdf.savefig(fig)
115+
plt.close()
116+
117+
fig = plt.figure(figsize=(8, 6), tight_layout=True)
118+
ax = plt.gca()
119+
ax.set_xlabel(r'log$_{10}$($E$/TeV)')
120+
ax.set_ylabel(r'$\Delta/\sigma$')
121+
122+
ax.errorbar(
123+
lge0,
124+
diff,
125+
marker='o',
126+
linestyle='none'
127+
)
128+
129+
ax.plot(
130+
[-1.5, 2.5],
131+
[0, 0],
132+
color='k',
133+
linestyle='--'
134+
)
135+
136+
ax.set_ylim(-0.5, 0.5)
137+
ax.set_xlim(-1.5, 2.5)
138+
139+
pdf.savefig(fig)
140+
plt.close()

compressCARE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ merged_care_file=$(merged_care_file "${zenith}" "${atm}" "${wobble}" "${nsb}" "$
9393
# tar -czvf "${compressed_care_file}" "${merged_dir}"
9494
# bzip2 -z "${merged_care_file}"
9595

96-
zstd -z "${merged_care_file}"
96+
zstd -zf "${merged_care_file}"
9797

9898
print_runtime "${SECONDS}"
9999

config/GrOptics/GrOpticsV6pilot_generic.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@ stops with the root prompt. These are cool drawings.
7373
DRAWTEL 1
7474

7575
TESTTEL 1 PSFgraph
76+
77+
* DEBUGBRANCHES 1
78+

countGrOptics

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ else
2222
wobble_list="${wobble}"
2323
fi
2424

25+
printf "CORSIKAs \n"
26+
corsika_dir=$(corsika_directory_zip "${zenith}" "${atm}")
27+
if [ -d "${corsika_dir}" ]; then
28+
# shellcheck disable=SC2012
29+
n=$(ls "${corsika_dir}" | wc -l)
30+
printf "%s" "$n"
31+
printf "\n"
32+
fi
33+
34+
2535
run=$(compute_run "${zenith}" "10")
2636

2737
for wobble in $wobble_list; do

countMerged

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ atm="winter"
1010
zenith="20"
1111
mode="std"
1212
wobble=""
13+
nsb=""
1314

1415
# shellcheck disable=SC2068
15-
collect_arguments 4 atm zenith mode wobble $@
16+
collect_arguments 5 atm zenith mode wobble nsb $@
1617

1718
atm=$(validate_atm "${atm}")
1819
zenith=$(validate_zenith "${zenith}")
@@ -31,7 +32,7 @@ for wobble in ${wobble_list}; do
3132
merged_care_file=$(merged_care_file "${zenith}" "${atm}" "${wob}" "100" "${mode}")
3233
merged_care_dir=$(dirname "${merged_care_file}")
3334

34-
ls "${merged_care_dir}/"*"${wob}"* -lhS
35-
n=$(ls "${merged_care_dir}/"*"${wob}"* | wc -l)
35+
ls "${merged_care_dir}/"*"${wob}"*"_${nsb}"* -lhS
36+
n=$(ls "${merged_care_dir}/"*"${wob}"*"_${nsb}"* | wc -l)
3637
printf "\n %s files\n" "${n}"
3738
done

loadFITS.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/zsh
2+
3+
# export VBFSYS=/afs/ifh.de/group/cta/scratch/prado/sw/libVBF
4+
export FITSSYS=/afs/ifh.de/group/cta/VERITAS/software/FITS/cfitsio
5+
6+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VBFSYS/lib
7+
export PATH=$VBFSYS/bin:$VBFSYS/include:$PATH
8+

0 commit comments

Comments
 (0)