Skip to content

Fix empty region-specific branches

This MR would like to fix a quite annoying problem: region-specific branches, defined by the addRegions({}) call, are created in the final ntuple iff there's at least one event passing the region selection.

In case of no events in a region the branch isn't stored, thus resulting in asymmetric output ntuples, which can't be hadded together (hadd adds the common branches only). The filling process follows this chain: accept("RegionName") -> pass("RegionName") -> ntupVar("RegionName"); the last step triggers the output branch creation.

The issue usually happens when processing separately, e.g. in a grid environment, a specific DSID.

I added this creation step before, when the createNtuple() function is called for the first time, by looping on the map holding region names: an if-clause checks the presence of a branch and, if not already created, will do it. The format allowed is only float due to the presence of eventWeight multiplication in the process.

The filling function is replaced with a BackFill(), following this recommendation, as branches are created and filled individually (maybe, can the other Fill() functions be upgraded in the same way, as there is a similar comment?)

Please, let me know if something is unclear

Merge request reports