28 noiseHandle_(nullptr) {}
123 uint16_t
min = 0x3FF;
129 uint16_t numzeroes = 0, numsats = 0;
131 if (iDigi == endChannelDigis)
134 for (; iDigi != endChannelDigis; ++iDigi) {
135 const uint16_t
val = iDigi->adc();
147 if (!channelDigis.
empty())
152 const uint16_t
threshold = static_cast<uint16_t>((2.0 * static_cast<double>(
max -
min)) / 3.0);
156 LogDebug(
"SiStripSpyUtilities") <<
"Channel with key: " << lFrame.
detId <<
" Min: " <<
min <<
" Max: " <<
max
159 if (numzeroes > 0 || numsats > 0) {
160 edm::LogWarning(
"SiStripSpyUtilities") <<
"Channel with key: " << lFrame.
detId <<
" has " << numzeroes
161 <<
" zero and " << numsats <<
" saturated samples.";
182 return static_cast<uint16_t>((2.0 * static_cast<double>(
range(aFrame))) / 3.0);
196 uint16_t& aFirstHeaderBit,
198 std::vector<uint16_t> lFirstBitVec;
199 lFirstBitVec.reserve(aInputDigis->
size());
203 for (; lDigis != aInputDigis->
end(); lDigis++) {
209 aFirstHeaderBit = lMaj.first;
210 uint32_t lMajorityCounter = lMaj.second;
216 LogInfo(
"SiStripSpyUtilities") <<
" -- Found majority position of first header (trailer) bit: " << aFirstHeaderBit
217 <<
" (" << lFirstTrailerBit <<
") for " << lMajorityCounter <<
" out of "
218 << lFirstBitVec.size() <<
" channels." << std::endl;
224 const uint16_t aExpectedPos) {
227 if (lRange < aQuality.minDigiRange || lRange > aQuality.
maxDigiRange) {
235 else if (aExpectedPos > 0 && (!(aFrame.
firstHeaderBit == aExpectedPos &&
248 uint8_t aboveThreshold = 0;
249 bool foundHeader =
false;
255 for (; iDigi != endChannelDigis; ++iDigi) {
261 if (aboveThreshold == 6) {
269 if (foundHeader &&
count < 5)
279 uint8_t aboveThreshold = 0;
280 bool foundTrailer =
false;
293 for (; iDigi != endChannelDigis; ++iDigi) {
299 if (aboveThreshold == 2) {
307 if (foundTrailer &&
count < 1)
317 const uint16_t aFirstBits) {
319 uint16_t
count = aFirstBits + 22;
321 std::pair<bool, bool> lPair = std::pair<bool, bool>(
false,
false);
331 if (iDigi == endChannelDigis)
339 if (iDigi == endChannelDigis)
340 return std::pair<bool, bool>(
false,
false);
351 const uint16_t aFirstBits) {
353 uint16_t
count = aFirstBits + 6;
354 std::pair<uint8_t, uint8_t> lPair = std::pair<uint8_t, uint8_t>(0, 0);
364 if (iDigi == endChannelDigis)
367 for (uint8_t
i = 0;
i < 16; ++
i) {
371 lPair.first |= (0x80 >> static_cast<uint8_t>(
i / 2));
373 lPair.second |= (0x80 >> static_cast<uint8_t>(
i / 2));
382 std::ostringstream lOs;
383 lOs <<
" ------------------------------------------------------" << std::endl
384 <<
" -- Error: " << aErr << std::endl
385 <<
" ------- Printing Frame for detId " << aFrame.
detId <<
" --------" << std::endl
388 <<
" -- digitalLow = " << aFrame.
digitalLow << std::endl
389 <<
" -- digitalHigh = " << aFrame.
digitalHigh << std::endl
390 <<
" -- baseline = " << aFrame.
baseline << std::endl
392 <<
" -- apvAddresses = " << static_cast<uint16_t>(aFrame.
apvAddress.first) <<
" "
393 << static_cast<uint16_t>(aFrame.
apvAddress.second) << std::endl
394 <<
" ------------------------------------------------------" << std::endl;
410 uint32_t lTot =
values.size();
412 return std::pair<uint16_t, uint32_t>(0, 0);
415 uint32_t lMajorityCounter = 0;
418 std::vector<uint16_t>::iterator lIter =
values.begin();
419 for (; lIter !=
values.end();) {
421 if (lCounter > lMajorityCounter) {
422 lMajorityCounter = lCounter;
430 if (static_cast<float>(lMajorityCounter) / lTot < 0.5) {
431 LogError(
"SiStripSpyUtilities") <<
" -- Found majority position for index " << aFedId <<
": " << lMaj
432 <<
" for less than half the values : " << lMajorityCounter <<
" out of " << lTot
433 <<
" values." << std::endl;
436 return std::pair<uint16_t, uint32_t>(lMaj, lMajorityCounter);
440 std::vector<uint32_t>& fedMajoritiesToFill) {
441 std::map<uint32_t, uint32_t>::const_iterator lMapIter = channelValues.begin();
442 uint16_t lPreviousFedId = 0;
443 std::vector<uint16_t> lAddrVec;
446 uint32_t lChCount = 0;
448 for (; lMapIter != channelValues.end(); ++lMapIter, ++lChCount) {
451 if (lPreviousFedId == 0) {
452 lPreviousFedId = lFedId;
454 if (lFedId == lPreviousFedId) {
455 lAddrVec.push_back(lMapIter->second);
457 if (lFedId != lPreviousFedId || (lChCount == channelValues.size() - 1)) {
461 fedMajoritiesToFill[lPreviousFedId] = lMaj;
466 if (lFedId != lPreviousFedId) {
467 lAddrVec.push_back(lMapIter->second);
468 lPreviousFedId = lFedId;