spine.construct.interaction.InteractionBuilder
- class spine.construct.interaction.InteractionBuilder(mode: Literal['reco', 'truth', 'both', 'all'], units: Literal['cm', 'px'])[source]
Builds reconstructed and truth interactions.
It takes the raw output of the reconstruction chain, extracts the necessary information and builds
RecoInteractionandTruthInteractionobjects from it.Methods
__call__(data)Build representations for a batch of data.
build_reco(data)Builds
RecoInteractionobjects from the full chain output.build_truth(data)Builds
TruthInteractionobjects from the full chain output.check_units(data, key[, entry])Checks that the objects in the list are expressed in the appropriate units.
construct(func, data[, entry])Prepares the input based on the required data and runs constructor.
load_reco(data)Load
RecoInteractionobjects from their stored versions.load_truth(data)Load
TruthInteractionobjects from their stored versions.process(data, mode[, entry])Build representations for a single entry.
- __init__(mode: Literal['reco', 'truth', 'both', 'all'], units: Literal['cm', 'px']) None
Initializes the builder.
- Parameters:
mode (str, default 'both') – Whether to construct reconstructed objects, true objects or both (one of ‘reco’, ‘truth’, ‘both’ or ‘all’)
units (str, default 'cm') – Units in which the position arguments of the constructed objects should be expressed (one of ‘cm’ or ‘px’)
Methods
__init__(mode, units)Initializes the builder.
build_reco(data)Builds
RecoInteractionobjects from the full chain output.build_truth(data)Builds
TruthInteractionobjects from the full chain output.check_units(data, key[, entry])Checks that the objects in the list are expressed in the appropriate units.
construct(func, data[, entry])Prepares the input based on the required data and runs constructor.
load_reco(data)Load
RecoInteractionobjects from their stored versions.load_truth(data)Load
TruthInteractionobjects from their stored versions.process(data, mode[, entry])Build representations for a single entry.
Attributes
- name: ClassVar[str | None] = 'interaction'
- build_reco(data: dict[str, Any]) list[RecoInteraction][source]
Builds
RecoInteractionobjects from the full chain output.- Parameters:
data (dict) – Dictionary of data products
- Returns:
List of constructed reconstructed interaction instances
- Return type:
List[RecoInteraction]
- build_truth(data: dict[str, Any]) list[TruthInteraction][source]
Builds
TruthInteractionobjects from the full chain output.- Parameters:
data (dict) – Dictionary of data products
- Returns:
List of constructed truth interaction instances
- Return type:
List[TruthInteraction]
- load_reco(data: dict[str, Any]) list[RecoInteraction][source]
Load
RecoInteractionobjects from their stored versions.- Parameters:
data (dict) – Dictionary of data products
- Returns:
List of restored reconstructed interaction instances
- Return type:
List[RecoInteraction]
- load_truth(data: dict[str, Any]) list[TruthInteraction][source]
Load
TruthInteractionobjects from their stored versions.- Parameters:
data (dict) – Dictionary of data products
- Returns:
List of restored truth interaction instances
- Return type:
List[TruthInteraction]