53 peds_[0].isProfile_ =
true;
71 peds_[1].isProfile_ =
true;
92 for (uint16_t iapv = 0; iapv < 2; iapv++) {
103 cm_[iapv].isProfile_ =
false;
105 cm_[iapv].vNumOfEntries_.resize(
nbins, 0);
106 cm_[iapv].vNumOfEntries_.resize(
nbins, 0);
167 <<
" Unexpected number of digis (" << digis.
data.size()
168 <<
") wrt number of histogram bins (" <<
nBins_ <<
")!";
173 for (uint16_t ibin = 0; ibin <
bins; ibin++) {
179 uint16_t
nbins =
peds_[0].vNumOfEntries_.size();
184 uint16_t napvs =
nbins / 128;
185 std::vector<uint32_t> cm;
189 std::vector<uint16_t>
adc;
190 for (uint16_t iapv = 0; iapv < napvs; iapv++) {
194 for (uint16_t ibin = 0; ibin < 128; ibin++) {
195 if ((iapv * 128) + ibin <
nbins) {
196 adc.push_back(digis.
data[(iapv * 128) + ibin].adc());
200 sort(
adc.begin(),
adc.end());
201 uint16_t
index =
adc.size() % 2 ?
adc.size() / 2 :
adc.size() / 2 - 1;
203 cm[iapv] = static_cast<uint32_t>(
adc[
index]);
207 for (uint16_t ibin = 0; ibin <
nbins; ibin++) {
208 float digiVal = digis.
data[ibin].adc();
210 float diff = digiVal - static_cast<float>(cm[ibin / 128]);
214 if (cm.size() <
cm_.size()) {
216 <<
" Fewer CM values than expected: " << cm.size();
238 <<
" Unexpected number of digis (" << digis.
data.size()
239 <<
") wrt number of histogram bins (" <<
nBins_ <<
")!";
244 for (uint16_t ibin = 0; ibin <
bins; ibin++) {
250 uint16_t
nbins =
peds_[0].vNumOfEntries_.size();
255 uint16_t napvs =
nbins / 128;
256 std::vector<uint32_t> cm;
260 std::vector<uint16_t>
adc;
261 for (uint16_t iapv = 0; iapv < napvs; iapv++) {
264 for (uint16_t ibin = 0; ibin < 128; ibin++) {
265 if ((iapv * 128) + ibin <
nbins) {
266 adc.push_back(digis.
data[(iapv * 128) + ibin].adc());
269 sort(
adc.begin(),
adc.end());
270 uint16_t
index =
adc.size() % 2 ?
adc.size() / 2 :
adc.size() / 2 - 1;
272 cm[iapv] = static_cast<uint32_t>(
adc[
index]);
277 for (uint16_t ibin = 0; ibin <
nbins; ibin++) {
278 float digiVal = digis.
data[ibin].adc();
280 float diff = digiVal - static_cast<float>(cm[ibin / 128]);
284 if (cm.size() <
cm_.size()) {
286 <<
" Fewer CM values than expected: " << cm.size();
293 for (uint16_t ibin = 0; ibin <
bins; ibin++) {
298 std::vector<uint32_t> adcHeader_high;
299 std::vector<uint32_t> adcHeader_low;
301 float threshold_high = (digisAlt.
data[286].adc() + digisAlt.
data[287].adc()) / 4;
302 float threshold_low = 100;
303 int minNumberForHeader = 4;
304 bool goodHeaderFound =
false;
305 int nConsecutiveHigh = 0;
306 adcHeader_high.clear();
307 adcHeader_high.reserve(30);
308 adcHeader_low.clear();
309 adcHeader_low.reserve(30);
311 for (uint16_t ibin = 6; ibin < 11; ibin++) {
312 if (digisAlt.
data[ibin].adc() > threshold_high) {
317 if (nConsecutiveHigh > minNumberForHeader)
318 goodHeaderFound =
true;
319 if (goodHeaderFound ==
false)
321 for (uint16_t ibin = 0; ibin < 30; ibin++) {
322 if (digisAlt.
data[ibin].adc() > threshold_high &&
324 adcHeader_high.push_back(digisAlt.
data[ibin].adc());
326 if (digisAlt.
data[ibin].adc() < threshold_low && goodHeaderFound) {
327 adcHeader_low.push_back(digisAlt.
data[ibin].adc());
330 if (adcHeader_low.empty() || adcHeader_high.empty()) {
333 for (uint16_t
i = 0;
i < adcHeader_low.size();
i++) {
336 for (uint16_t
i = 0;
i < adcHeader_high.size();
i++) {
347 const std::vector<uint16_t>& stripOnCluster) {
357 <<
" Unexpected number of digis (" << digis.
data.size()
358 <<
") wrt number of histogram bins (" <<
nBins_ <<
")!";
363 for (uint16_t ibin = 0; ibin <
bins; ibin++) {
368 uint16_t
nbins =
peds_[0].vNumOfEntries_.size();
372 uint16_t napvs =
nbins / 128;
373 std::vector<uint32_t> cm;
376 std::vector<uint16_t>
adc;
377 for (uint16_t iapv = 0; iapv < napvs; iapv++) {
380 for (uint16_t ibin = 0; ibin < 128; ibin++) {
381 if ((iapv * 128) + ibin <
nbins) {
382 if (
std::find(stripOnCluster.begin(), stripOnCluster.end(), (iapv * 128) + ibin) ==
383 stripOnCluster.end())
384 adc.push_back(digis.
data[(iapv * 128) + ibin].adc());
387 sort(
adc.begin(),
adc.end());
388 uint16_t
index =
adc.size() % 2 ?
adc.size() / 2 :
adc.size() / 2 - 1;
390 cm[iapv] = static_cast<uint32_t>(
adc[
index]);
395 for (uint16_t ibin = 0; ibin <
nbins; ibin++) {
396 if (
std::find(stripOnCluster.begin(), stripOnCluster.end(), ibin) != stripOnCluster.end()) {
399 float digiVal = digis.
data[ibin].adc();
401 float diff = digiVal - static_cast<float>(cm[ibin / 128]);
405 if (cm.size() <
cm_.size()) {
407 <<
" Fewer CM values than expected: " << cm.size();
414 for (uint16_t ibin = 0; ibin <
bins; ibin++) {
418 std::vector<uint32_t> adcHeader_high;
419 std::vector<uint32_t> adcHeader_low;
421 float threshold_high = (digisAlt.
data[286].adc() + digisAlt.
data[287].adc()) / 4;
422 float threshold_low = 120;
423 int minNumberForHeader = 4;
424 bool goodHeaderFound =
false;
425 int nConsecutiveHigh = 0;
426 adcHeader_high.clear();
427 adcHeader_high.reserve(30);
428 adcHeader_low.clear();
429 adcHeader_low.reserve(30);
431 for (uint16_t ibin = 6; ibin < 11; ibin++) {
432 if (digisAlt.
data[ibin].adc() > threshold_high) {
437 if (nConsecutiveHigh > minNumberForHeader)
438 goodHeaderFound =
true;
439 if (goodHeaderFound ==
false)
441 for (uint16_t ibin = 0; ibin < 30; ibin++) {
442 if (digisAlt.
data[ibin].adc() > threshold_high &&
444 adcHeader_high.push_back(digisAlt.
data[ibin].adc());
446 if (digisAlt.
data[ibin].adc() < threshold_low && goodHeaderFound) {
447 adcHeader_low.push_back(digisAlt.
data[ibin].adc());
450 if (adcHeader_low.empty() || adcHeader_high.empty()) {
453 for (uint16_t
i = 0;
i < adcHeader_low.size();
i++) {
456 for (uint16_t
i = 0;
i < adcHeader_high.size();
i++) {
470 for (uint16_t
ii = 0;
ii <
peds_[1].vNumOfEntries_.size(); ++
ii) {
473 float entries =
peds_[1].vNumOfEntries_[
ii];
479 float noise = spread;