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