R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandHit.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2025 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#pragma once
14
15#include "TObject.h"
16#include <Math/Vector3Dfwd.h>
17#include <Rtypes.h>
18#include <RtypesCore.h>
19#include <fmt/core.h>
20#include <iostream>
21
22// NOLINTBEGIN(misc-include-cleaner)
23#include <Math/Vector3D.h>
24#include <R3BFormatters.h>
25// NOLINTEND(misc-include-cleaner)
26
27constexpr auto NEUTRON_MASS_MEV = 939.565;
28
29struct R3BNeulandHit : public TObject
30{
31 int module_id = 0;
32 double tdc_left = 0.;
33 double tdc_right = 0.;
34 double time = 0.;
35 double qdc_left = 0.;
36 double qdc_right = 0.;
37 double energy = 0.;
38 ROOT::Math::XYZVectorD position;
39 ROOT::Math::XYZVectorD pixel;
40
41 R3BNeulandHit() = default;
42 R3BNeulandHit(int paddle,
43 double TdcL,
44 double TdcR,
45 double time,
46 double QdcL,
47 double QdcR,
48 double energy,
49 ROOT::Math::XYZVector pos,
50 ROOT::Math::XYZVector pix);
51
52 void Print(const Option_t* /*option*/) const override;
53 auto operator==(const R3BNeulandHit& other) const -> bool
54 {
55 // TODO: Change this if multi-hit capability is introduced
56 return this->GetPaddle() == other.GetPaddle();
57 }
58
59 // NOTE: for backward compabitlity
60 [[nodiscard]] auto GetPaddle() const -> int { return module_id; }
61 [[nodiscard]] auto GetTdcR() const -> double { return tdc_right; }
62 [[nodiscard]] auto GetTdcL() const -> double { return tdc_left; }
63 [[nodiscard]] auto GetT() const -> double { return time; }
64 [[nodiscard]] auto GetQdcR() const -> double { return qdc_right; }
65 [[nodiscard]] auto GetQdcL() const -> double { return qdc_left; }
66 [[nodiscard]] auto GetE() const -> double { return energy; }
67 [[nodiscard]] auto GetPosition() const -> const ROOT::Math::XYZVector& { return position; }
68 [[nodiscard]] auto GetPixel() const -> const ROOT::Math::XYZVector& { return pixel; }
69
70 [[nodiscard]] auto GetBeta() const -> double;
71 [[nodiscard]] auto GetEToF(double mass = NEUTRON_MASS_MEV) const -> double;
72
74};
75
76auto operator<<(std::ostream&, const R3BNeulandHit&) -> std::ostream&; // Support easy printing
77 //
78template <>
79class fmt::formatter<R3BNeulandHit>
80{
81 public:
82 static constexpr auto parse(format_parse_context& ctx) { return ctx.end(); }
83 template <typename FmtContent>
84 constexpr auto format(const R3BNeulandHit& hit, FmtContent& ctn) const
85 {
86 return fmt::format_to(
87 ctn.out(),
88 "{{module_id: {}, left_tdc: {}, right_tdc: {}, time: {} ns, left_qdc: {}, right_qdc: {}, energy: "
89 "{} MeV, position: {} cm, pixel: {}}}",
90 hit.module_id,
91 hit.tdc_left,
92 hit.tdc_right,
93 hit.time,
94 hit.qdc_left,
95 hit.qdc_right,
96 hit.energy,
97 hit.position,
98 hit.pixel);
99 }
100};
constexpr auto NEUTRON_MASS_MEV
static constexpr auto parse(format_parse_context &ctx)
constexpr auto format(const R3BNeulandHit &hit, FmtContent &ctn) const
auto GetQdcR() const -> double
auto GetPaddle() const -> int
R3BNeulandHit()=default
auto GetT() const -> double
auto GetPosition() const -> const ROOT::Math::XYZVector &
auto GetBeta() const -> double
void Print(const Option_t *) const override
ROOT::Math::XYZVectorD pixel
auto GetPixel() const -> const ROOT::Math::XYZVector &
ROOT::Math::XYZVectorD position
auto operator==(const R3BNeulandHit &other) const -> bool
ClassDefOverride(R3BNeulandHit, 3)
auto GetTdcR() const -> double
auto GetQdcL() const -> double
auto GetEToF(double mass=NEUTRON_MASS_MEV) const -> double
auto GetE() const -> double
auto GetTdcL() const -> double