Belle II Software development
TrgEclDigitizer.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <framework/datastore/StoreArray.h>
10#include <framework/gearbox/Unit.h>
11
12#include <ecl/geometry/ECLGeometryPar.h>
13#include <ecl/dataobjects/ECLSimHit.h>
14#include <ecl/dataobjects/ECLHit.h>
15
16#include "trg/ecl/TrgEclDigitizer.h"
17
18
19#include "trg//ecl/dataobjects/TRGECLDigi0.h"
20#include "trg/ecl/dataobjects/TRGECLWaveform.h" // by shebalin
21
22#include <iostream>
23#include <bitset>
24#include <math.h>
25#include <TRandom.h>
26
27using namespace Belle2;
28//using namespace TRG;
29//
30//
31//
36//
37//
38//
44//
45//
46//
47
48void
50{
51 clear();
52
53 delete m_TCMap;
54 delete m_DataBase;
55 m_TCMap = new TrgEclMapping();
57
58 // prepare Matrix for Noise generation
59 m_DataBase->readNoiseLMatrix(m_MatrixParallel, m_MatrixSerial);
60}
61
62void
64{
65 m_TCEnergy_tot.fill(0.);
66 m_TCTiming_tot.fill(0.);
67 for (uint i = 0; i < c_NTC; i++) {
68 m_TCEnergy[i].fill(0.);
69 m_TCTiming[i].fill(0.);
70 m_TCBkgContribution[i].fill(0.);
71 m_TCSigContribution[i].fill(0.);
72 m_TCBeambkgTag[i].fill(0.);
73 m_TCRawEnergy[i].fill(0.);
74 m_TCRawTiming[i].fill(0.);
75 m_TCRawBkgTag[i].fill(0.);
76 for (uint j = 0; j < 64; j++) {
77 m_WaveForm[i][j] = 0.;
78 }
79 }
80}
81
82//
83//
84//
85void
87{
88
89 //-------------------------------------------------------------------
90 // read Xtal data
91 //---------------------------------------------------------------------
92 if (m_sourceOfTC == 1) { // read ECLHit table
93
94 // only needed to resolve the dominant background tag below
95 std::vector< std::vector<float> > E_cell(c_nECLCrystals, std::vector<float>(c_nTimeBins, 0.0));
96 std::vector< std::vector<float> > beambkg_tag(c_nECLCrystals, std::vector<float>(c_nTimeBins, 0.0));
97
98 StoreArray<ECLHit> eclHitArray("ECLHits");
99
100 int nHits_hit = eclHitArray.getEntries();
101 //
102 for (int iHits = 0; iHits < nHits_hit; iHits++) {
103 // Get a hit
104 ECLHit* aECLHit = eclHitArray[iHits];
105 int beambkg = aECLHit->getBackgroundTag();
106
107 // Hit geom. info
108 int hitCellId = aECLHit->getCellId() - 1;
109 float hitE = aECLHit->getEnergyDep() / Unit::GeV;
110 float aveT = aECLHit->getTimeAve(); // ns :time from IP to PD
111 if (aveT < - m_TimeRange || aveT > m_TimeRange) {continue;} //Choose - TimeRange ~ TimeTange
112 int TimeIndex = (int)((aveT + m_TimeRange) / 100); //Binning : -4000 = 1st bin ~ 4000 c_nTimeBinsth bin.
113
114 int iTCIdm = m_TCMap->getTCIdFromXtalId(hitCellId + 1) - 1;
115 m_TCEnergy[iTCIdm][TimeIndex] += hitE;
116 m_TCTiming[iTCIdm][TimeIndex] += hitE * aveT;
117 if (beambkg > 0) {m_TCBkgContribution[iTCIdm][TimeIndex] += hitE ;}
118 else if (beambkg == 0) {m_TCSigContribution[iTCIdm][TimeIndex] += hitE;}
119
120 }
121 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
122 for (int iTime = 0; iTime < c_nTimeBins; iTime++) {
123
124 if (m_TCEnergy[iTCIdm][iTime] < 1e-9) {continue;}// 0.01MeV cut
125 /* cppcheck-suppress variableScope */
126 double maxbkgE = 0;
127 /* cppcheck-suppress variableScope */
128 int maxbkgtag = 0;
129 m_TCTiming[iTCIdm][iTime] /= m_TCEnergy[iTCIdm][iTime];
130 if (m_BeambkgTag == 1) {
131 if (m_TCBkgContribution[iTCIdm][iTime] < m_TCSigContribution[iTCIdm][iTime]) {
132 m_TCBeambkgTag[iTCIdm][iTime] = 0; //signal Tag : 0
133 } else {
134 for (int iXtalIdm = 0; iXtalIdm < c_nECLCrystals; iXtalIdm++) {
135 int iTCId = m_TCMap->getTCIdFromXtalId(iXtalIdm + 1) - 1;
136 if (iTCIdm != iTCId) {continue;}
137 if (maxbkgE < E_cell[iXtalIdm][iTime]) {
138 maxbkgE = E_cell[iXtalIdm][iTime];
139 maxbkgtag = beambkg_tag[iXtalIdm][iTime];
140 }
141 }
142 m_TCBeambkgTag[iTCIdm][iTime] = maxbkgtag;
143 }
144 }
145 }
146 }
147 }
148
149
150 if (m_sourceOfTC == 2) { // read ECLSimHit
151 std::vector< std::vector<float> > E_cell(c_nECLCrystals, std::vector<float>(c_nTimeBins, 0.0));
152 std::vector< std::vector<float> > T_ave(c_nECLCrystals, std::vector<float>(c_nTimeBins, 0.0));
153 std::vector< std::vector<float> > Tof_ave(c_nECLCrystals, std::vector<float>(c_nTimeBins, 0.0));
154 std::vector< std::vector<float> > beambkg_tag(c_nECLCrystals, std::vector<float>(c_nTimeBins, 0.0));
155
157 //=====================
158 // Loop over all hits of steps
159 //=====================
160 StoreArray<ECLSimHit> eclArray("ECLSimHits");
161 int nHits = eclArray.getEntries();
162 //
163 for (int iHits = 0; iHits < nHits; iHits++) {
164 // Get a hit
165 ECLSimHit* aECLSimHit = eclArray[iHits];
166
167 int hitCellId = aECLSimHit->getCellId() - 1;
168 float hitE = aECLSimHit->getEnergyDep() / Unit::GeV;
169 float hitTOF = aECLSimHit->getFlightTime() / Unit::ns;
170
171 G4ThreeVector t = aECLSimHit->getPosIn(); // [cm], Hit position in Xtal (based on from IP)
172 ROOT::Math::XYZVector HitInPos(t.x(), t.y(), t.z()); // = aECLSimHit->getPosIn(); // [cm], Hit position in Xtal (based on from IP)
173 ROOT::Math::XYZVector PosCell = eclp->GetCrystalPos(hitCellId);// [cm], Xtal position (based on from IP)
174 ROOT::Math::XYZVector VecCell = eclp->GetCrystalVec(hitCellId);
175 float local_pos_r = 15.0 - (HitInPos - PosCell).Dot(VecCell);
176 if (hitTOF < - m_TimeRange || hitTOF > m_TimeRange) {continue;}
177 int TimeIndex = (int)((hitTOF + m_TimeRange) / 100);
178 E_cell[hitCellId][TimeIndex] = E_cell[hitCellId][TimeIndex] + hitE;
179 T_ave[hitCellId][TimeIndex] = T_ave[hitCellId][TimeIndex] + hitE * local_pos_r;
180 Tof_ave[hitCellId][TimeIndex] = Tof_ave[hitCellId][TimeIndex] + hitE * hitTOF;
181 }
182 //
183 //
184 //
185 //===============
186 // Xtal energy and timing (0-8us, 0.2us interval, 40 bins)
187 //===============
188 for (int iECLCell = 0; iECLCell < c_nECLCrystals; iECLCell++) {
189 for (int TimeIndex = 0; TimeIndex < c_nTimeBins; TimeIndex++) {
190
191 if (E_cell[iECLCell][TimeIndex] < 1e-9) {continue;} // 0.01MeV cut
192
193 T_ave[iECLCell][TimeIndex] = T_ave[iECLCell][TimeIndex] / E_cell[iECLCell][TimeIndex];
194 T_ave[iECLCell][TimeIndex] =
195 6.05 +
196 0.0749 * T_ave[iECLCell][TimeIndex] -
197 0.00112 * T_ave[iECLCell][TimeIndex] * T_ave[iECLCell][TimeIndex];
198 Tof_ave[iECLCell][TimeIndex] = Tof_ave[iECLCell][TimeIndex] / E_cell[iECLCell][TimeIndex];
199
200 } // 40bins, Time interval = 200ns
201 }
202 //
203 //
204 //
205 for (int iXtalIdm = 0; iXtalIdm < c_nECLCrystals; iXtalIdm++) {
206 int iTCIdm = m_TCMap->getTCIdFromXtalId(iXtalIdm + 1) - 1;
207 for (int iTime = 0; iTime < c_nTimeBins; iTime++) {
208
209 if (E_cell[iXtalIdm][iTime] < 1e-9) {continue;} // 0.01MeV cut
210 m_TCEnergy[iTCIdm][iTime] += E_cell[iXtalIdm][iTime];
211 m_TCTiming[iTCIdm][iTime] += E_cell[iXtalIdm][iTime] * (T_ave[iXtalIdm][iTime]);
212 if (beambkg_tag[iXtalIdm][iTime] > 0) {m_TCBkgContribution[iTCIdm][iTime] += E_cell[iXtalIdm][iTime];}
213 if (beambkg_tag[iXtalIdm][iTime] == 0) {m_TCSigContribution[iTCIdm][iTime] += E_cell[iXtalIdm][iTime];}
214
215 }
216 }
217 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
218 for (int iTime = 0; iTime < c_nTimeBins; iTime++) {
219 /* cppcheck-suppress variableScope */
220 double maxbkgE = 0;
221 /* cppcheck-suppress variableScope */
222 int maxbkgtag = 0;
223
224 if (m_TCEnergy[iTCIdm][iTime] < 1e-9) {continue;} // 0.01MeV cut
225 m_TCTiming[iTCIdm][iTime] /= m_TCEnergy[iTCIdm][iTime];
226 if (m_BeambkgTag == 1) {
227 if (m_TCBkgContribution[iTCIdm][iTime] < m_TCSigContribution[iTCIdm][iTime]) {
228 m_TCBeambkgTag[iTCIdm][iTime] = 0; //signal Tag : 0
229 } else {
230 for (int iXtalIdm = 0; iXtalIdm < c_nECLCrystals; iXtalIdm++) {
231 int iTCId = m_TCMap->getTCIdFromXtalId(iXtalIdm + 1) - 1;
232 if (iTCIdm != iTCId) {continue;}
233 if (maxbkgE < E_cell[iXtalIdm][iTime]) {
234 maxbkgE = E_cell[iXtalIdm][iTime];
235 maxbkgtag = beambkg_tag[iXtalIdm][iTime];
236 }
237 }
238 m_TCBeambkgTag[iTCIdm][iTime] = maxbkgtag;
239 }
240 }
241 }
242
243 }
244
245 }
246 //--------------------------------------------------------
247 //
248 //--------------------------------------------------------
249 if (m_sourceOfTC == 3) {
250
251 StoreArray<ECLHit> eclHitArray("ECLHits");
252
253 int nHits_hit = eclHitArray.getEntries();
254 // signal hit
255 for (int iHits = 0; iHits < nHits_hit; iHits++) {
256 // Get a hit
257 ECLHit* aECLHit = eclHitArray[iHits];
258 // Hit geom. info
259 int hitCellId = aECLHit->getCellId() - 1;
260 float hitE = aECLHit->getEnergyDep() / Unit::GeV;
261 float aveT = aECLHit->getTimeAve(); // ns :time from IP to PD
262 // Choose - TimeRange ~ TimeTange
263 if (aveT < - m_TimeRange || aveT > m_TimeRange) {continue;}
264 // Binning : -4000 = 1st bin ~ 4000 c_nTimeBinsth bin.
265 int TimeIndex = (int)((aveT + m_TimeRange) / 100);
266
267 int iTCIdm = m_TCMap->getTCIdFromXtalId(hitCellId + 1) - 1;
268 m_TCEnergy[iTCIdm][TimeIndex] += hitE;
269 m_TCTiming[iTCIdm][TimeIndex] += hitE * aveT;
270 }
271 // background hit
272 StoreArray<TRGECLBGTCHit> m_trgeclBGTCHits("TRGECLBGTCHits_beamBG");
273 for (const TRGECLBGTCHit& ttt : m_trgeclBGTCHits) {
274 // TC timing
275 double tcbg_t = ttt.getTimeAve();
276 // Timing cut
277 if (abs(tcbg_t) > m_TimeRange) continue;
278 //Binning : -4000 = 1st bin ~ 4000 c_nTimeBinsth bin.
279 int TimeIndex = (int)((tcbg_t + m_TimeRange) / 100);
280 // TC energy
281 double tcbg_e = ttt.getEnergyDep();
282 // TC ID index
283 int iTCIdm = ttt.getTCId() - 1;
284 // TC energy and timing
285 double tc_e = m_TCEnergy[iTCIdm][TimeIndex];
286 double tc_t = m_TCTiming[iTCIdm][TimeIndex];
287 m_TCEnergy[iTCIdm][TimeIndex] += tcbg_e;
288 m_TCTiming[iTCIdm][TimeIndex] += (tcbg_e * tcbg_t + tc_e * tc_t);
289 }
290 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
291 for (int iTime = 0; iTime < c_nTimeBins; iTime++) {
292 m_TCTiming[iTCIdm][iTime] /= m_TCEnergy[iTCIdm][iTime];
293 }
294 }
295 }
296 //--------------------------
297 // TC energy and timing in t=0-1us as true values.
298 //--------------------------
299 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
300 for (int iTime = 40; iTime < 50; iTime++) {
301 m_TCEnergy_tot[iTCIdm] += m_TCEnergy[iTCIdm][iTime];
302 m_TCTiming_tot[iTCIdm] += m_TCTiming[iTCIdm][iTime] * m_TCEnergy[iTCIdm][iTime];
303 }
304 m_TCTiming_tot[iTCIdm] /= m_TCEnergy_tot[iTCIdm];
305 }
306
307 return;
308}
309//
310//
311//
312void
313TrgEclDigitizer::digitization01(std::vector<std::vector<double>>& TCDigiE,
314 std::vector<std::vector<double>>& TCDigiT)
315{
316 for (uint i = 0; i < c_NTC; i++) {
317 TCDigiE[i].assign(c_NSamplingDigi01, 0);
318 TCDigiT[i].assign(c_NSamplingDigi01, 0);
319 }
320
321 //
322 static constexpr double cut_energy_tot = 0.03; // [GeV]
323 static constexpr int nbin_pedestal = 4; // = nbin_pedestal*fam_sampling_interval [ns] in total
324 static constexpr double fam_sampling_interval = 125; // [ns]
325
326
327 // (Make sampling time random between FAM sampling intervals)
328 const double random_sampling_correction = gRandom->Rndm() * fam_sampling_interval; // [ns]
329 //==================
330 // (01)Signal digitization
331 //==================
332
333 // This is for the noise embedding step below, but can already be filled here to save time
334 std::bitset<c_NTC> hasEnergy;
335 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
336 for (int iTimeBin = 0; iTimeBin < c_nTimeBins; iTimeBin++) {
337
338 if (m_TCEnergy[iTCIdm][iTimeBin] >= 1e-9) {
339 hasEnergy[iTCIdm] = true;
340 }
341 if (m_TCEnergy[iTCIdm][iTimeBin] < 0.0001) {
342 continue;
343 } // 0.1MeV cut on TC bin_energy
344 for (int iSampling = 0; iSampling < c_NSamplingDigi01; iSampling++) {
345 // inputTiming is in [us] <-- Be careful, here is NOT [ns]
346 double inputTiming
347 = (-m_TCTiming[iTCIdm][iTimeBin] - m_TimeRange + (-nbin_pedestal + iSampling) * fam_sampling_interval) * 0.001;
348 inputTiming += random_sampling_correction * 0.001;
349 if (inputTiming < 0 || inputTiming > 2.0) {continue;} // Shaping in t0 ~t0+ 2.0 us
350 if (m_FADC == 1) {
351
352 TCDigiE[iTCIdm][iSampling] += interFADC(inputTiming) * m_TCEnergy[iTCIdm][iTimeBin];
353 } else {
354 TCDigiE[iTCIdm][iSampling] += SimplifiedFADC(0, inputTiming) * m_TCEnergy[iTCIdm][iTimeBin];
355 }
356 }
357
358 for (int iSampling = 0; iSampling < c_NSamplingDigi01; iSampling++) {
359 TCDigiT[iTCIdm][iSampling] = (-nbin_pedestal + iSampling - m_TimeRange / fam_sampling_interval) * fam_sampling_interval +
360 random_sampling_correction;
361 }
362 }
363 }
364
365
366 if (0) {
367 FILE* f_out_dat = fopen("ztsim.no_noise.dat", "w");
368 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
369 if (m_TCEnergy_tot[iTCIdm] < cut_energy_tot) { continue; } // TC energy_tot cut
370 fprintf(f_out_dat, "%5i %8.5f %8.5f %8.1f ",
371 iTCIdm + 1, m_TCEnergy_tot[iTCIdm], m_TCEnergy[iTCIdm][0], TCDigiT[iTCIdm][0]);
372 for (int iSampling = 0; iSampling < c_NSamplingDigi01; iSampling++) {
373 fprintf(f_out_dat, "%7.4f ", TCDigiE[iTCIdm][iSampling]);
374 }
375 fprintf(f_out_dat, "\n");
376 }
377 fclose(f_out_dat);
378 }
379 //==================
380 // (01)noise embedding
381 //==================
382 static constexpr double tmin_noise = -4; // original
383 static constexpr double tgen = 10.3; // original
384 static constexpr int bkg_level = 1030;
385 double ttt0 = 0; // [us]
386 /* cppcheck-suppress variableScope */
387 double ttt1 = 0; // [us]
388 /* cppcheck-suppress variableScope */
389 double ttt2 = 0; // [us]
390 //
391 static constexpr double frac_pileup = 0.035; // pileup noise fraction?
392 static constexpr double frac_parallel = 0.023; // parallel noise fraction?
393 static constexpr double frac_serial = 0.055; // serial noise fraction?
394 static constexpr double times_pileup = 1; // noise scale based on Belle noise.
395 static constexpr double times_parallel = 3.15; // noise scale
396 static constexpr double times_serial = 3.15; // noise scale
397
398 const double sqrTerm = std::sqrt(fam_sampling_interval * 0.001);
399 const double corr_pileup = times_pileup * frac_pileup * sqrTerm;
400 const double corr_parallel = times_parallel * frac_parallel * sqrTerm;
401 const double corr_serial = times_serial * frac_serial * sqrTerm;
402 const double parallelNoiseCorrection = 10 * corr_parallel;
403 const double serialNoiseCorrection = 10 * corr_serial;
404
405
406 if (0) {
407 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
408 if (m_TCEnergy_tot[iTCIdm] < cut_energy_tot) { continue; } // TC energy_tot cut
409 for (int jjj = 0; jjj < bkg_level; jjj++) {
410 ttt0 = -(tmin_noise + tgen * gRandom->Rndm()); // [us]
411 ttt1 = -(tmin_noise + tgen * gRandom->Rndm()); // [us]
412 ttt2 = -(tmin_noise + tgen * gRandom->Rndm()); // [us]
413 for (int iSampling = 0; iSampling < c_NSamplingDigi01; iSampling++) {
414 // (pile-up noise)
415 if (ttt0 > 0) { TCDigiE[iTCIdm][iSampling] += SimplifiedFADC(0, ttt0) * corr_pileup * 0.001; }
416 // (parallel noise)
417 if (ttt1 > 0) { TCDigiE[iTCIdm][iSampling] += SimplifiedFADC(1, ttt1) * corr_parallel; }
418 // (serial noise)
419 if (ttt2 > 0) { TCDigiE[iTCIdm][iSampling] += SimplifiedFADC(2, ttt2) * corr_serial; }
420 ttt0 += fam_sampling_interval * 0.001;
421 ttt1 += fam_sampling_interval * 0.001;
422 ttt2 += fam_sampling_interval * 0.001;
423 }
424 }
425 }
426 }
427 if (1) { //use L Matrix
428 // A TC with no deposited energy in any time bin receives no signal
429 // contribution at all, so noise alone cannot bring it over the fit
430 // threshold. Note m_TCEnergy_tot covers only bins 40-49 and so must NOT
431 // be used here: a real signal arriving just before t=0 falls in bin 39.
432 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
433
434 for (int iSampling = 0; iSampling < c_NSamplingDigi01; iSampling++) {
435 m_Xpr[iSampling] = gRandom ->Gaus(0, 1);
436 m_Xsr[iSampling] = gRandom ->Gaus(0, 1);
437 }
438
439 // drawn for every TC above, so the random sequence is left untouched
440 if (!hasEnergy[iTCIdm]) { continue; }
441
442 m_noisePileup.fill(0.);
443 m_noiseParallel.fill(0.);
444 m_noiseSerial.fill(0.);
445 for (int iSampling = 0; iSampling < c_NSamplingDigi01; iSampling++) {
446 double parallelNoiseTerm = 0., serialNoiseTerm = 0.;
447 for (int jSampling = 0; jSampling < c_NSamplingDigi01; jSampling++) {
448 parallelNoiseTerm += parallelNoiseCorrection * m_MatrixParallel[iSampling][jSampling] * m_Xpr[jSampling];
449 serialNoiseTerm += serialNoiseCorrection * m_MatrixSerial[iSampling][jSampling] * m_Xsr[jSampling];
450 }
451 m_noiseParallel[iSampling] += parallelNoiseTerm;
452 m_noiseSerial[iSampling] += serialNoiseTerm;
453 }
454
455 for (int iSampling = 0; iSampling < c_NSamplingDigi01; iSampling++) {
456 TCDigiE[iTCIdm][iSampling] += m_noisePileup[iSampling] + m_noiseParallel[iSampling] + m_noiseSerial[iSampling];
457 }
458 }
459 if (0) {
460 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) { //Only Pile-up noise use old method.
461 if (m_TCEnergy_tot[iTCIdm] < cut_energy_tot) { continue; } // TC energy_tot cut
462 for (int jjj = 0; jjj < bkg_level; jjj++) {
463 ttt0 = -(tmin_noise + tgen * gRandom->Rndm()); // [us]
464 for (int iSampling = 0; iSampling < c_NSamplingDigi01; iSampling++) {
465 // (pile-up noise)
466 if (ttt0 > 0) { TCDigiE[iTCIdm][iSampling] += SimplifiedFADC(0, ttt0) * corr_pileup * 0.001; }
467 ttt0 += fam_sampling_interval * 0.001;
468 }
469 }
470 }
471 }
472 }
473
474 if (m_SaveTCWaveForm == 1) {
475
476 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
477 for (int iSampling = 0; iSampling < c_NSamplingDigi01; iSampling++) {
478 m_WaveForm[iTCIdm][iSampling] = TCDigiE[iTCIdm][iSampling];
479 }
480
481 }
482 }
483
484}
485void
486TrgEclDigitizer::digitization02(std::vector<std::vector<double>>& TCDigiE, std::vector<std::vector<double>>& TCDigiT)
487{
488 //===============
489 // (03)Signal digitization (w/ 12ns interval for method-0)
490 //===============
491 for (uint i = 0; i < c_NTC; i++) {
492 TCDigiE[i].assign(c_NSamplingDigi02, 0);
493 TCDigiT[i].assign(c_NSamplingDigi02, 0);
494 }
495 double cut_energy_tot = 0.03; // [GeV]
496 int nbin_pedestal = 100;
497 float fam_sampling_interval = 12; // [ns]
498
499 std::vector< std::vector<float> > TCDigiEnergy(c_NTC, std::vector<float>(c_NSamplingDigi02, 0.0)); // [GeV]
500 std::vector< std::vector<float> > TCDigiTiming(c_NTC, std::vector<float>(c_NSamplingDigi02, 0.0)); // [ns]
501
502 // Make sampling time random between FAM sampling intervals
503 float random_sampling_correction = 0; // [ns]
504 random_sampling_correction = gRandom->Rndm() * fam_sampling_interval;
505 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
506 if (m_TCEnergy_tot[iTCIdm] < cut_energy_tot) {continue;} // TC energy_tot cut
507 for (int iTimeBin = 0; iTimeBin < c_nTimeBins; iTimeBin++) {
508 if (m_TCEnergy[iTCIdm][iTimeBin] < 0.0001) { continue; } // 0.1 MeV cut on TC bin_energy
509 for (int iSampling = 0; iSampling < c_NSamplingDigi02; iSampling++) {
510 // inputTiming is in [us] <-- Be careful, here is NOT [ns]
511 float inputTiming
512 = (-m_TCTiming[iTCIdm][iTimeBin] - m_TimeRange + (-nbin_pedestal + iSampling) * fam_sampling_interval) * 0.001;
513
514 inputTiming += random_sampling_correction * 0.001;
515 if (inputTiming < 0 || inputTiming > 2.0) {continue;} // Shaping in t0 ~t0+ 2.0 us
516
517 TCDigiEnergy[iTCIdm][iSampling] += FADC(0, inputTiming) * m_TCEnergy[iTCIdm][iTimeBin];
518 }
519 }
520 for (int iSampling = 0; iSampling < c_NSamplingDigi02; iSampling++) {
521 TCDigiTiming[iTCIdm][iSampling] = (-nbin_pedestal + iSampling - m_TimeRange / fam_sampling_interval) * fam_sampling_interval;
522 TCDigiTiming[iTCIdm][iSampling] += random_sampling_correction;
523 }
524 }
525 //==================
526 // (03)noise embedding
527 //==================
528
529 double tmin_noise = -4; // original
530 double tgen = 10.3; //
531 int bkg_level = 1030;
532 double ttt0 = 0; // [us]
533 double ttt1 = 0; // [us]
534 double ttt2 = 0; // [us]
535 //double frac_pileup = 0.035; // pileup noise fraction?
536 //double frac_parallel = 0.023; // parallel noise fraction?
537 //double frac_serial = 0.055; // serial noise fraction?
538 //double times_pileup = 1; // noise scale based on Belle noise.
539 //double times_parallel = 1; // noise scale
540 //double times_serial = 1; // noise scale
541 //double corr_pileup = times_pileup * frac_pileup * sqrt(fam_sampling_interval * 0.001);
542 //double corr_parallel = times_parallel * frac_parallel * sqrt(fam_sampling_interval * 0.001);
543 //double corr_serial = times_serial * frac_serial * sqrt(fam_sampling_interval * 0.001);
544 double corr_pileup = 0.011068;
545 double corr_parallel = 0.00727324;
546 double corr_serial = 0.0173925;
547
548
549 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
550 if (m_TCEnergy_tot[iTCIdm] < cut_energy_tot) { continue; } // 1 MeV TC energy cut
551 for (int jjj = 0; jjj < bkg_level; jjj++) {
552 ttt0 = -(tmin_noise + tgen * gRandom->Rndm()); // [us]
553 ttt1 = -(tmin_noise + tgen * gRandom->Rndm()); // [us]
554 ttt2 = -(tmin_noise + tgen * gRandom->Rndm()); // [us]
555 for (int iSampling = 0; iSampling < c_NSamplingDigi02; iSampling++) {
556 // (pile-up noise)
557 if (ttt0 > 0) { TCDigiEnergy[iTCIdm][iSampling] += FADC(0, ttt0) * corr_pileup * 0.001; }
558 // (parallel noise)
559 if (ttt1 > 0) { TCDigiEnergy[iTCIdm][iSampling] += FADC(1, ttt1) * corr_parallel; }
560 // (serial noise)
561 if (ttt2 > 0) { TCDigiEnergy[iTCIdm][iSampling] += FADC(2, ttt2) * corr_serial; }
562 ttt0 += fam_sampling_interval * 0.001;
563 ttt1 += fam_sampling_interval * 0.001;
564 ttt2 += fam_sampling_interval * 0.001;
565 }
566 }
567 }
568
569}
570//
571//
572//
573void
575{
576 //---------------
577 // Root Output
578 //---------------
579 int m_hitNum = 0;
580 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
581 for (int iBinTime = 0; iBinTime < c_nTimeBins; iBinTime++) {
582 if (m_TCEnergy[iTCIdm][iBinTime] < 0.001) {continue;}
583 StoreArray<TRGECLDigi0> TCDigiArray;
584 TCDigiArray.appendNew();
585 m_hitNum = TCDigiArray.getEntries() - 1;
586
587 TCDigiArray[m_hitNum]->setEventId(m_nEvent);
588 TCDigiArray[m_hitNum]->setTCId(iTCIdm + 1);
589 TCDigiArray[m_hitNum]->setiBinTime(iBinTime);
590 TCDigiArray[m_hitNum]->setRawEnergy(m_TCEnergy[iTCIdm][iBinTime]);
591 TCDigiArray[m_hitNum]->setRawTiming(m_TCTiming[iTCIdm][iBinTime]);
592 TCDigiArray[m_hitNum]->setBeamBkgTag(m_TCBeambkgTag[iTCIdm][iBinTime]);
593 }
594 }
595
596 if (m_SaveTCWaveForm == 1) {
597 StoreArray<TRGECLWaveform> TCWaveformArray;
598 for (int iTCIdm = 0; iTCIdm < c_NTC; iTCIdm++) {
599 if (iTCIdm == c_nTimeBins) iTCIdm = 512; // skip barrel
600 int tc_phi_id = m_TCMap->getTCPhiIdFromTCId(iTCIdm + 1);
601 int tc_theta_id = m_TCMap->getTCThetaIdFromTCId(iTCIdm + 1);
602 TRGECLWaveform* newWf =
603 TCWaveformArray.appendNew(iTCIdm + 1, m_WaveForm[iTCIdm]);
604 newWf->setThetaPhiIDs(tc_theta_id, tc_phi_id);
605 }
606
607 }
608
609
610 return;
611}
612//
613//
614//
615double
617{
618 timing = timing * 1000;
619
620 double E_out = 0;
621
622 // m_SignalAmp is sampled every 12 ns up to 2928 ns; nothing to interpolate
623 // outside that range. Excluding the upper edge also keeps endbin in range.
624 if (timing < 0 || timing >= 12.0 * (m_SignalAmp.size() - 1)) {return E_out;}
625
626 const int startbin = (int)(timing) / 12;
627 const int endbin = startbin + 1;
628 // the sampling times are exactly 12 ns * index, so no lookup table is needed
629 const double starttime = 12.0 * startbin;
630 const double endtime = 12.0 * endbin;
631
632 if (timing > starttime) {
633 E_out = ((m_SignalAmp[endbin] - m_SignalAmp[startbin]) / (endtime - starttime)) *
634 (timing - starttime) + m_SignalAmp[startbin];
635 }
636
637 return E_out;
638
639}
640//
641//
642//
643double
645 double timing)
646{
647
648 //--------------------------------------
649 //
650 // o "timing" unit is [us]
651 // o flag_gen = 0(=signal), 1(=parallel), 2(=serial)
652 // o return value(PDF) is [GeV]
653 //
654 //--------------------------------------
655 double tsh, dd;
656 static double tc, tc2, tsc, tris, b1, b2;
657 static double amp, dft, as;
658 static double td, t1, t2;
659
660 static int ifir = 0;
661
662 if (ifir == 0) {
663
664 td = 0.10; // diff time ( 0.10)
665 t1 = 0.10; // integ1 real ( 0.10)
666 b1 = 30.90; // integ1 imag ( 30.90)
667 t2 = 0.01; // integ2 real ( 0.01)
668 b2 = 30.01; // integ2 imag ( 30.01)
669 double ts = 1.00; // scint decay ( 1.00)
670 dft = 0.600; // diff delay ( 0.600)
671 as = 0.548; // diff frac ( 0.548)
672 //
673 amp = 1.0;
674 tris = 0.01;
675 tsc = ts;
676 //
677 int im = 0;
678 int ij = 0;
679 int fm = 0;
680 tc = 0;
681 double tt = u_max(u_max(td, t1), u_max(t2, ts)) * 2;
682 int flag_once = 0;
683 while (flag_once == 0) {
684 double dt = tt / 1000;
685 double tm = 0;
686 for (int j = 1; j <= 1000; j++) {
687 tc2 = tc - dft;
688 double fff =
689 (ShapeF(tc, t1, b1, t2, b2, td, tsc) -
690 ShapeF(tc, t1, b1, t2, b2, td, tris) * 0.01) -
691 (ShapeF(tc2, t1, b1, t2, b2, td, tsc) -
692 ShapeF(tc2, t1, b1, t2, b2, td, tris) * 0.01) * as;
693 if (fff > fm) {
694 fm = fff;
695 tm = tc;
696 im = j;
697 }
698 tc = tc + dt;
699 }
700 if (im >= 1000) {
701 tt = 2 * tt;
702 flag_once = 0;
703 continue;
704 }
705 if (ij == 0) {
706 ij = 1;
707 tc = 0.99 * tm;
708 dt = tm * 0.02 / 1000;
709 flag_once = 0;
710 continue;
711 }
712 flag_once = 1;
713 }
714 amp = 1.0 / fm;
715 ifir = 1;
716 }
717 //
718 //
719 double pdf = 0;
720 if (flag_gen == 0) {
721 //-----<signal>
722 tc2 = timing - dft;
723 pdf = amp * (
724 (ShapeF(timing, t1, b1, t2, b2, td, tsc) -
725 ShapeF(timing, t1, b1, t2, b2, td, tris) * 0.01) -
726 (ShapeF(tc2, t1, b1, t2, b2, td, tsc) -
727 ShapeF(tc2, t1, b1, t2, b2, td, tris) * 0.01) * as);
728 } else if (flag_gen == 1) {
729 //-----<parallel>
730 tc2 = timing - dft;
731 tsh = 0.001;
732 pdf = amp * (
733 ShapeF(timing, t1, b1, t2, b2, td, tsh) -
734 ShapeF(tc2, t1, b1, t2, b2, td, tsh) * as);
735 pdf = pdf * 0.001; // GeV
736 } else {
737 //-----<serial>
738 tc2 = timing - dft;
739 tsh = 0.001;
740 pdf = amp * (
741 ShapeF(timing, t1, b1, t2, b2, td, tsh) -
742 ShapeF(tc2, t1, b1, t2, b2, td, tsh) * as);
743 //
744 tc = timing - 0.01;
745 if (tc < 0) { tc = 0; }
746 dd = timing - tc;
747 tc2 = tc - dft;
748 pdf = (amp * (
749 ShapeF(tc, t1, b1, t2, b2, td, tsh) -
750 ShapeF(tc2, t1, b1, t2, b2, td, tsh) * as) - pdf) / dd;
751 pdf = pdf * 0.001; // GeV
752 }
753
754 return pdf;
755}
756//
757//
758//
759double
761 double t01,
762 double tb1,
763 double t02,
764 double tb2,
765 double td1,
766 double ts1)
767{
768 double dr;
769 double dzna;
770 double das1, das0, dac0;
771 double dcs0s, dsn0s, dcs0d, dsn0d;
772 double dcs1s, dsn1s, dcs1d, dsn1d;
773
774 double sv123 = 0.0;
775 if (t00 < 0) return 0;
776
777 dr = (ts1 - td1) / td1;
778 if (fabs(dr) <= 1.0e-5) {
779 if (ts1 > td1) { ts1 = td1 * 1.00001; }
780 else { ts1 = td1 * 0.99999; }
781 }
782 //
783 dr = (pow((t01 - t02), 2) + pow((tb1 - tb2), 2)) / (pow((t01), 2) + pow((tb1), 2));
784 if (dr <= 1.e-10) {
785 if (t01 < t02) { t01 = t02 / 1.00001; }
786 else { t01 = t02 / 0.99999; }
787 }
788 if (t00 <= 0.0) return 0;
789 //
790 //
791 //
792 double a1 = 1 / t01;
793 double a2 = 1 / tb1;
794 double b1 = 1 / t02;
795 double b2 = 1 / tb2;
796 double c1 = 1 / td1;
797 double c2 = 1 / ts1;
798
799 das0 = b2 * (pow((b1 - a1), 2) + (b2 + a2) * (b2 - a2));
800 dac0 = -2 * (b1 - a1) * a2 * b2;
801 das1 = a2 * (pow((b1 - a1), 2) - (b2 + a2) * (b2 - a2));
802
803 dsn0s = ((c2 - a1) * das0 - (-a2) * dac0) / (pow(a2, 2) + pow((c2 - a1), 2));
804 dcs0s = ((-a2) * das0 + (c2 - a1) * dac0) / (pow(a2, 2) + pow((c2 - a1), 2));
805
806 dsn1s = ((c2 - b1) * das1 - (-b2) * (-dac0)) / (pow(b2, 2) + pow((c2 - b1), 2));
807 dcs1s = ((-b2) * das1 + (c2 - b1) * (-dac0)) / (pow(b2, 2) + pow((c2 - b1), 2));
808
809 dsn0d = ((c1 - a1) * das0 - (-a2) * dac0) / (pow(a2, 2) + pow((c1 - a1), 2));
810 dcs0d = ((-a2) * das0 + (c1 - a1) * dac0) / (pow(a2, 2) + pow((c1 - a1), 2));
811
812 dsn1d = ((c1 - b1) * das1 - (-b2) * (-dac0)) / (pow(b2, 2) + pow((c1 - b1), 2));
813 dcs1d = ((-b2) * das1 + (c1 - b1) * (-dac0)) / (pow(b2, 2) + pow((c1 - b1), 2));
814 //
815 //
816 //
817 dzna = (pow((b1 - a1), 2) + pow((b2 - a2), 2)) * (pow((b1 - a1), 2) + pow((a2 + b2), 2));
818
819 sv123 = (
820 (dcs0s + dcs1s) * exp(-c2 * t00) * (-1) +
821 (dcs0d + dcs1d) * exp(-c1 * t00) +
822 ((dsn0s - dsn0d) * sin(a2 * t00) + (dcs0s - dcs0d) * cos(a2 * t00)) * exp(-a1 * t00) +
823 ((dsn1s - dsn1d) * sin(b2 * t00) + (dcs1s - dcs1d) * cos(b2 * t00)) * exp(-b1 * t00)
824 )
825 / dzna / (1 / c2 - 1 / c1);
826
827 return sv123;
828}
829
830//
831//
832//
833
834
835double
837 double timing)
838{
839
840 //--------------------------------------
841 //
842 // o "timing" unit is [us]
843 // o flag_gen = 0(=signal), 1(=parallel), 2(=serial)
844 // o return value(PDF) is [GeV]
845 // o Generate signal shape using a simplified function.
846 //
847 //
848 //--------------------------------------
849 double tsh, dd;
850 static double tc, tc2, tsc, tris;
851 static double amp, dft, as;
852
853
854 // int im, ij;
855
856 static int ifir = 0;
857
858 if (ifir == 0) {
859
860 const double td = 0.10; // diff time ( 0.10)
861 const double t1 = 0.10; // integ1 real ( 0.10)
862 // b1 = 30.90; // integ1 imag ( 30.90)
863 const double t2 = 0.01; // integ2 real ( 0.01)
864 // b2 = 30.01; // integ2 imag ( 30.01)
865 double ts = 1.00; // scint decay ( 1.00)
866 dft = 0.600; // diff delay ( 0.600)
867 as = 0.548; // diff frac ( 0.548)
868 //
869 amp = 1.0;
870 tris = 0.01;
871 // ts0 = 0.0;
872 tsc = ts;
873 double fm = 0;
874 //
875 int im = 0;
876 int ij = 0;
877 tc = 0;
878 double tt = u_max(u_max(td, t1), u_max(t2, ts)) * 2;
879 int flag_once = 0;
880 while (flag_once == 0) {
881 double dt = tt / 1000;
882
883 double tm = 0;
884 for (int j = 1; j <= 1000; j++) {
885 tc2 = tc - dft;
886 double fff =
887 (ShapeF(tc, tsc) -
888 ShapeF(tc, tris) * 0.01) -
889 (ShapeF(tc2, tsc) -
890 ShapeF(tc2, tris) * 0.01) * as;
891 if (fff > fm) {
892 fm = fff;
893 tm = tc;
894 im = j;
895 }
896 tc = tc + dt;
897 }
898 if (im >= 1000) {
899 tt = 2 * tt;
900 flag_once = 0;
901 continue;
902 }
903 if (ij == 0) {
904 ij = 1;
905 tc = 0.99 * tm;
906 dt = tm * 0.02 / 1000;
907 flag_once = 0;
908 continue;
909 }
910 flag_once = 1;
911 }
912 amp = 1.0 / fm;
913 ifir = 1;
914 }
915 //
916 //
917 double pdf = 0;
918 if (flag_gen == 0) {
919 //-----<signal>
920 tc2 = timing - dft;
921 pdf = amp * (
922 (ShapeF(timing, tsc) -
923 ShapeF(timing, tris) * 0.01) -
924 (ShapeF(tc2, tsc) -
925 ShapeF(tc2, tris) * 0.01) * as);
926 } else if (flag_gen == 1) {
927 //-----<parallel>
928 tc2 = timing - dft;
929 tsh = 0.001;
930 pdf = amp * (
931 ShapeF(timing, tsh) -
932 ShapeF(tc2, tsh) * as);
933 pdf = pdf * 0.001; // GeV
934 } else {
935 //-----<serial>
936 tc2 = timing - dft;
937 tsh = 0.001;
938 pdf = amp * (
939 ShapeF(timing, tsh) -
940 ShapeF(tc2, tsh) * as);
941 //
942 tc = timing - 0.01;
943 if (tc < 0) { tc = 0; }
944 dd = timing - tc;
945 tc2 = tc - dft;
946 pdf = (amp * (
947 ShapeF(tc, tsh) -
948 ShapeF(tc2, tsh) * as) - pdf) / dd;
949 pdf = pdf * 0.001; // GeV
950 }
951
952 return pdf;
953}
954
955
956double TrgEclDigitizer::ShapeF(double t00, double ts1)
957{
958 static const double realNaN = std::numeric_limits<double>::quiet_NaN();
959
960 double dzna;
961 // double das1,das0,dac0;
962 double dcs0s = realNaN, dsn0s = realNaN, dcs0d, dsn0d;
963 double dcs1s = realNaN, dsn1s = realNaN, dcs1d, dsn1d;
964 double a1, a2, b1, b2, c1, c2 = realNaN;
965 double sv123 = 0.0;
966
967 if (t00 <= 0.0) return 0;
968
969
970
971 a1 = 10 ;
972 a2 = 0.0323625 ;
973 b1 = 100;
974 b2 = 0.0333222;
975 c1 = 10;
976
977 if (ts1 == 1) {
978 c2 = 1;
979 dsn0s = -29.9897;
980 dcs0s = -0.08627;
981
982 dsn1s = -2.64784;
983 dcs1s = -0.00285194;
984 }
985 if (ts1 == 0.01) {
986 c2 = 100;
987 dsn0s = 2.999 ;
988 dcs0s = -0.00323517;
989
990 dsn1s = 5.82524;
991 dcs1s = -7866.7;
992 }
993 if (ts1 == 0.001) {
994 c2 = 1000;
995 dsn0s = 0.272636;
996 dcs0s = -0.000204983;
997
998 dsn1s = 0.291262;
999 dcs1s = 0.000204894;
1000 }
1001
1002 dsn0d = -5.998;
1003 dcs0d = -8340.22;
1004
1005 dsn1d = -2.91262;
1006 dcs1d = -0.00323517;
1007 //
1008 //
1009 //
1010 dzna = 6.561e+07;
1011
1012 sv123 = (
1013 (dcs0s + dcs1s) * exp(-c2 * t00) * (-1) +
1014 (dcs0d + dcs1d) * exp(-c1 * t00) +
1015 ((dsn0s - dsn0d) * sin(a2 * t00) + (dcs0s - dcs0d) * cos(a2 * t00)) * exp(-a1 * t00) +
1016 ((dsn1s - dsn1d) * sin(b2 * t00) + (dcs1s - dcs1d) * cos(b2 * t00)) * exp(-b1 * t00)
1017 )
1018 / dzna / (1 / c2 - 1 / c1);
1019
1020 return sv123;
1021}
1022//
1023//
1024//
1025double
1026TrgEclDigitizer::u_max(double aaa, double bbb)
1027{
1028 if (aaa > bbb) { return aaa; }
1029 else { return bbb; }
1030}
1031//
1032//
1033//
Class to store simulated hits which equate to average of ECLSImHit on crystals input for digitization...
Definition ECLHit.h:25
double getTimeAve() const
Get average time.
Definition ECLHit.h:75
int getCellId() const
Get Cell ID.
Definition ECLHit.h:65
double getEnergyDep() const
Get deposit energy.
Definition ECLHit.h:70
ClassECLSimHit - Geant4 simulated hit for the ECL.
Definition ECLSimHit.h:29
int getCellId() const
Get Cell ID.
Definition ECLSimHit.h:86
double getFlightTime() const
Get Flight time from IP.
Definition ECLSimHit.h:101
double getEnergyDep() const
Get Deposit energy.
Definition ECLSimHit.h:106
G4ThreeVector getPosIn() const
Get Position.
Definition ECLSimHit.h:121
The Class for ECL Geometry Parameters.
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.
ROOT::Math::XYZVector GetCrystalPos(int cid)
The Position of crystal.
ROOT::Math::XYZVector GetCrystalVec(int cid)
The direction of crystal.
virtual unsigned short getBackgroundTag() const
Get background tag.
Definition SimHitBase.h:46
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
T * appendNew()
Construct a new T object at the end of the array.
Definition StoreArray.h:247
int getEntries() const
Get the number of objects in the array.
Definition StoreArray.h:216
Example Detector.
void setThetaPhiIDs(int thid, int phid)
Set Theta and Phi Id of TC.
class TrgEclDataBase;
std::array< std::array< double, c_nTimeBins >, c_NTC > m_TCEnergy
TC Energy converted from Xtarl Energy [GeV].
std::array< std::array< double, c_nTimeBins >, c_NTC > m_TCBkgContribution
Beambackground contribution.
virtual ~TrgEclDigitizer()
Destructor.
std::array< float, c_NSamplingDigi01 > m_Xpr
Random parallel noise.
void save(int)
save fitting result into tables
std::array< std::array< double, 64 >, 64 > m_MatrixParallel
Noise Matrix of Parallel and Serial Noise.
void initialize()
Initialize the class.
static constexpr int c_nTimeBins
Numer of time bins.
std::array< std::array< double, c_nTimeBins >, c_NTC > m_TCTiming
TC Timing converted from Xtarl Timing [GeV].
static constexpr int c_NTC
Number of ECL TriggerCells (TC)
std::array< float, c_NSamplingDigi01 > m_noiseParallel
Noise from parallel.
std::array< float, c_NSamplingDigi01 > m_Xsr
Random serial noise.
static constexpr int c_NSamplingDigi02
Numer of sampling points for digitizer02.
double m_WaveForm[c_NTC][c_NSamplingDigi01]
TC Energy converted from Xtarl Energy [GeV].
void digitization01(std::vector< std::vector< double > > &, std::vector< std::vector< double > > &)
fit method, digi with 125ns interval
static constexpr std::array< double, 245 > m_SignalAmp
Normalised FADC signal shape, sampled every 12 ns from 0 to 2928 ns.
std::array< std::array< double, c_nTimeBins >, c_NTC > m_TCSigContribution
Signal contribution.
int m_SaveTCWaveForm
Flag of waveform table.
std::array< std::array< double, c_nTimeBins >, c_NTC > m_TCBeambkgTag
Beambackground tag.
std::array< std::array< double, 60 >, c_NTC > m_TCRawBkgTag
Input Beambackground tag.
std::array< double, c_NTC > m_TCEnergy_tot
TC Energy converted from Xtarl Energy [GeV].
std::array< std::array< double, 64 >, 64 > m_MatrixSerial
Noise Low triangle Matrix of Serial noise.
double interFADC(double)
Faster FADC using interpolation.
void getTCHit()
get TC Hits from Xtal hits Set TC data m_sourceOfTC => 1=ECLHit, 2=ECLSimHit, 3=ECLHit+TRGECLBGTCHit ...
std::array< float, c_NSamplingDigi01 > m_noiseSerial
Noise from serial.
std::array< std::array< double, 60 >, c_NTC > m_TCRawTiming
Input TC timing[ns].
TrgEclDataBase * m_DataBase
Object of DataBase.
double FADC(int, double)
FADC.
double SimplifiedFADC(int, double)
FADC.
std::array< std::array< double, 60 >, c_NTC > m_TCRawEnergy
Input TC energy[GeV].
double u_max(double, double)
Find max value between 2 vals;.
void clear()
Clear all the data fields.
std::array< float, c_NSamplingDigi01 > m_noisePileup
Noise from pileup.
double ShapeF(double, double, double, double, double, double, double)
return shape using FADC function
void digitization02(std::vector< std::vector< double > > &, std::vector< std::vector< double > > &)
original no fit method, digi with 12ns interval
static constexpr int c_nECLCrystals
Numer of time bins.
int m_FADC
Flag of choosing the method of waveform generation function 0: use simplifiedFADC,...
TrgEclMapping * m_TCMap
Object of TC Mapping.
int m_BeambkgTag
Flag of saving beam background tag or not.
int m_sourceOfTC
Which TC source to use.
double m_TimeRange
time range(default : -4000 ~ 4000 ns )
static constexpr int c_NSamplingDigi01
Numer of sampling points for digitizer01.
std::array< double, c_NTC > m_TCTiming_tot
TC Timing converted from Xtarl Timing [GeV].
A class of TC Mapping.
static const double ns
Standard of [time].
Definition Unit.h:48
static const double GeV
Standard of [energy, momentum, mass].
Definition Unit.h:51
static const double realNaN
This collects the B-meson properties in the hadronic B-decays It is used for the Ecms calibration in ...
Abstract base class for different kinds of events.