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

feat: Add logger to multi stepper #1964

Merged
merged 7 commits into from
Apr 12, 2023
Merged
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
10 changes: 8 additions & 2 deletions Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ class MultiEigenStepperLoop
/// .curvilinearState()
FinalReductionMethod m_finalReductionMethod = FinalReductionMethod::eMean;

/// The logger (used if no logger is provided by caller of methods)
std::unique_ptr<const Acts::Logger> m_logger;

/// Small vector type for speeding up some computations where we need to
/// accumulate stuff of components. We think 16 is a reasonable amount here.
template <typename T>
Expand Down Expand Up @@ -218,9 +221,12 @@ class MultiEigenStepperLoop
/// Constructor from a magnetic field and a optionally provided Logger
MultiEigenStepperLoop(
std::shared_ptr<const MagneticFieldProvider> bField,
FinalReductionMethod finalReductionMethod = FinalReductionMethod::eMean)
FinalReductionMethod finalReductionMethod = FinalReductionMethod::eMean,
std::unique_ptr<const Logger> logger = getDefaultLogger("GSF",
Logging::INFO))
: EigenStepper<extensionlist_t, auctioneer_t>(std::move(bField)),
m_finalReductionMethod(finalReductionMethod) {}
m_finalReductionMethod(finalReductionMethod),
m_logger(std::move(logger)) {}

struct State {
/// The struct that stores the individual components
Expand Down
4 changes: 1 addition & 3 deletions Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ Result<double> MultiEigenStepperLoop<E, R, A>::step(

State& stepping = state.stepping;
auto& components = stepping.components;

// @TODO: This needs to be a real logger
const Logger& logger = getDummyLogger();
const Logger& logger = *m_logger;

// Update step count
stepping.steps++;
Expand Down
9 changes: 6 additions & 3 deletions Examples/Algorithms/TrackFitting/src/GsfFitterFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ ActsExamples::makeGsfFitterFunction(
double weightCutoff, Acts::FinalReductionMethod finalReductionMethod,
bool abortOnError, bool disableAllMaterialHandling,
const Acts::Logger& logger) {
MultiStepper stepper(std::move(magneticField), finalReductionMethod);

// Standard fitter
MultiStepper stepper(magneticField, finalReductionMethod,
logger.cloneWithSuffix("Step"));
Acts::Navigator::Config cfg{std::move(trackingGeometry)};
cfg.resolvePassive = false;
cfg.resolveMaterial = true;
Expand All @@ -133,9 +133,12 @@ ActsExamples::makeGsfFitterFunction(
logger.cloneWithSuffix("GSF"));

// Direct fitter
MultiStepper directStepper(std::move(magneticField), finalReductionMethod,
logger.cloneWithSuffix("Step"));
Acts::DirectNavigator directNavigator{
logger.cloneWithSuffix("DirectNavigator")};
DirectPropagator directPropagator(stepper, std::move(directNavigator),
DirectPropagator directPropagator(std::move(directStepper),
std::move(directNavigator),
logger.cloneWithSuffix("DirectPropagator"));
DirectFitter directTrackFitter(std::move(directPropagator),
BetheHeitlerApprox(betheHeitlerApprox),
Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ void propagator_instatiation_test_function() {
auto bField = std::make_shared<NullBField>();
multi_stepper_t multi_stepper(bField);
Propagator<multi_stepper_t, Navigator> propagator(
multi_stepper, Navigator{Navigator::Config{}});
std::move(multi_stepper), Navigator{Navigator::Config{}});

auto surface = Acts::Surface::makeShared<Acts::PlaneSurface>(
Vector3::Zero(), Vector3{1.0, 0.0, 0.0});
Expand Down