R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BDigitizingChannel.cxx
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
15#include <algorithm>
16
17namespace R3B::Digitizing
18{
20 : fSide(side)
21 {
22 }
23
24 auto Channel::GetDefaultRandomGen() -> TRandom3&
25 {
26 static auto random3 = TRandom3{};
27 return random3;
28 }
29
31 {
32 if (!fSignals.valid())
33 {
34 fSignals.set(ConstructSignals());
35 }
36 return fSignals.getRef();
37 }
38
39 auto Channel::HasFired() -> bool { return (!GetSignals().empty()); }
40
41 auto Channel::GetTrigTime() -> double
42 {
43 if (!fTrigTime.valid())
44 {
45 const auto& signals = GetSignals();
46 auto it =
47 std::min_element(signals.begin(),
48 signals.end(),
49 [](const auto& left_v, const auto& right_v) { return left_v.tdc < right_v.tdc; });
50 fTrigTime.set((it != signals.end() ? it->tdc : MAXTIME));
51 }
52 return fTrigTime.get();
53 }
54} // namespace R3B::Digitizing
virtual auto GetTrigTime() -> double
virtual auto HasFired() -> bool
static auto GetDefaultRandomGen() -> TRandom3 &
std::vector< Signal > Signals
virtual auto ConstructSignals() -> Signals=0
auto GetSignals() -> const Signals &