Skip to content
Snippets Groups Projects

Serialization to variant_data and json

Merged Paul Gessinger requested to merge ACTS-418-serialization into master

This MR introduces a data structure based on boost::variant which can be used to create a json like tree with nodes of varying types. This is introduced into some of the geometry classes as methods toVariantData and constructors that accept variant_data. It works up to layers, so you can serialize a list of layers, and reconstruct the layers from this. I want to use this to rework the geometry creation tests in the framework (I already did that, didn't open an MR for that yet).

This does not introduce a json library dependency in core. However, it adds a JsonPlugin which has a from_json function and depends on nlohmann::json (as @sroe suggested). This is one single file json.hpp that is about 500kB and is bundled inside the plugin and can be loaded with #include “ACTS/Plugins/JsonPlugin/lib/json.hpp”. This can read json strings and turn them into json c++ objects, which Acts::from_json can turn into variant_data, which you can turn into anything then.

I added tests for all the classes that can convert to variant_data and can build from variant_data, testing exactly that. Some information gets lost during the process, for instance in the DD4hep case, the transform is hard-copied into the output from the DetectorElement, and (right now) the detector element is not rebuild from the variant_data input. This gives a standalone surface without any connection. This can, however, in principle also be implemented.

WIP because I still need to

  • Readjust to TE-less SurfaceArray
  • Write some doc comments!

Closes ACTS-418

Edited by Robert Johannes Langenberg

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading