pisa icon indicating copy to clipboard operation
pisa copied to clipboard

Hack: dataProcParams.py `file_type`, specific field names referred to

Open jllanfranchi opened this issue 7 years ago • 0 comments

This appeared in the code with PR #422 from @philippeller, I assume it's from @ts4051

        """ ...
        Parameters
        ----------
        file_type : 'mc' or 'data'
        """
        field_map = copy.deepcopy(self['field_map'])
        if file_type == 'data':
            for name, path in field_map.items():
                if ('I3MCWeightDict' in path) or ('PrimaryNu' in path) or ('trueNeutrino' in path):
                    del field_map[name]

Here we can e.g. simply allow for missing fields, or for more specificity, allow passing which fields are allowed to be missing; specifying field names within a generic module like this is a bad hack. But the best solution is probably that any of this should not be necessary; if there are fields we don't want, then they should not be specified in the first place, and it should fail as before if the fields are missing.

I.e., all of this logic should be handled in the module where we specify particular field names: make_events_file.py, not here. It might also make sense to add another command line arg to that script, too, if it is not possible to determine that a file is MC or data implicitly (and hence needing custom fields to be added/removed).

jllanfranchi avatar Jan 16 '18 19:01 jllanfranchi