Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Core/include/Acts/TrackFitting/GsfOptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ struct GsfOptions {

double weightCutoff = 1.e-4;

double transverseMomentumCut = 0.0; // GeV, no cut by default

bool abortOnError = false;

bool disableAllMaterialHandling = false;
Expand Down
44 changes: 38 additions & 6 deletions Core/include/Acts/TrackFitting/detail/GsfActor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ struct GsfActor {
/// When to discard components
double weightCutoff = 1.0e-4;

/// Minimum transverse momentum (in GeV) for components
double transverseMomentumCut = 0.0; // GeV, no cut by default

/// When this option is enabled, material information on all surfaces is
/// ignored. This disables the component convolution as well as the handling
/// of energy. This may be useful for debugging.
Expand Down Expand Up @@ -271,6 +274,13 @@ struct GsfActor {
return;
}

// Check if all components were removed by momentum cut
if (tmpStates.tips.empty()) {
ACTS_VERBOSE("All components removed by transverse momentum cut");
stepper.clearComponents(state.stepping);
return;
}

updateStepper(state, stepper, tmpStates);
}
// We have material, we thus need a component cache since we will
Expand Down Expand Up @@ -301,11 +311,9 @@ struct GsfActor {
result);

if (componentCache.empty()) {
ACTS_WARNING(
"No components left after applying energy loss. "
"Is the weight cutoff "
<< m_cfg.weightCutoff << " too high?");
ACTS_WARNING("Return to propagator without applying energy loss");
ACTS_VERBOSE(
"All components removed by cuts (weight or momentum cutoff)");
stepper.clearComponents(state.stepping);
return;
}

Expand All @@ -328,7 +336,7 @@ struct GsfActor {

template <typename propagator_state_t, typename stepper_t,
typename navigator_t>
bool checkAbort(propagator_state_t& /*state*/, const stepper_t& /*stepper*/,
bool checkAbort(propagator_state_t& state, const stepper_t& stepper,
const navigator_t& /*navigator*/, const result_type& result,
const Logger& /*logger*/) const {
if (m_cfg.numberMeasurements &&
Expand All @@ -337,6 +345,13 @@ struct GsfActor {
return true;
}

// Stop if all components have been removed
if (stepper.numberComponents(state.stepping) == 0) {
ACTS_VERBOSE(
"Stop navigation because all components were removed by cuts");
return true;
}

return false;
}

Expand Down Expand Up @@ -434,6 +449,14 @@ struct GsfActor {
}();

assert(p_prev + delta_p > 0. && "new momentum must be > 0");

// Apply pT cut here to avoid const of expansion and merging later
const auto pT = (p_prev + delta_p) * std::sin(new_pars[eBoundTheta]);
if (pT < m_cfg.transverseMomentumCut) {
ACTS_VERBOSE("Skip new component with pT=" << pT << " GeV");
continue;
}

new_pars[eBoundQOverP] =
particleHypothesis.qOverP(p_prev + delta_p, old_bound.charge());

Expand Down Expand Up @@ -583,6 +606,14 @@ struct GsfActor {

const auto& trackStateProxy = *trackStateProxyRes;

const auto &params = trackStateProxy.parameters();
const auto p = stepper.particleHypothesis(state.stepping).extractMomentum(params[eBoundQOverP]);
const auto pT = p * std::sin(params[eBoundTheta]);
if (pT < m_cfg.transverseMomentumCut) {
ACTS_VERBOSE("Skip component with pT=" << pT << " after Kalman update");
continue;
}

// If at least one component is no outlier, we consider the whole thing
// as a measurementState
if (trackStateProxy.typeFlags().test(TrackStateFlag::MeasurementFlag)) {
Expand Down Expand Up @@ -801,6 +832,7 @@ struct GsfActor {
m_cfg.abortOnError = options.abortOnError;
m_cfg.disableAllMaterialHandling = options.disableAllMaterialHandling;
m_cfg.weightCutoff = options.weightCutoff;
m_cfg.transverseMomentumCut = options.transverseMomentumCut;
m_cfg.mergeMethod = options.componentMergeMethod;
m_cfg.calibrationContext = &options.calibrationContext.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ enum class MixtureReductionAlgorithm { weightCut, KLDistance };
/// @param betheHeitlerApprox The object that encapsulates the approximation.
/// @param maxComponents number of maximum components in the track state
/// @param weightCutoff when to drop components
/// @param transverseMomentumCut minimum transverse momentum (in GeV) for
/// components
/// @param componentMergeMethod How to merge a mixture to a single set of
/// parameters and covariance
/// @param mixtureReductionAlgorithm How to reduce the number of components
Expand All @@ -105,6 +107,7 @@ std::shared_ptr<TrackFitterFunction> makeGsfFitterFunction(
std::shared_ptr<const Acts::MagneticFieldProvider> magneticField,
const std::shared_ptr<const Acts::BetheHeitlerApprox>& betheHeitlerApprox,
std::size_t maxComponents, double weightCutoff,
double transverseMomentumCut,
Acts::ComponentMergeMethod componentMergeMethod,
MixtureReductionAlgorithm mixtureReductionAlgorithm,
double reverseFilteringCovarianceScaling, const Acts::Logger& logger);
Expand Down
6 changes: 5 additions & 1 deletion Examples/Algorithms/TrackFitting/src/GsfFitterFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ struct GsfFitterFunctionImpl final : public ActsExamples::TrackFitterFunction {

std::size_t maxComponents = 0;
double weightCutoff = 0;
const double momentumCutoff = 0; // 500_MeV;
double transverseMomentumCut = 0.0; // GeV, no cut by default
const double momentumCutoff = 0; // 500_MeV;
bool abortOnError = false;
bool disableAllMaterialHandling = false;
MixtureReductionAlgorithm reductionAlg =
Expand Down Expand Up @@ -93,6 +94,7 @@ struct GsfFitterFunctionImpl final : public ActsExamples::TrackFitterFunction {
gsfOptions.referenceSurface = options.referenceSurface;
gsfOptions.maxComponents = maxComponents;
gsfOptions.weightCutoff = weightCutoff;
gsfOptions.transverseMomentumCut = transverseMomentumCut;
gsfOptions.abortOnError = abortOnError;
gsfOptions.disableAllMaterialHandling = disableAllMaterialHandling;
gsfOptions.componentMergeMethod = mergeMethod;
Expand Down Expand Up @@ -177,6 +179,7 @@ std::shared_ptr<TrackFitterFunction> ActsExamples::makeGsfFitterFunction(
std::shared_ptr<const Acts::MagneticFieldProvider> magneticField,
const std::shared_ptr<const Acts::BetheHeitlerApprox>& betheHeitlerApprox,
std::size_t maxComponents, double weightCutoff,
double transverseMomentumCut,
Acts::ComponentMergeMethod componentMergeMethod,
MixtureReductionAlgorithm mixtureReductionAlgorithm,
double reverseFilteringCovarianceScaling, const Acts::Logger& logger) {
Expand Down Expand Up @@ -210,6 +213,7 @@ std::shared_ptr<TrackFitterFunction> ActsExamples::makeGsfFitterFunction(
std::move(trackFitter), std::move(directTrackFitter), geo);
fitterFunction->maxComponents = maxComponents;
fitterFunction->weightCutoff = weightCutoff;
fitterFunction->transverseMomentumCut = transverseMomentumCut;
fitterFunction->mergeMethod = componentMergeMethod;
fitterFunction->reductionAlg = mixtureReductionAlgorithm;
fitterFunction->reverseFilteringCovarianceScaling =
Expand Down
2 changes: 2 additions & 0 deletions Python/Examples/python/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,7 @@ def addTruthTrackingGsf(
trackingGeometry: acts.TrackingGeometry,
field: acts.MagneticFieldProvider,
inputProtoTracks: str = "truth_particle_tracks",
transverseMomentumCut: float = 0.5,
logLevel: Optional[acts.logging.Level] = None,
) -> None:
customLogLevel = acts.examples.defaultLogging(s, logLevel)
Expand All @@ -1658,6 +1659,7 @@ def addTruthTrackingGsf(
"componentMergeMethod": acts.examples.ComponentMergeMethod.maxWeight,
"mixtureReductionAlgorithm": acts.examples.MixtureReductionAlgorithm.KLDistance,
"weightCutoff": 1.0e-4,
"transverseMomentumCut": transverseMomentumCut,
"reverseFilteringCovarianceScaling": 100.0,
"level": customLogLevel(),
}
Expand Down
11 changes: 6 additions & 5 deletions Python/Examples/src/TrackFitting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,21 @@ void addTrackFitting(py::module& mex) {
std::shared_ptr<const MagneticFieldProvider> magneticField,
const std::shared_ptr<const BetheHeitlerApprox>& betheHeitlerApprox,
std::size_t maxComponents, double weightCutoff,
double transverseMomentumCut,
ComponentMergeMethod componentMergeMethod,
MixtureReductionAlgorithm mixtureReductionAlgorithm,
double reverseFilteringCovarianceScaling, Logging::Level level) {
return makeGsfFitterFunction(
std::move(trackingGeometry), std::move(magneticField),
betheHeitlerApprox, maxComponents, weightCutoff,
componentMergeMethod, mixtureReductionAlgorithm,
reverseFilteringCovarianceScaling,
transverseMomentumCut, componentMergeMethod,
mixtureReductionAlgorithm, reverseFilteringCovarianceScaling,
*getDefaultLogger("GSFFunc", level));
},
"trackingGeometry"_a, "magneticField"_a, "betheHeitlerApprox"_a,
"maxComponents"_a, "weightCutoff"_a, "componentMergeMethod"_a,
"mixtureReductionAlgorithm"_a, "reverseFilteringCovarianceScaling"_a,
"level"_a);
"maxComponents"_a, "weightCutoff"_a, "transverseMomentumCut"_a,
"componentMergeMethod"_a, "mixtureReductionAlgorithm"_a,
"reverseFilteringCovarianceScaling"_a, "level"_a);

mex.def(
"makeGlobalChiSquareFitterFunction",
Expand Down
Loading