Skip to content

Commit

Permalink
Merge branch 'main' into ex-dense-measurement-container
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Sep 4, 2024
2 parents e10e284 + b2cd8fb commit 7ea7bab
Show file tree
Hide file tree
Showing 17 changed files with 120 additions and 416 deletions.
Binary file modified CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf.root
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions CI/physmon/workflows/physmon_trackfinding_ttbar_pu200.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
addPythia8,
addFatras,
addDigitization,
ParticleSelectorConfig,
)
from acts.examples.reconstruction import (
addSeeding,
Expand Down Expand Up @@ -63,6 +64,10 @@
setup.trackingGeometry,
setup.field,
rnd=rnd,
preSelectParticles=ParticleSelectorConfig(
rho=(0.0, 24 * u.mm),
absZ=(0.0, 1.0 * u.m),
),
)

addDigitization(
Expand Down
2 changes: 2 additions & 0 deletions Core/include/Acts/EventData/TrackProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,8 @@ class TrackProxy {
setReferenceSurface(other.referenceSurface().getSharedPtr());
parameters() = other.parameters();
covariance() = other.covariance();
} else {
setReferenceSurface(nullptr);
}

nMeasurements() = other.nMeasurements();
Expand Down
76 changes: 49 additions & 27 deletions Core/include/Acts/Propagator/Navigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,24 +276,6 @@ class Navigator {
m_cfg.trackingGeometry->highestTrackingVolume();
}

// We set the current surface to the start surface
// for eventual post-update action, e.g. material integration
// or collection when leaving a surface at the start of
// an extrapolation process
state.navigation.currentSurface = state.navigation.startSurface;
if (state.navigation.currentSurface != nullptr) {
ACTS_VERBOSE(volInfo(state)
<< "Current surface set to start surface "
<< state.navigation.currentSurface->geometryId());

assert(state.navigation.currentSurface->isOnSurface(
state.geoContext, stepper.position(state.stepping),
stepper.direction(state.stepping),
BoundaryTolerance::Infinite(),
state.options.surfaceTolerance) &&
"Stepper not on surface");
}

// Fast Navigation initialization for start condition:
// - short-cut through object association, saves navigation in the
// - geometry and volume tree search for the lowest volume
Expand All @@ -302,18 +284,26 @@ class Navigator {
ACTS_VERBOSE(
volInfo(state)
<< "Fast start initialization through association from Surface.");

// assign the current layer and volume by association
state.navigation.startLayer =
state.navigation.startSurface->associatedLayer();
state.navigation.currentLayer = state.navigation.startLayer;

state.navigation.startVolume =
state.navigation.startLayer->trackingVolume();
state.navigation.currentVolume = state.navigation.startVolume;
} else if (state.navigation.startVolume != nullptr) {
ACTS_VERBOSE(
volInfo(state)
<< "Fast start initialization through association from Volume.");

state.navigation.currentVolume = state.navigation.startVolume;

state.navigation.startLayer =
state.navigation.startVolume->associatedLayer(
state.geoContext, stepper.position(state.stepping));
state.navigation.currentLayer = state.navigation.startLayer;
} else {
ACTS_VERBOSE(volInfo(state)
<< "Slow start initialization through search.");
Expand All @@ -323,15 +313,17 @@ class Navigator {
<< toString(stepper.position(state.stepping))
<< " and direction "
<< toString(stepper.direction(state.stepping)));

state.navigation.startVolume =
m_cfg.trackingGeometry->lowestTrackingVolume(
state.geoContext, stepper.position(state.stepping));
state.navigation.startLayer =
state.navigation.startVolume != nullptr
? state.navigation.startVolume->associatedLayer(
state.geoContext, stepper.position(state.stepping))
: nullptr;
state.navigation.currentVolume = state.navigation.startVolume;

if (state.navigation.startVolume != nullptr) {
state.navigation.startLayer =
state.navigation.startVolume->associatedLayer(
state.geoContext, stepper.position(state.stepping));
state.navigation.currentLayer = state.navigation.startLayer;
ACTS_VERBOSE(volInfo(state) << "Start volume resolved.");
} else {
ACTS_VERBOSE(volInfo(state)
Expand All @@ -341,15 +333,41 @@ class Navigator {
}
}

if (state.navigation.startVolume != nullptr) {
ACTS_VERBOSE(volInfo(state) << "Start volume resolved.");
assert(state.navigation.startVolume->inside(
stepper.position(state.stepping),
state.options.surfaceTolerance) &&
"We did not end up inside the volume.");
}

if (state.navigation.startLayer != nullptr) {
ACTS_VERBOSE(volInfo(state) << "Start layer resolved "
<< state.navigation.startLayer->geometryId());
// We provide the layer to the resolve surface method in this case
resolveSurfaces(state, stepper);
}

// Set the start volume as current volume
state.navigation.currentVolume = state.navigation.startVolume;
// Set the start layer as current layer
state.navigation.currentLayer = state.navigation.startLayer;

if (state.navigation.startLayer != nullptr) {
ACTS_VERBOSE(volInfo(state) << "Start layer to be resolved.");
// We provide the layer to the resolve surface method in this case
resolveSurfaces(state, stepper);
// We set the current surface to the start surface for eventual post-update
// action, e.g. material integration or collection when leaving a surface at
// the start of an extrapolation process
state.navigation.currentSurface = state.navigation.startSurface;
if (state.navigation.currentSurface != nullptr) {
ACTS_VERBOSE(volInfo(state)
<< "Current surface set to start surface "
<< state.navigation.currentSurface->geometryId());

assert(state.navigation.currentSurface->isOnSurface(
state.geoContext, stepper.position(state.stepping),
stepper.direction(state.stepping),
BoundaryTolerance::Infinite(),
state.options.surfaceTolerance) &&
"Stepper not on surface");
}
}

Expand Down Expand Up @@ -551,6 +569,10 @@ class Navigator {
return;
} else {
ACTS_VERBOSE(volInfo(state) << "Volume updated.");
assert(state.navigation.currentVolume->inside(
stepper.position(state.stepping),
state.options.surfaceTolerance) &&
"We did not end up inside the volume.");
// Forget the boundary information
state.navigation.navBoundaries.clear();
state.navigation.navBoundaryIndex =
Expand Down
52 changes: 26 additions & 26 deletions Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ namespace Acts::Experimental {
namespace Gx2fConstants {
constexpr std::string_view gx2fnUpdateColumn = "Gx2fnUpdateColumn";

// Mask for the track states. We don't need Smoothed and Filtered
constexpr TrackStatePropMask trackStateMask = TrackStatePropMask::Predicted |
// Mask for the track states. We don't need Predicted and Filtered
constexpr TrackStatePropMask trackStateMask = TrackStatePropMask::Smoothed |
TrackStatePropMask::Jacobian |
TrackStatePropMask::Calibrated;

Expand Down Expand Up @@ -343,7 +343,7 @@ void addMeasurementToGx2fSums(Eigen::MatrixXd& aMatrixExtended,
extendedJacobian.block<eBoundSize, 2>(0, deltaPosition) = jacPhiTheta;
}

const BoundVector predicted = trackState.predicted();
const BoundVector predicted = trackState.smoothed();

const ActsVector<kMeasDim> measurement =
trackState.template calibrated<kMeasDim>();
Expand Down Expand Up @@ -431,7 +431,7 @@ void addMaterialToGx2fSums(
"No scattering angles found for material surface.");
}

const ActsScalar sinThetaLoc = std::sin(trackState.predicted()[eBoundTheta]);
const ActsScalar sinThetaLoc = std::sin(trackState.smoothed()[eBoundTheta]);

// The position, where we need to insert the values in aMatrix and bVector
const std::size_t deltaPosition = eBoundSize + 2 * nMaterialsHandled;
Expand Down Expand Up @@ -497,9 +497,9 @@ void addMaterialToGx2fSums(
/// @param ndfSystem The number of degrees of freedom, determining the size of meaning full block
///
/// @return deltaParams The calculated delta parameters.
void updateCovariancePredicted(BoundMatrix& fullCovariancePredicted,
Eigen::MatrixXd& aMatrixExtended,
const std::size_t ndfSystem);
void updateGx2fCovarianceParams(BoundMatrix& fullCovariancePredicted,
Eigen::MatrixXd& aMatrixExtended,
const std::size_t ndfSystem);

/// Global Chi Square fitter (GX2F) implementation.
///
Expand Down Expand Up @@ -736,8 +736,8 @@ class Gx2Fitter {
}

// Fill the track state
trackStateProxy.predicted() = boundParams.parameters();
trackStateProxy.predictedCovariance() = state.stepping.cov;
trackStateProxy.smoothed() = boundParams.parameters();
trackStateProxy.smoothedCovariance() = state.stepping.cov;

trackStateProxy.jacobian() = jacobian;
trackStateProxy.pathLength() = pathLength;
Expand All @@ -746,13 +746,13 @@ class Gx2Fitter {
stepper.update(state.stepping,
transformBoundToFreeParameters(
trackStateProxy.referenceSurface(),
state.geoContext, trackStateProxy.predicted()),
trackStateProxy.predicted(),
trackStateProxy.predictedCovariance(), *surface);
state.geoContext, trackStateProxy.smoothed()),
trackStateProxy.smoothed(),
trackStateProxy.smoothedCovariance(), *surface);
}
}

// We have predicted parameters, so calibrate the uncalibrated input
// We have smoothed parameters, so calibrate the uncalibrated input
// measurement
extensions.calibrator(state.geoContext, *calibrationContext,
sourcelink_it->second, trackStateProxy);
Expand Down Expand Up @@ -837,18 +837,18 @@ class Gx2Fitter {
ACTS_VERBOSE(" boundParams after the update:\n" << boundParams);

// Fill the track state
trackStateProxy.predicted() = boundParams.parameters();
trackStateProxy.predictedCovariance() = state.stepping.cov;
trackStateProxy.smoothed() = boundParams.parameters();
trackStateProxy.smoothedCovariance() = state.stepping.cov;

trackStateProxy.jacobian() = jacobian;
trackStateProxy.pathLength() = pathLength;

stepper.update(state.stepping,
transformBoundToFreeParameters(
trackStateProxy.referenceSurface(),
state.geoContext, trackStateProxy.predicted()),
trackStateProxy.predicted(),
trackStateProxy.predictedCovariance(), *surface);
state.geoContext, trackStateProxy.smoothed()),
trackStateProxy.smoothed(),
trackStateProxy.smoothedCovariance(), *surface);
}

// Get and set the type flags
Expand Down Expand Up @@ -921,8 +921,8 @@ class Gx2Fitter {
const auto& [boundParams, jacobian, pathLength] = *res;

// Fill the track state
trackStateProxy.predicted() = boundParams.parameters();
trackStateProxy.predictedCovariance() = state.stepping.cov;
trackStateProxy.smoothed() = boundParams.parameters();
trackStateProxy.smoothedCovariance() = state.stepping.cov;

trackStateProxy.jacobian() = jacobian;
trackStateProxy.pathLength() = pathLength;
Expand Down Expand Up @@ -1334,16 +1334,16 @@ class Gx2Fitter {
ACTS_INFO("Abort with relChi2changeCutOff after "
<< nUpdate + 1 << "/" << gx2fOptions.nUpdateMax
<< " iterations.");
updateCovariancePredicted(fullCovariancePredicted, aMatrixExtended,
ndfSystem);
updateGx2fCovarianceParams(fullCovariancePredicted, aMatrixExtended,
ndfSystem);
break;
}

if (chi2sum > oldChi2sum + 1e-5) {
ACTS_DEBUG("chi2 not converging monotonically");

updateCovariancePredicted(fullCovariancePredicted, aMatrixExtended,
ndfSystem);
updateGx2fCovarianceParams(fullCovariancePredicted, aMatrixExtended,
ndfSystem);
break;
}

Expand All @@ -1361,8 +1361,8 @@ class Gx2Fitter {
return Experimental::GlobalChiSquareFitterError::DidNotConverge;
}

updateCovariancePredicted(fullCovariancePredicted, aMatrixExtended,
ndfSystem);
updateGx2fCovarianceParams(fullCovariancePredicted, aMatrixExtended,
ndfSystem);
break;
}

Expand Down
Loading

0 comments on commit 7ea7bab

Please sign in to comment.