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