ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Debug output options

description of debug output options More...

+ Collaboration diagram for Debug output options:

Namespaces

namespace  Acts::Logging
 debug output related helper classes and functions
 

Classes

class  Acts::Logger
 class for printing debug output More...
 

Macros

#define ACTS_LOCAL_LOGGER(log_object)
 macro to use a local Acts::Logger object
 
#define ACTS_VERBOSE(x)
 macro for verbose debug output
 
#define ACTS_DEBUG(x)
 macro for debug debug output
 
#define ACTS_INFO(x)
 macro for info debug output
 
#define ACTS_WARNING(x)
 macro for warning debug output
 
#define ACTS_ERROR(x)
 macro for error debug output
 
#define ACTS_FATAL(x)
 macro for fatal debug output
 

Detailed Description

description of debug output options

The Acts logging facility supports several severity levels which allow you to control the amount of information displayed at run-time. Logger objects can easily be created using the Acts::getDefaultLogger function which should be sufficient to get you started. In case you need more customized debug output, you can make use of the output decorators defined in Acts::Logging or even write your own implementation of Acts::Logging::OutputDecorator.

In order to add debug messages to your program, you should use the provided macros for the different severity levels:

All of these macros require that a function logger() returning a Acts::Logger object is available in the scope in which the macros are used. Inside classes containing an Acts::Logger object as member variable, this could be achieved by providing a private class method called logger() (for an example see e.g. Acts::CylinderVolumeBuilder::logger). Inside free functions or member methods with local logger objects, the same effect can be achieved by using the macro ACTS_LOCAL_LOGGER which is provided for your convenience.

Code example illustrating the usage
#include <fstream>
#include <memory>
void myFunction() {
// open the logfile
std::ofstream logfile("log.txt");
// setup a logger instance for >= INFO messages, streaming into the log file
// make sure you do NOT call the variable 'logger'
std::unique_ptr<const Acts::Logger> myLogger
= Acts::getDefaultLogger("MyLogger", Acts::Logging::INFO, &logfile);
// make sure the Acts debug macros can work with your logger
ACTS_LOCAL_LOGGER(myLogger);
ACTS_VERBOSE("This message will not appear in the logfile.");
ACTS_INFO("But this one will: Hello World!");
// do not forget to close the logfile
logfile.close();
}

In case you are using Acts in another framework which comes with its own logging facility (e.g. Gaudi) you can pipe the logging output from Acts tools and algorithms to your framework's logging system by supplying different implementations of:

Since Acts makes extensive use of Acts::getDefaultLogger to provide sufficient information for debugging, you would need to provide a modified implementation of this function (using your output filter and printing policies) to also pipe this output to your framework.

Changing the implementation of an already defined function is a non-trivial task in C++. We recommend the following approach using the possibility to inject custom code by pre-loading shared libraries with LD_PRELOAD. You need to provide an appropriate implementation for a function of the following signature into a separate source file and compile it in a shared library

namespace Acts {
std::unique_ptr<const Logger> getDefaultLogger(const std::string&,
std::ostream*);
}

Then you can run your executable, which uses Acts tools and algorithms, in the following way (tested under Unix)

LD_PRELOAD=<YOUR_SHARED_LIBRARY> path/to/your/exectuable

For an example have a look at CustomDefaultLogger.cpp which you can use as follows:

cd <ACTS/INSTALL/DIRECTORY>
source bin/setup.sh
LD_PRELOAD=lib/libActsCustomLogger.so bin/Examples/ActsGenericDetector

Macro Definition Documentation

#define ACTS_DEBUG (   x)
Value:
if (logger().doPrint(Acts::Logging::DEBUG)) \
logger().log(Acts::Logging::DEBUG) << x;

macro for debug debug output

Parameters
xdebug message
Precondition
logger() must be a valid expression in the scope where this macro is used and it must return a Acts::Logger object.

The debug message is printed if the current Acts::Logging::Level <= Acts::Logging::DEBUG.

Definition at line 83 of file Logger.hpp.

View newest version in sPHENIX GitHub at line 83 of file Logger.hpp

Referenced by FW::EffPlotTool::book(), FW::TrackSummaryPlotTool::book(), FW::FakeRatePlotTool::book(), FW::ResPlotTool::book(), Acts::Test::BOOST_AUTO_TEST_CASE(), Acts::TGeoLayerBuilder::buildLayers(), Acts::AdaptiveMultiVertexFinder< vfitter_t, sfinder_t >::canRecoverFromNoCompatibleTracks(), Acts::AdaptiveMultiVertexFinder< vfitter_t, sfinder_t >::canRemoveNonCompatibleTrackFromSeedTracks(), Acts::PassiveLayerBuilder::centralLayers(), FW::Generic::ProtoLayerCreatorT< detector_element_t >::centralProtoLayers(), Acts::VolumeMaterialMapper::checkAndInsert(), Acts::SurfaceMaterialMapper::checkAndInsert(), Acts::AdaptiveMultiVertexFinder< vfitter_t, sfinder_t >::checkVertexAndCompatibleTracks(), FW::ResPlotTool::clear(), FW::Generic::ProtoLayerCreatorT< detector_element_t >::createProtoLayers(), Acts::SurfaceMaterialMapper::createState(), Acts::PassiveLayerBuilder::endcapLayers(), Acts::CylinderVolumeHelper::estimateAndCheckDimension(), FW::HelloLoggerAlgorithm::execute(), FW::TrackSelector::execute(), FW::DigitizationAlgorithm::execute(), FW::ParticleSelector::execute(), FW::FatrasAlgorithm< simulator_t >::execute(), FW::FittingAlgorithm::execute(), FW::PropagationAlgorithm< propagator_t >::executeTest(), FW::FatrasAlgorithm< simulator_t >::FatrasAlgorithm(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::filter(), Acts::VolumeMaterialMapper::finalizeMaps(), Acts::SurfaceMaterialMapper::finalizeMaps(), Acts::ZScanVertexFinder< vfitter_t >::find(), Acts::IterativeVertexFinder< vfitter_t, sfinder_t >::find(), Acts::AdaptiveMultiVertexFinder< vfitter_t, sfinder_t >::find(), Acts::IterativeVertexFinder< vfitter_t, sfinder_t >::getVertexSeed(), main(), Acts::GainMatrixSmoother< parameters_t >::operator()(), Acts::CKFSourceLinkSelector::operator()(), FW::ParticleSelector::ParticleSelector(), FW::RootVertexAndTracksReader::read(), FW::RootMaterialTrackReader::read(), FW::EventGenerator::read(), FW::Options::readFatrasConfig(), Acts::IterativeVertexFinder< vfitter_t, sfinder_t >::reassignTracksToNewVertex(), Acts::IterativeVertexFinder< vfitter_t, sfinder_t >::removeUsedCompatibleTracks(), FW::RootMaterialTrackReader::RootMaterialTrackReader(), FW::RootVertexAndTracksReader::RootVertexAndTracksReader(), Acts::CylinderVolumeBuilder::trackingVolume(), FW::EffPlotTool::write(), FW::Obj::ObjTrackingGeometryWriter::write(), FW::TrackSummaryPlotTool::write(), FW::FakeRatePlotTool::write(), FW::Obj::ObjSurfaceWriter::write(), FW::ResPlotTool::write(), and FW::RootTrajectoryWriter::writeT().

#define ACTS_ERROR (   x)
Value:
if (logger().doPrint(Acts::Logging::ERROR)) \
logger().log(Acts::Logging::ERROR) << x;

macro for error debug output

Parameters
xdebug message
Precondition
logger() must be a valid expression in the scope where this macro is used and it must return a Acts::Logger object.

The debug message is printed if the current Acts::Logging::Level <= Acts::Logging::ERROR.

Definition at line 125 of file Logger.hpp.

View newest version in sPHENIX GitHub at line 125 of file Logger.hpp

Referenced by Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::addSourcelinkState(), Acts::KalmanFitter< propagator_t, updater_t, smoother_t, outlier_finder_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::backwardFilter(), Acts::Test::BOOST_AUTO_TEST_CASE(), Acts::DD4hepLayerBuilder::centralLayers(), Acts::DD4hepVolumeBuilder::centralVolumes(), Acts::LayerCreator::checkBinning(), FW::TrackFinderPerformanceWriter::Impl::close(), Acts::SurfaceArrayCreator::createVariableAxis(), Acts::LayerCreator::cylinderLayer(), FW::Sequencer::determineEventsRange(), Acts::LayerCreator::discLayer(), Acts::DD4hepLayerBuilder::endcapLayers(), FWE::VertexFindingAlgorithm::execute(), FWE::VertexFitAlgorithm::execute(), FW::FatrasAlgorithm< simulator_t >::execute(), Acts::KalmanFitter< propagator_t, updater_t, smoother_t, outlier_finder_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::filter(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::filter(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::finalize(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::findTracks(), Acts::KalmanFitter< propagator_t, updater_t, smoother_t, outlier_finder_t, calibrator_t, input_converter_t, output_converter_t >::fit(), Acts::LayerArrayCreator::layerArray(), Acts::KalmanFitter< propagator_t, updater_t, smoother_t, outlier_finder_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::operator()(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::operator()(), Acts::LayerCreator::planeLayer(), Acts::CylinderVolumeBuilder::trackingVolume(), FW::RootParticleWriter::writeT(), and FW::RootSimHitWriter::writeT().

#define ACTS_FATAL (   x)
Value:
if (logger().doPrint(Acts::Logging::FATAL)) \
logger().log(Acts::Logging::FATAL) << x;

macro for fatal debug output

Parameters
xdebug message
Precondition
logger() must be a valid expression in the scope where this macro is used and it must return a Acts::Logger object.

The debug message is printed if the current Acts::Logging::Level <= Acts::Logging::FATAL.

Definition at line 139 of file Logger.hpp.

View newest version in sPHENIX GitHub at line 139 of file Logger.hpp

Referenced by Acts::Test::BOOST_AUTO_TEST_CASE(), FW::HitSmearing::execute(), FW::FatrasAlgorithm< simulator_t >::execute(), FW::FittingAlgorithm::execute(), FW::CsvPlanarClusterReader::read(), FW::CsvPlanarClusterWriter::writeT(), and FW::RootPlanarClusterWriter::writeT().

#define ACTS_INFO (   x)
#define ACTS_LOCAL_LOGGER (   log_object)
Value:
struct __local_acts_logger \
{ \
__local_acts_logger(std::unique_ptr<const ::Acts::Logger> logger): \
m_logger(std::move(logger)) \
{} \
\
const ::Acts::Logger& operator()() const \
{ \
return *m_logger; \
} \
\
std::unique_ptr<const ::Acts::Logger> m_logger; \
}; \
__local_acts_logger logger(log_object);

macro to use a local Acts::Logger object

Parameters
log_objectlogger instance of type
Precondition
In the current scope, the symbol logger is not yet defined.
Postcondition
The ownership of the given log_object is transferred and log_object should not be used directly any more.

This macro allows to use a locally defined logging object with the ACTS_* logging macros. The envisaged usage is the following:

void myFunction() {
std::unique_ptr<const Acts::Logger> myLogger
= /* .. your initialization .. */;
ACTS_LOCAL_LOGGER(std::move(myLogger));
ACTS_VERBOSE("hello world!");
}

Definition at line 43 of file Logger.hpp.

View newest version in sPHENIX GitHub at line 43 of file Logger.hpp

Referenced by Acts::addCylinderLayerProtoMaterial(), Acts::addDiscLayerProtoMaterial(), Acts::Test::BOOST_AUTO_TEST_CASE(), Acts::convertDD4hepDetector(), FW::determineEventFilesRange(), main(), FW::Options::readFatrasConfig(), FW::RootBFieldWriter< bfield_t >::run(), and Acts::volumeBuilder_dd4hep().

#define ACTS_VERBOSE (   x)
Value:
if (logger().doPrint(Acts::Logging::VERBOSE)) \
logger().log(Acts::Logging::VERBOSE) << x;

macro for verbose debug output

Parameters
xdebug message
Precondition
logger() must be a valid expression in the scope where this macro is used and it must return a Acts::Logger object.

The debug message is printed if the current Acts::Logging::Level <= Acts::Logging::VERBOSE.

Definition at line 69 of file Logger.hpp.

View newest version in sPHENIX GitHub at line 69 of file Logger.hpp

Referenced by FW::WhiteBoard::add(), Acts::addCylinderLayerProtoMaterial(), Acts::addDiscLayerProtoMaterial(), Acts::CylinderVolumeHelper::addFaceVolumes(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::addHoleState(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::addPassiveState(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::addSourcelinkState(), Acts::CylinderVolumeBuilder::analyzeContent(), Acts::KalmanFitter< propagator_t, updater_t, smoother_t, outlier_finder_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::backwardFilter(), Acts::Test::BOOST_AUTO_TEST_CASE(), Acts::TGeoLayerBuilder::buildLayers(), Acts::PlanarModuleStepper::cellSteps(), Acts::PassiveLayerBuilder::centralLayers(), Acts::DD4hepLayerBuilder::centralLayers(), FW::Generic::LayerBuilderT< detector_element_t >::centralLayers(), FW::Generic::ProtoLayerCreatorT< detector_element_t >::centralProtoLayers(), Acts::DD4hepVolumeBuilder::centralVolumes(), Acts::LayerCreator::checkBinning(), Acts::SurfaceArrayCreator::completeBinning(), FW::Generic::LayerBuilderT< detector_element_t >::constructEndcapLayers(), Acts::CylinderVolumeHelper::createContainerTrackingVolume(), Acts::CylinderVolumeHelper::createCylinderLayer(), Acts::CylinderVolumeHelper::createDiscLayer(), Acts::SurfaceArrayCreator::createEquidistantAxis(), Acts::CylinderVolumeHelper::createGapTrackingVolume(), FW::Generic::ProtoLayerCreatorT< detector_element_t >::createProtoLayers(), Acts::SurfaceMaterialMapper::createState(), Acts::CylinderVolumeHelper::createTrackingVolume(), Acts::SurfaceArrayCreator::createVariableAxis(), Acts::LayerCreator::cylinderLayer(), FW::Contextual::PayloadDecorator::decorate(), FW::Contextual::AlignmentDecorator::decorate(), Acts::JsonGeometryConverter::detectorRepToJson(), FW::determineEventFilesRange(), Acts::LayerCreator::discLayer(), Acts::PassiveLayerBuilder::endcapLayers(), Acts::DD4hepLayerBuilder::endcapLayers(), FW::RootSimHitWriter::endRun(), FW::RootPropagationStepsWriter::endRun(), Acts::CylinderVolumeHelper::estimateAndCheckDimension(), FW::HelloLoggerAlgorithm::execute(), FW::HelloWhiteBoardAlgorithm::execute(), FW::HelloRandomAlgorithm::execute(), FW::DigitizationAlgorithm::execute(), FW::FittingAlgorithm::execute(), FW::PropagationAlgorithm< propagator_t >::executeTest(), Acts::KalmanFitter< propagator_t, updater_t, smoother_t, outlier_finder_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::filter(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::filter(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::finalize(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::findTracks(), Acts::KalmanFitter< propagator_t, updater_t, smoother_t, outlier_finder_t, calibrator_t, input_converter_t, output_converter_t >::fit(), FW::WhiteBoard::get(), Acts::CylinderVolumeHelper::glueTrackingVolumes(), Acts::CylinderVolumeHelper::interGlueTrackingVolume(), Acts::JsonGeometryConverter::jsonToMaterialMaps(), Acts::LayerArrayCreator::layerArray(), Acts::VolumeMaterialMapper::mapMaterialTrack(), Acts::SurfaceMaterialMapper::mapMaterialTrack(), Acts::KalmanFitter< propagator_t, updater_t, smoother_t, outlier_finder_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::materialInteractor(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::materialInteractor(), Acts::GainMatrixSmoother< parameters_t >::operator()(), FW::Pythia8Generator::operator()(), Acts::GainMatrixUpdater< parameters_t >::operator()(), Acts::CKFSourceLinkSelector::operator()(), Acts::KalmanFitter< propagator_t, updater_t, smoother_t, outlier_finder_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::operator()(), Acts::CombinatorialKalmanFilter< propagator_t, updater_t, smoother_t, source_link_selector_t, branch_stopper_t, calibrator_t, input_converter_t, output_converter_t >::Actor< source_link_t, parameters_t >::operator()(), Acts::LayerCreator::planeLayer(), FW::Pythia8Generator::Pythia8Generator(), FW::RootVertexAndTracksReader::read(), FW::RootMaterialTrackReader::read(), FW::EventGenerator::read(), Acts::SurfaceMaterialMapper::resolveMaterialSurfaces(), Acts::VolumeMaterialMapper::resolveMaterialVolume(), Acts::TGeoLayerBuilder::resolveSensitive(), FW::RootMaterialDecorator::RootMaterialDecorator(), Acts::AdaptiveMultiVertexFitter< input_track_t, linearizer_t >::setWeightsAndUpdate(), Acts::SurfaceArrayCreator::surfaceArrayOnCylinder(), Acts::SurfaceArrayCreator::surfaceArrayOnDisc(), Acts::SurfaceArrayCreator::surfaceArrayOnPlane(), Acts::CylinderVolumeBuilder::trackingVolume(), Acts::volumeBuilder_dd4hep(), FW::Obj::ObjTrackingGeometryWriter::write(), FW::Obj::ObjSurfaceWriter::write(), and FW::RootMaterialWriter::write().