R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandTJumpCanvas.cxx
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
15#include <R3BNeulandCommon.h>
17#include <TH2.h>
18#include <range/v3/view.hpp>
19
20constexpr auto EVENT_NUM_MAX = 10000000;
21
22namespace R3B::Neuland
23{
24 void TJumpCanvas::DataInit() { cal_data_.init(); }
26 {
27
28 auto& canvas = CreateNewCanvas(histograms);
29 auto bar_numbers = GetBarNumber();
30 canvas.divide(2, 2);
31
32 constexpr auto TSTART_BIN_SIZE = 1000;
33 constexpr auto TSTART_MIN = -11000.;
34 constexpr auto TSTART_MAX = 50000.;
35
36 constexpr auto ZOOM_TIME_MAX = 200.;
37
38 hTstart_ = canvas.add<1, TH1D>("hTstart", "Tstart", TSTART_BIN_SIZE, TSTART_MIN, TSTART_MAX);
39 hTestJump_ = canvas.add<2, TH2D>(
40 "hTestJump", "Test Jump", bar_numbers, 0.5, bar_numbers + 0.5, TSTART_BIN_SIZE, TSTART_MIN, -TSTART_MIN);
41 hTestJump_.pad()->SetLogz();
42 hTestJumpvsEvnt_ = canvas.add<3, TH2D>("hJumpsvsEvnt",
43 "Jumps vs Evnt",
44 TSTART_BIN_SIZE,
45 0,
47 TSTART_BIN_SIZE,
48 TSTART_MIN,
49 -TSTART_MIN);
50 hTestJumpvsEvnt_.pad()->SetLogz();
51
52 hTestJumpvsEvntzoom_ = canvas.add<4, TH2D>("hJumpsvsEvntzoom",
53 "Jumps vs Evnt zoomed",
54 TSTART_BIN_SIZE,
55 0,
57 TSTART_BIN_SIZE,
58 -ZOOM_TIME_MAX,
59 ZOOM_TIME_MAX);
60 hTestJumpvsEvntzoom_.pad()->SetLogz();
61 }
62
64 {
65 auto* event_header = GetOnlineSpectra()->GetEventHeader();
66 const auto event_number = static_cast<unsigned int>(event_header->GetEventno() % EVENT_NUM_MAX);
67 if (event_number < last_event_num_)
68 {
69 hTestJumpvsEvnt_->Reset();
70 hTestJumpvsEvntzoom_->Reset();
71 }
72 last_event_num_ = event_number;
73
74 auto time_start = event_header->GetTStart();
75 if (not std::isnan(time_start))
76 {
77 hTstart_->Fill(time_start);
78 // fmt::print("tstart: {}\n", time_start);
79 }
80
81 for (const auto& bar_signal_one : cal_data_)
82 {
83 const auto module_num = bar_signal_one.module_num;
84 for (const auto& signal_one : ranges::views::concat(bar_signal_one.left, bar_signal_one.right))
85 {
86 for (const auto& signal_other :
87 cal_data_ |
88 ranges::views::transform(
89 [](const auto& bar_signal)
90 { return ranges::views::concat(bar_signal.left, bar_signal.right); }) |
91 ranges::views::join)
92 {
93 const auto time_one = signal_one.leading_time - signal_one.trigger_time;
94 const auto time_other = signal_other.leading_time - signal_other.trigger_time;
95 const auto time_jump = (time_one - time_other).value;
96 hTestJump_->Fill(module_num, time_jump);
97 hTestJumpvsEvnt_->Fill(event_number, time_jump);
98 hTestJumpvsEvntzoom_->Fill(event_number, time_jump);
99 }
100 }
101 }
102 }
103
105} // namespace R3B::Neuland
constexpr auto EVENT_NUM_MAX
auto CreateNewCanvas(DataMonitor &histograms) -> DataMonitorCanvas &
auto GetOnlineSpectra() const -> OnlineSpectra *
void CanvasInit(DataMonitor &histograms) override
void CanvasFill(DataMonitor &histograms) override
Simulation of NeuLAND Bar/Paddle.