Fix track masking in the scaling
Masking previously happened in a few different places, in a few different ways.
- Checking the first track variable for
NaN
, and building a mask from this. Using the first variable was unstable, as we are relying on it beingfloat
, which is not always the case. This meant the masking broke for the new samples in some cases. - Elsewhere, we used a
tracks == 0
check, after runningnp.nan_to_num
. This is also broken as there are some possibleint
vars (e.g.JFVertexIndex
,leptonID
) for which0
is a valid value, and the default for padded tracks is-1
.
This implements a solution for both problems, using the valid
flag (which is designed for this use) where possible, and, if it is not available, defaulting to finding the first float
variable and using a NaN
check.
Edited by Samuel Van Stroud