Skip to content

Commit db7c727

Browse files
committed
Vertex: also print time error
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 8e34906 commit db7c727

File tree

1 file changed

+22
-3
lines changed
  • DataFormats/Reconstruction/include/ReconstructionDataFormats

1 file changed

+22
-3
lines changed

DataFormats/Reconstruction/include/ReconstructionDataFormats/Vertex.h

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ class Vertex : public VertexBase
152152
std::string asString() const;
153153
#endif
154154

155-
GPUd() ushort getNContributors() const { return mNContributors; }
155+
GPUd() ushort getNContributors() const
156+
{
157+
return mNContributors;
158+
}
156159
GPUd() void setNContributors(ushort v) { mNContributors = v; }
157160
GPUd() void addContributor() { mNContributors++; }
158161

@@ -184,12 +187,26 @@ namespace detail
184187
{
185188
template <typename T>
186189
concept Streamable = requires(std::ostream& os, const T& a) {
187-
{ os << a } -> std::same_as<std::ostream&>;
190+
{
191+
os << a
192+
}
193+
-> std::same_as<std::ostream&>;
188194
};
189195

190196
template <typename T>
191197
concept HasFormattableTimeStamp = requires(const T& t) {
192-
{ fmt::format("{}", t.getTimeStamp()) } -> std::convertible_to<std::string>;
198+
{
199+
fmt::format("{}", t.getTimeStamp())
200+
}
201+
-> std::convertible_to<std::string>;
202+
};
203+
204+
template <typename T>
205+
concept HasFormattableTimeStampWithError = requires(const T& t) {
206+
{
207+
fmt::format("{}+-{}", t.getTimeStamp(), t.getTimeStampError())
208+
}
209+
-> std::convertible_to<std::string>;
193210
};
194211
} // namespace detail
195212

@@ -201,6 +218,8 @@ inline std::string Vertex<Stamp>::asString() const
201218
std::ostringstream oss;
202219
oss << mTimeStamp;
203220
return oss.str();
221+
} else if constexpr (detail::HasFormattableTimeStampWithError<Stamp>) {
222+
return fmt::format("{}+-{}", mTimeStamp.getTimeStamp(), mTimeStamp.getTimeStampError());
204223
} else if constexpr (detail::HasFormattableTimeStamp<Stamp>) {
205224
return fmt::format("{}", mTimeStamp.getTimeStamp());
206225
} else {

0 commit comments

Comments
 (0)