Skip to content

Ability to aggregate all selection flags into single output variable in OutputAnalysisConfig

One of the "inconveniences" of CP algorithms at the moment is that we end up with several selection flags per object in the output, inflating the output size and also potentially increasing user error.

Typical scenario: For jets, we have jet_select_jvt, which contains just the JVT selection, and then jet_select_or, which contains overlap removal decision. For electrons, if we have a tight working point defined, we have el_select_tight which contains the lepton pre-selection + the working point selection, and then el_select_or which contains overlap removal decision.

In this MR a proposal for solving this is to add in the output block a logic to pick up for each output container all selections (so-called working points) and store a single flag agggregating all pre-selections, working point selection, and also overlap removal, if enabled.

Example of what happened before this MR with electron selection flag el_select_tight:

| /*** PythonConfig AnaAlgorithm/CP::AsgSelectionAlg/ElectronSelectionSummary_tight                                                                                                
| |- particles: 'AnaElectrons_%SYS%'                                                     
| |- preselection: 'selectEta,as_bits&&trackSelection,as_bits&&goodOQ,as_bits&&selectPt,as_bits&&selectLikelihood_tight,as_bits&&isolated_tight,as_bits'                           
| |- selectionDecoration: 'baselineSelection_tight,as_char'                                                                                                                                                                                                                                                                                                            
| \--- (End of PythonConfig AnaAlgorithm/CP::AsgSelectionAlg/ElectronSelectionSummary_tight)

-> no OR flag included, even if we enable adding OR to each selection (see below). Also the PtEtaSelection block is not propagated, even though it is added in the block config!

Example of what happens after this MR with electron selection flag el_select_tight:

| /*** PythonConfig AnaAlgorithm/CP::AsgSelectionAlg/ObjectSelectionSummary_AnaElectrons_tight                                                                                     
| |- particles: 'AnaElectrons_%SYS%'                                                                                                                                               
| |- preselection: 'selectEta,as_bits&&trackSelection,as_bits&&goodOQ,as_bits&&selectPt,as_bits&&selectLikelihood_tight,as_bits&&isolated_tight,as_bits&&selectPtEta&&passesOR_%SYS%,as_char'
| |- selectionDecoration: 'baselineSelection_tight'                                                                                                                                
| \--- (End of PythonConfig AnaAlgorithm/CP::AsgSelectionAlg/ObjectSelectionSummary_AnaElectrons_tight)

-> OR flag added when enabled + also PtEtaSelection correctly propagated.

There is also a switch added to disable making these flags in the output, if not desired (e.g. if an analysis only cares about making some loosely-preselected NTuple and manages all further selections offline).

In addition, I introduce and set by default a new config option addToAllSelections for OverlapAnalysisConfig block. If this is true, the OR decision is added by default to all selections above, which is the default behavior that we want. We already see that users fail to understand this, and assume, that e.g. passing AnaElectrons.tight to event selection means, that event selection is applied using tight electrons including overlap removal, but this is not the case by default. To revert to the old behavior where OR decision is decoupled from selections, one just needs to switch addToAllSelection to False.

Edited by Oliver Majersky

Merge request reports