Skip to content

Commit

Permalink
refactor: Reduce WARNING verbosity in 2 cases (#2458)
Browse files Browse the repository at this point in the history
Replaces in 2 cases a potentially large amount of WARNING output with DEBUG output and a single WARNING message with a hint to the debug output.
  • Loading branch information
benjaminhuth authored Sep 19, 2023
1 parent 19662db commit d62a42f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
12 changes: 12 additions & 0 deletions Core/include/Acts/TrackFitting/GaussianSumFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ struct GaussianSumFitter {
ACTS_VERBOSE("- processed states: " << fwdGsfResult.processedStates);
ACTS_VERBOSE("- measuerement states: " << fwdGsfResult.measurementStates);

std::size_t nInvalidBetheHeitler = fwdGsfResult.nInvalidBetheHeitler;

//////////////////
// Backward pass
//////////////////
Expand Down Expand Up @@ -392,6 +394,16 @@ struct GaussianSumFitter {
GsfError::NoMeasurementStatesCreatedBackward);
}

nInvalidBetheHeitler += bwdGsfResult.nInvalidBetheHeitler;

if (nInvalidBetheHeitler > 0) {
ACTS_WARNING("Encountered "
<< nInvalidBetheHeitler
<< " cases where the material thickness exceeds the range "
"of the Bethe-Heitler-Approximation. Enable DEBUG output "
"for more information.");
}

////////////////////////////////////
// Create Kalman Result
////////////////////////////////////
Expand Down
16 changes: 11 additions & 5 deletions Core/include/Acts/TrackFitting/detail/GsfActor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ struct GsfResult {
std::vector<const Acts::Surface*> visitedSurfaces;
std::vector<const Acts::Surface*> surfacesVisitedBwdAgain;

std::size_t nInvalidBetheHeitler = 0;

// Propagate potential errors to the outside
Result<void> result{Result<void>::success()};

Expand Down Expand Up @@ -289,7 +291,8 @@ struct GsfActor {
std::vector<ComponentCache>& componentCache = result.componentCache;
componentCache.clear();

convoluteComponents(state, stepper, navigator, tmpStates, componentCache);
convoluteComponents(state, stepper, navigator, tmpStates, componentCache,
result.nInvalidBetheHeitler);

if (componentCache.empty()) {
ACTS_WARNING(
Expand Down Expand Up @@ -325,7 +328,8 @@ struct GsfActor {
void convoluteComponents(propagator_state_t& state, const stepper_t& stepper,
const navigator_t& navigator,
const TemporaryStates& tmpStates,
std::vector<ComponentCache>& componentCache) const {
std::vector<ComponentCache>& componentCache,
std::size_t& nInvalidBetheHeitler) const {
auto cmps = stepper.componentIterable(state.stepping);
for (auto [idx, cmp] : zip(tmpStates.tips, cmps)) {
auto proxy = tmpStates.traj.getTrackState(idx);
Expand All @@ -335,7 +339,7 @@ struct GsfActor {
stepper.particleHypothesis(state.stepping));

applyBetheHeitler(state, navigator, bound, tmpStates.weights.at(idx),
componentCache);
componentCache, nInvalidBetheHeitler);
}
}

Expand All @@ -344,7 +348,8 @@ struct GsfActor {
const navigator_t& navigator,
const BoundTrackParameters& old_bound,
const double old_weight,
std::vector<ComponentCache>& componentCaches) const {
std::vector<ComponentCache>& componentCaches,
std::size_t& nInvalidBetheHeitler) const {
const auto& surface = *navigator.currentSurface(state.navigation);
const auto p_prev = old_bound.absoluteMomentum();

Expand All @@ -360,7 +365,8 @@ struct GsfActor {

// Emit a warning if the approximation is not valid for this x/x0
if (not m_cfg.bethe_heitler_approx->validXOverX0(slab.thicknessInX0())) {
ACTS_WARNING(
++nInvalidBetheHeitler;
ACTS_DEBUG(
"Bethe-Heitler approximation encountered invalid value for x/x0="
<< slab.thicknessInX0() << " at surface " << surface.geometryId());
}
Expand Down
14 changes: 12 additions & 2 deletions Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ActsExamples::ProcessCode ActsExamples::DigitizationAlgorithm::execute(
// Setup random number generator
auto rng = m_cfg.randomNumbers->spawnGenerator(ctx);

// Some statistics
std::size_t skippedHits = 0;

ACTS_DEBUG("Starting loop over modules ...");
for (const auto& simHitsGroup : groupByModule(simHits)) {
// Manual pair unpacking instead of using
Expand Down Expand Up @@ -222,8 +225,9 @@ ActsExamples::ProcessCode ActsExamples::DigitizationAlgorithm::execute(
auto res =
digitizer.smearing(rng, simHit, *surfacePtr, ctx.geoContext);
if (not res.ok()) {
ACTS_WARNING("Problem in hit smearing, skip hit ("
<< res.error().message() << ")");
++skippedHits;
ACTS_DEBUG("Problem in hit smearing, skip hit ("
<< res.error().message() << ")");
continue;
}
const auto& [par, cov] = res.value();
Expand Down Expand Up @@ -274,6 +278,12 @@ ActsExamples::ProcessCode ActsExamples::DigitizationAlgorithm::execute(
*digitizerItr);
}

if (skippedHits > 0) {
ACTS_WARNING(
skippedHits
<< " skipped in Digitization. Enable DEBUG mode to see more details.");
}

m_sourceLinkWriteHandle(ctx, std::move(sourceLinks));
m_measurementWriteHandle(ctx, std::move(measurements));
m_clusterWriteHandle(ctx, std::move(clusters));
Expand Down

0 comments on commit d62a42f

Please sign in to comment.