Skip to content

Commit

Permalink
Fix greedy solver logger: (flood -> debug) + typos
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainJoube committed Apr 17, 2024
1 parent 5cc46d9 commit 8ea55b7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ class greedy_ambiguity_resolution_algorithm
// is greater than measurement_id_0_warning_threshold.
float measurement_id_0_warning_threshold = 0.1f;

bool verbose_info = false;
bool verbose_error = true;
bool verbose_flood = false;
bool verbose_warning = true;
bool verbose_info = false;
bool verbose_debug = false;
};

struct state_t {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,26 @@ namespace traccc {

namespace {

#define LOG_INFO(msg) \
if (_config.verbose_info) { \
logger::info() << msg << std::endl; \
}

#define LOG_FLOOD(msg) \
if (_config.verbose_flood) { \
logger::flood() << msg << std::endl; \
}

#define LOG_ERROR(msg) \
if (_config.verbose_error) { \
logger::error() << msg << std::endl; \
}

#define LOG_WARN(msg) \
if (_config.verbose_error) { \
if (_config.verbose_warning) { \
logger::warn() << msg << std::endl; \
}

#define LOG_INFO(msg) \
if (_config.verbose_info) { \
logger::info() << msg << std::endl; \
}

#define LOG_DEBUG(msg) \
if (_config.verbose_debug) { \
logger::debug() << msg << std::endl; \
}

// This logger is specific to the greedy_ambiguity_resolution_algorithm, and to
// this translation unit.
struct logger {
Expand All @@ -70,8 +70,8 @@ struct logger {
return std::cout;
}

static std::ostream& flood() {
std::cout << "INFO: @greedy_ambiguity_resolution_algorithm: ";
static std::ostream& debug() {
std::cout << "DEBUG: @greedy_ambiguity_resolution_algorithm: ";
return std::cout;
}
};
Expand All @@ -91,7 +91,7 @@ greedy_ambiguity_resolution_algorithm::operator()(
resolve(state);

if (_config.check_obvious_errs) {
LOG_FLOOD("Checking result validity...");
LOG_DEBUG("Checking result validity...");
check_obvious_errors(track_states, state);
}

Expand All @@ -100,7 +100,7 @@ greedy_ambiguity_resolution_algorithm::operator()(
track_state_container_types::host res;
res.reserve(state.selected_tracks.size());

LOG_FLOOD(
LOG_DEBUG(
"state.selected_tracks.size() = " << state.selected_tracks.size());

for (std::size_t index : state.selected_tracks) {
Expand Down Expand Up @@ -433,7 +433,7 @@ void greedy_ambiguity_resolution_algorithm::resolve(state_t& state) const {
for (std::size_t i = 0; i < _config.maximum_iterations; ++i) {
// Lazy out if there is nothing to filter on.
if (state.selected_tracks.empty()) {
LOG_FLOOD("No tracks left - exit loop");
LOG_DEBUG("No tracks left - exit loop");
break;
}

Expand All @@ -443,7 +443,7 @@ void greedy_ambiguity_resolution_algorithm::resolve(state_t& state) const {
state.selected_tracks.begin(), state.selected_tracks.end(),
shared_measurements_comperator);

LOG_FLOOD(
LOG_DEBUG(
"Current maximum shared measurements "
<< state
.shared_measurements_per_track[maximum_shared_measurements]);
Expand All @@ -458,7 +458,7 @@ void greedy_ambiguity_resolution_algorithm::resolve(state_t& state) const {
*std::max_element(state.selected_tracks.begin(),
state.selected_tracks.end(), track_comperator);

LOG_FLOOD("Remove track "
LOG_DEBUG("Remove track "
<< bad_track << " n_meas "
<< state.measurements_per_track[bad_track].size()
<< " nShared "
Expand All @@ -469,7 +469,7 @@ void greedy_ambiguity_resolution_algorithm::resolve(state_t& state) const {
++iteration_count;
}

LOG_FLOOD("Iteration_count: " << iteration_count);
LOG_DEBUG("Iteration_count: " << iteration_count);
}

} // namespace traccc

0 comments on commit 8ea55b7

Please sign in to comment.