HEPonHPC / apprentice

Other
9 stars 8 forks source link

app-tune2: wrong error approximation bins used when error json contains zero weight bins #11

Open ojinoo opened 1 year ago

ojinoo commented 1 year ago

Describe the bug When the error approximation json contains zero weight bins that appear alphabetically before non-zero weight bins then app-tune2 uses the wrong error approximations for the minimization.

There are three cases when this can happen:

  1. The Inputdata contains more observables than included in the weightfile and app-build is used without the -w option.
  2. Weightfile explicitly contains zero weight observables.
  3. Subset of bins of an observable are used, e.g. /JADE_OPAL_2000_S4300807/d08-x01-y01#8:16

Fix In app.appset.TuningObjective2.mkFromFiles replace

        if f_errors is not None:
            EAS = AppSet(f_errors)
            ERA = [EAS._RA[g] for g in good]
            self._EAS=AppSet(ERA, self._binids)

with

        if f_errors is not None:
            self._EAS = AppSet(f_errors, binids=self._binids)