R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandMappedCanvas.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 <R3BLogger.h>
16#include <R3BNeulandCommon.h>
17
18namespace R3B::Neuland
19{
20 void MappedCanvas::DataInit() { mapped_data_.init(); }
22 {
23 auto& canvas = CreateNewCanvas(histograms);
24 auto bar_numbers = GetBarNumber();
25
26 canvas.divide(1, 2);
27 canvas.add<1, TH1D>("hMappedBar1fLE", "Mapped: Bars fine 1LE", bar_numbers, 0.5, bar_numbers + 0.5)
28 ->SetLineColor(kBlue);
29 canvas.add<1, TH1D>("hMappedBar1fTE", "Mapped: Bars fine 1TE", bar_numbers, 0.5, bar_numbers + 0.5)
30 ->SetLineColor(kBlack);
31 canvas.add<1, TH1D>("hMappedBar1cLE", "Mapped: Bars coarse 1LE", bar_numbers, 0.5, bar_numbers + 0.5)
32 ->SetLineColor(kRed);
33 canvas.add<1, TH1D>("hMappedBar1cTE", "Mapped: Bars coarse 1TE", bar_numbers, 0.5, bar_numbers + 0.5)
34 ->SetLineColor(kOrange);
35
36 canvas.add<2, TH1D>("hMappedBar2fLE", "Mapped: Bars fine 2LE", bar_numbers, 0.5, bar_numbers + 0.5)
37 ->SetLineColor(kBlue);
38 canvas.add<2, TH1D>("hMappedBar2fTE", "Mapped: Bars fine 2TE", bar_numbers, 0.5, bar_numbers + 0.5)
39 ->SetLineColor(kBlack);
40 canvas.add<2, TH1D>("hMappedBar2cLE", "Mapped: Bars coarse 2LE", bar_numbers, 0.5, bar_numbers + 0.5)
41 ->SetLineColor(kRed);
42 canvas.add<2, TH1D>("hMappedBar2cTE", "Mapped: Bars coarse 2TE", bar_numbers, 0.5, bar_numbers + 0.5)
43 ->SetLineColor(kOrange);
44 }
45
47 {
48 auto fill_if_positive = [](double check_value, TH1* histogram, double fill_value)
49 {
50 if (check_value > 0)
51 {
52 histogram->Fill(fill_value);
53 }
54 };
55
56 for (const auto& plane_data : mapped_data_)
57 {
58 const auto plane_num = plane_data.plane_num;
59 for (const auto& [bar_num, bar_data] : plane_data.bars)
60 {
61 const auto module_num = Neuland_PlaneBar2ModuleNum(plane_num, bar_num);
62 for (const auto& left_signal : bar_data.left)
63 {
64 fill_if_positive(left_signal.leading.fine, histograms.get("hMappedBar1fLE"), module_num);
65 fill_if_positive(left_signal.leading.coarse, histograms.get("hMappedBar1cLE"), module_num);
66 fill_if_positive(left_signal.trailing.fine, histograms.get("hMappedBar1fTE"), module_num);
67 fill_if_positive(left_signal.trailing.coarse, histograms.get("hMappedBar1cTE"), module_num);
68 }
69 for (const auto& right_signal : bar_data.right)
70 {
71 fill_if_positive(right_signal.leading.fine, histograms.get("hMappedBar2fLE"), module_num);
72 fill_if_positive(right_signal.leading.coarse, histograms.get("hMappedBar2cLE"), module_num);
73 fill_if_positive(right_signal.trailing.fine, histograms.get("hMappedBar2fTE"), module_num);
74 fill_if_positive(right_signal.trailing.coarse, histograms.get("hMappedBar2cTE"), module_num);
75 }
76 }
77 }
78 }
79
81
82} // namespace R3B::Neuland
auto get(const std::string &histName) -> TH1 *
void CanvasInit(DataMonitor &histograms) override
void CanvasFill(DataMonitor &histograms) override
auto CreateNewCanvas(DataMonitor &histograms) -> DataMonitorCanvas &
Simulation of NeuLAND Bar/Paddle.
constexpr auto Neuland_PlaneBar2ModuleNum(unsigned int planeNum, unsigned int barNum) -> unsigned int