-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optionally decorate geometry dumps to json.
Added the possibility to pass a decorator to the json converter to add extra attributes to the json dump of certain objects. Decorator interfaces are defined for adding attributes to surface and volume or their material dumps.
- Loading branch information
Goetz Gaycken
committed
Dec 12, 2022
1 parent
ce28f69
commit 6fbb368
Showing
9 changed files
with
230 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
Plugins/Json/include/Acts/Plugins/Json/ITrackingGeometryJsonDecorator.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2017-2021 CERN for the benefit of the Acts project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "Acts/Plugins/Json/ActsJson.hpp" | ||
|
||
namespace Acts { | ||
class TrackingVolume; | ||
class Surface; | ||
class ISurfaceMaterial; | ||
class IVolumeMaterial; | ||
|
||
/// helper class to add extra informtion to surface or volume json objects | ||
class ITrackingGeometryJsonDecorator { | ||
public: | ||
virtual ~ITrackingGeometryJsonDecorator() = default; | ||
|
||
/// Add extra elements to the json object already filled for the given | ||
/// surface | ||
/// | ||
/// @param surface the surface which was used to fill the json object | ||
/// @param json the json object that is enhanced | ||
virtual void decorate(const Acts::Surface &surface, | ||
nlohmann::json &json) const = 0; | ||
|
||
/// Add extra elements to the json object already filled for the given | ||
/// volume | ||
/// | ||
/// @param volume the volume which was used to fill the json object | ||
/// @param json the json object that is enhanced | ||
virtual void decorate(const Acts::TrackingVolume &volume, | ||
nlohmann::json &json) const = 0; | ||
}; | ||
} // namespace Acts |
42 changes: 42 additions & 0 deletions
42
Plugins/Json/include/Acts/Plugins/Json/IVolumeMaterialJsonDecorator.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2017-2021 CERN for the benefit of the Acts project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "Acts/Plugins/Json/ActsJson.hpp" | ||
|
||
namespace Acts { | ||
class TrackingVolume; | ||
class Surface; | ||
class ISurfaceMaterial; | ||
class IVolumeMaterial; | ||
|
||
/// helper class to add extra informtion to surface or volume json objects | ||
class IVolumeMaterialJsonDecorator { | ||
public: | ||
virtual ~IVolumeMaterialJsonDecorator() = default; | ||
|
||
/// Add extra elements to the json object already filled for the given | ||
/// surface material | ||
/// | ||
/// @param material the surface material which was used to | ||
/// fill the json object | ||
/// @param json the json object that is enhanced | ||
virtual void decorate(const Acts::ISurfaceMaterial &material, | ||
nlohmann::json &json) const = 0; | ||
|
||
/// Add extra elements to the json object already filled for the given | ||
/// volume material | ||
/// | ||
/// @param material the volume material which was used to | ||
/// fill the json object | ||
/// @param json the json object that is enhanced | ||
virtual void decorate(const Acts::IVolumeMaterial &material, | ||
nlohmann::json &json) const = 0; | ||
}; | ||
} // namespace Acts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.