Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Reduce WARNING verbosity in 2 cases #2458

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 12 additions & 0 deletions Core/include/Acts/TrackFitting/GaussianSumFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,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 @@ -400,6 +402,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 @@ -308,7 +310,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 @@ -344,7 +347,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 @@ -361,7 +365,7 @@ struct GsfActor {
proxy.filtered(), proxy.filteredCovariance());

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

Expand All @@ -370,7 +374,8 @@ struct GsfActor {
const navigator_t& navigator,
const BoundTrackParameters& old_bound,
const double old_weight, const MetaCache& metaCache,
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 @@ -386,7 +391,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
Loading