Skip to content

Commit

Permalink
Support for skipping edge holes
Browse files Browse the repository at this point in the history
  • Loading branch information
pbutti committed Dec 13, 2024
1 parent 29ed187 commit fbc3b2f
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 5 deletions.
11 changes: 9 additions & 2 deletions Core/include/Acts/EventData/MultiTrajectoryHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct TrajectoryState {
std::size_t nMeasurements = 0;
std::size_t nOutliers = 0;
std::size_t nHoles = 0;
//std::size_t nEdgeHoles = 0;
double chi2Sum = 0;
std::vector<double> measurementChi2 = {};
std::vector<double> outlierChi2 = {};
Expand Down Expand Up @@ -61,7 +62,10 @@ TrajectoryState trajectoryState(const traj_t& multiTraj, std::size_t tipIndex) {
auto typeFlags = state.typeFlags();
if (typeFlags.test(Acts::TrackStateFlag::HoleFlag)) {
trajState.nHoles++;
} else if (typeFlags.test(Acts::TrackStateFlag::OutlierFlag)) {
} //else if (typeFlags.test(Acts::TrackStateFlag::EdgeHoleFlag)) {
//trajState.nEdgeHoles++;
//}
else if (typeFlags.test(Acts::TrackStateFlag::OutlierFlag)) {
trajState.nOutliers++;
trajState.outlierChi2.push_back(state.chi2());
trajState.outlierVolume.push_back(volume);
Expand Down Expand Up @@ -113,7 +117,10 @@ VolumeTrajectoryStateContainer trajectoryState(
auto typeFlags = state.typeFlags();
if (typeFlags.test(Acts::TrackStateFlag::HoleFlag)) {
trajState.nHoles++;
} else if (typeFlags.test(Acts::TrackStateFlag::OutlierFlag)) {
} //else if (typeFlags.test(Acts::TrackStateFlag::EdgeHoleFlag)) {
//trajState.nEdgeHoles++;
//}
else if (typeFlags.test(Acts::TrackStateFlag::OutlierFlag)) {
trajState.nOutliers++;
trajState.outlierChi2.push_back(state.chi2());
trajState.outlierVolume.push_back(volume);
Expand Down
21 changes: 19 additions & 2 deletions Core/include/Acts/EventData/TrackProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,28 @@ class TrackProxy {
return component<unsigned int, hashString("nHoles")>();
}

/// Return the number of measurements for the track. Const version
/// @return The number of measurements
/// Return the number of holes for the track. Const version
/// @return The number of holes
unsigned int nHoles() const {
return component<unsigned int, hashString("nHoles")>();
}

/// Return a mutable reference to the number of edge holes for the track.
/// Mutable version
/// @note Only available if the track proxy is not read-only
/// @return The number of edge holes
//unsigned int& nEdgeHoles()
// requires(!ReadOnly)
//{
// return component<unsigned int, hashString("nEdgeHoles")>();
//}

/// Return the number of edge holes for the track. Const version
/// @return The number of edge holes
//unsigned int nEdgeHoles() const {
// return component<unsigned int, hashString("nEdgeHoles")>();
//}

/// Return a mutable reference to the number of outliers for the track.
/// Mutable version
/// @note Only available if the track proxy is not read-only
Expand Down Expand Up @@ -596,6 +612,7 @@ class TrackProxy {

nMeasurements() = other.nMeasurements();
nHoles() = other.nHoles();
//nEdgeHoles() = other.nEdgeHoles();
nOutliers() = other.nOutliers();
nSharedHits() = other.nSharedHits();
chi2() = other.chi2();
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/EventData/TrackStateType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ enum TrackStateFlag {
HoleFlag = 3,
MaterialFlag = 4,
SharedHitFlag = 5,
NumTrackStateFlags = 6
EdgeHoleFlag = 6,
NumTrackStateFlags = 7
};

class ConstTrackStateType;
Expand Down
5 changes: 5 additions & 0 deletions Core/include/Acts/EventData/VectorTrackContainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class VectorTrackContainerBase {
return &instance.m_nMeasurements[itrack];
case "nHoles"_hash:
return &instance.m_nHoles[itrack];
//case "nEdgeHoles"_hash:
// return &instance.m_nEdgeHoles[itrack];
case "chi2"_hash:
return &instance.m_chi2[itrack];
case "ndf"_hash:
Expand Down Expand Up @@ -126,6 +128,8 @@ class VectorTrackContainerBase {
assert(result);
result = result && m_nHoles.size() == size;
assert(result);
//result = result && m_nEdgeHoles.size() == size;
//assert(result);
result = result && m_chi2.size() == size;
assert(result);
result = result && m_ndf.size() == size;
Expand Down Expand Up @@ -180,6 +184,7 @@ class VectorTrackContainerBase {

std::vector<unsigned int> m_nMeasurements;
std::vector<unsigned int> m_nHoles;
//std::vector<unsigned int> m_nEdgeHoles;
std::vector<float> m_chi2;
std::vector<unsigned int> m_ndf;
std::vector<unsigned int> m_nOutliers;
Expand Down
3 changes: 3 additions & 0 deletions Core/include/Acts/Propagator/PropagatorOptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ struct PurePropagatorPlainOptions {
/// @note ignored if empty
/// @note requires `VolumeConstraintAborter` aborter
std::vector<std::uint32_t> endOfWorldVolumeIds;
/// Placeholder:: edgeHoles
bool keepEdgeHoles=false;

};

} // namespace detail
Expand Down
18 changes: 18 additions & 0 deletions Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,10 @@ class CombinatorialKalmanFilter {
/// Calibration context for the finding run
const CalibrationContext* calibrationContextPtr{nullptr};


/// PlaceHolder for EdgeHoles
bool keepEdgeHoles = false;

/// @brief CombinatorialKalmanFilter actor operation
///
/// @tparam propagator_state_t Type of the Propagator state
Expand Down Expand Up @@ -810,6 +814,7 @@ class CombinatorialKalmanFilter {
currentBranch = result.activeBranches.back();
prevTip = currentBranch.tipIndex();
} else {

if (expectMeasurements) {
ACTS_VERBOSE("Detected hole after measurement selection on surface "
<< surface->geometryId());
Expand All @@ -829,6 +834,17 @@ class CombinatorialKalmanFilter {
exclude_sensor_border)) {
currentBranch.nHoles()++;
}
else {
if (!keepEdgeHoles) {
currentBranch.nHoles()++;
}
else {
auto typeFlags = currentState.typeFlags();
typeFlags.reset(TrackStateFlag::HoleFlag);
typeFlags.set(TrackStateFlag::EdgeHoleFlag);
//currentBranch.nEdgeHoles()++;
}
}
}

BranchStopperResult branchStopperResult =
Expand Down Expand Up @@ -1203,6 +1219,8 @@ class CombinatorialKalmanFilter {
combKalmanActor.updaterLogger = m_updaterLogger.get();
combKalmanActor.calibrationContextPtr = &tfOptions.calibrationContext.get();

combKalmanActor.keepEdgeHoles = tfOptions.propagatorPlainOptions.keepEdgeHoles;

// copy source link accessor, calibrator and measurement selector
combKalmanActor.m_sourceLinkAccessor = tfOptions.sourceLinkAccessor;
combKalmanActor.m_extensions = tfOptions.extensions;
Expand Down

0 comments on commit fbc3b2f

Please sign in to comment.