ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::TrackingGeometryMaterialJsonConverter Class Reference

Versioned material-document conversion, independent of the legacy material converters. More...

#include <ActsPlugins/Json/TrackingGeometryMaterialJsonConverter.hpp>

Classes

struct  Config
 Built-in or application-extended serialization registry. More...
class  DecodeContext
 Per-document decoding state, also available to application decoders. More...
class  EncodeContext
 Per-document encoding state, also available to application encoders. More...
struct  Options
 Output options. Version is a property of this codec, not an option. More...

Public Types

using SlabStore = std::shared_ptr<std::vector<MaterialSlab>>
 Shared grid slab allocation.
using SurfaceDecoder
 Surface decoder dispatch by kind.
using SurfaceEncoder
 Concrete surface encoder dispatch.

Public Member Functions

 TrackingGeometryMaterialJsonConverter (Config config=Config::defaultConfig())
 Construct with default or application-extended dispatchers.
TrackingGeometryMaterial fromFile (const std::filesystem::path &path) const
 Read a document, detecting encoding/compression from file contents.
TrackingGeometryMaterial fromJson (const nlohmann::json &encoded) const
 Decode and validate a complete material document.
void toFile (const TrackingGeometryMaterial &material, const std::filesystem::path &path, const Options &options=Options::defaultOptions()) const
 Write JSON/CBOR with optional zstd, selected by the filename extension.
nlohmann::json toJson (const TrackingGeometryMaterial &material, const Options &options=Options::defaultOptions()) const
 Encode a complete material document.

Detailed Description

Versioned material-document conversion, independent of the legacy material converters.

Applies no material to geometry. The reader checks construction invariants; use the offline JSON Schema for full format validation. Version 1 supports surface material only; volume assignments are rejected.

Member Typedef Documentation

◆ SurfaceDecoder

Initial value:
const DecodeContext&>
JSON-specific dispatcher that routes decoder functions based on a string kind tag found in the encode...
Definition JsonKindDispatcher.hpp:27
Per-document decoding state, also available to application decoders.
Definition TrackingGeometryMaterialJsonConverter.hpp:65

Surface decoder dispatch by kind.

◆ SurfaceEncoder

Initial value:
Base class of all surface-based material description.
Definition ISurfaceMaterial.hpp:39
Per-document encoding state, also available to application encoders.
Definition TrackingGeometryMaterialJsonConverter.hpp:36
Template class for type-based function dispatch.
Definition TypeDispatcher.hpp:38

Concrete surface encoder dispatch.

Constructor & Destructor Documentation

◆ TrackingGeometryMaterialJsonConverter()

Acts::TrackingGeometryMaterialJsonConverter::TrackingGeometryMaterialJsonConverter ( Config config = Config::defaultConfig())
explicit

Construct with default or application-extended dispatchers.

Parameters
configPayload conversion registry

Member Function Documentation

◆ fromFile()

TrackingGeometryMaterial Acts::TrackingGeometryMaterialJsonConverter::fromFile ( const std::filesystem::path & path) const

Read a document, detecting encoding/compression from file contents.

Parameters
pathInput filename
Returns
Decoded assignments, without applying them

◆ fromJson()

TrackingGeometryMaterial Acts::TrackingGeometryMaterialJsonConverter::fromJson ( const nlohmann::json & encoded) const

Decode and validate a complete material document.

Parameters
encodedVersioned document, never the legacy hierarchy-map layout
Returns
Assignments and optional description, without applying them

◆ toFile()

void Acts::TrackingGeometryMaterialJsonConverter::toFile ( const TrackingGeometryMaterial & material,
const std::filesystem::path & path,
const Options & options = Options::defaultOptions() ) const

Write JSON/CBOR with optional zstd, selected by the filename extension.

Parameters
materialMaterial container
pathOutput filename
optionsOutput precision, formatting and compression

◆ toJson()

nlohmann::json Acts::TrackingGeometryMaterialJsonConverter::toJson ( const TrackingGeometryMaterial & material,
const Options & options = Options::defaultOptions() ) const

Encode a complete material document.

Parameters
materialContainer, including an optional description
optionsOutput precision (formatting applies only to files)
Exceptions
std::invalid_argumentif volume assignments are present or the requested precision is outside [0, 23]
Returns
Versioned JSON document