File GeometryHierarchyMapJsonConverter.hpp

namespace Acts

Set the Geometry Context PLUGIN.

Set the Calibration Context PLUGIN.

Convenience functions to ease creation of and Acts::InterpolatedMaterialMap and to avoid code duplication.

Set the Mangetic Field Context PLUGIN.

Convenience functions to ease creation of and Acts::InterpolatedBFieldMap and to avoid code duplication.

Currently implemented for the two most common formats: rz and xyz.

template<typename value_t>
class GeometryHierarchyMapJsonConverter
#include <Acts/Plugins/Json/GeometryHierarchyMapJsonConverter.hpp>

Convert a geometry hierarchy map to/from Json.

The value type is expected to be directly convertible to/from a Json object. It has to be either a fundamental type or appropriate to_json(json&, const value_t&) and from_json(const json&, value_t&) functions must be available. See the relevant nlohmann::json documentation for further information.

tparam value_t

value type stored in the geometry hierarchy map

A user-defined identifier is stored in the encoded Json object that is used to identify which value type is stored in the file. The identifier is checked for consistency when decoding the Json object.

Public Types

using Container = GeometryHierarchyMap<value_t>
using Value = value_t

Public Functions

inline GeometryHierarchyMapJsonConverter(std::string valueIdentifier)

Construct the converter.

Parameters

valueIdentifier – user-defined identifier for the stored value

Container fromJson(const nlohmann::json &encoded) const

Decode a Json object into a geometry hierarchy map.

Parameters

encoded – Json object that should be decoded

Throws

std::invalid_argument – in case of format errors

Returns

Decoded geometry hierarchy map

nlohmann::json toJson(const Container &container) const

Encode the geometry hierarchy map into a Json object.

Parameters

container – Geometry hierarchy map that should be encoded

Returns

Encoded Json object

Private Members

std::string m_valueIdentifier

Private Static Functions

static inline GeometryIdentifier decodeIdentifier(const nlohmann::json &encoded)
static inline nlohmann::json encodeIdentifier(GeometryIdentifier id)

Private Static Attributes

static constexpr const char *const kEntriesKey = "entries"
static constexpr int kFormatVersion = 0

The version of the encoded Json container format.

This must be increased manually everytime the container format changes.

static constexpr const char *const kHeaderKey = "acts-geometry-hierarchy-map"