R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandCountRateCanvas.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2023 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
17#include <R3BIOConnector.h>
18#include <R3BNeulandCalData2.h>
19#include <R3BNeulandHit.h>
21#include <chrono>
22
23constexpr auto DEFAULT_COUNTING_DURATION = std::chrono::seconds{ 10 };
24
25namespace R3B::Neuland
26{
28 {
29 public:
36
37 explicit CountRateCanvas(std::string_view name)
38 : OnlineCanvas(name)
39 {
40 }
41 void ResetCount();
42
43 private:
44 InputVectorConnector<PaddleTamexMappedData> mapped_data_{ "NeulandMappedData" };
45 InputVectorConnector<BarCalData> cal_data_{ "NeulandCalData" };
46 InputVectorConnector<R3BNeulandHit> hit_data_{ "NeulandHits" };
47
48 CanvasElement<TGraph> los_count_rate_;
49 CanvasElement<TGraph> map_count_rate_;
50 CanvasElement<TGraph> cal_count_rate_;
51 CanvasElement<TGraph> hit_count_rate_;
52
53 int los_counter_ = 0;
54 int map_counter_ = 0;
55 int cal_counter_ = 0;
56 int hit_counter_ = 0;
57
58 std::chrono::time_point<std::chrono::steady_clock> start_time_ = std::chrono::steady_clock::now();
59 std::chrono::time_point<std::chrono::steady_clock> timer_;
60 std::chrono::seconds counting_duration_ = DEFAULT_COUNTING_DURATION;
61 RangeViewMode last_view_mode_ = RangeViewMode::full;
62
63 void DataInit() override;
64 void CanvasInit(DataMonitor& histograms) override;
65 void CanvasFill(DataMonitor& histograms) override;
66 void CanvasFinish() override;
67
68 void los_count();
69 void map_count();
70 void cal_count();
71 void hit_count();
72 void calculate_count_rate();
73 void adjust_graph_view();
74
75 inline void set_view(double width);
76 inline void set_full_view();
77 inline void set_two_hour_view();
78 inline void set_four_hour_view();
79
80 template <typename UnaryOp>
81 void do_each_graph(UnaryOp&& optn);
82 };
83
84 template <typename UnaryOp>
85 void CountRateCanvas::do_each_graph(UnaryOp&& optn)
86 {
87 optn(los_count_rate_);
88 optn(map_count_rate_);
89 optn(cal_count_rate_);
90 optn(hit_count_rate_);
91 }
92} // namespace R3B::Neuland
constexpr auto DEFAULT_COUNTING_DURATION
void CanvasFill(DataMonitor &histograms) override
void CanvasInit(DataMonitor &histograms) override
OnlineCanvas(const OnlineCanvas &)=default
Simulation of NeuLAND Bar/Paddle.
InputConnector< std::vector< ElementType > > InputVectorConnector