Skip to content
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
20c2350
snapshot
asalzburger Jul 7, 2025
3bf4216
snapshot
asalzburger Jul 7, 2025
ea24b12
snapshot
asalzburger Jul 8, 2025
c2507c0
next snapshot
asalzburger Jul 8, 2025
4423ef6
cleanup volume maps / surface maps
asalzburger Jul 8, 2025
2242550
surface material i/o moved
asalzburger Jul 8, 2025
1f29357
Merge branch 'main' into chore-move-material-map-io-to-plugins
asalzburger Jul 8, 2025
9bb6bd4
Merge branch 'main' into chore-move-material-map-io-to-plugins
asalzburger Jul 8, 2025
4d4233e
checking against potential nullptr
asalzburger Jul 8, 2025
3e2583f
remove new operator usage
asalzburger Jul 8, 2025
ad2c8dd
remove SonarCloud issues
asalzburger Jul 9, 2025
c8cbdbf
Merge branch 'main' into chore-move-material-map-io-to-plugins
asalzburger Jul 9, 2025
a31211e
int vs size
asalzburger Jul 9, 2025
390e103
fixing CI
asalzburger Jul 9, 2025
f6c54e2
make clang-tidy happy
asalzburger Jul 9, 2025
7b59369
more SonarCloud issues
asalzburger Jul 9, 2025
8075386
more SonarCloud issues
asalzburger Jul 9, 2025
8f7718c
Merge branch 'main' into chore-move-material-map-io-to-plugins
asalzburger Jul 9, 2025
3deed01
more SonarCloud issues fixed
asalzburger Jul 9, 2025
a86122c
chore-move-material-map-io-to-plugins
asalzburger Jul 10, 2025
3af4073
Merge branch 'main' into chore-move-material-map-io-to-plugins
asalzburger Jul 10, 2025
718352f
Update Examples/Io/Root/src/RootMaterialDecorator.cpp
asalzburger Jul 10, 2025
7658541
renaming to TrackingGeometryMaterial
asalzburger Jul 10, 2025
4f20c6b
next round of PR comments
asalzburger Jul 10, 2025
ff1ce44
adding read-in test for indexed material
asalzburger Jul 10, 2025
65227b4
fix detector pytest
asalzburger Jul 10, 2025
254a352
make pytest run
asalzburger Jul 10, 2025
4869cbd
Merge branch 'main' into chore-move-material-map-io-to-plugins
asalzburger Jul 10, 2025
972bf7c
symmetrize RootIO with internal payloads
asalzburger Jul 10, 2025
a59cb30
last fixable SonarCloud issue
asalzburger Jul 10, 2025
7ed2a46
renaming
asalzburger Jul 11, 2025
18aee02
Merge branch 'main' into chore-move-material-map-io-to-plugins
asalzburger Jul 12, 2025
ab4b34e
break
asalzburger Jul 12, 2025
d37fe26
delete
asalzburger Jul 12, 2025
899d502
unbreak
asalzburger Jul 12, 2025
3a9acce
Merge branch 'main' into chore-move-material-map-io-to-plugins
kodiakhq[bot] Jul 12, 2025
b3a39cc
break
asalzburger Jul 12, 2025
c94bc8a
unbreak
asalzburger Jul 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions Core/include/Acts/Material/MaterialMapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "Acts/MagneticField/MagneticFieldContext.hpp"
#include "Acts/Material/MaterialInteraction.hpp"
#include "Acts/Material/MaterialInteractionAssignment.hpp"
#include "Acts/Material/TrackingGeometryMaterial.hpp"
#include "Acts/Material/interface/IAssignmentFinder.hpp"
#include "Acts/Material/interface/ISurfaceMaterialAccumulater.hpp"
#include "Acts/Utilities/Logger.hpp"
Expand All @@ -24,14 +25,6 @@ namespace Acts {
/// @brief material mapping procedure
class MaterialMapper {
public:
/// @brief The material maps
using SurfaceMaterialMaps =
std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>;
using VolumeMaterialMaps =
std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;
using DetectorMaterialMaps =
std::pair<SurfaceMaterialMaps, VolumeMaterialMaps>;

/// @brief nested configuration struct
struct Config {
// The assignment finder
Expand Down Expand Up @@ -83,7 +76,7 @@ class MaterialMapper {
const Options& options = Options{}) const;

/// Finalize the maps
DetectorMaterialMaps finalizeMaps(const State& state) const;
TrackingGeometryMaterial finalizeMaps(const State& state) const;

private:
/// Access method to the logger
Expand Down
28 changes: 28 additions & 0 deletions Core/include/Acts/Material/TrackingGeometryMaterial.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// This file is part of the ACTS project.
//
// Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/Material/ISurfaceMaterial.hpp"
#include "Acts/Material/IVolumeMaterial.hpp"

#include <map>
#include <memory>
#include <utility>

namespace Acts {

using SurfaceMaterialMaps =
std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>;
using VolumeMaterialMaps =
std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;
using TrackingGeometryMaterial =
std::pair<SurfaceMaterialMaps, VolumeMaterialMaps>;

} // namespace Acts
4 changes: 2 additions & 2 deletions Core/src/Material/MaterialMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ Acts::MaterialMapper::mapMaterial(State& state, const GeometryContext& gctx,
return {mappedMaterial, unmappedMaterial};
}

Acts::MaterialMapper::DetectorMaterialMaps Acts::MaterialMapper::finalizeMaps(
Acts::TrackingGeometryMaterial Acts::MaterialMapper::finalizeMaps(
const State& state) const {
// The final maps
DetectorMaterialMaps detectorMaterialMaps;
TrackingGeometryMaterial detectorMaterialMaps;
// The surface maps
detectorMaterialMaps.first =
m_cfg.surfaceMaterialAccumulater->finalizeMaterial(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,7 @@
#pragma once

#include "Acts/Geometry/GeometryIdentifier.hpp"

#include <map>
#include <memory>

namespace Acts {

class ISurfaceMaterial;
class IVolumeMaterial;

using SurfaceMaterialMap =
std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>;

using VolumeMaterialMap =
std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;

using DetectorMaterialMaps = std::pair<SurfaceMaterialMap, VolumeMaterialMap>;
} // namespace Acts
#include "Acts/Material/TrackingGeometryMaterial.hpp"

namespace ActsExamples {

Expand All @@ -40,7 +24,8 @@ class IMaterialWriter {
/// The single writer class
///
/// @param detMaterial the detector material maps
virtual void writeMaterial(const Acts::DetectorMaterialMaps& detMaterial) = 0;
virtual void writeMaterial(
const Acts::TrackingGeometryMaterial& detMaterial) = 0;
};

} // namespace ActsExamples
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class MappingMaterialDecorator : public IMaterialDecorator {
public:
using BinningMap = std::map<std::uint64_t, std::pair<int, int>>;

using VolumeMaterialMap =
std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;

MappingMaterialDecorator(const Acts::TrackingGeometry& tGeometry,
Acts::Logging::Level level,
bool clearSurfaceMaterial = true,
Expand Down Expand Up @@ -276,7 +273,7 @@ class MappingMaterialDecorator : public IMaterialDecorator {
private:
BinningMap m_binningMap;

VolumeMaterialMap m_volumeMaterialMap;
VolumeMaterialMaps m_volumeMaterialMap;

bool m_clearSurfaceMaterial{true};
bool m_clearVolumeMaterial{true};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "Acts/MagneticField/MagneticFieldContext.hpp"
#include "Acts/Material/MaterialInteraction.hpp"
#include "Acts/Material/SurfaceMaterialMapper.hpp"
#include "Acts/Material/TrackingGeometryMaterial.hpp"
#include "Acts/Material/VolumeMaterialMapper.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "ActsExamples/Framework/DataHandle.hpp"
Expand All @@ -32,18 +33,7 @@
#include <vector>

namespace Acts {

class TrackingGeometry;
class ISurfaceMaterial;
class IVolumeMaterial;

using SurfaceMaterialMap =
std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>;

using VolumeMaterialMap =
std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;

using DetectorMaterialMaps = std::pair<SurfaceMaterialMap, VolumeMaterialMap>;
} // namespace Acts

namespace ActsExamples {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CoreMaterialMapping::CoreMaterialMapping(const CoreMaterialMapping::Config& cfg,
}

CoreMaterialMapping::~CoreMaterialMapping() {
Acts::DetectorMaterialMaps detectorMaterial =
Acts::TrackingGeometryMaterial detectorMaterial =
m_cfg.materialMapper->finalizeMaps(*m_mappingState);
// Loop over the available writers and write the maps
for (auto& imw : m_cfg.materiaMaplWriters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ MaterialMapping::MaterialMapping(const MaterialMapping::Config& cfg,

ProcessCode MaterialMapping::finalize() {
ACTS_INFO("Finalizing material mappig output");
Acts::DetectorMaterialMaps detectorMaterial;
Acts::TrackingGeometryMaterial detectorMaterial;

if (m_cfg.materialSurfaceMapper && m_cfg.materialVolumeMapper) {
// Finalize all the maps using the cached state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/Material/ISurfaceMaterial.hpp"
#include "Acts/Material/IVolumeMaterial.hpp"
#include "Acts/Material/TrackingGeometryMaterial.hpp"
#include "Acts/Plugins/Json/MaterialMapJsonConverter.hpp"
#include "Acts/Utilities/EnumBitwiseOperators.hpp"
#include "Acts/Utilities/Logger.hpp"
Expand All @@ -27,18 +28,7 @@
#include <utility>

namespace Acts {

class TrackingGeometry;
class ISurfaceMaterial;
class IVolumeMaterial;

using SurfaceMaterialMap =
std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>;

using VolumeMaterialMap =
std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;

using DetectorMaterialMaps = std::pair<SurfaceMaterialMap, VolumeMaterialMap>;
} // namespace Acts

namespace ActsExamples {
Expand Down Expand Up @@ -79,7 +69,8 @@ class JsonMaterialWriter : public IMaterialWriter {
/// Write out the material map
///
/// @param detMaterial is the SurfaceMaterial and VolumeMaterial maps
void writeMaterial(const Acts::DetectorMaterialMaps& detMaterial) override;
void writeMaterial(
const Acts::TrackingGeometryMaterial& detMaterial) override;

/// Write out the material map from Geometry
///
Expand Down
2 changes: 1 addition & 1 deletion Examples/Io/Json/src/JsonMaterialWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ActsExamples::JsonMaterialWriter::JsonMaterialWriter(
ActsExamples::JsonMaterialWriter::~JsonMaterialWriter() = default;

void ActsExamples::JsonMaterialWriter::writeMaterial(
const Acts::DetectorMaterialMaps& detMaterial) {
const Acts::TrackingGeometryMaterial& detMaterial) {
// Evoke the converter
auto jOut = m_converter->materialMapsToJson(detMaterial);
// And write the file(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <Acts/Material/IMaterialDecorator.hpp>
#include <Acts/Material/ISurfaceMaterial.hpp>
#include <Acts/Material/IVolumeMaterial.hpp>
#include <Acts/Material/TrackingGeometryMaterial.hpp>
#include <Acts/Plugins/Root/RootMaterialMapIo.hpp>
#include <Acts/Surfaces/Surface.hpp>
#include <Acts/Utilities/Logger.hpp>

Expand All @@ -26,17 +28,6 @@

class TFile;

namespace Acts {
class ISurfaceMaterial;
class IVolumeMaterial;

using SurfaceMaterialMap =
std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>;
using VolumeMaterialMap =
std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;
using DetectorMaterialMaps = std::pair<SurfaceMaterialMap, VolumeMaterialMap>;
} // namespace Acts

namespace ActsExamples {

/// @class RootMaterialDecorator
Expand All @@ -48,42 +39,10 @@ class RootMaterialDecorator : public Acts::IMaterialDecorator {
/// Configuration of the Reader
class Config {
public:
/// The name of the output surface tree
std::string folderSurfaceNameBase = "SurfaceMaterial";
/// The name of the output volume tree
std::string folderVolumeNameBase = "VolumeMaterial";
/// The volume identification string
std::string voltag = "_vol";
/// The boundary identification string
std::string boutag = "_bou";
/// The layer identification string
std::string laytag = "_lay";
/// The approach identification string
std::string apptag = "_app";
/// The sensitive identification string
std::string sentag = "_sen";
/// The bin number tag
std::string ntag = "n";
/// The value tag -> binning values: AxisZ, AxisR, AxisPhi, etc.
std::string vtag = "v";
/// The option tag -> binning options: open, closed
std::string otag = "o";
/// The range min tag: min value
std::string mintag = "min";
/// The range max tag: max value
std::string maxtag = "max";
/// The thickness tag
std::string ttag = "t";
/// The x0 tag
std::string x0tag = "x0";
/// The l0 tag
std::string l0tag = "l0";
/// The A tag
std::string atag = "A";
/// The Z tag
std::string ztag = "Z";
/// The rho tag
std::string rhotag = "rho";
/// Accessor config
Acts::RootMaterialMapIo::Config accessorConfig;
/// Accessor options
Acts::RootMaterialMapIo::Options accessorOptions;
/// The name of the output file
std::string fileName = "material-maps.root";
};
Expand Down Expand Up @@ -127,7 +86,7 @@ class RootMaterialDecorator : public Acts::IMaterialDecorator {
}

/// Return the maps
const Acts::DetectorMaterialMaps materialMaps() const {
Acts::TrackingGeometryMaterial materialMaps() const {
return {m_surfaceMaterialMap, m_volumeMaterialMap};
}

Expand All @@ -144,10 +103,10 @@ class RootMaterialDecorator : public Acts::IMaterialDecorator {
TFile* m_inputFile{nullptr};

/// Surface based material
Acts::SurfaceMaterialMap m_surfaceMaterialMap;
Acts::SurfaceMaterialMaps m_surfaceMaterialMap;

/// Volume based material
Acts::VolumeMaterialMap m_volumeMaterialMap;
Acts::VolumeMaterialMaps m_volumeMaterialMap;

bool m_clearSurfaceMaterial{true};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#pragma once

#include "Acts/Material/MaterialInteraction.hpp"
#include "Acts/Plugins/Root/RootMaterialTrackAccessor.hpp"
#include "Acts/Plugins/Root/RootMaterialTrackIo.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "ActsExamples/Framework/DataHandle.hpp"
#include "ActsExamples/Framework/IReader.hpp"
Expand Down Expand Up @@ -99,7 +99,7 @@ class RootMaterialTrackReader : public IReader {
/// multiple entries corresponding to one event number)
std::vector<long long> m_entryNumbers = {};

Acts::RootMaterialTrackAccessor m_accessor;
Acts::RootMaterialTrackIo m_accessor;
};

} // namespace ActsExamples
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "ActsExamples/Framework/ProcessCode.hpp"
#include "ActsExamples/Framework/WriterT.hpp"
#include <Acts/Plugins/Root/RootMaterialTrackAccessor.hpp>
#include <Acts/Plugins/Root/RootMaterialTrackIo.hpp>
#include <Acts/Propagator/MaterialInteractor.hpp>
#include <Acts/Utilities/Logger.hpp>

Expand Down Expand Up @@ -108,7 +108,7 @@ class RootMaterialTrackWriter
/// The output tree name
TTree* m_outputTree = nullptr;
/// The read - write payload
Acts::RootMaterialTrackAccessor m_accessor;
Acts::RootMaterialTrackIo m_accessor;
};

} // namespace ActsExamples
Loading
Loading