Skip to content
Snippets Groups Projects
Commit c458bb3e authored by Vaibhavi Gawas's avatar Vaibhavi Gawas Committed by Wouter Deconinck
Browse files

Replace draw_clusters.py

parent 5c1b0d2b
Branches vgawas-phy
No related tags found
1 merge request!258Replace draw_clusters.py
......@@ -52,6 +52,7 @@ from Configurables import Jug__Reco__CalorimeterIslandCluster as IslandCluster
from Configurables import Jug__Reco__ImagingPixelReco as ImCalPixelReco
from Configurables import Jug__Reco__ImagingTopoCluster as ImagingCluster
from Configurables import Jug__Reco__ImagingClusterReco as ImagingClusterReco
from Configurables import Jug__Reco__ClusterRecoCoG as RecoCoG
# branches needed from simulation root file
sim_coll = [
......@@ -108,12 +109,10 @@ if has_ecal_barrel_scfi:
) # different sector
algorithms.append(cb_ecal_cl)
cb_ecal_clreco = ImagingClusterReco(
cb_ecal_clreco = RecoCoG(
"cb_ecal_clreco",
inputProtoClusters=cb_ecal_cl.outputProtoClusterCollection,
outputClusters="EcalBarrelImagingClusters",
outputLayers="EcalBarrelImagingLayers",
mcHits="EcalBarrelHits",
inputProtoClusterCollection=cb_ecal_cl.outputProtoClusterCollection,
outputClusterCollection="EcalBarrelImagingClusters",
)
algorithms.append(cb_ecal_clreco)
......@@ -155,15 +154,24 @@ else:
)
algorithms.append(sciglass_ecal_cl)
sciglass_ecal_clreco = ImagingClusterReco(
sciglass_ecal_clreco = RecoCoG(
"sciglass_ecal_clreco",
inputProtoClusters=sciglass_ecal_cl.outputProtoClusterCollection,
mcHits="EcalBarrelHits",
outputClusters="EcalBarrelClusters",
outputLayers="EcalBarrelLayers",
inputProtoClusterCollection=sciglass_ecal_cl.outputProtoClusterCollection,
# mcHits="EcalBarrelHits",
outputClusterCollection="EcalBarrelClusters",
#OutputLevel=DEBUG
)
algorithms.append(sciglass_ecal_clreco)
# sciglass_barrel_clreco = RecoCoG(
# "sciglass_barrel_clreco",
# inputProtoClusterCollection=sciglass_ecal_cl.outputProtoClusterCollection,
# outputClusterCollection="EcalBarrelScFiClusters",
# logWeightBase=6.2,
# )
# algorithms.append(sciglass_barrel_clreco)
podout.outputCommands = [
"drop *",
"keep MCParticles",
......
......@@ -25,6 +25,11 @@ default_type = {
['barrel.py'],
['draw_clusters.py'],
['EcalBarrelImagingClusters']],
'barrel_sciglass': [
['barrel.py'],
['draw_clusters.py'],
['EcalBarrelClusters']],
# 'all': [
# ['all_ecal.py'],
# ['draw_clusters.py'],
......
......@@ -58,7 +58,9 @@ if __name__ == '__main__':
parser.add_argument('--collections', dest='coll', default='',
help='Collection names for clusters, separated by \",\"')
args = parser.parse_args()
#rec_file='home/vaibhavi/eic/benchmarks/reconstruction_benchmarks/rec_barrel_electron_5.0_5.0.root'
# multi-threading for RDataFrame
nthreads = os.cpu_count()//2
ROOT.ROOT.EnableImplicitMT(nthreads)
......@@ -69,6 +71,7 @@ if __name__ == '__main__':
load_root_macros(args.macros)
rdf_rec = ROOT.RDataFrame('events', args.rec_file)
#rdf_rec = ROOT.RDataFrame('events', rec_file)
if not args.coll:
print('No collection names provided, no plots generated.')
......@@ -88,14 +91,17 @@ if __name__ == '__main__':
plots = [
('nhits', 'Number of Hits', 50),
('energy', 'Energy (GeV)', 50),
('eta', '$\eta$', 50),
#('eta', '$\eta$', 50),
]
for coll in [c.strip() for c in args.coll.split(',')]:
df = flatten_collection(rdf_rec, coll)
fig, axs = plt.subplots(2, 2, figsize=(12, 8), dpi=160)
ncl = df.groupby('event')['{}.ID.value'.format(coll)].nunique().values
axs[0][0].hist(ncl, weights=np.repeat(1./float(ncl.shape[0]), ncl.shape[0]),
bins=np.arange(0, 10), align='mid', ec='k')
#ncl = df.groupby('event')['{}.ID.value'.format(coll)].nunique().values
#axs[0][0].hist(ncl, weights=np.repeat(1./float(ncl.shape[0]), ncl.shape[0]),
#bins=np.arange(0, 10), align='mid', ec='k')
ncl = df.groupby('event')['event'].count()
axs[0][0].hist(ncl, weights=np.repeat(1./float(ncl.count()), ncl.count()),
bins=np.arange(0, 10), align='mid', ec='k')
axs[0][0].set_xlabel('Number of Clusters', fontsize=16)
for ax, (branch, xlabel, bins) in zip(axs.flat[1:], plots):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment