Skip to content
Snippets Groups Projects
Commit 3b4db988 authored by Chao Peng's avatar Chao Peng
Browse files

update cluster info from analysis script

parent 0803515d
No related branches found
No related tags found
1 merge request!107modify clustering to use the latest components
This commit is part of merge request !107. Comments created here will be created in the context of that merge request.
...@@ -3,7 +3,7 @@ clustering:process : ...@@ -3,7 +3,7 @@ clustering:process :
stage: process stage: process
timeout: 8 hour timeout: 8 hour
script: script:
- bash benchmarks/clustering/full_cal_clusters.sh -t fullcalo -n 100 -p "pion-" --pmin 5 --pmax 5 - bash benchmarks/clustering/full_cal_clusters.sh -t fullcalo -n 1000 -p "pion-" --pmin 5 --pmax 5
clustering:results: clustering:results:
extends: .rec_benchmark extends: .rec_benchmark
......
...@@ -84,7 +84,7 @@ echo "FULL_CAL_COMPACT_PATH = ${FULL_CAL_COMPACT_PATH}" ...@@ -84,7 +84,7 @@ echo "FULL_CAL_COMPACT_PATH = ${FULL_CAL_COMPACT_PATH}"
# Generate the input events # Generate the input events
python benchmarks/imaging_ecal/scripts/gen_particles.py ${FULL_CAL_GEN_FILE} -n ${FULL_CAL_NUMEV}\ python benchmarks/imaging_ecal/scripts/gen_particles.py ${FULL_CAL_GEN_FILE} -n ${FULL_CAL_NUMEV}\
--angmin 60 --angmax 120 --phmin 0 --phmax 360 --pmin ${FULL_CAL_PMIN} --pmax ${FULL_CAL_PMAX}\ --angmin 5 --angmax 175 --phmin 0 --phmax 360 --pmin ${FULL_CAL_PMIN} --pmax ${FULL_CAL_PMAX}\
--particles="${particle}" --particles="${particle}"
if [[ "$?" -ne "0" ]] ; then if [[ "$?" -ne "0" ]] ; then
......
...@@ -21,7 +21,7 @@ def load_root_macros(arg_macros): ...@@ -21,7 +21,7 @@ def load_root_macros(arg_macros):
print('Loading root macros: \'{}\' does not exist, skip loading it.'.format(path)) print('Loading root macros: \'{}\' does not exist, skip loading it.'.format(path))
def thrown_particles_figure(df): def thrown_particles_figure(df, save):
# define truth particle info # define truth particle info
df = df.Define('isThrown', 'mcparticles2.genStatus == 1')\ df = df.Define('isThrown', 'mcparticles2.genStatus == 1')\
.Define('thrownParticles', 'mcparticles2[isThrown]')\ .Define('thrownParticles', 'mcparticles2[isThrown]')\
...@@ -70,7 +70,37 @@ def thrown_particles_figure(df): ...@@ -70,7 +70,37 @@ def thrown_particles_figure(df):
ax.set_ylabel(label[1], fontsize=24) ax.set_ylabel(label[1], fontsize=24)
fig.text(0.5, 0.95, 'Thrown Particles', ha='center', fontsize=24) fig.text(0.5, 0.95, 'Thrown Particles', ha='center', fontsize=24)
return fig fig.savefig(save)
plt.close(fig)
def general_clusters_figure(df, collection, save):
data = df.AsNumpy([
'{}.nhits'.format(collection),
'{}.energy'.format(collection),
'{}.polar.theta'.format(collection),
'{}.polar.phi'.format(collection),
])
# figure
fig, axs = plt.subplots(2, 2, figsize=(16, 12), dpi=120)
labels = [
('Number of Hits', 'Counts'),
('Energy (MeV)', 'Counts'),
('Theta (rad)', 'Counts'),
('Phi (rad)', 'Counts'),
]
for ax, label, (name, vals) in zip(axs.flat, labels, data.items()):
hvals = [v for vec in vals for v in vec]
ax.hist(hvals, bins=50, ec='k')
ax.tick_params(labelsize=22, direction='in', which='both')
ax.grid(linestyle=':', which='both')
ax.set_axisbelow(True)
ax.set_xlabel(label[0], fontsize=24)
ax.set_ylabel(label[1], fontsize=24)
fig.text(0.5, 0.95, collection, ha='center', fontsize=24)
fig.savefig(save)
plt.close(fig)
if __name__ == '__main__': if __name__ == '__main__':
...@@ -97,6 +127,8 @@ if __name__ == '__main__': ...@@ -97,6 +127,8 @@ if __name__ == '__main__':
rdf = ROOT.RDataFrame('events', args.file) rdf = ROOT.RDataFrame('events', args.file)
fig = thrown_particles_figure(rdf) thrown_particles_figure(rdf, save=os.path.join(args.outdir, 'thrown_particles.png'))
fig.savefig(os.path.join(args.outdir, 'thrown_particles.png')) general_clusters_figure(rdf, collection='CrystalEcalClusters', save=os.path.join(args.outdir, 'crystal_ecal_clusters.png'))
general_clusters_figure(rdf, collection='EcalBarrelClusters', save=os.path.join(args.outdir, 'ecal_barrel_clusters.png'))
general_clusters_figure(rdf, collection='HcalBarrelClusters', save=os.path.join(args.outdir, 'hcal_barrel_clusters.png'))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment