bdrum / cern-physics

My analysis workflow
1 stars 1 forks source link

Add parametrized functions #5

Closed bdrum closed 4 years ago

bdrum commented 4 years ago

Now here I just play with data and get correct pt, but now I have to get pt for different data for comparison and so on

bdrum commented 4 years ago

Add wrapper to histogram

Now, e.g. to draw few histograms on the one figure I use this.

But I would like to generalize it:

Parameters:

fig = plt.figure(figsize=(15, 7))
ax = fig.add_axes([0,0,1,1])
fig.suptitle(f'4pr Mass | {0} < pt <= {0.15}', fontsize=32)
plt.style.use(hep.style.ROOT)
GoodEvents = GetGoodEvents()
counts, bins = np.histogram(GetMass(Draw=False), bins=100, range=(0,4))
_ = ax.hist(GetMass(Draw=False), bins=bins, color='black', histtype='step', label=f'Q = 0;Entries {np.sum(counts)}')
GoodEvents = GetGoodEvents(ChargeEqualCondition=False)
counts, bins = np.histogram(GetMass(ChargeEqualCondition=False,Draw=False), bins=100, range=(0,4))
_ = ax.hist(GetMass(ChargeEqualCondition=False,Draw=False), bins=bins, color='red', histtype='step', label=f'Q != 0;Entries {np.sum(counts)}')
ax.legend()