Skip to content

Commit

Permalink
Merge branch 'main' into feat/digi_disable_clusterization
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger authored Sep 20, 2024
2 parents 448e714 + 4aa7d19 commit a878abe
Show file tree
Hide file tree
Showing 40 changed files with 731 additions and 133 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ endif()
# minimal dependency versions. they are defined here in a single place so
# they can be easily upgraded, although they might not be used if the
# dependency is included via `add_subdirectory(...)`.
set(_acts_actsvg_version 0.4.40)
set(_acts_autodiff_version 0.6)
set(_acts_actsvg_version 0.4.47)
set(_acts_boost_version 1.71.0)
set(_acts_dd4hep_version 1.21)
set(_acts_edm4hep_version 0.7)
Expand All @@ -232,13 +231,14 @@ set(_acts_podio_version 1.0.1) # will try this first
set(_acts_podio_fallback_version 0.16) # if not found, will try this one
set(_acts_doxygen_version 1.9.4)
set(_acts_hepmc3_version 3.2.1)
set(_acts_nlohmanjson_version 3.2.0)
set(_acts_nlohmanjson_version 3.10.5)
set(_acts_onnxruntime_version 1.12.0)
set(_acts_root_version 6.20)
set(_acts_tbb_version 2020.1)
set(_acts_pythia8_version 8.309)
set(_acts_detray_version 0.72.0)
set(_acts_traccc_version 0.13.0)
set(_acts_pybind11_version 2.13.1)
set(_acts_detray_version 0.72.1)
set(_acts_traccc_version 0.15.0)
set(_acts_covfie_version 0.10.0)
set(_acts_vecmem_version 1.4.0)
set(_acts_algebraplugins_version 0.22.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ScoreBasedAmbiguityResolution::computeInitialState(

for (const auto& ts : track.trackStatesReversed()) {
if (!ts.hasReferenceSurface()) {
ACTS_ERROR("Track state has no reference surface");
ACTS_DEBUG("Track state has no reference surface");
continue;
}
auto iVolume = ts.referenceSurface().geometryId().volume();
Expand Down
9 changes: 9 additions & 0 deletions Core/include/Acts/EventData/MultiTrajectory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ class TrackStateRange {
}
}

Iterator operator++(int) {
Iterator tmp(*this);
operator++();
return tmp;
}

bool operator==(const Iterator& other) const {
if (!proxy && !other.proxy) {
return true;
Expand All @@ -109,6 +115,9 @@ class TrackStateRange {
Iterator begin() { return m_begin; }
Iterator end() { return Iterator{std::nullopt}; }

Iterator cbegin() const { return m_begin; }
Iterator cend() const { return Iterator{std::nullopt}; }

private:
Iterator m_begin;
};
Expand Down
6 changes: 6 additions & 0 deletions Core/include/Acts/Geometry/Polyhedron.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Geometry/Extent.hpp"
#include "Acts/Visualization/ViewConfig.hpp"

#include <cstddef>
#include <vector>

namespace Acts {

class IVisualization3D;

/// @class Polyhedron
///
/// Struct which contains a cartesian approximation for any surface type.
Expand Down Expand Up @@ -79,5 +82,8 @@ struct Polyhedron {
///
/// @return ranges that describe the space taken by this surface
Extent extent(const Transform3& transform = Transform3::Identity()) const;

void visualize(IVisualization3D& helper,
const ViewConfig& viewConfig = {}) const;
};
} // namespace Acts
7 changes: 7 additions & 0 deletions Core/include/Acts/Geometry/Volume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ class Volume : public GeometryObject {
bool operator==(const Volume& other) const;
bool operator!=(const Volume& other) const;

/// Produces a 3D visualization of this volume
/// @param helper The visualization helper describing the output format
/// @param gctx The geometry context
/// @param viewConfig The view configuration
void visualize(IVisualization3D& helper, const GeometryContext& gctx,
const ViewConfig& viewConfig = {}) const;

protected:
Transform3 m_transform;
Transform3 m_itransform;
Expand Down
4 changes: 4 additions & 0 deletions Core/include/Acts/Surfaces/Surface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/Intersection.hpp"
#include "Acts/Utilities/Result.hpp"
#include "Acts/Visualization/ViewConfig.hpp"

#include <array>
#include <cstddef>
Expand Down Expand Up @@ -484,6 +485,9 @@ class Surface : public virtual GeometryObject,
virtual ActsMatrix<2, 3> localCartesianToBoundLocalDerivative(
const GeometryContext& gctx, const Vector3& position) const = 0;

void visualize(IVisualization3D& helper, const GeometryContext& gctx,
const ViewConfig& viewConfig = {}) const;

protected:
/// Output Method for std::ostream, to be overloaded by child classes
///
Expand Down
3 changes: 1 addition & 2 deletions Core/include/Acts/Utilities/BoundingBox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ class AxisAlignedBoundingBox {
/// @param helper The visualization helper to write to
/// @param color The color to use for drawing
/// @param trf An optional transform to apply first.
void draw(IVisualization3D& helper,
std::array<int, 3> color = {120, 120, 120},
void draw(IVisualization3D& helper, Color color = {120, 120, 120},
const transform_type& trf = transform_type::Identity()) const
requires(DIM == 3);

Expand Down
3 changes: 1 addition & 2 deletions Core/include/Acts/Utilities/BoundingBox.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,7 @@ Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::transformed(

template <typename entity_t, typename value_t, std::size_t DIM>
void Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::draw(
IVisualization3D& helper, std::array<int, 3> color,
const transform_type& trf) const
IVisualization3D& helper, Color color, const transform_type& trf) const
requires(DIM == 3)
{
static_assert(DIM == 3, "PLY output only supported in 3D");
Expand Down
110 changes: 110 additions & 0 deletions Core/include/Acts/Utilities/GraphViz.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// This file is part of the Acts project.
//
// Copyright (C) 2024 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 <ostream>
#include <vector>

namespace Acts::GraphViz {

enum class Shape {
Box,
Polygon,
Ellipse,
Oval,
Circle,
Point,
Egg,
Triangle,
Plaintext,
Plain,
Diamond,
Trapezium,
Parallelogram,
House,
Pentagon,
Hexagon,
Septagon,
Octagon,
DoubleCircle,
DoubleOctagon,
TripleOctagon,
InvTriangle,
InvTrapezium,
InvHouse,
Mdiamond,
Msquare,
Mcircle,
Rect,
Rectangle,
Square,
Star,
None,
Underline,
Cylinder,
Note,
Tab,
Folder,
Box3d,
Component,
Promoter,
Cds,
Terminator,
Utr,
PrimerSite,
RestrictionSite,
FivePOverhang,
ThreePOverhang,
NOverhang,
Assembly,
Signature,
Insulator,
Ribosite,
RNAStab,
ProteaseSite,
ProteinStab,
RPromoter,
RArrow,
LArrow,
LPromoter
};

std::ostream& operator<<(std::ostream& os, const Shape& shape);

enum class Style {
Filled,
Invisible,
Diagonals,
Rounded,
Dashed,
Dotted,
Solid,
Bold
};

std::ostream& operator<<(std::ostream& os, const Style& style);

struct Node {
std::string id;
std::string label;
Shape shape = Shape::Ellipse;
std::vector<Style> style = {Style::Solid};
};

std::ostream& operator<<(std::ostream& os, const Node& node);

struct Edge {
Node from;
Node to;
Style style = Style::Solid;
};

std::ostream& operator<<(std::ostream& os, const Edge& node);

} // namespace Acts::GraphViz
13 changes: 6 additions & 7 deletions Core/include/Acts/Visualization/IVisualization3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Visualization/ViewConfig.hpp"

#include <array>
#include <cstddef>
#include <filesystem>
#include <fstream>
#include <string>
#include <vector>

namespace Acts {
Expand All @@ -27,11 +24,13 @@ class IVisualization3D {
public:
using FaceType = std::vector<std::size_t>;

static constexpr Color s_defaultColor = {120, 120, 120};

/// Draw a vertex at a given location and a color.
/// @param vtx The vertex position
/// @param color The color
///
virtual void vertex(const Vector3& vtx, ColorRGB color = {120, 120, 120}) = 0;
virtual void vertex(const Vector3& vtx, Color color = s_defaultColor) = 0;

/// Draw a face that connects a list of vertices.
/// @note Depending on the helper implementation, out of plane vertices might
Expand All @@ -40,7 +39,7 @@ class IVisualization3D {
/// @param color The color of the face
///
virtual void face(const std::vector<Vector3>& vtxs,
ColorRGB color = {120, 120, 120}) = 0;
Color color = s_defaultColor) = 0;

/// Draw a faces that connects a list of vertices - expert only
///
Expand All @@ -52,15 +51,15 @@ class IVisualization3D {
///
virtual void faces(const std::vector<Vector3>& vtxs,
const std::vector<FaceType>& faces,
ColorRGB color = {120, 120, 120}) = 0;
Color color = s_defaultColor) = 0;

/// Draw a line from a vertex to another
/// @param a The start vertex
/// @param b The end vertex
/// @param color The color of the line
///
virtual void line(const Vector3& a, const Vector3& b,
ColorRGB color = {120, 120, 120}) = 0;
Color color = s_defaultColor) = 0;

/// Write the content of the helper to an outstream.
/// @param os The output stream for file
Expand Down
15 changes: 8 additions & 7 deletions Core/include/Acts/Visualization/ObjVisualization3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,20 @@ class ObjVisualization3D : public IVisualization3D {
: m_outputPrecision(prec), m_outputScalor(scale) {}

/// @copydoc Acts::IVisualization3D::vertex()
void vertex(const Vector3& vtx, ColorRGB color = {0, 0, 0}) final;
void vertex(const Vector3& vtx, Color color = s_defaultColor) final;

/// @copydoc Acts::IVisualization3D::line()
void line(const Vector3& a, const Vector3& b,
ColorRGB color = {0, 0, 0}) final;
Color color = s_defaultColor) final;

/// @copydoc Acts::IVisualization3D::face()
void face(const std::vector<Vector3>& vtxs, ColorRGB color = {0, 0, 0}) final;
void face(const std::vector<Vector3>& vtxs,
Color color = s_defaultColor) final;

/// @copydoc Acts::IVisualization3D::faces()
void faces(const std::vector<Vector3>& vtxs,
const std::vector<FaceType>& faces,
ColorRGB color = {0, 0, 0}) final;
Color color = s_defaultColor) final;

/// @copydoc Acts::IVisualization3D::write(const std::filesystem::path&) const
void write(const std::filesystem::path& path) const final;
Expand All @@ -85,9 +86,9 @@ class ObjVisualization3D : public IVisualization3D {
std::vector<FaceType> m_faces;
std::vector<LineType> m_lines;
/// Map of colors to be written at given index position
std::map<std::size_t, ColorRGB> m_lineColors;
std::map<std::size_t, ColorRGB> m_vertexColors;
std::map<std::size_t, ColorRGB> m_faceColors;
std::map<std::size_t, Color> m_lineColors;
std::map<std::size_t, Color> m_vertexColors;
std::map<std::size_t, Color> m_faceColors;
};

#ifndef DOXYGEN
Expand Down
12 changes: 6 additions & 6 deletions Core/include/Acts/Visualization/PlyVisualization3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ class PlyVisualization3D : public IVisualization3D {
using VertexType = Eigen::Matrix<ValueType, 3, 1>;

/// @copydoc Acts::IVisualization3D::vertex()
void vertex(const Vector3& vtx, ColorRGB color = {120, 120, 120}) final;
void vertex(const Vector3& vtx, Color color = {120, 120, 120}) final;

/// @copydoc Acts::IVisualization3D::face()
void face(const std::vector<Vector3>& vtxs,
ColorRGB color = {120, 120, 120}) final;
Color color = {120, 120, 120}) final;

/// @copydoc Acts::IVisualization3D::faces()
void faces(const std::vector<Vector3>& vtxs,
const std::vector<FaceType>& faces,
ColorRGB color = {120, 120, 120}) final;
Color color = {120, 120, 120}) final;

/// @copydoc Acts::IVisualization3D::line()
void line(const Vector3& a, const Vector3& b,
ColorRGB color = {120, 120, 120}) final;
Color color = {120, 120, 120}) final;

/// @copydoc Acts::IVisualization3D::write(const std::filesystem::path&) const
void write(const std::filesystem::path& path) const final;
Expand All @@ -61,9 +61,9 @@ class PlyVisualization3D : public IVisualization3D {
void clear() final;

private:
std::vector<std::pair<VertexType, ColorRGB>> m_vertices;
std::vector<std::pair<VertexType, Color>> m_vertices;
std::vector<FaceType> m_faces;
std::vector<std::pair<std::pair<std::size_t, std::size_t>, ColorRGB>> m_edges;
std::vector<std::pair<std::pair<std::size_t, std::size_t>, Color>> m_edges;
};

#ifndef DOXYGEN
Expand Down
Loading

0 comments on commit a878abe

Please sign in to comment.