10#include <ecl/modules/eclDigitizer/ECLDigitizerModule.h>
13#include <ecl/dataobjects/ECLDigit.h>
14#include <ecl/dataobjects/ECLDsp.h>
15#include <ecl/dataobjects/ECLDspWithExtraMCInfo.h>
16#include <ecl/dataobjects/ECLHit.h>
17#include <ecl/dataobjects/ECLSimHit.h>
18#include <ecl/dataobjects/ECLTrig.h>
19#include <ecl/dataobjects/ECLWaveforms.h>
20#include <ecl/dbobjects/ECLWaveformData.h>
21#include <ecl/digitization/BitStream.h>
22#include <ecl/digitization/ECLCompress.h>
23#include <ecl/digitization/shaperdsp.h>
24#include <ecl/geometry/ECLGeometryPar.h>
25#include <ecl/utility/ECLDspUtilities.h>
28#include <framework/gearbox/Unit.h>
29#include <framework/logging/Logger.h>
30#include <framework/utilities/FileSystem.h>
59 "Flag to use crate trigger times from beam background overlay if there are any (default: false)",
false);
60 addParam(
"Background",
m_background,
"Flag to use the Digitizer configuration with backgrounds (default: false)",
false);
61 addParam(
"Calibration",
m_calibration,
"Flag to use the Digitizer for Waveform fit Covariance Matrix calibration (default: false)",
64 "Flag to take into account energy deposition in photodiodes; Default diode is sensitive detector (default: true)",
true);
65 addParam(
"WaveformMaker",
m_waveformMaker,
"Flag to produce background waveform digits (default: false)",
false);
66 addParam(
"CompressionAlgorithm",
m_compAlgo,
"Waveform compression algorithm (default: 0u)", 0u);
68 addParam(
"HadronPulseShapes",
m_HadronPulseShape,
"Flag to include hadron component in pulse shape construction (default: true)",
72 "If gt 0 value is applied to all crystals for waveform saving threshold. If lt 0 dbobject is used. (GeV)", -1.0);
74 "Flag to store Dsp with extra MC information in addition to normal Dsp (default: false)",
false);
76 "Threshold above with to store Dsp with extra MC information [GeV]",
79 "Use DSP coefficients from the database for the processing. This "
80 "will significantly reduce performance so this option is to be "
81 "used for testing only.",
false);
83 "Use ECLWF{Parameters,AlgoParams,NoiseParams} payloads",
true);
85 "Normalization coefficient for ECL signal shape. "
86 "If positive, use same static value for all ECL channels. "
87 "If negative, calculate dynamically at beginRun().", -1.0);
104 "Hadron pulse shapes for ECL simulations are enabled. Pulse shape simulations use techniques validated with test beam data documented in: S. Longo and J. M. Roney 2018 JINST 13 P03018");
106 B2DEBUG(20,
"Hadron pulse shapes for ECL simulations are disabled.");
110 B2DEBUG(20,
"Diode-crossing pulse shapes for ECL simulations are enabled.");
112 B2DEBUG(20,
"Diode-crossing pulse shapes for ECL simulations are disabled.");
132 double ns_per_tick = 1.0 / (4.0 * ec.
getRF()) * 1e3;
184 B2FATAL(
"ECLDigitizer: Can't initialize eclChannelMapper!");
190 int& m_lar,
int& m_ltr,
int& m_lq,
int& m_chi)
const
198 const short int*
id =
m_idn[t.idn].id;
200 int A0 = (int) * (
id + 0) - 128;
201 int Askip = (int) * (
id + 1) - 128;
203 int Ahard = (int) * (
id + 2);
204 int k_a = (int) * (
reinterpret_cast<const unsigned char*
>(
id) + 26);
205 int k_b = (int) * (
reinterpret_cast<const unsigned char*
>(
id) + 27);
206 int k_c = (int) * (
reinterpret_cast<const unsigned char*
>(
id) + 28);
207 int k_16 = (int) * (
reinterpret_cast<const unsigned char*
>(
id) + 29);
208 int k1_chi = (int) * (
reinterpret_cast<const unsigned char*
>(
id) + 24);
209 int k2_chi = (int) * (
reinterpret_cast<const unsigned char*
>(
id) + 25);
211 int chi_thres = (int) * (
id + 15);
213 int trg_time = ttrig;
215 result = lftda_(
reinterpret_cast<const int*
>(r.f),
reinterpret_cast<const int*
>(r.f1),
reinterpret_cast<const int*
>(r.fg41),
216 reinterpret_cast<const int*
>(r.fg43),
217 reinterpret_cast<const int*
>(r.fg31),
reinterpret_cast<const int*
>(r.fg32),
reinterpret_cast<const int*
>(r.fg33), FitA,
218 trg_time, A0, Ahard, Askip, k_a, k_b, k_c, k_16, k1_chi,
221 std::vector<int> adc(31);
222 for (
int i = 0; i < 31; i++) adc[i] = FitA[i];
227 int ttrig_packed = ttrig / 6 * 8 + ttrig % 6;
233 m_lq = result.quality;
237 int discarded_bits = 0;
238 if ((m_chi & 0x7800000) != 0) {
240 }
else if ((m_chi & 0x0600000) != 0) {
242 }
else if ((m_chi & 0x0180000) != 0) {
244 }
else if ((m_chi & 0x0060000) != 0) {
246 }
else if ((m_chi & 0x0018000) != 0) {
248 }
else if ((m_chi & 0x0006000) != 0) {
250 }
else if ((m_chi & 0x0001800) != 0) {
252 }
else if ((m_chi & 0x0000600) != 0) {
255 if (discarded_bits > 0) {
256 m_chi >>= discarded_bits;
257 m_chi <<= discarded_bits;
267 const double tscale = 2 * trgtick, toff = ec.
s_clock / (2 * ec.
getRF());
277 int cellId = hit.getCellId();
280 double timeOffset = tscale *
m_ttime[id] - toff;
281 double hitE = hit.getEnergyDep() *
m_calib[j].ascale * E2GeV;
282 double hitTimeAve = (hit.getFlightTime() +
m_calib[j].tshift + eclp->
time2sensor(j, hit.getPosition())) * T2us;
284 m_adc[j].energyConversion =
m_calib[j].ascale * E2GeV * 20000;
285 m_adc[j].flighttime += hit.getFlightTime() * hit.getEnergyDep();
286 m_adc[j].timeshift +=
m_calib[j].tshift * hit.getEnergyDep();
287 m_adc[j].timetosensor += eclp->
time2sensor(j, hit.getPosition()) * hit.getEnergyDep();
288 m_adc[j].totalHadronDep += hit.getHadronEnergyDep();
289 m_adc[j].totalDep += hit.getEnergyDep();
292 double hitHadronE = hit.getHadronEnergyDep() *
m_calib[j].ascale * E2GeV;
296 m_adc[j].AddHit(hitE, hitTimeAve + timeOffset,
m_ss[
m_tbl[j].iss]);
303 int cellId = hit.getCellId();
306 double timeOffset = tscale *
m_ttime[id] - toff;
307 double hitE = hit.getEnergyDep() *
m_calib[j].ascale * E2GeV;
308 double hitTimeAve = (hit.getTimeAve() +
m_calib[j].tshift) * T2us;
309 m_adc[j].AddHit(hitE, hitTimeAve + timeOffset,
m_ss[
m_tbl[j].iss]);
317 const double diodeEdep2crystalEdep = E2GeV * (1 / (5000 * 3.6e-6));
319 int cellId = hit.getCellId();
322 double timeOffset = tscale *
m_ttime[id] - toff;
323 double hitE = hit.getEnergyDep() *
m_calib[j].ascale * diodeEdep2crystalEdep;
324 double hitTimeAve = (hit.getTimeAve() +
m_calib[j].tshift) * T2us;
332 a.AddHit(hitE, hitTimeAve + timeOffset,
m_ss[1]);
341 double hitE = 0.1, hitTimeAve = 0.0;
342 for (
int j = 0; j < ec.
m_nch; j++) {
345 double timeOffset = tscale *
m_ttime[id] - toff;
346 m_adc[j].AddHit(hitE, hitTimeAve + timeOffset,
m_ss[
m_tbl[j].iss]);
356 for (
int i = 0; i < ec.
m_nsmp; i++) z[i] = gRandom->Gaus(0, 1);
357 m_noise[
m_tbl[J].inoise].generateCorrelatedNoise(z.data(), AdcNoise.data());
358 for (
int i = 0; i < ec.
m_nsmp; i++) FitA[i] = 20 * AdcNoise[i] + 3000;
368 B2FATAL(
"Unknown compression algorithm: " <<
m_compAlgo);
370 std::vector<int> FitA(ec.
m_nsmp);
372 for (
int j = 0; j < ec.
m_nch; j++) {
375 for (
int i = 0; i < ec.
m_nsmp; i++) {
376 int A = 20000 * a.c[i] + FitA[i];
377 FitA[i] = max(0, min(A, (1 << 18) - 1));
386 std::swap(out.getStore(), wf->
getStore());
395 struct ch_t {
int cell, id;};
398 int j = hit.getCellId() - 1;
411 unsigned int compAlgo = out.getNBits(8);
412 comp = selectAlgo(compAlgo & 0x7f);
414 B2FATAL(
"Unknown compression algorithm: " << compAlgo);
415 isTrigTime = compAlgo >> 7;
417 for (
int i = 0; i < ECL::ECL_CRATES; i++) {
418 unsigned char t = out.getNBits(7);
425 int DeltaT = gRandom->Uniform(0,
double(ec.
m_ntrg) * 0.5);
426 for (
int id = 0;
id < ECL::ECL_CRATES;
id++)
m_ttime[
id] = DeltaT;
430 for (
int id = 0;
id < ECL::ECL_CRATES;
id++) {
433 eclTrig->setTrigId(
id);
434 eclTrig->setTimeTrig(triggerPhase0);
435 eclTrig->setTrigTag(triggerTag0);
444 std::vector<int> FitA(ec.
m_nsmp);
447 for (
int j = 0; j < ec.
m_nch; j++) {
451 if (
m_adc[j].totalDep > 0) {
463 if (a.total < 0.0001)
continue;
467 for (
int i = 0; i < ec.
m_nsmp; i++) {
468 int A = 20000 * a.c[i] + FitA[i];
469 FitA[i] = max(0, min(A, (1 << 18) - 1));
486 if (energyFit >
m_Awave[CellId - 1]) {
488 const auto eclDsp =
m_eclDsps.appendNew();
489 eclDsp->setCellId(CellId);
490 eclDsp->setDspA(FitA.data());
496 eclDspWithExtraMCInfo->setCellId(CellId);
497 eclDspWithExtraMCInfo->setDspA(FitA.data());
498 eclDspWithExtraMCInfo->setEnergyDep(a.totalDep);
499 eclDspWithExtraMCInfo->setHadronEnergyDep(a.totalHadronDep);
500 eclDspWithExtraMCInfo->setFlightTime(a.flighttime);
501 eclDspWithExtraMCInfo->setTimeShift(a.timeshift);
502 eclDspWithExtraMCInfo->setTimeToSensor(a.timetosensor);
503 eclDspWithExtraMCInfo->setEnergyConversion(a.energyConversion * 20000);
507 eclDigit->setCellId(CellId);
508 eclDigit->setAmp(energyFit);
509 eclDigit->setTimeFit(tFit);
510 eclDigit->setQuality(qualityFit);
512 eclDigit->setChi(chi);
513 else eclDigit->setChi(0);
514 for (
const auto& hit : hitmap)
515 if (hit.cell == j) eclDigit->addRelationTo(
m_eclHits[hit.id]);
519 if (eclDigit->getCellId() == DspWithExtraMCInfo.getCellId()) DspWithExtraMCInfo.addRelationTo(eclDigit);
523 if (comp)
delete comp;
534 float photonParsPSD[10];
535 float hadronParsPSD[10];
536 float diodeParsPSD[10];
537 for (
int i = 0; i < 10; i++) {
556 TFile* rootfile =
nullptr;
557 TTree* tree =
nullptr;
558 TTree* tree2 =
nullptr;
559 TTree* tree3 =
nullptr;
562 bool hasChanged =
false;
567 if (!hasChanged)
return;
576 B2DEBUG(150,
"ECLDigitizer: Reading configuration data with background from: " << dataFileName);
579 B2DEBUG(150,
"ECLDigitizer: Reading configuration data without background from: " << dataFileName);
581 assert(! dataFileName.empty());
583 rootfile =
new TFile(dataFileName.c_str(),
"read");
584 tree =
static_cast<TTree*
>(rootfile->Get(
"EclWF"));
585 tree2 =
static_cast<TTree*
>(rootfile->Get(
"EclAlgo"));
586 tree3 =
static_cast<TTree*
>(rootfile->Get(
"EclNoise"));
589 if (tree == 0 || tree2 == 0 || tree3 == 0) B2FATAL(
"Data not found");
593 const int maxncellid = 512;
595 vector<int> cellId(maxncellid);
597 tree->SetBranchAddress(
"ncellId", &ncellId);
598 tree->SetBranchAddress(
"cellId", cellId.data());
600 vector<int> eclWaveformDataTable(ec.
m_nch);
601 for (Long64_t j = 0, jmax = tree->GetEntries(); j < jmax; j++) {
603 assert(ncellId <= maxncellid);
604 for (
int i = 0; i < ncellId; ++i)
605 eclWaveformDataTable[cellId[i] - 1] = j;
607 B2DEBUG(150,
"ECLDigitizer: " << tree->GetEntries() <<
" sets of wave form covariance matrices will be used.");
610 tree2->SetBranchAddress(
"Algopars", &algo);
611 tree2->SetBranchAddress(
"ncellId", &ncellId);
612 tree2->SetBranchAddress(
"cellId", cellId.data());
613 Long64_t jmax2 = tree2->GetEntries();
614 vector<ECLWFAlgoParams> eclWFAlgoParams;
615 eclWFAlgoParams.reserve(jmax2);
616 for (Long64_t j = 0; j < jmax2; j++) {
618 assert(ncellId <= maxncellid);
619 eclWFAlgoParams.push_back(*algo);
620 for (
int i = 0; i < ncellId; ++i)
621 m_tbl[cellId[i] - 1].idn = j;
623 if (algo)
delete algo;
624 B2DEBUG(150,
"ECLDigitizer: " << eclWFAlgoParams.size() <<
" parameter sets of fitting algorithm were read.");
627 tree3->SetBranchAddress(
"NoiseM", &noise);
628 tree3->SetBranchAddress(
"ncellId", &ncellId);
629 tree3->SetBranchAddress(
"cellId", cellId.data());
631 Long64_t jmax3 = tree3->GetEntries();
633 for (Long64_t j = 0; j < jmax3; j++) {
635 assert(ncellId <= maxncellid);
638 for (
int i = 0; i < ec.
m_nch; i++)
642 for (
int i = 0; i < ncellId; ++i)
643 m_tbl[cellId[i] - 1].inoise = j;
646 if (noise)
delete noise;
647 B2DEBUG(150,
"ECLDigitizer: " << eclWFAlgoParams.size() <<
" noise matrices were loaded.");
650 m_idn.resize(eclWFAlgoParams.size());
651 for (
int i = 0, imax = eclWFAlgoParams.size(); i < imax; i++)
654 vector<uint_pair_t> pairIdx;
655 for (
int i = 0; i < ec.
m_nch; i++) {
656 unsigned int wfIdx = eclWaveformDataTable[i];
657 unsigned int algoIdx =
m_tbl[i].idn;
659 vector<uint_pair_t>::iterator ip = find(pairIdx.begin(), pairIdx.end(), p);
660 if (ip != pairIdx.end()) {
661 m_tbl[i].ifunc = ip - pairIdx.begin();
663 m_tbl[i].ifunc = pairIdx.size();
664 pairIdx.push_back(p);
672 tree->SetBranchAddress(
"CovarianceM", &eclWFData);
673 tree->SetBranchStatus(
"ncellId", 0);
674 tree->SetBranchStatus(
"cellId", 0);
677 for (
unsigned int ip = 0; ip < pairIdx.size(); ip++) {
679 tree->GetEntry(p.first);
682 B2DEBUG(150,
"ECLDigitizer: " <<
m_fitparams.size() <<
" fitting crystals groups were created.");
688 m_ss[0].InitSample(MP, 27.7221);
694 for (
int i = 0; i < ec.
m_nch; i++)
m_tbl[i].iss = 0;
698 const double diode_params[] = {0 + 0.5, 0.100002, 0.756483, 0.456153, 0.0729031, 0.3906 / 9.98822, 2.85128, 0.842469, 0.854184, 0.110284};
699 m_ss[1].InitSample(diode_params, 0.9569100 * 9.98822);
701 B2DEBUG(150,
"ECLDigitizer: " <<
m_ss.size() <<
" sampled signal templates were created.");
711 t.id[ 0] = eclWFAlgo.
getlAT() + 128;
712 t.id[ 1] = eclWFAlgo.
getsT() + 128;
713 t.id[ 2] = eclWFAlgo.
gethT();
725 t.ic[12 * 2 + 0] = eclWFAlgo.
getk1();
726 t.ic[12 * 2 + 1] = eclWFAlgo.
getk2();
727 t.ic[13 * 2 + 0] = eclWFAlgo.
getka();
728 t.ic[13 * 2 + 1] = eclWFAlgo.
getkb();
729 t.ic[14 * 2 + 0] = eclWFAlgo.
getkc();
730 t.ic[14 * 2 + 1] = eclWFAlgo.
gety0s() - 16;
733 t.id[15] = eclWFAlgo.
getcT();
742 vector<double> MP(10);
748 int ia = 1 << eclWFAlgo.
getka();
749 int ib = 1 << eclWFAlgo.
getkb();
750 int ic = 1 << eclWFAlgo.
getkc();
752 double dbl_f [192][16];
753 double dbl_f1 [192][16];
754 double dbl_fg31[192][16];
755 double dbl_fg32[192][16];
756 double dbl_fg33[192][16];
757 double dbl_fg41[24][16];
758 double dbl_fg43[24][16];
771 double unitscale = 1.0;
782 double g0g0 = 0, g0g1 = 0, g1g1 = 0, g0g2 = 0, g1g2 = 0, g2g2 = 0;
783 double sg0[16], sg1[16], sg2[16];
784 for (
int j = 0; j < 16; j++) {
785 double g0 = 0, g1 = 0, g2 = 0;
786 for (
int i = 0; i < 16; i++) {
787 if (fm < f[i].first) fm = f[i].first;
788 g0 += ssd[j][i] * f[i].first;
789 g1 += ssd[j][i] * f[i].second;
792 g0g0 += g0 * f[j].first;
793 g0g1 += g1 * f[j].first;
794 g1g1 += g1 * f[j].second;
803 double a00 = g1g1 * g2g2 - g1g2 * g1g2;
804 double a11 = g0g0 * g2g2 - g0g2 * g0g2;
805 double a22 = g0g0 * g1g1 - g0g1 * g0g1;
806 double a01 = g1g2 * g0g2 - g0g1 * g2g2;
807 double a02 = g0g1 * g1g2 - g1g1 * g0g2;
808 double a12 = g0g1 * g0g2 - g0g0 * g1g2;
810 double igg2 = 1 / (a11 * g1g1 + g0g1 * a01 + g1g2 * a12);
813 const double isd = 3. / 4., sd = 1 / isd ;
814 for (
int i = 0; i < 16; i++) {
815 double w = i ? 1.0 : 1. / 16.;
817 dbl_f [k][i] = (f[i].first * iff * w);
818 dbl_f1 [k][i] = (f[i].second * iff * w * sd);
820 double fg31 = (a00 * sg0[i] + a01 * sg1[i] + a02 * sg2[i]) * igg2;
821 double fg32 = (a01 * sg0[i] + a11 * sg1[i] + a12 * sg2[i]) * igg2;
822 double fg33 = (a02 * sg0[i] + a12 * sg1[i] + a22 * sg2[i]) * igg2;
824 dbl_fg31[k][i] = (fg31 * ia * w);
825 dbl_fg32[k][i] = (fg32 * ib * w * isd);
826 dbl_fg33[k][i] = (fg33 * ic * w);
830 int jk = 23 + ((48 - k) >> 2);
831 if (jk >= 0 && jk < 24 && (48 - k) % 4 == 0) {
833 double igg1 = 1 / a11;
835 for (
int i = 0; i < 16; i++) {
836 double w = i ? 1.0 : 1. / 16.;
838 double fg41 = (g2g2 * sg0[i] - g0g2 * sg2[i]) * igg1;
839 double fg43 = (g0g0 * sg2[i] - g0g2 * sg0[i]) * igg1;
840 dbl_fg41[jk][i] = (fg41 * ia * w);
841 dbl_fg43[jk][i] = (fg43 * ic * w);
848 for (
int k = 0; k < 2 * ec.
m_ndt; k++) {
849 for (
int j = 0; j < 16; j++) {
850 ref_f [k][j] = lrint(dbl_f [k][j] / fm);
851 ref_f1 [k][j] = lrint(dbl_f1 [k][j] / fm);
852 ref_fg31[k][j] = lrint(dbl_fg31[k][j] * fm);
853 ref_fg32[k][j] = lrint(dbl_fg32[k][j] * fm);
854 ref_fg33[k][j] = lrint(dbl_fg33[k][j]);
855 if (k >= 24)
continue;
856 ref_fg41[k][j] = lrint(dbl_fg41[k][j] * fm);
857 ref_fg43[k][j] = lrint(dbl_fg43[k][j]);
int m_ADCThreshold
ADC threshold for wavefom fits.
std::vector< calibration_t > m_calib
Storage for calibration constants.
double m_unitscale
Normalization coefficient for ECL signal shape.
StoreArray< ECLDsp > m_eclDsps
Generated waveforms.
void callbackHadronSignalShapes()
callback hadron signal shapes from database
void shapeSignals()
Emulate response of energy deposition in a crystal and attached photodiode and make waveforms.
ECL::ECLChannelMapper m_eclMapper
Channel Mapper.
DBObjPtr< TTree > m_algoParameters
Shape fitting algorithm parameters.
StoreObjPtr< ECLWaveforms > m_eclWaveforms
Compressed waveforms.
std::vector< algoparams_t > m_idn
Fit algorithm parameters shared by group of crystals.
StoreArray< ECLHit > m_eclDiodeHits
Diode hits array.
std::pair< unsigned int, unsigned int > uint_pair_t
a pair of unsigned ints
bool m_dspDataTest
DSP data usage flag.
std::vector< fitparams_t > m_fitparams
Pairs of (waveform parameters, fit parameters)
virtual void initialize() override
Initialize variables.
virtual void event() override
Actual digitization of all hits in the ECL.
double m_WaveformThresholdOverride
If gt 0, value will override ECL_FPGA_StoreWaveform and apply value (in GeV) as threshold for all cry...
DBObjPtr< ECLCrystalCalib > m_CrateTimeOffset
Crate time offset.
DBObjPtr< TTree > m_waveformParameters
CellID-specific signal shapes.
double m_DspWithExtraMCInfoThreshold
Energy threshold above which to store DSPs with extra information.
StoreArray< ECLTrig > m_eclTrigs
Trigger information.
DBObjPtr< ECLCrystalCalib > m_MCTimeOffset
MC time offset.
StoreArray< ECLSimHit > m_eclSimHits
SimHits array.
bool m_background
Module parameters.
StoreArray< ECLDigit > m_eclDigits
Output Arrays.
void getfitparams(const ECLWaveformData &, const ECLWFAlgoParams &, fitparams_t &)
load waveform fit parameters for the shapeFitter function
void shapeFitterWrapper(const int j, const int *FitA, const int m_ttrig, int &m_lar, int &m_ltr, int &m_lq, int &m_chi) const
function wrapper for waveform fit
std::vector< double > m_Awave
Storage for waveform saving thresholds.
DBObjPtr< ECLCrystalCalib > m_CrystalElectronicsTime
Crystal electronics time.
std::vector< signalsample_t > m_ss_HadronShapeSimulations
tabulated shape line for hadron shape simulations
fitparams_t::int_array_192x16_t int_array_192x16_t
weighting coefficients for time and amplitude calculation
DBObjPtr< ECLCrystalCalib > m_CrystalElectronics
Crystal electronics.
virtual void beginRun() override
Nothing so far.
unsigned int m_compAlgo
compression algorithm for background waveforms
bool m_HadronPulseShape
hadron pulse shape flag
DBObjPtr< ECLCrystalCalib > m_CrystalEnergy
Crystal energy.
ECL::EclConfiguration::adccounts_t adccounts_t
ADC counts.
bool m_trigTime
Use trigger time from beam background overlay.
std::vector< crystallinks_t > m_tbl
Lookup table for ECL channels.
std::vector< adccounts_t > m_adc
Storage for adc hits from entire calorimeter (8736 crystals)
ECLDigitizerModule()
Constructor.
StoreArray< ECLDspWithExtraMCInfo > m_eclDspsWithExtraMCInfo
Generated waveforms with extra MC information.
StoreArray< ECLHit > m_eclHits
Hits array.
bool m_useWaveformParameters
If true, use m_waveformParameters, m_algoParameters, m_noiseParameters.
~ECLDigitizerModule() override
Destructor.
DBObjPtr< ECLCrystalCalib > m_FPGAWaveform
FPGA waveform.
bool m_calibration
calibration flag
bool m_storeDspWithExtraMCInfo
DSP with extra info flag.
unsigned char m_ttime[ECL::ECL_CRATES]
storage for trigger time in each ECL.
DBObjPtr< TTree > m_noiseParameters
Electronics noise covariance matrix.
bool m_loadOnce
Always load waveform parameters at least once.
std::vector< ECLNoiseData > m_noise
parameters for correlated noise simulation
DBObjPtr< ECLDigitWaveformParametersForMC > m_waveformParametersMC
Hadron signal shapes.
void repack(const ECLWFAlgoParams &, algoparams_t &)
repack waveform fit parameters from ROOT format to plain array of unsigned short for the shapeFitter ...
ECL::EclConfiguration::fitparams_t fitparams_t
fit parameters
fitparams_t::int_array_24x16_t int_array_24x16_t
weighting coefficients amplitude calculation.
void makeWaveforms()
Produce and compress waveforms for beam background overlay.
bool m_waveformMaker
produce only waveform digits
StoreObjPtr< EventMetaData > m_EventMetaData
Event metadata.
void readDSPDB()
read Shaper-DSP data from root file
void makeElectronicNoiseAndPedestal(int j, int *FitA)
fill the waveform array FitA by electronic noise and bias it for channel J [0-8735]
std::string m_eclWaveformsName
name of background waveforms storage
ECL::EclConfiguration::algoparams_t algoparams_t
algorithm parameters
DBObjPtr< ECLCrystalCalib > m_CrystalTimeOffset
Crystal time offset.
bool m_inter
internuclear counter effect
std::vector< signalsample_t > m_ss
tabulated shape line
Container for constant matrix used to generate electronic noise.
Container for constant parameters used in waveform fits.
int getkc() const
getter for multipliers power of 2 for fg33,fg43
int getlAT() const
getter for the threshold to calculate time
int getsT() const
getter for the threshold to send data to collector
int getcT() const
getter for the chi2 threshold for quality bit
int getk1() const
getter for the multipliers power of 2 for f
int getk2() const
getter for multipliers power of 2 for chi2 calculation
int getkb() const
getter for multipliers power of 2 for fg32
int gethT() const
getter for the hardware threshold
int gety0s() const
getter for the start point for pedestal calculation
int getka() const
getter for multipliers power of 2 for fg31 fg41
Abstract class (interface) for ECL waveform compression/decompression to/from the BitStream storage.
virtual void uncompress(BitStream &in, int *adc)=0
Decompress the ECL waveform.
virtual void compress(BitStream &out, const int *adc)=0
Compress the ECL waveform.
static ECLShapeFit shapeFitter(int cid, const std::vector< int > &adc, int ttrig, bool adjusted_timing=true)
Emulate shape fitting algorithm from ShaperDSP using algorithm from ecl/utility/src/ECLDspEmulator....
The Class for ECL Geometry Parameters.
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.
double time2sensor(int cid, const G4ThreeVector &hit_pos)
function to calculate flight time to diode sensor
Singleton class to hold the ECL configuration.
static constexpr double m_step
time between points in internal units t_{asrto}*m_rf/2.
static constexpr double s_clock
digitization clock in RF units
static EclConfiguration & get()
return this instance
static constexpr int m_nch
total number of electronic channels (crystals) in calorimeter
void setBackground(bool val)
set the background flag
static double getRF()
See m_rf.
static constexpr int m_ntrg
number of trigger counts per ADC clock tick
static constexpr int m_ndt
number of points per ADC tick where signal fit procedure parameters are evaluated
static constexpr int m_nsmp
number of ADC measurements for signal fitting
Class include function that calculate electronic response from energy deposit.
void fillvector(std::vector< double > &) const
fill vector with response function values and its derivative
void settimeseed(double)
set initial time
void settimestride(double)
set grid step for function calculation
void nextseed()
substruct toffset to tzero
void setseedoffset(double)
set timeoffset
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
static const double us
[microsecond]
static const double GeV
Standard of [energy, momentum, mass].
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
const int c_NCrystals
Number of crystals.
Abstract base class for different kinds of events.
calibration constants per channel
Indices in arrays with info on ECL channels.
ShaperDSP fit results from _lftda function.