Skip to content

Commit

Permalink
feat: Outstream operator for TrackStatePropMask (#1165)
Browse files Browse the repository at this point in the history
I've found this very helpful for some types of debugging.
  • Loading branch information
paulgessinger committed Feb 21, 2022
1 parent f407b53 commit b7d2de0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Core/include/Acts/EventData/TrackStatePropMask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Acts/Utilities/EnumBitwiseOperators.hpp"

#include <limits>
#include <ostream>
#include <type_traits>

namespace Acts {
Expand Down Expand Up @@ -38,4 +39,6 @@ enum struct TrackStatePropMask : uint8_t {

ACTS_DEFINE_ENUM_BITWISE_OPERATORS(TrackStatePropMask)

std::ostream& operator<<(std::ostream& os, TrackStatePropMask mask);

} // namespace Acts
1 change: 1 addition & 0 deletions Core/src/EventData/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ target_sources(
TrackParameters.cpp
TransformationBoundToFree.cpp
TransformationFreeToBound.cpp
TrackStatePropMask.cpp
)
41 changes: 41 additions & 0 deletions Core/src/EventData/TrackStatePropMask.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// This file is part of the Acts project.
//
// Copyright (C) 2022 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include "Acts/EventData/TrackStatePropMask.hpp"

#include "Acts/Utilities/Helpers.hpp"

#include <ostream>

namespace Acts {

std::ostream& operator<<(std::ostream& os, TrackStatePropMask mask) {
using PM = TrackStatePropMask;
os << "TrackStatePropMask(";
if (mask == PM::None) {
os << "None";
} else {
os << "\n [" << (ACTS_CHECK_BIT(mask, PM::Predicted) ? "x" : " ")
<< "] predicted";
os << "\n [" << (ACTS_CHECK_BIT(mask, PM::Filtered) ? "x" : " ")
<< "] filtered";
os << "\n [" << (ACTS_CHECK_BIT(mask, PM::Smoothed) ? "x" : " ")
<< "] smoothed";
os << "\n [" << (ACTS_CHECK_BIT(mask, PM::Jacobian) ? "x" : " ")
<< "] jacobian";
os << "\n [" << (ACTS_CHECK_BIT(mask, PM::Uncalibrated) ? "x" : " ")
<< "] uncalibrated";
os << "\n [" << (ACTS_CHECK_BIT(mask, PM::Calibrated) ? "x" : " ")
<< "] calibrated";
os << "\n";
}
os << ")";
return os;
}

} // namespace Acts

0 comments on commit b7d2de0

Please sign in to comment.