69void PedestalData::fill(gsl::span<const PedestalDigit>
digits)
74 uint16_t solarId = d.getSolarId();
75 uint8_t dsId = d.getDsId();
76 uint8_t channel = d.getChannel();
78 auto iPedestal = mPedestals.find(solarId);
80 if (iPedestal == mPedestals.end()) {
81 auto iPedestalsNew = mPedestals.emplace(std::make_pair(solarId, initPedestalMatrix(solarId)));
82 iPedestal = iPedestalsNew.first;
85 if (iPedestal == mPedestals.end()) {
86 LOGP(fatal,
"failed to insert new element in padestals map");
90 auto& ped = iPedestal->second[dsId][channel];
92 for (uint16_t
i = 0;
i < d.nofSamples();
i++) {
93 auto s = d.getSample(
i);
96 uint64_t N = ped.mEntries;
98 double p0 = ped.mPedestal;
99 double p = p0 + (s - p0) / N;
102 double M0 = ped.mVariance;
103 double M = M0 + (s - p0) * (s - p);
108 LOGP(info,
"solarId {} dsId {} ch {} nsamples {} entries{} mean {} variance {}",
109 (
int)solarId, (
int)dsId, (
int)channel, d.nofSamples(), ped.mEntries, ped.mPedestal, ped.mVariance);