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 "TVector3.h"
17#include <R3BFormatters.h> // NOLINT: for formatting
18#include <Rtypes.h>
19#include <RtypesCore.h>
20#include <fmt/core.h>
21#include <iostream>
22
23constexpr auto NEUTRON_MASS_MEV = 939.565;
24
25struct R3BNeulandHit : public TObject
26{
27 int module_id = 0;
28 double tdc_left = 0.;
29 double tdc_right = 0.;
30 double time = 0.;
31 double qdc_left = 0.;
32 double qdc_right = 0.;
33 double energy = 0.;
34 TVector3 position;
35 TVector3 pixel;
36
37 R3BNeulandHit() = default;
38 R3BNeulandHit(int paddle,
39 double TdcL,
40 double TdcR,
41 double time,
42 double QdcL,
43 double QdcR,
44 double energy,
45 const TVector3& pos,
46 const TVector3& pix);
47
48 void Print(const Option_t* /*option*/) const override;
49 auto operator==(const R3BNeulandHit& other) const -> bool
50 {
51 // TODO: Change this if multi-hit capability is introduced
52 return this->GetPaddle() == other.GetPaddle();
53 }
54
55 // NOTE: for backward compabitlity
56 [[nodiscard]] auto GetPaddle() const -> int { return module_id; }
57 [[nodiscard]] auto GetTdcR() const -> double { return tdc_right; }
58 [[nodiscard]] auto GetTdcL() const -> double { return tdc_left; }
59 [[nodiscard]] auto GetT() const -> double { return time; }
60 [[nodiscard]] auto GetQdcR() const -> double { return qdc_right; }
61 [[nodiscard]] auto GetQdcL() const -> double { return qdc_left; }
62 [[nodiscard]] auto GetE() const -> double { return energy; }
63 [[nodiscard]] auto GetPosition() const -> TVector3 { return position; }
64 [[nodiscard]] auto GetPixel() const -> TVector3 { return pixel; }
65
66 [[nodiscard]] auto GetBeta() const -> double;
67 [[nodiscard]] auto GetEToF(double mass = NEUTRON_MASS_MEV) const -> double;
68
70};
71
72auto operator<<(std::ostream&, const R3BNeulandHit&) -> std::ostream&; // Support easy printing
73 //
74template <>
75class fmt::formatter<R3BNeulandHit>
76{
77 public:
78 static constexpr auto parse(format_parse_context& ctx) { return ctx.end(); }
79 template <typename FmtContent>
80 constexpr auto format(const R3BNeulandHit& hit, FmtContent& ctn) const
81 {
82 return format_to(
83 ctn.out(),
84 "{{module_id: {}, left_tdc: {}, right_tdc: {}, time: {} ns, left_qdc: {}, right_qdc: {}, energy: "
85 "{} MeV, position: {} cm, pixel: {}}}",
86 hit.module_id,
87 hit.tdc_left,
88 hit.tdc_right,
89 hit.time,
90 hit.qdc_left,
91 hit.qdc_right,
92 hit.energy,
93 hit.position,
94 hit.pixel);
95 }
96};
constexpr auto NEUTRON_MASS_MEV
static constexpr auto parse(format_parse_context &ctx)
constexpr auto format(const R3BNeulandHit &hit, FmtContent &ctn) const
ClassDefOverride(R3BNeulandHit, 2)
auto GetQdcR() const -> double
TVector3 position
auto GetPaddle() const -> int
R3BNeulandHit()=default
auto GetT() const -> double
auto GetBeta() const -> double
void Print(const Option_t *) const override
auto GetPixel() const -> TVector3
auto operator==(const R3BNeulandHit &other) const -> bool
auto GetPosition() const -> TVector3
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