BmnRoot
Loading...
Searching...
No Matches
BmnDigiContainerTemplate.cxx
Go to the documentation of this file.
1/* Copyright (C) 2021 Institute for Nuclear Research, Moscow
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Nikolay Karpushkin [committer] */
4
13
14#include <TBuffer.h> // for TBuffer
15#include <TClass.h> // for BmnDigiContainerTemplate::IsA()
16#include <TString.h> // for Form, TString
17#include <string> // for basic_string
18
19// --- Default constructor
21 : fAmpl()
22 , fZL()
23 , fIntegral()
24 , fTimeMax()
25 , fToT()
26
27 , fFitAmpl()
28 , fFitZL()
29 , fFitIntegral()
30 , fFitR2()
31 , fFitTimeMax()
32
33 , fWfm()
34 , fFitWfm()
35{}
36
37// clang-format off
38// --- Constructor with assignment
39BmnDigiContainerTemplate::BmnDigiContainerTemplate(int ampl, int zl, int integral, int time_max, int tot,
40 float fit_ampl, float fit_zl, float fit_integral, float fit_R2, float fit_time_max,
41 std::vector<float> wfm, std::vector<float> fit_wfm)
42 : fAmpl(ampl)
43 , fZL(zl)
44 , fIntegral(integral)
45 , fTimeMax(time_max)
46 , fToT(tot)
47
48 , fFitAmpl(fit_ampl)
49 , fFitZL(fit_zl)
50 , fFitIntegral(fit_integral)
51 , fFitR2(fit_R2)
52 , fFitTimeMax(fit_time_max)
53
54 , fWfm(wfm)
55 , fFitWfm(fit_wfm) {}
56// clang-format on
57
58// --- Copy constructor
60 : fAmpl(other.fAmpl)
61 , fZL(other.fZL)
62 , fIntegral(other.fIntegral)
63 , fTimeMax(other.fTimeMax)
64 , fToT(other.fToT)
65
66 , fFitAmpl(other.fFitAmpl)
67 , fFitZL(other.fFitZL)
68 , fFitIntegral(other.fFitIntegral)
69 , fFitR2(other.fFitR2)
70 , fFitTimeMax(other.fFitTimeMax)
71
72 , fWfm(other.fWfm)
73 , fFitWfm(other.fFitWfm)
74{}
75
76// --- Move constructor
78 : fAmpl(other.fAmpl)
79 , fZL(other.fZL)
80 , fIntegral(other.fIntegral)
81 , fTimeMax(other.fTimeMax)
82 , fToT(other.fToT)
83
84 , fFitAmpl(other.fFitAmpl)
85 , fFitZL(other.fFitZL)
86 , fFitIntegral(other.fFitIntegral)
87 , fFitR2(other.fFitR2)
88 , fFitTimeMax(other.fFitTimeMax)
89
90 , fWfm(other.fWfm)
91 , fFitWfm(other.fFitWfm)
92{}
93
94// --- Assignment operator
96{
97 if (this != &other) {
98 fAmpl = other.fAmpl;
99 fZL = other.fZL;
100 fIntegral = other.fIntegral;
101 fTimeMax = other.fTimeMax;
102 fToT = other.fToT;
103
104 fFitAmpl = other.fFitAmpl;
105 fFitZL = other.fFitZL;
107 fFitR2 = other.fFitR2;
108 fFitTimeMax = other.fFitTimeMax;
109
110 fWfm = other.fWfm;
111 fFitWfm = other.fFitWfm;
112 }
113 return *this;
114}
115
116// --- Move assignment operator
118{
119 if (this != &other) {
120 fAmpl = other.fAmpl;
121 fZL = other.fZL;
122 fIntegral = other.fIntegral;
123 fTimeMax = other.fTimeMax;
124 fToT = other.fToT;
125
126 fFitAmpl = other.fFitAmpl;
127 fFitZL = other.fFitZL;
128 fFitIntegral = other.fFitIntegral;
129 fFitR2 = other.fFitR2;
130 fFitTimeMax = other.fFitTimeMax;
131
132 fWfm = other.fWfm;
133 fFitWfm = other.fFitWfm;
134 }
135 return *this;
136}
137
139{
140 fAmpl = 0;
141 fZL = 0;
142 fIntegral = 0;
143 fTimeMax = 0;
144 fToT = 0;
145
146 fFitAmpl = 0.;
147 fFitZL = 0.;
148 fFitIntegral = 0.;
149 fFitR2 = 2.;
150 fFitTimeMax = -1.;
151
152 fWfm.clear();
153 fFitWfm.clear();
154}
155
156void BmnDigiContainerTemplate::DrawWfmWithTitle(TCanvas* canvas, TString hist_name)
157{
158 if (fWfm.empty())
159 return;
160 canvas->cd(1);
161
162 std::vector<float> points(fWfm.size());
163 std::iota(std::begin(points), std::end(points), 0); // Fill with 0, 1, ..., wfm.back().
164 TGraph* tgr_ptr = new TGraph(fWfm.size(), &points[0], &fWfm[0]);
165 tgr_ptr->SetTitle(hist_name.Data());
166 tgr_ptr->Draw();
167 if (!fFitWfm.empty()) {
168 TGraph* tgr_ptr_fit = new TGraph(fFitWfm.size(), &points[0], &fFitWfm[0]);
169 tgr_ptr_fit->SetLineColor(kRed);
170 tgr_ptr_fit->SetLineWidth(2);
171 tgr_ptr_fit->Draw("same");
172 }
173}
Data class for Bmn digi container template.
BmnDigiContainerTemplate()
Default constructor.
std::vector< float > fWfm
Time of maximum in fit of waveform [adc samples].
float fFitTimeMax
Quality of waveform fit [] – good near 0.
float fFitZL
Amplitude from fit of waveform [adc counts].
float fFitR2
Energy deposition from fit of waveform [adc counts].
int fToT
Time of maximum in waveform [adc samples].
void DrawWfmWithTitle(TCanvas *canvas, TString hist_name)
int fZL
Amplitude from waveform [adc counts].
float fFitIntegral
ZeroLevel from fit of waveform [adc counts].
BmnDigiContainerTemplate & operator=(const BmnDigiContainerTemplate &)
float fFitAmpl
Time over threshold [adc samples].
int fTimeMax
Energy deposition from waveform [adc counts].
int fIntegral
ZeroLevel from waveform [adc counts].