Belle II Software  release-08-01-10
pxd.background_generator Namespace Reference

basf2 (Belle II Analysis Software Framework) # Author: The Belle II Collaboration # # See git log for contributors and copyright holders. More...

Namespaces

 models
 basf2 (Belle II Analysis Software Framework) # Author: The Belle II Collaboration # # See git log for contributors and copyright holders.
 

Classes

class  PXDBackgroundGenerator
 Class for the PXD background generator module. More...
 

Functions

str _verify_model (str model)
 Function to verify that model: More...
 
str _verify_checkpoint (Union[None, str, pathlib.Path] checkpoint)
 Function to verify that checkpoint: More...
 
Union[None, int] _verify_seed (Union[None, int] seed)
 Function to verify that seed: More...
 
int _verify_nintra (int nintra)
 Function to verify that nintra: More...
 
int _verify_ninter (int ninter)
 Function to verify that ninter: More...
 
str _verify_globaltag (str globaltag)
 Function to verify that globaltag: More...
 
Callable inject_simulation (Union[None, basf2.Module] module=None)
 Helper function to incorporate a module instance into add_simulation after BGOverlayInput. More...
 

Variables

 VXDID_ARGS
 Sequence of forty tuples (layer, ladder, sensor) used to instantiate VxdID specifier objects for distinct PXD modules. More...
 

Detailed Description

basf2 (Belle II Analysis Software Framework) # Author: The Belle II Collaboration # # See git log for contributors and copyright holders.

# This file is licensed under LGPL-3.0, see LICENSE.md. #

Generate PXD background samples for background overlay on the fly.

Function Documentation

◆ _verify_checkpoint()

str pxd.background_generator._verify_checkpoint ( Union[None, str, pathlib.Path]  checkpoint)
private

Function to verify that checkpoint:

  • is either None, a string, or a pathlib.Path object,
  • is a valid path to an existing file - if not None.

The value of checkpoint is returned if the conditions are met. An exception is raised otherwise.

Definition at line 65 of file __init__.py.

65 def _verify_checkpoint(checkpoint: Union[None, str, pathlib.Path]) -> str:
66  if not isinstance(checkpoint, (type(None), str, pathlib.Path)):
67  raise TypeError("expecting None or type str `checkpoint`")
68  if checkpoint is None:
69  return checkpoint
70  checkpoint = os.path.expandvars(str(checkpoint))
71  if not (os.path.exists(checkpoint) and os.path.isfile(checkpoint)):
72  raise ValueError(f"invalid `checkpoint`: {checkpoint!r}")
73  return checkpoint
74 
75 

◆ _verify_globaltag()

str pxd.background_generator._verify_globaltag ( str  globaltag)
private

Function to verify that globaltag:

  • is a string.

The value of globaltag is returned if the condition is met. An exception is raised otherwise.

Definition at line 129 of file __init__.py.

◆ _verify_model()

str pxd.background_generator._verify_model ( str  model)
private

Function to verify that model:

  • is a string,
  • is a valid name for a model that is available for selection.

The value of model is returned if the conditions are met. An exception is raised otherwise.

Definition at line 49 of file __init__.py.

◆ _verify_ninter()

int pxd.background_generator._verify_ninter ( int  ninter)
private

Function to verify that ninter:

  • is an integer,
  • is larger than zero.

The value of ninter is returned if the conditions are met. An exception is raised otherwise.

Definition at line 115 of file __init__.py.

◆ _verify_nintra()

int pxd.background_generator._verify_nintra ( int  nintra)
private

Function to verify that nintra:

  • is an integer,
  • is larger than zero.

The value of nintra is returned if the conditions are met. An exception is raised otherwise.

Definition at line 100 of file __init__.py.

◆ _verify_seed()

Union[None, int] pxd.background_generator._verify_seed ( Union[None, int]  seed)
private

Function to verify that seed:

  • is either None or an integer,
  • is in the interval $ [-2^{63}, 2^{63} - 1] $ - if not None.

The value of seed is returned if the conditions are met. An exception is raised otherwise.

Definition at line 83 of file __init__.py.

◆ inject_simulation()

Callable pxd.background_generator.inject_simulation ( Union[None, basf2.Module]   module = None)

Helper function to incorporate a module instance into add_simulation after BGOverlayInput.

Parameters
moduleModule instance to be incorporated, defaults to None - return unmodified function
Returns
Drop-in replacement function for add_simulation
Incorporate a module instance
into :py:func:`.add_simulation` after `!BGOverlayInput`.

:param module: Module instance to be incorporated,
    defaults to None - return unmodified function
:type module: :py:class:`basf2.Module`, optional

:returns: Drop-in replacement function for :py:func:`.add_simulation`

Definition at line 364 of file __init__.py.

Variable Documentation

◆ VXDID_ARGS

VXDID_ARGS
Initial value:
1 = tuple(
2  tuple(product([1], [ladder + 1 for ladder in range(8)], [1, 2]))
3  + tuple(product([2], [ladder + 1 for ladder in range(12)], [1, 2]))
4 )

Sequence of forty tuples (layer, ladder, sensor) used to instantiate VxdID specifier objects for distinct PXD modules.

It is assumed that the indices of tuples in the sequence match indices along the first axis of tensors with shape (40, 250, 768) that are produced by the generator.

Definition at line 36 of file __init__.py.