R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BPaddleTamexMappedData2.h
Go to the documentation of this file.
1#pragma once
2/******************************************************************************
3 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
4 * Copyright (C) 2019-2023 Members of R3B Collaboration *
5 * *
6 * This software is distributed under the terms of the *
7 * GNU General Public Licence (GPL) version 3, *
8 * copied verbatim in the file "LICENSE". *
9 * *
10 * In applying this license GSI does not waive the privileges and immunities *
11 * granted to it by virtue of its status as an Intergovernmental Organization *
12 * or submit itself to any jurisdiction. *
13 ******************************************************************************/
14
15#include "TObject.h"
16#include <R3BShared.h>
17#include <fmt/format.h>
18#include <fmt/ranges.h>
19
20namespace R3B
21{
23 {
24 unsigned int fine = 0; // fine time value
25 unsigned int coarse = 0; // coarse time value
26 ClassDefNV(SingleEdgeSignal, 1)
27 };
28
30 {
31 SingleEdgeSignal leading{}; // leading edge
32 SingleEdgeSignal trailing{}; // trailing edge
33 //
34 ClassDefNV(DoubleEdgeSignal, 1)
35 };
36
38 {
39 MapBarSignal() = default;
40 MapBarSignal(R3B::Side side, const DoubleEdgeSignal& signal);
41 inline void push_back(R3B::Side side, const DoubleEdgeSignal& signal)
42 {
43 (side == R3B::Side::left ? left : right).push_back(signal);
44 }
45 [[nodiscard]] auto get(R3B::Side side) const -> const auto& { return side == R3B::Side::left ? left : right; }
46
47 std::vector<DoubleEdgeSignal> left;
48 std::vector<DoubleEdgeSignal> right;
49 ClassDefNV(MapBarSignal, 1)
50 };
51
53 {
54 unsigned int plane_num = 0; //... number of plane 1..n
55 std::unordered_map<unsigned int, R3B::MapBarSignal> bars; //... number of bar 1..n
56
58 explicit PaddleTamexMappedData(unsigned int pID);
59 void push_back(R3B::Side side, unsigned int barID, const R3B::DoubleEdgeSignal& signal);
60 inline auto empty() const -> bool { return bars.empty(); };
61
62 ClassDefNV(PaddleTamexMappedData, 1)
63 };
64
66 {
67 unsigned int module_num = 0; //... number of trigID 1..n
69 ClassDefNV(PaddleTamexTrigMappedData, 1)
70 };
71} // namespace R3B
72
73template <>
74class fmt::formatter<R3B::SingleEdgeSignal>
75{
76 public:
77 static constexpr auto parse(format_parse_context& ctx) { return ctx.end(); }
78 template <typename FmtContent>
79 constexpr auto format(const R3B::SingleEdgeSignal& signal, FmtContent& ctn) const
80 {
81 return format_to(ctn.out(), "{{fine: {}, coarse: {} }}", signal.fine, signal.coarse);
82 }
83};
84
85template <>
86class fmt::formatter<R3B::DoubleEdgeSignal>
87{
88 public:
89 static constexpr auto parse(format_parse_context& ctx) { return ctx.end(); }
90 template <typename FmtContent>
91 constexpr auto format(const R3B::DoubleEdgeSignal& signal, FmtContent& ctn) const
92 {
93 return format_to(ctn.out(), "{{leading: {}, trailing: {} }}", signal.leading, signal.trailing);
94 }
95};
96
97template <>
98class fmt::formatter<R3B::MapBarSignal>
99{
100 public:
101 static constexpr auto parse(format_parse_context& ctx) { return ctx.end(); }
102 template <typename FmtContent>
103 constexpr auto format(const R3B::MapBarSignal& signal, FmtContent& ctn) const
104 {
105 return format_to(
106 ctn.out(), "{{left: [{}], right: [{}] }}", fmt::join(signal.left, ", "), fmt::join(signal.left, ", "));
107 }
108};
109
110using R3BPaddleTamexMappedDataContainer = std::vector<R3B::PaddleTamexMappedData>;
111using R3BPaddleTamexTrigDataContainer = std::map<unsigned int, R3B::PaddleTamexTrigMappedData>;
112
std::vector< R3B::PaddleTamexMappedData > R3BPaddleTamexMappedDataContainer
R3B::PaddleTamexMappedData R3BPaddleTamexMappedData2
std::map< unsigned int, R3B::PaddleTamexTrigMappedData > R3BPaddleTamexTrigDataContainer
R3B::PaddleTamexTrigMappedData R3BPaddleTamexTrigMappedData
static constexpr auto parse(format_parse_context &ctx)
constexpr auto format(const R3B::DoubleEdgeSignal &signal, FmtContent &ctn) const
constexpr auto format(const R3B::MapBarSignal &signal, FmtContent &ctn) const
static constexpr auto parse(format_parse_context &ctx)
static constexpr auto parse(format_parse_context &ctx)
constexpr auto format(const R3B::SingleEdgeSignal &signal, FmtContent &ctn) const
std::vector< DoubleEdgeSignal > right
auto get(R3B::Side side) const -> const auto &
MapBarSignal()=default
void push_back(R3B::Side side, const DoubleEdgeSignal &signal)
std::vector< DoubleEdgeSignal > left
void push_back(R3B::Side side, unsigned int barID, const R3B::DoubleEdgeSignal &signal)
std::unordered_map< unsigned int, R3B::MapBarSignal > bars