Skip to content

Commit

Permalink
Merge branch 'main' into physmon
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger authored Feb 21, 2024
2 parents 3c2b662 + a42f23b commit 45182a2
Show file tree
Hide file tree
Showing 58 changed files with 1,052 additions and 1,189 deletions.
5 changes: 2 additions & 3 deletions CI/physmon/phys_perf_mon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ set -e
set -x


mode=${1:all}
mode=${1:-all}
if ! [[ $mode = @(all|kalman|gsf|fullchains|vertexing|simulation) ]]; then
echo "Usage: $0 <all|kalman|gsf|fullchains|vertexing|simulation> (outdir)"
exit 1
fi

outdir=${2:physmon}
[ -z "$outdir" ] && outdir=physmon
outdir=${2:-physmon}
mkdir -p $outdir

refdir=CI/physmon/reference
Expand Down
Binary file modified CI/physmon/reference/performance_ivf_truth_estimated_hist.root
Binary file not shown.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ option(ACTS_BUILD_PLUGIN_DD4HEP "Build DD4hep plugin" OFF)
option(ACTS_BUILD_PLUGIN_PODIO "Build Podio plugin" OFF)
option(ACTS_BUILD_PLUGIN_EDM4HEP "Build EDM4hep plugin" OFF)
option(ACTS_BUILD_PLUGIN_FPEMON "Build FPE monitoring plugin" OFF)
option(ACTS_BUILD_PLUGIN_GEOMODEL "Build GeoModel plugin" OFF)
option(ACTS_USE_SYSTEM_GEOMODEL "Use a system-provided GeoModel installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_BUILD_PLUGIN_GEANT4 "Build Geant4 plugin" OFF)
option(ACTS_BUILD_PLUGIN_EXATRKX "Build the Exa.TrkX plugin" OFF)
option(ACTS_EXATRKX_ENABLE_ONNX "Build the Onnx backend for the exatrkx plugin" OFF)
Expand Down Expand Up @@ -186,6 +188,7 @@ set(_acts_autodiff_version 0.6)
set(_acts_boost_version 1.71.0)
set(_acts_dd4hep_version 1.21)
set(_acts_edm4hep_version 0.7)
set(_acts_geomodel_version 4.6.0)
set(_acts_podio_version 0.16)
set(_acts_doxygen_version 1.9.4)
set(_acts_eigen3_version 3.3.7)
Expand Down Expand Up @@ -287,6 +290,15 @@ if(ACTS_BUILD_PLUGIN_DD4HEP)
find_package(Python 3.8 REQUIRED COMPONENTS Interpreter)
find_package(DD4hep ${_acts_dd4hep_version} REQUIRED CONFIG COMPONENTS DDCore DDDetectors)
endif()
if(ACTS_BUILD_PLUGIN_GEOMODEL)
if(ACTS_USE_SYSTEM_GEOMODEL)
message(STATUS "Using system installation of GeoModel")
find_package(GeoModel ${_acts_geomodel_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/GeoModel)
endif()
endif()

if(ACTS_BUILD_PLUGIN_JSON)
if(ACTS_USE_SYSTEM_NLOHMANN_JSON)
message(STATUS "Using system installation of nlohmann::json")
Expand Down
1 change: 0 additions & 1 deletion Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ class Gx2Fitter {
// Update:
// - Waiting for a current surface
auto surface = navigator.currentSurface(state.navigation);
// std::string direction = state.stepping.navDir.toString();
if (surface != nullptr &&
surface->associatedDetectorElement() != nullptr) {
++result.surfaceCount;
Expand Down
10 changes: 3 additions & 7 deletions Core/include/Acts/Vertexing/AdaptiveGridDensityVertexFinder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,16 @@ namespace Acts {
/// Unlike the GridDensityVertexFinder, this seeder implements an adaptive
/// version where the density grid grows bigger with added tracks.
class AdaptiveGridDensityVertexFinder final : public IVertexFinder {
using GridDensity = AdaptiveGridTrackDensity;

public:
using DensityMap = typename GridDensity::DensityMap;
using DensityMap = AdaptiveGridTrackDensity::DensityMap;

/// @brief The Config struct
struct Config {
///@param gDensity The grid density
Config(const GridDensity& gDensity) : gridDensity(gDensity) {}
Config(const AdaptiveGridTrackDensity& gDensity) : gridDensity(gDensity) {}

// The grid density object
GridDensity gridDensity;
AdaptiveGridTrackDensity gridDensity;

// Cache the main grid and the density contributions (trackGrid and z-bin)
// for every single track.
Expand Down Expand Up @@ -129,5 +127,3 @@ class AdaptiveGridDensityVertexFinder final : public IVertexFinder {
};

} // namespace Acts

#include "AdaptiveGridDensityVertexFinder.ipp"
41 changes: 15 additions & 26 deletions Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "Acts/Utilities/Logger.hpp"
#include "Acts/Utilities/Result.hpp"
#include "Acts/Vertexing/AMVFInfo.hpp"
#include "Acts/Vertexing/AdaptiveMultiVertexFitter.hpp"
#include "Acts/Vertexing/IVertexFinder.hpp"
#include "Acts/Vertexing/ImpactPointEstimator.hpp"
#include "Acts/Vertexing/TrackLinearizer.hpp"
Expand All @@ -25,19 +26,9 @@

namespace Acts {
/// @brief Implements an iterative vertex finder
///
////////////////////////////////////////////////////////////
///
/// Brief description of the algorithm implemented:
/// TODO
///
////////////////////////////////////////////////////////////
///
/// @tparam vfitter_t Vertex fitter type
/// @tparam sfinder_t Seed finder type
template <typename vfitter_t>
class AdaptiveMultiVertexFinder final : public IVertexFinder {
using FitterState_t = typename vfitter_t::State;
using VertexFitter = AdaptiveMultiVertexFitter;
using VertexFitterState = VertexFitter::State;

public:
/// Configuration struct
Expand All @@ -48,7 +39,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
/// @param sfinder The seed finder
/// @param ipEst ImpactPointEstimator
/// @param bIn Input magnetic field
Config(vfitter_t fitter, std::shared_ptr<const IVertexFinder> sfinder,
Config(VertexFitter fitter, std::shared_ptr<const IVertexFinder> sfinder,
ImpactPointEstimator ipEst,
std::shared_ptr<const MagneticFieldProvider> bIn)
: vertexFitter(std::move(fitter)),
Expand All @@ -57,7 +48,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
bField{std::move(bIn)} {}

// Vertex fitter
vfitter_t vertexFitter;
VertexFitter vertexFitter;

// Vertex seed finder
std::shared_ptr<const IVertexFinder> seedFinder;
Expand Down Expand Up @@ -230,7 +221,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
/// from seed track collection in last iteration
///
/// @return The seed vertex
Result<Vertex> doSeeding(
Result<std::optional<Vertex>> doSeeding(
const std::vector<InputTrack>& trackVector, Vertex& currentConstraint,
const VertexingOptions& vertexingOptions,
IVertexFinder::State& seedFinderState,
Expand Down Expand Up @@ -264,7 +255,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
/// @param vertexingOptions Vertexing options
Result<void> addCompatibleTracksToVertex(
const std::vector<InputTrack>& tracks, Vertex& vtx,
FitterState_t& fitterState,
VertexFitterState& fitterState,
const VertexingOptions& vertexingOptions) const;

/// @brief Method that tries to recover from cases where no tracks
Expand All @@ -282,7 +273,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
Result<bool> canRecoverFromNoCompatibleTracks(
const std::vector<InputTrack>& allTracks,
const std::vector<InputTrack>& seedTracks, Vertex& vtx,
const Vertex& currentConstraint, FitterState_t& fitterState,
const Vertex& currentConstraint, VertexFitterState& fitterState,
const VertexingOptions& vertexingOptions) const;

/// @brief Method that tries to prepare the vertex for the fit
Expand All @@ -299,7 +290,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
Result<bool> canPrepareVertexForFit(
const std::vector<InputTrack>& allTracks,
const std::vector<InputTrack>& seedTracks, Vertex& vtx,
const Vertex& currentConstraint, FitterState_t& fitterState,
const Vertex& currentConstraint, VertexFitterState& fitterState,
const VertexingOptions& vertexingOptions) const;

/// @brief Method that checks if vertex is a good vertex and if
Expand All @@ -313,7 +304,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
/// @return pair(nCompatibleTracks, isGoodVertex)
std::pair<int, bool> checkVertexAndCompatibleTracks(
Vertex& vtx, const std::vector<InputTrack>& seedTracks,
FitterState_t& fitterState, bool useVertexConstraintInFit) const;
VertexFitterState& fitterState, bool useVertexConstraintInFit) const;

/// @brief Method that removes all tracks that are compatible with
/// current vertex from seedTracks
Expand All @@ -325,7 +316,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
/// removed
void removeCompatibleTracksFromSeedTracks(
Vertex& vtx, std::vector<InputTrack>& seedTracks,
FitterState_t& fitterState,
VertexFitterState& fitterState,
std::vector<InputTrack>& removedSeedTracks) const;

/// @brief Method that tries to remove an incompatible track
Expand All @@ -341,7 +332,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
/// @return Incompatible track was removed
bool removeTrackIfIncompatible(Vertex& vtx,
std::vector<InputTrack>& seedTracks,
FitterState_t& fitterState,
VertexFitterState& fitterState,
std::vector<InputTrack>& removedSeedTracks,
const GeometryContext& geoCtx) const;

Expand All @@ -354,7 +345,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
///
/// @return Keep new vertex
bool keepNewVertex(Vertex& vtx, const std::vector<Vertex*>& allVertices,
FitterState_t& fitterState) const;
VertexFitterState& fitterState) const;

/// @brief Method that evaluates if the new vertex candidate is
/// merged with one of the previously found vertices
Expand All @@ -376,7 +367,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
/// @param vertexingOptions Vertexing options
Result<void> deleteLastVertex(
Vertex& vtx, std::vector<std::unique_ptr<Vertex>>& allVertices,
std::vector<Vertex*>& allVerticesPtr, FitterState_t& fitterState,
std::vector<Vertex*>& allVerticesPtr, VertexFitterState& fitterState,
const VertexingOptions& vertexingOptions) const;

/// @brief Prepares the output vector of vertices
Expand All @@ -387,9 +378,7 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder {
/// @return The output vertex collection
Result<std::vector<Vertex>> getVertexOutputList(
const std::vector<Vertex*>& allVerticesPtr,
FitterState_t& fitterState) const;
VertexFitterState& fitterState) const;
};

} // namespace Acts

#include "Acts/Vertexing/AdaptiveMultiVertexFinder.ipp"
2 changes: 0 additions & 2 deletions Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,5 +271,3 @@ class AdaptiveMultiVertexFitter {
};

} // namespace Acts

#include "Acts/Vertexing/AdaptiveMultiVertexFitter.ipp"
2 changes: 0 additions & 2 deletions Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,3 @@ class FullBilloirVertexFitter {
};

} // namespace Acts

#include "FullBilloirVertexFitter.ipp"
3 changes: 0 additions & 3 deletions Core/include/Acts/Vertexing/GaussianTrackDensity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace Acts {
/// their d0 and z0 perigee parameters (mean value) and covariance
/// matrices (determining the width of the function)
class GaussianTrackDensity {
// @TODO: Remove template
public:
/// @brief Struct to store information for a single track
struct TrackEntry {
Expand Down Expand Up @@ -202,5 +201,3 @@ class GaussianTrackDensity {
};

} // namespace Acts

#include "Acts/Vertexing/GaussianTrackDensity.ipp"
9 changes: 3 additions & 6 deletions Core/include/Acts/Vertexing/GridDensityVertexFinder.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ auto Acts::GridDensityVertexFinder<mainGridSize, trkGridSize>::find(
}
if (!couldRemoveTracks) {
// No tracks were removed anymore
// Return empty seed, i.e. vertex at constraint position
// Return empty seed
// (Note: Upstream finder should check for this break condition)
std::vector<Vertex> seedVec{vertexingOptions.constraint};
return seedVec;
return std::vector<Vertex>{};
}
} else {
state.mainGrid = MainGridVector::Zero();
Expand Down Expand Up @@ -94,9 +93,7 @@ auto Acts::GridDensityVertexFinder<mainGridSize, trkGridSize>::find(

returnVertex.setFullCovariance(seedCov);

std::vector<Vertex> seedVec{returnVertex};

return seedVec;
return std::vector<Vertex>{returnVertex};
}

template <int mainGridSize, int trkGridSize>
Expand Down
2 changes: 0 additions & 2 deletions Core/include/Acts/Vertexing/HelicalTrackLinearizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,3 @@ class HelicalTrackLinearizer {
};

} // namespace Acts

#include "HelicalTrackLinearizer.ipp"
52 changes: 11 additions & 41 deletions Core/include/Acts/Vertexing/IterativeVertexFinder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
#include "Acts/MagneticField/MagneticFieldProvider.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "Acts/Utilities/Result.hpp"
#include "Acts/Vertexing/FsmwMode1dFinder.hpp"
#include "Acts/Vertexing/FullBilloirVertexFitter.hpp"
#include "Acts/Vertexing/HelicalTrackLinearizer.hpp"
#include "Acts/Vertexing/IVertexFinder.hpp"
#include "Acts/Vertexing/ImpactPointEstimator.hpp"
#include "Acts/Vertexing/TrackLinearizer.hpp"
#include "Acts/Vertexing/Vertex.hpp"
#include "Acts/Vertexing/VertexingOptions.hpp"
#include "Acts/Vertexing/ZScanVertexFinder.hpp"

#include <functional>

Expand Down Expand Up @@ -56,12 +54,9 @@ namespace Acts {
/// from tracksAtVertex if not compatible.
/// 5. Add vertex to vertexCollection
/// 6. Repeat until no seedTracks are left or max. number of vertices found
///
////////////////////////////////////////////////////////////
///
/// @tparam vfitter_t Vertex fitter type
template <typename vfitter_t>
class IterativeVertexFinder final : public IVertexFinder {
using VertexFitter = FullBilloirVertexFitter;

public:
/// Configuration struct
struct Config {
Expand All @@ -71,14 +66,14 @@ class IterativeVertexFinder final : public IVertexFinder {
/// @param lin Track linearizer
/// @param sfinder The seed finder
/// @param est ImpactPointEstimator
Config(vfitter_t fitter, std::shared_ptr<IVertexFinder> sfinder,
Config(VertexFitter fitter, std::shared_ptr<IVertexFinder> sfinder,
ImpactPointEstimator est)
: vertexFitter(std::move(fitter)),
seedFinder(std::move(sfinder)),
ipEst(std::move(est)) {}

/// Vertex fitter
vfitter_t vertexFitter;
VertexFitter vertexFitter;

/// Track linearizer
TrackLinearizer trackLinearizer;
Expand Down Expand Up @@ -143,33 +138,7 @@ class IterativeVertexFinder final : public IVertexFinder {
/// @param logger The logging instance
IterativeVertexFinder(Config cfg,
std::unique_ptr<const Logger> logger = getDefaultLogger(
"IterativeVertexFinder", Logging::INFO))
: m_cfg(std::move(cfg)), m_logger(std::move(logger)) {
if (!m_cfg.extractParameters.connected()) {
throw std::invalid_argument(
"IterativeVertexFinder: "
"No function to extract parameters "
"provided.");
}

if (!m_cfg.trackLinearizer.connected()) {
throw std::invalid_argument(
"IterativeVertexFinder: "
"No track linearizer provided.");
}

if (!m_cfg.seedFinder) {
throw std::invalid_argument(
"IterativeVertexFinder: "
"No seed finder provided.");
}

if (!m_cfg.field) {
throw std::invalid_argument(
"IterativeVertexFinder: "
"No magnetic field provider provided.");
}
}
"IterativeVertexFinder", Logging::INFO));

/// @brief Finds vertices corresponding to input trackVector
///
Expand Down Expand Up @@ -206,11 +175,14 @@ class IterativeVertexFinder final : public IVertexFinder {

/// @brief Method that calls seed finder to retrieve a vertex seed
///
/// @param state The state object
/// @param seedTracks Seeding tracks
/// @param vertexingOptions Vertexing options
Result<Vertex> getVertexSeed(State& state,
const std::vector<InputTrack>& seedTracks,
const VertexingOptions& vertexingOptions) const;
///
/// @return Vertex seed
Result<std::optional<Vertex>> getVertexSeed(
State& state, const std::vector<InputTrack>& seedTracks,
const VertexingOptions& vertexingOptions) const;

/// @brief Removes all tracks in tracksToRemove from seedTracks
///
Expand Down Expand Up @@ -288,5 +260,3 @@ class IterativeVertexFinder final : public IVertexFinder {
};

} // namespace Acts

#include "IterativeVertexFinder.ipp"
Loading

0 comments on commit 45182a2

Please sign in to comment.