R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
ParResultReader.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <fmt/base.h>
5#include <fmt/core.h>
6#include <string>
7#include <string_view>
8#include <unordered_map>
9
10namespace R3B::Millepede
11{
13 {
14 int par_num = 0;
15 float value = 0.F;
16 float pre_sigma = 0.F;
17 float value_diff = 0.F;
18 float error = 0.F;
19 };
20
22 {
23 int label = 0;
24 int entry = 0;
25 float correction = 0.;
26 float error = 0.;
27 };
28
30 {
31 public:
32 enum class Mode : uint8_t
33 {
36 };
37 ResultReader() = default;
38 void set_filename(std::string_view filename) { filename_ = filename; }
39 void set_mode(Mode mode) { mode_ = mode; }
40
41 void read();
42 void print();
43 [[nodiscard]] auto get_pars() const -> const auto& { return par_results_; }
44
45 private:
47 std::string filename_;
48 void read_pede_par_file();
49 void read_json_file();
50 std::unordered_map<int, ParResultEntry> par_results_;
51 };
52
53} // namespace R3B::Millepede
54
55template <>
56class fmt::formatter<R3B::Millepede::ParResultEntry>
57{
58 public:
59 static constexpr auto parse(format_parse_context& ctx) { return ctx.end(); }
60 template <typename FmtContent>
61 constexpr auto format(const R3B::Millepede::ParResultEntry& entry, FmtContent& ctn) const
62 {
63 return fmt::format_to(ctn.out(),
64 "par id: {}, value: {}, sigma: {}, value_diff: {}, error: {}",
65 entry.par_num,
66 entry.value,
67 entry.pre_sigma,
68 entry.value_diff,
69 entry.error);
70 }
71};
std::unordered_map< int, ParResultEntry > par_results_
auto get_pars() const -> const auto &
void set_filename(std::string_view filename)
constexpr auto format(const R3B::Millepede::ParResultEntry &entry, FmtContent &ctn) const
static constexpr auto parse(format_parse_context &ctx)
int entry
int label
float error
float correction
float error
float value
float value_diff
int par_num
float pre_sigma