Skip to content

Add sanitized variables to Converter script in order to support ntuple vector variables

Chris Scheulen requested to merge chscheul/mva-trainer:upstr_master into master

Previously, vectorized variables would be saved in the hdf5-files as arrays and therefore be of type object. This creates problems with some internal numpy functions and is inefficient for storage purposes.

With the inclusion of a new method in HelperModules.py named sanitize_root, vectorized variables are now detected and converted into 2-tuples of (variablename, fill_value) in accordance with http://scikit-hep.org/root_numpy/reference/generated/root_numpy.root2array.html.

The method allows usage of vectorized variables in expressions, although using multiple vectorized variables in the same expression has not been tested and is therefore NOT recommended. The checks currently work via detection of a pattern [n] somewhere in the config expression, where n has to fulfill str.isdigit().

Edited by Chris Scheulen

Merge request reports

Loading