BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
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
5
/** @file BmnDigiContainerTemplate.cxx
6
** @author Nikolay Karpushkin <karpushkin@inr.ru>
7
** @date 18.01.2022
8
**
9
** Code for Data class for Bmn digi container template
10
**/
11
12
#include "
BmnDigiContainerTemplate.h
"
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
20
BmnDigiContainerTemplate::BmnDigiContainerTemplate
()
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
39
BmnDigiContainerTemplate::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
59
BmnDigiContainerTemplate::BmnDigiContainerTemplate
(
const
BmnDigiContainerTemplate
& other)
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
77
BmnDigiContainerTemplate::BmnDigiContainerTemplate
(
BmnDigiContainerTemplate
&& other)
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
95
BmnDigiContainerTemplate
&
BmnDigiContainerTemplate::operator=
(
const
BmnDigiContainerTemplate
& other)
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
;
106
fFitIntegral
= other.
fFitIntegral
;
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
117
BmnDigiContainerTemplate
&
BmnDigiContainerTemplate::operator=
(
BmnDigiContainerTemplate
&& other)
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
138
void
BmnDigiContainerTemplate::reset
()
139
{
140
fAmpl
= 0;
/// Amplitude from waveform [adc counts]
141
fZL
= 0;
/// ZeroLevel from waveform [adc counts]
142
fIntegral
= 0;
/// Energy deposition from waveform [adc counts]
143
fTimeMax
= 0;
/// Time of maximum in waveform [adc samples]
144
fToT
= 0;
/// Time over threshold [adc samples]
145
146
fFitAmpl
= 0.;
/// Amplitude from fit of waveform [adc counts]
147
fFitZL
= 0.;
/// ZeroLevel from fit of waveform [adc counts]
148
fFitIntegral
= 0.;
/// Energy deposition from fit of waveform [adc counts]
149
fFitR2
= 2.;
/// Quality of waveform fit [] -- good near 0
150
fFitTimeMax
= -1.;
/// Time of maximum in fit of waveform [adc samples]
151
152
fWfm
.clear();
153
fFitWfm
.clear();
154
}
155
156
void
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
}
kRed
kRed
TBuffer.h
TClass.h
TString.h
BmnDigiContainerTemplate.h
BmnDigiContainerTemplate::BmnDigiContainerTemplate
BmnDigiContainerTemplate()
Default constructor.
Definition
BmnDigiContainerTemplate.cxx:20
BmnDigiContainerTemplate::fFitWfm
std::vector< float > fFitWfm
Definition
BmnDigiContainerTemplate.h:104
BmnDigiContainerTemplate::fWfm
std::vector< float > fWfm
Time of maximum in fit of waveform [adc samples].
Definition
BmnDigiContainerTemplate.h:103
BmnDigiContainerTemplate::fFitTimeMax
float fFitTimeMax
Quality of waveform fit [] – good near 0.
Definition
BmnDigiContainerTemplate.h:101
BmnDigiContainerTemplate::fFitZL
float fFitZL
Amplitude from fit of waveform [adc counts].
Definition
BmnDigiContainerTemplate.h:98
BmnDigiContainerTemplate::reset
void reset()
Definition
BmnDigiContainerTemplate.cxx:138
BmnDigiContainerTemplate::fFitR2
float fFitR2
Energy deposition from fit of waveform [adc counts].
Definition
BmnDigiContainerTemplate.h:100
BmnDigiContainerTemplate::fToT
int fToT
Time of maximum in waveform [adc samples].
Definition
BmnDigiContainerTemplate.h:95
BmnDigiContainerTemplate::fAmpl
int fAmpl
Definition
BmnDigiContainerTemplate.h:91
BmnDigiContainerTemplate::DrawWfmWithTitle
void DrawWfmWithTitle(TCanvas *canvas, TString hist_name)
Definition
BmnDigiContainerTemplate.cxx:156
BmnDigiContainerTemplate::fZL
int fZL
Amplitude from waveform [adc counts].
Definition
BmnDigiContainerTemplate.h:92
BmnDigiContainerTemplate::fFitIntegral
float fFitIntegral
ZeroLevel from fit of waveform [adc counts].
Definition
BmnDigiContainerTemplate.h:99
BmnDigiContainerTemplate::operator=
BmnDigiContainerTemplate & operator=(const BmnDigiContainerTemplate &)
Assignment operator.
Definition
BmnDigiContainerTemplate.cxx:95
BmnDigiContainerTemplate::fFitAmpl
float fFitAmpl
Time over threshold [adc samples].
Definition
BmnDigiContainerTemplate.h:97
BmnDigiContainerTemplate::fTimeMax
int fTimeMax
Energy deposition from waveform [adc counts].
Definition
BmnDigiContainerTemplate.h:94
BmnDigiContainerTemplate::fIntegral
int fIntegral
ZeroLevel from waveform [adc counts].
Definition
BmnDigiContainerTemplate.h:93
TAttLine::SetLineWidth
virtual void SetLineWidth(Width_t lwidth)
TAttLine::SetLineColor
virtual void SetLineColor(Color_t lcolor)
TCanvas
TCanvas::cd
TVirtualPad * cd(Int_t subpadnumber=0) override
TGraph
TGraph::Draw
void Draw(Option_t *chopt="") override
TGraph::SetTitle
void SetTitle(const char *title="") override
TString
TString::Data
const char * Data() const
base
data
BmnDigiContainerTemplate.cxx
Generated on
for BmnRoot by
1.17.0