ROOT functions in upROOT?

173 Views Asked by At

I'm trying to run analysis strictly in Python using upROOT, but I'm finding (unsurprisingly) that I have to build a lot of tools that are already in ROOT. I don't mind doing it, but I want to make sure I don't mess stuff up.

For instance, I have the following for mass squared:

m_squared = np.divide(np.multiply(p_squared, g_squared), b_squared)

Where "p_squared" is the global momentum magnitude (squared), "g_squared" is inverse gamma squared, and "b_squared" is beta squared.

I also have the following for phi:

add_pi = np.hstack(np.where((oX < 0.0) & (oY > 0.0)))
subtract_pi = np.hstack(np.where((oX < 0.0) & (oY < 0.0)))
Phi = np.arctan(np.divide(oY, oX))
Phi[add_pi] = Phi[add_pi] + np.pi
Phi[subtract_pi] = Phi[subtract_pi] - np.pi

Where "oX" and "oY" are the x and y origin coordinates for tracks, respectively.

Is there something built into upROOT to do this? Or is this just a PyROOT thing?

1

There are 1 best solutions below

0
On BEST ANSWER

There’s a module in upROOT called “vector” which works for these purposes; it’s new in uproot4 (running with awkward1.0). Anyone interested can check it out here. I’m marking this as solved since this is exactly what I'm looking for, though it should be noted that "vector" is currently in development so it's not yet complete.

Thanks!