Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

boosting 4-vectors does not work on TLorentzVectorArray #62

@lukasheinrich

Description

@lukasheinrich

Hi,

I am stumbling over a problem w/ 4-vectors in uproot_methods:

Consider the problem of having events with lorentz vectors and wanting to boost all of them into their rest frame. The operation works per-event, but not o the full full (batched) set of events

I'm looking into what the issue could be but perhaps someone is faster

x = [
    [
        [0,0,12,13],
        [0,0,4,5]
    ],
    [
        [0,0,15,17],
        [0,0,24,25]
    ],
]

mom = awkward.fromiter(x)
v = uproot_methods.TLorentzVectorArray.from_cartesian(mom[:,:,0],mom[:,:,1],mom[:,:,2],mom[:,:,3])

boost_back = (v.p3/v.p3.mag)*v.beta
print(
    [vv.boost(bb) for vv,bb in zip(v,-boost_back)]
)
print(
    v.boost(-boost_back)
)

the first print works as expected, the seconds does not and fails with

in boost(self, p3)
    227         gamma2 = self.awkward.numpy.zeros(b2.shape, dtype=self.awkward.numpy.float64)
    228         mask = (b2 != 0)
--> 229         gamma2[mask] = (gamma[mask] - 1) / b2[mask]
    230         del mask
    231 

IndexError: too many indices for array

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions