BmnRoot
Loading...
Searching...
No Matches
BmnTrigInfoDst.cxx
Go to the documentation of this file.
1/********************************************************************************
2 * BmnTrigInfoDst.cxx *
3 *******************************************************************************/
4#include "BmnTrigInfoDst.h"
5
6#include "BmnFDPoint.h"
7#include "BmnTrigDigit.h"
8#include "BmnTrigWaveDigit.h"
9#include "FairLogger.h"
10
12{
13 if (fBC1Digits || fBC2Digits || fFDDigits || fBDDigits) {
14 LOG(error) << "BmnTrigInfoDst: branches have been already created. It is a programming error";
15 return;
16 }
17
18 isExpData = isExp;
19 if (isExpData) {
20 fBC0Digits = new TClonesArray("BmnTrigWaveDigit");
21 fBC1Digits = new TClonesArray("BmnTrigWaveDigit");
22 fBC2Digits = new TClonesArray("BmnTrigWaveDigit");
23 fFDDigits = new TClonesArray("BmnTrigWaveDigit");
24 } else
25 fFDDigits = new TClonesArray("BmnFDPoint");
26 fBDDigits = new TClonesArray("BmnTrigDigit");
27}
28
29// Default constructor
31 : TNamed("BmnTrigInfoDst", "DST")
32 , isExpData(true)
33 , fVCAmp(0.)
34 , fBC0Amp(0.)
35 , fBC1Amp(0.)
36 , fBC1Integral(0.)
37 , fBC2Amp(0.)
38 , fBDMult(0)
39 , fSiMDMult(0)
40 , fFDAmp(0.)
41 , fInputsAR(0)
42 , fInputsBR(0)
43 , fBC0Digits(nullptr)
44 , fBC1Digits(nullptr)
45 , fBC2Digits(nullptr)
46 , fBDDigits(nullptr)
47 , fFDDigits(nullptr)
48{}
49
50// Constructor with flag whether experimental data are used
52 : TNamed("BmnTrigInfoDst", "DST")
53 , fVCAmp(0.)
54 , fBC0Amp(0.)
55 , fBC1Amp(0.)
56 , fBC1Integral(0.)
57 , fBC2Amp(0.)
58 , fBDMult(0)
59 , fSiMDMult(0)
60 , fFDAmp(0.)
61 , fInputsAR(0)
62 , fInputsBR(0)
63 , fBC0Digits(nullptr)
64 , fBC1Digits(nullptr)
65 , fBC2Digits(nullptr)
66 , fBDDigits(nullptr)
67 , fFDDigits(nullptr)
68{
69 isExpData = isExp;
70 CreateBranches(isExpData);
71}
72
73// Copy constructor
75 : TNamed("BmnTrigInfoDst", "DST")
76 , isExpData(other.isExpData)
77 , fVCAmp(other.fVCAmp)
78 , fBC0Amp(other.fBC0Amp)
79 , fBC1Amp(other.fBC1Amp)
80 , fBC1Integral(other.fBC1Integral)
81 , fBC2Amp(other.fBC2Amp)
82 , fBDMult(other.fBDMult)
83 , fSiMDMult(other.fSiMDMult)
84 , fFDAmp(other.fFDAmp)
85 , fInputsAR(other.fInputsAR)
86 , fInputsBR(other.fInputsBR)
87{
88 if (other.fBC0Digits)
89 fBC0Digits = new TClonesArray(*other.fBC0Digits);
90 else
91 fBC0Digits = nullptr;
92 if (other.fBC1Digits)
93 fBC1Digits = new TClonesArray(*other.fBC1Digits);
94 else
95 fBC1Digits = nullptr;
96 if (other.fBC2Digits)
97 fBC2Digits = new TClonesArray(*other.fBC2Digits);
98 else
99 fBC2Digits = nullptr;
100 if (other.fBDDigits)
101 fBDDigits = new TClonesArray(*other.fBDDigits);
102 else
103 fBDDigits = nullptr;
104 if (other.fFDDigits)
105 fFDDigits = new TClonesArray(*other.fFDDigits);
106 else
107 fFDDigits = nullptr;
108}
109
110// Copy assignment operator
112{
113 if (&other != this) {
114 isExpData = other.isExpData;
115 fBC0Amp = other.fBC0Amp;
116 fVCAmp = other.fVCAmp;
117 fBC1Amp = other.fBC1Amp;
118 fBC1Integral = other.fBC1Integral;
119 fBC2Amp = other.fBC2Amp;
120 fBDMult = other.fBDMult;
121 fSiMDMult = other.fSiMDMult;
122 fFDAmp = other.fFDAmp;
123 fInputsAR = other.fInputsAR;
124 fInputsBR = other.fInputsBR;
125
126 TCAFree();
127 if (other.fBC0Digits)
128 fBC0Digits = new TClonesArray(*other.fBC0Digits);
129 else
130 fBC0Digits = nullptr;
131 if (other.fBC1Digits)
132 fBC1Digits = new TClonesArray(*other.fBC1Digits);
133 else
134 fBC1Digits = nullptr;
135 if (other.fBC2Digits)
136 fBC2Digits = new TClonesArray(*other.fBC2Digits);
137 else
138 fBC2Digits = nullptr;
139 if (other.fBDDigits)
140 fBDDigits = new TClonesArray(*other.fBDDigits);
141 else
142 fBDDigits = nullptr;
143 if (other.fFDDigits)
144 fFDDigits = new TClonesArray(*other.fFDDigits);
145 else
146 fFDDigits = nullptr;
147 }
148 return *this;
149}
150
151// Move constructor
153 : TNamed("BmnTrigInfoDst", "DST")
154 , isExpData(other.isExpData)
155 , fVCAmp(other.fVCAmp)
156 , fBC0Amp(other.fBC0Amp)
157 , fBC1Amp(other.fBC1Amp)
158 , fBC1Integral(other.fBC1Integral)
159 , fBC2Amp(other.fBC2Amp)
160 , fBDMult(other.fBDMult)
161 , fSiMDMult(other.fSiMDMult)
162 , fFDAmp(other.fFDAmp)
163 , fInputsAR(other.fInputsAR)
164 , fInputsBR(other.fInputsBR)
165{
166 fBC0Digits = std::exchange(other.fBC0Digits, nullptr);
167 fBC1Digits = std::exchange(other.fBC1Digits, nullptr);
168 fBC2Digits = std::exchange(other.fBC2Digits, nullptr);
169 fBDDigits = std::exchange(other.fBDDigits, nullptr);
170 fFDDigits = std::exchange(other.fFDDigits, nullptr);
171}
172
173// Move assignment operator
175{
176 isExpData = other.isExpData;
177 fBC0Amp = other.fBC0Amp;
178 fVCAmp = other.fVCAmp;
179 fBC1Amp = other.fBC1Amp;
180 fBC1Integral = other.fBC1Integral;
181 fBC2Amp = other.fBC2Amp;
182 fBDMult = other.fBDMult;
183 fSiMDMult = other.fSiMDMult;
184 fFDAmp = other.fFDAmp;
185 fInputsAR = other.fInputsAR;
186 fInputsBR = other.fInputsBR;
187
188 TCAFree();
189 fBC0Digits = std::exchange(other.fBC0Digits, nullptr);
190 fBC1Digits = std::exchange(other.fBC1Digits, nullptr);
191 fBC2Digits = std::exchange(other.fBC2Digits, nullptr);
192 fBDDigits = std::exchange(other.fBDDigits, nullptr);
193 fFDDigits = std::exchange(other.fFDDigits, nullptr);
194
195 return *this;
196}
197
199{
200 fVCAmp = fBC1Amp = fBC1Integral = fBC2Amp = fFDAmp = 0.;
201 fBDMult = fSiMDMult = 0;
202 if (fBC0Digits)
203 fBC0Digits->Delete();
204 if (fBC1Digits)
205 fBC1Digits->Delete();
206 if (fBC2Digits)
207 fBC2Digits->Delete();
208 if (fFDDigits)
209 fFDDigits->Delete();
210 if (fBDDigits)
211 fBDDigits->Delete();
212}
213
214void BmnTrigInfoDst::TCAFree()
215{
216 if (fBC0Digits) {
217 fBC0Digits->Delete();
218 delete fBC0Digits;
219 }
220 if (fBC1Digits) {
221 fBC1Digits->Delete();
222 delete fBC1Digits;
223 }
224 if (fBC2Digits) {
225 fBC2Digits->Delete();
226 delete fBC2Digits;
227 }
228 if (fFDDigits) {
229 fFDDigits->Delete();
230 delete fFDDigits;
231 }
232 if (fBDDigits) {
233 fBDDigits->Delete();
234 delete fBDDigits;
235 }
236}
237
239{
240 TCAFree();
241}
void CreateBranches(Bool_t isExp)
BmnTrigInfoDst & operator=(const BmnTrigInfoDst &other)