R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandHitCanvas.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
14#include "R3BNeulandHitCanvas.h"
15#include <R3BNeulandCommon.h>
17#include <TH2.h>
18
19namespace R3B::Neuland
20{
21 void HitCanvas::DataInit() { hit_data_.init(); }
23 {
24 auto& canvas = CreateNewCanvas(histograms);
25 auto bar_numbers = GetBarNumber();
26
27 canvas.divide(2, 2);
28
29 constexpr auto ENERGY_BIN_SIZE = 2000;
30 constexpr auto ENERGY_MAX = 120.;
31
32 constexpr auto TIME_DIFF_BIN_SIZE = 1000;
33 constexpr auto TIME_DIFF_MAX = 60.;
34
35 constexpr auto TOF_BIN_SIZE = 6000;
36 constexpr auto TOF_MIN = -100;
37 constexpr auto TOF_MAX = 400;
38
39 hHitEvsBar_ = canvas.add<1, TH2D>(
40 "hHitEvsBar", "Energy of hits", bar_numbers, -0.5, bar_numbers + 0.5, ENERGY_BIN_SIZE, 0, ENERGY_MAX);
41 hHitEvsBar_->GetXaxis()->SetTitle("module ID");
42 hHitEvsBar_->GetYaxis()->SetTitle("energy (MeV)");
43
44 hTdiffvsBar_ = canvas.add<2, TH2D>("hTdiffvsBar",
45 "Time difference between left and right PMT signals",
46 bar_numbers,
47 -0.5,
48 bar_numbers + 0.5,
49 TIME_DIFF_BIN_SIZE,
50 -TIME_DIFF_MAX,
51 TIME_DIFF_MAX);
52 hTdiffvsBar_->GetXaxis()->SetTitle("module ID");
53 hTdiffvsBar_->GetYaxis()->SetTitle("time difference (ns)");
54
55 hTofvsBar_ = canvas.add<3, TH2D>(
56 "hTofvsBar", "Time of hits", bar_numbers, -0.5, bar_numbers + 0.5, TOF_BIN_SIZE, TOF_MIN, TOF_MAX);
57 hTofvsBar_->GetXaxis()->SetTitle("module ID");
58 hTofvsBar_->GetYaxis()->SetTitle("time (ns)");
59 hTofvsEhit_ = canvas.add<4, TH2D>(
60 "hTofvsEhit", "Time vs energy of hits", ENERGY_BIN_SIZE, 0., ENERGY_MAX, TOF_BIN_SIZE, TOF_MIN, TOF_MAX);
61 hTofvsEhit_->GetXaxis()->SetTitle("energy (MeV)");
62 hTofvsEhit_->GetYaxis()->SetTitle("time (ns)");
63 }
64
65 void HitCanvas::CanvasFill(DataMonitor& /*histograms*/)
66 {
67 // if (hit_data_.size() > 0)
68 // {
69 // const auto event_num = GetOnlineSpectra()->GetEventHeader()->GetEventno();
70 // fmt::print("hit spectra event number: {}, size: {} -----------------\n", event_num, hit_data_.size());
71 // }
72
73 for (const auto& hit : hit_data_)
74 {
75 const auto& module_id = hit.module_id;
76 hHitEvsBar_->Fill(module_id, hit.energy);
77 // std::cout << "energy: " << hit.energy << "\n";
78 hTdiffvsBar_->Fill(module_id, hit.tdc_left - hit.tdc_right);
79 // fmt::print("hHitEvsBar_ module id: {} energy: {}\n", module_id, hit.energy);
80 // fmt::print("hTdiffvsBar module id: {} time: {}\n", module_id, hit.tdc_left - hit.tdc_right);
81
82 if (hit.energy > 0.)
83 {
84 hTofvsBar_->Fill(module_id, hit.time);
85 hTofvsEhit_->Fill(hit.energy, hit.time);
86 // fmt::print("hTofvsBar module id: {} time: {}\n", module_id, hit.time);
87 // fmt::print("hTofvsEhit energy: {} time: {}\n", hit.energy, hit.time);
88 }
89 }
90 }
92} // namespace R3B::Neuland
void CanvasFill(DataMonitor &histograms) override
void CanvasInit(DataMonitor &histograms) override
auto CreateNewCanvas(DataMonitor &histograms) -> DataMonitorCanvas &
Simulation of NeuLAND Bar/Paddle.