R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BDigitizingChannel.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019 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
14#pragma once
15#include "Validated.h"
16#include <TRandom3.h>
17#include <vector>
18
19namespace R3B::Digitizing
20{
21 class Paddle;
22 const double MAXTIME = 1e100;
23
24 enum class ChannelSide
25 {
26 right = 1,
27 left = 2
28 };
29 // output data structure of channel
31 {
32 double qdc{};
33 double tdc{ MAXTIME };
34 double qdcUnSat{};
36 ChannelSignal() = default;
37 };
38
39 // output data structure for Cal Data
41 {
42 double tot{};
43 double tle{};
45 ChannelCalSignal() = default;
46 };
47
48 // input data structure of channel
50 {
51 double time{};
52 double light{};
53 ChannelHit() = default;
54 ChannelHit(double p_time, double p_light)
55 : time{ p_time }
56 , light{ p_light }
57 {
58 }
59 auto operator<(const ChannelHit& rhs) const -> bool { return (time < rhs.time); }
60 };
61
62 class Channel
63 {
64 public:
67 using Hit = ChannelHit;
68 using Signals = std::vector<Signal>;
69 using CalSignals = std::vector<CalSignal>;
70
71 explicit Channel(ChannelSide);
72
73 // rule of 5
74 virtual ~Channel() = default; // FIXME: Root doesn't like pure virtual destructors (= 0;)
75 Channel(const Channel& other) = delete;
76 auto operator=(const Channel& other) -> Channel& = delete;
77 Channel(Channel&& other) = default;
78 auto operator=(Channel&& other) -> Channel& = delete;
79
80 virtual void AddHit(Hit hit) = 0;
81 virtual auto HasFired() -> bool;
82 // virtual auto HasCalFired() -> bool;
83
84 // Getters:
85 virtual auto GetTrigTime() -> double;
86 auto GetSignals() -> const Signals&;
87 auto GetSide() const -> ChannelSide { return fSide; }
88 auto GetPaddle() const -> Paddle* { return fPaddle; }
89
90 virtual auto GetCalSignals() -> CalSignals { return {}; }
91
92 void SetPaddle(Paddle* v_paddle) { fPaddle = v_paddle; }
93 auto Is_ValidSignals() -> bool { return fSignals.valid(); }
94 auto Is_ValidCalSignals() -> bool { return fCalSignals.valid(); }
95 void InvalidateSignals() { fSignals.invalidate(); }
96 void InvalidateCalSignals() { fCalSignals.invalidate(); }
97 void InvalidateTrigTime() { fTrigTime.invalidate(); }
98 virtual void AttachToPaddle(Paddle* paddle) { fPaddle = paddle; };
99 static auto GetDefaultRandomGen() -> TRandom3&;
100
101 private:
102 virtual auto ConstructSignals() -> Signals = 0;
103 virtual auto ConstructCalSignals() -> CalSignals { return {}; };
104 Paddle* fPaddle = nullptr; // pointer to the paddle who owns this channel
105 ChannelSide fSide; // side of the channel
106 mutable Validated<Signals> fSignals; // output signals from the channel
107 mutable Validated<CalSignals> fCalSignals; // output cal signals from the channel
108 mutable Validated<double> fTrigTime;
109 };
110} // namespace R3B::Digitizing
virtual auto ConstructCalSignals() -> CalSignals
virtual auto GetCalSignals() -> CalSignals
virtual auto GetTrigTime() -> double
auto operator=(const Channel &other) -> Channel &=delete
virtual void AttachToPaddle(Paddle *paddle)
Channel(Channel &&other)=default
virtual auto HasFired() -> bool
static auto GetDefaultRandomGen() -> TRandom3 &
std::vector< Signal > Signals
virtual auto ConstructSignals() -> Signals=0
virtual void AddHit(Hit hit)=0
void SetPaddle(Paddle *v_paddle)
auto GetSignals() -> const Signals &
auto operator=(Channel &&other) -> Channel &=delete
auto GetSide() const -> ChannelSide
auto GetPaddle() const -> Paddle *
virtual ~Channel()=default
Channel(const Channel &other)=delete
std::vector< CalSignal > CalSignals
ChannelHit(double p_time, double p_light)
auto operator<(const ChannelHit &rhs) const -> bool