-
Notifications
You must be signed in to change notification settings - Fork 28
Store additional information in TLorentzVector #40
Comments
Yes. A TLorentzVectorArray contains a Table, so you should be able to attach or remove any other arrays to it, as long as they fit (same number of elements, and if jagged, same number in each subarray). a = TLorentzVectorArray.from_ptetaphim(pt, eta, phi, mass)
a["isolation"] = isolation and so on. |
OK, that's ridiculously easy. |
OK, while this obviously isn't the recommended way to do things, I noticed that when I looped over the jets the iterator seemed to return a regular TLorentzVector without the isolation attached. Is there some way to get both together? I noticed that the following seems to work:
but it's a bit clunky. |
To get that to work, I should have made the TLorentzVector object (singular) a mixin of Table.Row, instead of a separate class. At some point, I should do that so that you can get isolation from I'll reopen this to remind myself to go back and do that. |
Another approach is to nest the ObjectArray inside a Table, e.g.
Then it should carry around the fields, with the small inconvenience of having to access the lorentz vector properties through the name: |
I asked earlier about constructing the Lorentz vector objects directly from numpy arrays. That works really well! But I'd also like to be able to add additional information to the objects, i.e. in some cases we have other jet characteristics like b-tagging scores. Is there some method to append additional information (which is stored in another array) to each object?
The text was updated successfully, but these errors were encountered: