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