spine.geo.manager.GeoManager

class spine.geo.manager.GeoManager[source]

Manages a singleton instance of a Geometry class.

Methods

get_instance()

Get the current geometry instance.

get_instance_if_initialized()

Get the current geometry instance if initialized.

initialize(detector[, tag, version])

Initialize the geometry module for a given detector.

initialize_or_get(detector[, tag, version])

Initialize the geometry if needed, or return the existing instance.

is_initialized()

Check if the geometry instance is initialized.

reset()

Reset the geometry instance (useful for testing).

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

get_instance()

Get the current geometry instance.

get_instance_if_initialized()

Get the current geometry instance if initialized.

initialize(detector[, tag, version])

Initialize the geometry module for a given detector.

initialize_or_get(detector[, tag, version])

Initialize the geometry if needed, or return the existing instance.

is_initialized()

Check if the geometry instance is initialized.

reset()

Reset the geometry instance (useful for testing).

classmethod initialize(detector: str, tag: str | None = None, version: str | int | float | None = None) Geometry[source]

Initialize the geometry module for a given detector.

Parameters:
  • detector (str) – The name of the detector.

  • tag (str, optional) – A tag to identify a specific configuration.

  • version (str, optional) – A version number for the geometry configuration.

Returns:

The initialized geometry instance.

Return type:

Geometry

classmethod initialize_or_get(detector: str, tag: str | None = None, version: str | int | float | None = None) Geometry[source]

Initialize the geometry if needed, or return the existing instance.

Parameters:
  • detector (str) – The name of the detector.

  • tag (str, optional) – A tag to identify a specific configuration.

  • version (str, optional) – A version number for the geometry configuration.

classmethod is_initialized() bool[source]

Check if the geometry instance is initialized.

Returns:

True if the geometry instance is initialized, False otherwise.

Return type:

bool

classmethod get_instance() Geometry[source]

Get the current geometry instance.

Parameters:

raise_error (bool, optional) – Whether to raise an error if the instance is not initialized.

Returns:

The current geometry instance.

Return type:

Geometry

classmethod get_instance_if_initialized() Geometry | None[source]

Get the current geometry instance if initialized.

Returns:

The current geometry instance, or None if not initialized.

Return type:

Optional[Geometry]

classmethod reset() None[source]

Reset the geometry instance (useful for testing).