Skip to content

Commit

Permalink
Merge branch 'main' into feat-isometry
Browse files Browse the repository at this point in the history
  • Loading branch information
pbutti authored Jan 29, 2025
2 parents 73067da + e61fa2d commit d42caaa
Show file tree
Hide file tree
Showing 19 changed files with 250 additions and 127 deletions.
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
23 changes: 11 additions & 12 deletions Core/include/Acts/Propagator/DirectNavigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class DirectNavigator {
}

state.direction = propagationDirection;
ACTS_VERBOSE("Navigation direction is " << propagationDirection);

// We set the current surface to the start surface
state.currentSurface = state.options.startSurface;
Expand All @@ -195,18 +196,16 @@ class DirectNavigator {
ACTS_VERBOSE("Current surface set to nullptr");
}

// Reset the surface index
state.resetSurfaceIndex();
bool foundStartSurface = false;
for (const Surface* surface : state.options.surfaces) {
if (surface == state.currentSurface) {
foundStartSurface = true;
break;
}
state.nextSurface();
}
ACTS_VERBOSE("Initial surface index set to " << state.surfaceIndex);
if (!foundStartSurface) {
// Find initial index.
auto found =
std::ranges::find(state.options.surfaces, state.options.startSurface);

if (found != state.options.surfaces.end()) {
// The index should be the index before the start surface, depending on
// the direction
state.surfaceIndex = std::distance(state.options.surfaces.begin(), found);
state.surfaceIndex += state.direction == Direction::Backward() ? 1 : -1;
} else {
ACTS_DEBUG(
"Did not find the start surface in the sequence. Assuming it is not "
"part of the sequence. Trusting the correctness of the input "
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 d42caaa

Please sign in to comment.