R3BROOT
R3B analysis software
Toggle main menu visibility
Loading...
Searching...
No Matches
R3BFormatters.h
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) 2024 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3
* Copyright (C) 2024-2026 Members of R3B Collaboration *
4
* *
5
* This software is distributed under the terms of the *
6
* GNU General Public Licence (GPL) version 3, *
7
* copied verbatim in the file "LICENSE". *
8
* *
9
* In applying this license GSI does not waive the privileges and immunities *
10
* granted to it by virtue of its status as an Intergovernmental Organization *
11
* or submit itself to any jurisdiction. *
12
******************************************************************************/
13
14
#pragma once
15
16
#ifndef __CLING__
17
#include "
R3BShared.h
"
18
#include "
R3BValueError.h
"
19
#include <Math/Vector3Dfwd.h>
20
#include <TVector3.h>
21
#include <fmt/base.h>
22
#include <fmt/core.h>
23
#include <fmt/format.h>
24
25
// NOLINTNEXTLINE(misc-include-cleaner)
26
#include <Math/Vector3D.h>
27
28
template
<>
29
class
fmt::formatter<TVector3>
30
{
31
public
:
32
static
constexpr
auto
parse
(format_parse_context& ctx) {
return
ctx.end(); }
33
template
<
typename
FmtContent>
34
constexpr
auto
format
(
const
TVector3& vec, FmtContent& ctn)
const
35
{
36
return
fmt::format_to(ctn.out(),
"[x: {}, y: {}, z: {}]"
, vec.X(), vec.Y(), vec.Z());
37
}
38
};
39
40
template
<>
41
class
fmt::formatter<
ROOT
::Math::XYZVector>
42
{
43
public
:
44
static
constexpr
auto
parse
(format_parse_context& ctx) {
return
ctx.end(); }
45
template
<
typename
FmtContent>
46
constexpr
auto
format
(
const
ROOT::Math::XYZVector& vec, FmtContent& ctn)
const
47
{
48
return
fmt::format_to(ctn.out(),
"[x: {}, y: {}, z: {}]"
, vec.X(), vec.Y(), vec.Z());
49
}
50
};
51
52
template
<
typename
DataType>
53
class
fmt::formatter<
R3B
::LRPair<DataType>>
54
{
55
public
:
56
static
constexpr
auto
parse
(format_parse_context& ctx) {
return
ctx.end(); }
57
template
<
typename
FmtContent>
58
constexpr
auto
format
(
const
R3B::LRPair<DataType>
& data_pair, FmtContent& ctn)
const
59
{
60
return
fmt::format_to(ctn.out(),
"[left: {}, right: {}]"
, data_pair.
left
(), data_pair.
right
());
61
}
62
};
63
64
template
<>
65
class
fmt::formatter<
R3B
::
Side
>
66
{
67
public
:
68
static
constexpr
auto
parse
(format_parse_context& ctx) {
return
ctx.end(); }
69
template
<
typename
FmtContent>
70
constexpr
auto
format
(
const
R3B::Side
& side, FmtContent& ctn)
const
71
{
72
if
(side ==
R3B::Side::left
)
73
{
74
return
fmt::format_to(ctn.out(),
"{}"
,
"left"
);
75
}
76
return
fmt::format_to(ctn.out(),
"{}"
,
"right"
);
77
}
78
};
79
#endif
Side
Side
Definition
R3BShared.h:112
R3BShared.h
R3BValueError.h
R3B::LRPair
Definition
R3BShared.h:140
R3B::LRPair::left
auto left() -> DataType &
Definition
R3BShared.h:149
R3B::LRPair::right
auto right() -> DataType &
Definition
R3BShared.h:150
fmt::formatter< R3B::LRPair< DataType > >::format
constexpr auto format(const R3B::LRPair< DataType > &data_pair, FmtContent &ctn) const
Definition
R3BFormatters.h:58
fmt::formatter< R3B::LRPair< DataType > >::parse
static constexpr auto parse(format_parse_context &ctx)
Definition
R3BFormatters.h:56
fmt::formatter< R3B::Side >::format
constexpr auto format(const R3B::Side &side, FmtContent &ctn) const
Definition
R3BFormatters.h:70
fmt::formatter< R3B::Side >::parse
static constexpr auto parse(format_parse_context &ctx)
Definition
R3BFormatters.h:68
fmt::formatter< ROOT::Math::XYZVector >::parse
static constexpr auto parse(format_parse_context &ctx)
Definition
R3BFormatters.h:44
fmt::formatter< ROOT::Math::XYZVector >::format
constexpr auto format(const ROOT::Math::XYZVector &vec, FmtContent &ctn) const
Definition
R3BFormatters.h:46
fmt::formatter< TVector3 >::format
constexpr auto format(const TVector3 &vec, FmtContent &ctn) const
Definition
R3BFormatters.h:34
fmt::formatter< TVector3 >::parse
static constexpr auto parse(format_parse_context &ctx)
Definition
R3BFormatters.h:32
R3B
Definition
R3BNeulandAnalysisApp.cxx:44
R3B::Side
Side
Definition
R3BShared.h:112
R3B::Side::left
@ left
Definition
R3BShared.h:113
ROOT
Definition
R3BROOTTypeJson.h:8
r3bbase
R3BFormatters.h
Generated by
1.18.0