|
def | __init__ (self, *skims, NoisyModules=None, additionalDataDescription=None, udstOutput=None, mdstOutput=False, mdst_kwargs=None, CombinedSkimName="CombinedSkim", OutputFileName=None, mc=None, analysisGlobaltag=None) |
|
def | __str__ (self) |
|
def | __name__ (self) |
|
def | __call__ (self, path) |
|
def | __iter__ (self) |
|
def | load_standard_lists (self, path) |
|
def | additional_setup (self, path) |
|
def | build_lists (self, path) |
|
def | output_udst (self, path) |
|
def | output_mdst_if_any_flag_passes (self, *path, **kwargs) |
|
def | apply_hlt_hadron_cut_if_required (self, path) |
|
def | set_skim_logging (self) |
|
def | TestFiles (self) |
|
def | flags (self) |
|
def | flag (self) |
|
def | initialise_skim_flag (self, path) |
|
def | update_skim_flag (self, path) |
|
def | produce_on_tau_samples (self) |
|
def | merge_data_structures (self) |
|
def | __description__ (self) |
|
def | __category__ (self) |
|
def | __authors__ (self) |
|
def | __contact__ (self) |
|
def | code (self) |
|
def | validation_histograms (self, path) |
|
def | postskim_path (self) |
|
def | skim_event_cuts (self, cut, *path) |
|
Class for creating combined skims which can be run using similar-looking methods
to `BaseSkim` objects.
A steering file which combines skims can be as simple as the following:
.. code-block:: python
import basf2 as b2
import modularAnalysis as ma
from skim.WGs.foo import OneSkim, TwoSkim, RedSkim, BlueSkim
path = b2.Path()
ma.inputMdstList("default", [], path=path)
skims = CombinedSkim(OneSkim(), TwoSkim(), RedSkim(), BlueSkim())
skims(path) # load standard lists, create skim lists, and save to uDST
path.process()
When skims are combined using this class, the `BaseSkim.NoisyModules` lists of each
skim are combined and all silenced.
The heavy-lifting functions `BaseSkim.additional_setup`, `BaseSkim.build_lists` and
`BaseSkim.output_udst` are modified to loop over the corresponding functions of each
invididual skim. The `load_standard_lists` method is also modified to load all
required lists, without accidentally loading a list twice.
Calling an instance of the `CombinedSkim` class will load all the required particle
lists, then run all the setup steps, then the list building functions, and then all
the output steps.
Definition at line 464 of file core.py.
def merge_data_structures |
( |
|
self | ) |
|
Read the values of `BaseSkim.MergeDataStructures` and merge data structures
accordingly.
For example, if ``MergeDataStructures`` has the value ``{"FEIChannelArgs":
_merge_boolean_dicts.__func__}``, then ``_merge_boolean_dicts`` is run on all
input skims with the attribute ``FEIChannelArgs``, and the value of
``FEIChannelArgs`` for that skim is set to the result.
In the FEI skims, this is used to merge configs which are passed to a cached
function, thus allowing us to apply the FEI once with all the required particles
available.
Definition at line 794 of file core.py.
def skim_event_cuts |
( |
|
self, |
|
|
|
cut, |
|
|
* |
path |
|
) |
| |
|
inherited |
Apply event-level cuts in a skim-safe way.
Parameters:
cut (str): Event-level cut to be applied.
path (basf2.Path): Skim path to be processed.
Returns:
Path on which the rest of this skim should be processed.
On this path, only events which passed the event-level cut will
be processed further.
.. Tip::
If running this function in `BaseSkim.additional_setup` or
`BaseSkim.build_lists`, redefine the ``path`` to the path returned by
`BaseSkim.skim_event_cuts`, *e.g.*
.. code-block:: python
def build_lists(self, path):
path = self.skim_event_cuts("nTracks>4", path=path)
# rest of skim list building...
.. Note::
The motivation for using this function over `applyEventCuts` is that
`applyEventCuts` completely removes events from processing. If we combine
multiple skims in a single steering file (which is done in production), and
the first has a set of event-level cuts, then all the remaining skims will
never even see those events.
Internally, this function creates a new path, which is only processed for
events passing the event-level cut. To avoid issues around particles not
being available on the main path (leading to noisy error logs), we need to
add the rest of the skim to this path. So this new path is assigned to the
attribute ``BaseSkim._ConditionalPath``, and ``BaseSkim.__call__`` will run
all remaining methods on this path.
Definition at line 272 of file core.py.
Location of test MDST sample. To modify this, set the property
`BaseSkim.TestSampleProcess`, and this function will find an appropriate test
sample from the list in
``/group/belle2/dataprod/MC/SkimTraining/SampleLists/TestFiles.yaml``
If no sample can be found, an empty list is returned.
Reimplemented from BaseSkim.
Definition at line 736 of file core.py.