Skip to content

Commit

Permalink
Merge branch 'main' into fix/edm4hep-reader-hit-count
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jan 30, 2025
2 parents 4e6d0ac + ec213e9 commit 5680a72
Show file tree
Hide file tree
Showing 42 changed files with 792 additions and 169 deletions.
32 changes: 32 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,38 @@ test_exatrkx_python:
- pytest -rFsv -k torch --collect-only
- pytest -rFsv -k gpu-torch # For now only test torch GPU pipeline

build_gnn_tensorrt:
stage: build
image: ghcr.io/acts-project/ubuntu2404_tensorrt:74
variables:
DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-24.04/deps.$DEPENDENCY_TAG.tar.zst

cache:
- !reference [.ccache_base, cache]

tags:
- docker-gpu-nvidia

script:
- git clone $CLONE_URL src
- cd src
- git checkout $HEAD_SHA
- source CI/dependencies.sh
- cd ..
- mkdir build
- >
cmake -B build -S src
-DACTS_BUILD_PLUGIN_EXATRKX=ON
-DACTS_EXATRKX_ENABLE_TORCH=OFF
-DACTS_EXATRKX_ENABLE_CUDA=ON
-DACTS_EXATRKX_ENABLE_TENSORRT=ON
-DPython_EXECUTABLE=$(which python3)
-DCMAKE_CUDA_ARCHITECTURES="75;86"
- ccache -z
- cmake --build build -- -j6
- ccache -s


build_linux_ubuntu:
stage: build
image: registry.cern.ch/ghcr.io/acts-project/ubuntu2404:63
Expand Down
Binary file not shown.
Binary file not shown.
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,6 @@ if(ACTS_BUILD_PLUGIN_EXATRKX)
else()
message(STATUS "Build Exa.TrkX plugin for CPU only")
endif()
if(NOT (ACTS_EXATRKX_ENABLE_ONNX OR ACTS_EXATRKX_ENABLE_TORCH))
message(
FATAL_ERROR
"When building the Exa.TrkX plugin, at least one of ACTS_EXATRKX_ENABLE_ONNX \
and ACTS_EXATRKX_ENABLE_TORCHSCRIPT must be enabled."
)
endif()
if(ACTS_EXATRKX_ENABLE_TORCH)
find_package(TorchScatter REQUIRED)
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ std::vector<double> Acts::ScoreBasedAmbiguityResolution::ambiguityScore(
// detector.
std::size_t nHits = trackFeatures.nHits;
if (nHits > detector.maxHits) {
score = score * (detector.maxHits - nHits + 1); // hits are good !
score = score * (nHits - detector.maxHits + 1); // hits are good !
nHits = detector.maxHits;
}
score = score * detector.factorHits[nHits];
Expand Down
21 changes: 12 additions & 9 deletions Core/include/Acts/Seeding/GbtsBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,31 @@
#define OffsetBarrelSCT 3
#define OffsetEndcapSCT 10

namespace Acts::Experimental {

template <typename space_point_t>
class TrigInDetTriplet {
public:
TrigInDetTriplet() = delete; // to prevent creation w/o initialization

TrigInDetTriplet(Acts::GbtsSP<space_point_t> s1,
Acts::GbtsSP<space_point_t> s2,
Acts::GbtsSP<space_point_t> s3, float Q)
TrigInDetTriplet(GbtsSP<space_point_t> s1, GbtsSP<space_point_t> s2,
GbtsSP<space_point_t> s3, float Q)
: m_s1(std::move(s1)), m_s2(std::move(s2)), m_s3(std::move(s3)), m_Q(Q) {}

TrigInDetTriplet(TrigInDetTriplet* t)
: m_s1(t->m_s1), m_s2(t->m_s2), m_s3(t->m_s3), m_Q(t->m_Q) {}

const Acts::GbtsSP<space_point_t>& s1() const { return m_s1; }
const Acts::GbtsSP<space_point_t>& s2() const { return m_s2; }
const Acts::GbtsSP<space_point_t>& s3() const { return m_s3; }
const GbtsSP<space_point_t>& s1() const { return m_s1; }
const GbtsSP<space_point_t>& s2() const { return m_s2; }
const GbtsSP<space_point_t>& s3() const { return m_s3; }
float Q() const { return m_Q; }
void Q(double newQ) { m_Q = newQ; }

protected:
Acts::GbtsSP<space_point_t> m_s1;
Acts::GbtsSP<space_point_t> m_s2;
Acts::GbtsSP<space_point_t> m_s3;
GbtsSP<space_point_t> m_s1;
GbtsSP<space_point_t> m_s2;
GbtsSP<space_point_t> m_s3;
float m_Q; // Quality
};

} // namespace Acts::Experimental
4 changes: 2 additions & 2 deletions Core/include/Acts/Seeding/GbtsDataStorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <numbers>
#include <vector>

namespace Acts {
namespace Acts::Experimental {

constexpr std::size_t MAX_SEG_PER_NODE = 1000; // was 30
constexpr std::size_t N_SEG_CONNS = 6; // was 6
Expand Down Expand Up @@ -286,4 +286,4 @@ class GbtsEdge {
unsigned int m_vNei[N_SEG_CONNS]{}; // global indices of the connected edges
};

} // namespace Acts
} // namespace Acts::Experimental
10 changes: 5 additions & 5 deletions Core/include/Acts/Seeding/GbtsGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <memory>
#include <vector>

namespace Acts {
namespace Acts::Experimental {
class TrigInDetSiLayer {
public:
int m_subdet; // combined ID
Expand Down Expand Up @@ -264,7 +264,7 @@ template <typename space_point_t>
class GbtsGeometry {
public:
GbtsGeometry(const std::vector<TrigInDetSiLayer> &layers,
std::unique_ptr<Acts::GbtsConnector> &conn)
std::unique_ptr<GbtsConnector> &conn)

: m_connector(std::move(conn)) {
const float min_z0 = -168.0;
Expand Down Expand Up @@ -334,7 +334,7 @@ class GbtsGeometry {

int num_bins() const { return m_nEtaBins; }

Acts::GbtsConnector *connector() const { return m_connector.get(); }
GbtsConnector *connector() const { return m_connector.get(); }

protected:
const GbtsLayer<space_point_t> *addNewLayer(const TrigInDetSiLayer &l,
Expand All @@ -358,7 +358,7 @@ class GbtsGeometry {

int m_nEtaBins{0};

std::unique_ptr<Acts::GbtsConnector> m_connector;
std::unique_ptr<GbtsConnector> m_connector;
};

} // namespace Acts
} // namespace Acts::Experimental
31 changes: 17 additions & 14 deletions Core/include/Acts/Seeding/GbtsTrackingFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <list>
#include <vector>

namespace Acts::Experimental {

template <typename external_spacepoint_t>
struct GbtsEdgeState {
public:
Expand All @@ -33,7 +35,7 @@ struct GbtsEdgeState {

GbtsEdgeState(bool f) : m_initialized(f) {}

void initialize(Acts::GbtsEdge<external_spacepoint_t>* pS) {
void initialize(GbtsEdge<external_spacepoint_t>* pS) {
m_initialized = true;

m_J = 0.0;
Expand Down Expand Up @@ -99,7 +101,7 @@ struct GbtsEdgeState {

float m_J{};

std::vector<Acts::GbtsEdge<external_spacepoint_t>*> m_vs;
std::vector<GbtsEdge<external_spacepoint_t>*> m_vs;

float m_X[3]{}, m_Y[2]{}, m_Cx[3][3]{}, m_Cy[2][2]{};
float m_refX{}, m_refY{}, m_c{}, m_s{};
Expand All @@ -112,14 +114,14 @@ struct GbtsEdgeState {
template <typename external_spacepoint_t>
class GbtsTrackingFilter {
public:
GbtsTrackingFilter(const std::vector<Acts::TrigInDetSiLayer>& g,
std::vector<Acts::GbtsEdge<external_spacepoint_t>>& sb,
GbtsTrackingFilter(const std::vector<TrigInDetSiLayer>& g,
std::vector<GbtsEdge<external_spacepoint_t>>& sb,
std::unique_ptr<const Acts::Logger> logger =
Acts::getDefaultLogger("Filter",
Acts::Logging::Level::INFO))
: m_geo(g), m_segStore(sb), m_logger(std::move(logger)) {}

void followTrack(Acts::GbtsEdge<external_spacepoint_t>* pS,
void followTrack(GbtsEdge<external_spacepoint_t>* pS,
GbtsEdgeState<external_spacepoint_t>& output) {
if (pS->m_level == -1) {
return; // already collected
Expand Down Expand Up @@ -153,7 +155,7 @@ class GbtsTrackingFilter {
}

protected:
void propagate(Acts::GbtsEdge<external_spacepoint_t>* pS,
void propagate(GbtsEdge<external_spacepoint_t>* pS,
GbtsEdgeState<external_spacepoint_t>& ts) {
if (m_globalStateCounter >= MAX_EDGE_STATE) {
return;
Expand All @@ -173,14 +175,13 @@ class GbtsTrackingFilter {
}
int level = pS->m_level;

std::list<Acts::GbtsEdge<external_spacepoint_t>*> lCont;
std::list<GbtsEdge<external_spacepoint_t>*> lCont;

for (int nIdx = 0; nIdx < pS->m_nNei;
nIdx++) { // loop over the neighbours of this segment
unsigned int nextSegmentIdx = pS->m_vNei[nIdx];

Acts::GbtsEdge<external_spacepoint_t>* pN =
&(m_segStore.at(nextSegmentIdx));
GbtsEdge<external_spacepoint_t>* pN = &(m_segStore.at(nextSegmentIdx));

if (pN->m_level == -1) {
continue; // already collected
Expand Down Expand Up @@ -210,15 +211,15 @@ class GbtsTrackingFilter {
}
} else { // branching
int nBranches = 0;
for (typename std::list<Acts::GbtsEdge<external_spacepoint_t>*>::iterator
sIt = lCont.begin();
for (typename std::list<GbtsEdge<external_spacepoint_t>*>::iterator sIt =
lCont.begin();
sIt != lCont.end(); ++sIt, nBranches++) {
propagate((*sIt), new_ts); // recursive call
}
}
}

bool update(Acts::GbtsEdge<external_spacepoint_t>* pS,
bool update(GbtsEdge<external_spacepoint_t>* pS,
GbtsEdgeState<external_spacepoint_t>& ts) {
const float sigma_t = 0.0003;
const float sigma_w = 0.00009;
Expand Down Expand Up @@ -379,9 +380,9 @@ class GbtsTrackingFilter {
return m_geo.at(index).m_type; // needs to be 0, 2, or -2
}

const std::vector<Acts::TrigInDetSiLayer>& m_geo;
const std::vector<TrigInDetSiLayer>& m_geo;

std::vector<Acts::GbtsEdge<external_spacepoint_t>>& m_segStore;
std::vector<GbtsEdge<external_spacepoint_t>>& m_segStore;

std::vector<GbtsEdgeState<external_spacepoint_t>*> m_stateVec;

Expand All @@ -392,3 +393,5 @@ class GbtsTrackingFilter {
const Acts::Logger& logger() const { return *m_logger; }
std::unique_ptr<const Acts::Logger> m_logger{nullptr};
};

} // namespace Acts::Experimental
19 changes: 9 additions & 10 deletions Core/include/Acts/Seeding/SeedFinderGbts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <utility>
#include <vector>

namespace Acts {
namespace Acts::Experimental {

template <typename external_spacepoint_t>
struct GbtsTrigTracklet {
Expand Down Expand Up @@ -65,14 +65,13 @@ class SeedFinderGbts {

// inner
template <typename output_container_t>
void createSeeds(
const Acts::RoiDescriptor & /*roi*/,
const Acts::GbtsGeometry<external_spacepoint_t> & /*gbtsgeo*/,
output_container_t & /*out_cont*/);
void createSeeds(const RoiDescriptor & /*roi*/,
const GbtsGeometry<external_spacepoint_t> & /*gbtsgeo*/,
output_container_t & /*out_cont*/);
// outer
std::vector<seed_t> createSeeds(
const Acts::RoiDescriptor & /*roi*/,
const Acts::GbtsGeometry<external_spacepoint_t> & /*gbtsgeo*/);
const RoiDescriptor & /*roi*/,
const GbtsGeometry<external_spacepoint_t> & /*gbtsgeo*/);

private:
enum Dim { DimPhi = 0, DimR = 1, DimZ = 2 };
Expand All @@ -82,8 +81,8 @@ class SeedFinderGbts {

void runGbts_TrackFinder(
std::vector<GbtsTrigTracklet<external_spacepoint_t>> &vTracks,
const Acts::RoiDescriptor &roi,
const Acts::GbtsGeometry<external_spacepoint_t> &gbtsgeo);
const RoiDescriptor &roi,
const GbtsGeometry<external_spacepoint_t> &gbtsgeo);

// needs to be member of class so can accessed by all member functions
std::unique_ptr<GbtsDataStorage<external_spacepoint_t>> m_storage{nullptr};
Expand All @@ -96,6 +95,6 @@ class SeedFinderGbts {
Acts::getDefaultLogger("Finder", Acts::Logging::Level::INFO);
};

} // namespace Acts
} // namespace Acts::Experimental

#include "Acts/Seeding/SeedFinderGbts.ipp"
Loading

0 comments on commit 5680a72

Please sign in to comment.