Skip to content
Snippets Groups Projects
Commit 444b31f9 authored by Marshall Scott's avatar Marshall Scott Committed by Wouter Deconinck
Browse files

Resolve "Job Failed #408711: imaging_ecal_pion_rejection has...

Resolve "Job Failed #408711: imaging_ecal_pion_rejection has ZeroDivisionError: Weights sum to zero, can't be normalized"
parent 010009ce
No related branches found
No related tags found
1 merge request!224Resolve "Job Failed #408711: imaging_ecal_pion_rejection has ZeroDivisionError: Weights sum to zero, can't be normalized"
File mode changed from 100644 to 100755
......@@ -110,7 +110,7 @@ if __name__ == '__main__':
else:
dfc = df[(df['eta'] <= df['eta'].quantile(0.95)) & (df['eta'] >= df['eta'].quantile(0.05)) &
(df['phi'] <= df['phi'].quantile(0.95)) & (df['phi'] >= df['phi'].quantile(0.05))]
vec = np.average(dfc[['x', 'y', 'z']].values, axis=0, weights=dfc['energy'].values)
vec = np.average(dfc[['x', 'y', 'z']].values, axis=0, weights= dfc['energy'].values if np.sum(dfc['energy'].values) > 0 else None)
vec = vec/np.linalg.norm(vec)
# particle line from (0, 0, 0) to the inner Ecal surface
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment