CMS 3D CMS Logo

Classes | Public Member Functions | Static Public Member Functions | Private Attributes

sistrip::SpyUtilities Class Reference

#include <SiStripSpyUtilities.h>

List of all members.

Classes

struct  Frame
struct  FrameQuality

Public Member Functions

const SiStripFedCablinggetCabling (const edm::EventSetup &)
 Updates the cabling object from the DB.
const SiStripDetCablinggetDetCabling (const edm::EventSetup &)
 Updates the det cabling object from the DB.
edm::ESHandle< SiStripNoisesgetNoiseHandle (const edm::EventSetup &eventSetup)
edm::ESHandle< SiStripPedestalsgetPedestalHandle (const edm::EventSetup &eventSetup)
 SpyUtilities ()
 ~SpyUtilities ()

Static Public Member Functions

static const uint8_t extractAPVaddress (const Frame &aFrame)
static const Frame extractFrameInfo (const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, bool aPrintDebug=false)
static void fedIndex (uint32_t aFedIndex, uint16_t &aFedId, uint16_t &aFedChannel)
static void fillFEDMajorities (const std::map< uint32_t, uint32_t > &channelValues, std::vector< uint32_t > &fedMajoritiesToFill)
static const std::pair
< uint8_t, uint8_t > 
findAPVAddresses (const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold, const uint16_t aFirstBits)
static const std::pair< bool,
bool > 
findAPVErrorBits (const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold, const uint16_t aFirstBits)
static const uint16_t findHeaderBits (const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold)
static std::pair< uint16_t,
uint32_t > 
findMajorityValue (std::vector< uint16_t > &values, const uint16_t aFedId=0)
static const uint16_t findTrailerBits (const edm::DetSetVector< SiStripRawDigi >::detset &channelDigis, const uint16_t threshold)
static void getMajorityHeader (const edm::DetSetVector< SiStripRawDigi > *aInputDigis, uint16_t &firstHeaderBit, bool printResult=true)
static const bool isValid (const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
static std::string print (const Frame &aFrame, std::string aErr)
static const uint16_t range (const Frame &aFrame)
static const uint16_t threshold (const Frame &aFrame)

Private Attributes

const SiStripFedCablingcabling_
 The cabling object.
uint32_t cacheId_
 DB cache ID used to establish if the cabling has changed during the run.
uint32_t cacheIdDet_
 DB cache ID used to establish if the cabling has changed during the run.
const SiStripDetCablingdetCabling_
 The cabling object.
uint32_t noiseCacheId_
edm::ESHandle< SiStripNoisesnoiseHandle_
uint32_t pedsCacheId_
edm::ESHandle< SiStripPedestalspedsHandle_

Detailed Description

Definition at line 25 of file SiStripSpyUtilities.h.


Constructor & Destructor Documentation

sistrip::SpyUtilities::SpyUtilities ( )

Definition at line 21 of file SiStripSpyUtilities.cc.

sistrip::SpyUtilities::~SpyUtilities ( )

Definition at line 34 of file SiStripSpyUtilities.cc.

References cabling_, and detCabling_.

  {
    if ( cabling_ ) cabling_ = 0;
    if ( detCabling_ ) detCabling_ = 0;
  }

Member Function Documentation

const uint8_t sistrip::SpyUtilities::extractAPVaddress ( const Frame aFrame) [static]

Definition at line 196 of file SiStripSpyUtilities.cc.

References sistrip::SpyUtilities::Frame::apvAddress, and sistrip::SpyUtilities::Frame::apvErrorBit.

  {

    if (aFrame.apvErrorBit.first == false) return aFrame.apvAddress.first;
    else if (aFrame.apvErrorBit.second == false) {
      return aFrame.apvAddress.second;
    }
    else {
      return 0;
    }
    
  }
const SpyUtilities::Frame sistrip::SpyUtilities::extractFrameInfo ( const edm::DetSetVector< SiStripRawDigi >::detset &  channelDigis,
bool  aPrintDebug = false 
) [static]

Definition at line 121 of file SiStripSpyUtilities.cc.

References sistrip::SpyUtilities::Frame::apvAddress, sistrip::SpyUtilities::Frame::apvErrorBit, sistrip::SpyUtilities::Frame::baseline, edm::DetSet< T >::begin(), edm::DetSet< T >::detId(), sistrip::SpyUtilities::Frame::detId, sistrip::SpyUtilities::Frame::digitalHigh, sistrip::SpyUtilities::Frame::digitalLow, edm::DetSet< T >::end(), findAPVAddresses(), findAPVErrorBits(), findHeaderBits(), findTrailerBits(), sistrip::SpyUtilities::Frame::firstHeaderBit, sistrip::SpyUtilities::Frame::firstTrailerBit, max(), min, edm::DetSet< T >::size(), and threshold().

Referenced by SiStripSpyMonitorModule::analyze(), sistrip::SpyDigiConverter::extractPayloadDigis(), and getMajorityHeader().

  {

    SpyUtilities::Frame lFrame;
    lFrame.detId = channelDigis.detId();
    lFrame.firstHeaderBit = 0;
    lFrame.firstTrailerBit = 0;
    lFrame.digitalLow = 0;
    lFrame.digitalHigh = 0;
    lFrame.baseline = 0;
    lFrame.apvErrorBit.first = false;
    lFrame.apvErrorBit.second = false;
    lFrame.apvAddress.first = 0;
    lFrame.apvAddress.second = 0;

    uint16_t min = 0x3FF;
    uint16_t max = 0;
    edm::DetSetVector<SiStripRawDigi>::detset::const_iterator iDigi = channelDigis.begin();
    const edm::DetSetVector<SiStripRawDigi>::detset::const_iterator endChannelDigis = channelDigis.end();

    //counters for outputting warnings
    uint16_t numzeroes = 0, numsats = 0;

    if (iDigi == endChannelDigis) return lFrame;

    for (; iDigi != endChannelDigis; ++iDigi) {
      const uint16_t val = iDigi->adc();
      if (val < min) min = val;
      if (val > max) max = val;
      if (val==0)     numzeroes++;
      if (val==0x3FF) numsats++;
      lFrame.baseline += val;
    }

    if (channelDigis.size()>0) lFrame.baseline = lFrame.baseline/channelDigis.size();
    lFrame.digitalLow = min;
    lFrame.digitalHigh = max;

    const uint16_t threshold = static_cast<uint16_t>( (2.0 * static_cast<double>(max-min)) / 3.0 );

    if (aPrintDebug){
//       if ( edm::isDebugEnabled() ) {
//      LogDebug("SiStripSpyUtilities") << "Channel with key: " << lFrame.detId
//                                      << " Min: " << min << " Max: " << max
//                                      << " Range: " << (max-min) << " Threshold: " << threshold;
//       }
      if (numzeroes>0 || numsats>0) {
        edm::LogWarning("SiStripSpyUtilities") << "Channel with key: " << lFrame.detId << " has "
                                               << numzeroes << " zero and "
                                               << numsats   << " saturated samples.";
      }
    }

    lFrame.firstHeaderBit = findHeaderBits(channelDigis,threshold);
    lFrame.firstTrailerBit = findTrailerBits(channelDigis,threshold);

    lFrame.apvErrorBit = findAPVErrorBits(channelDigis,threshold,lFrame.firstHeaderBit);
    lFrame.apvAddress = findAPVAddresses(channelDigis,threshold,lFrame.firstHeaderBit);
  
    return lFrame;
 
  }
void sistrip::SpyUtilities::fedIndex ( uint32_t  aFedIndex,
uint16_t &  aFedId,
uint16_t &  aFedChannel 
) [static]

Definition at line 433 of file SiStripSpyUtilities.cc.

References sistrip::FED_ID_MAX, sistrip::FED_ID_MIN, sistrip::FEDCH_PER_FED, and sistrip::invalid_.

Referenced by sistrip::FEDEmulatorModule::produce().

                                                     {

    //find the corresponding detId (for the pedestals)
    aFedId = static_cast<uint16_t>(aFedIndex/sistrip::FEDCH_PER_FED);
    aFedChannel = static_cast<uint16_t>(aFedIndex%sistrip::FEDCH_PER_FED);
  
    if (aFedId < sistrip::FED_ID_MIN ||
        aFedId > sistrip::FED_ID_MAX ||
        aFedChannel >= sistrip::FEDCH_PER_FED ) { 
      aFedId = sistrip::invalid_;
      aFedChannel = sistrip::invalid_;
    }

  }
void sistrip::SpyUtilities::fillFEDMajorities ( const std::map< uint32_t, uint32_t > &  channelValues,
std::vector< uint32_t > &  fedMajoritiesToFill 
) [static]

Definition at line 485 of file SiStripSpyUtilities.cc.

References sistrip::FED_ID_MAX, sistrip::FED_ID_MIN, sistrip::FEDCH_PER_FED, and findMajorityValue().

  {

    std::map<uint32_t,uint32_t>::const_iterator lMapIter = channelValues.begin();
    uint16_t lPreviousFedId = 0;
    std::vector<uint16_t> lAddrVec;
    lAddrVec.reserve(sistrip::FEDCH_PER_FED);
    fedMajoritiesToFill.resize(sistrip::FED_ID_MAX-sistrip::FED_ID_MIN+1,0);
    uint32_t lChCount = 0;

    for ( ; lMapIter != channelValues.end(); ++lMapIter,++lChCount){

      uint16_t lFedId = static_cast<uint16_t>(lMapIter->first/sistrip::FEDCH_PER_FED);

      if (lPreviousFedId == 0) {
        lPreviousFedId = lFedId;
      }
      if (lFedId == lPreviousFedId) {
        lAddrVec.push_back(lMapIter->second);
      }
      if (lFedId != lPreviousFedId || (lChCount == channelValues.size()-1)) {
        //extract majority address

        uint32_t lMaj = sistrip::SpyUtilities::findMajorityValue(lAddrVec,lPreviousFedId).first;
        fedMajoritiesToFill[lPreviousFedId] = lMaj;

        lAddrVec.clear();
        
        //if new fed, fill the first channel
        if (lFedId != lPreviousFedId) {
          lAddrVec.push_back(lMapIter->second);
          lPreviousFedId = lFedId;
        }

      }
    }

  }
const std::pair< uint8_t, uint8_t > sistrip::SpyUtilities::findAPVAddresses ( const edm::DetSetVector< SiStripRawDigi >::detset &  channelDigis,
const uint16_t  threshold,
const uint16_t  aFirstBits 
) [static]

Definition at line 376 of file SiStripSpyUtilities.cc.

References edm::DetSet< T >::begin(), prof2calltree::count, edm::DetSet< T >::end(), i, sistrip::SPY_SAMPLES_PER_CHANNEL, and threshold().

Referenced by extractFrameInfo().

  {
  
    // Loop over digis looking for firstHeader+6
    uint16_t count = aFirstBits+6;
    std::pair<uint8_t,uint8_t> lPair = std::pair<uint8_t,uint8_t>(0,0);

    //check enough room to have 16 values....
    if (count >= sistrip::SPY_SAMPLES_PER_CHANNEL-15) return lPair;

    edm::DetSetVector<SiStripRawDigi>::detset::const_iterator iDigi = channelDigis.begin()+count;
    const edm::DetSetVector<SiStripRawDigi>::detset::const_iterator endChannelDigis = channelDigis.end();

    //double check....
    if (iDigi == endChannelDigis) return lPair;

    for (uint8_t i = 0; i < 16; ++i) {
      if ( iDigi->adc() > threshold) {
        //data is MSB first
        if (i%2==0)
          lPair.first |= (0x80 >> static_cast<uint8_t>(i/2));
        else 
          lPair.second |= (0x80 >> static_cast<uint8_t>(i/2));
      }
      ++iDigi;
    }

    return lPair;

  }
const std::pair< bool, bool > sistrip::SpyUtilities::findAPVErrorBits ( const edm::DetSetVector< SiStripRawDigi >::detset &  channelDigis,
const uint16_t  threshold,
const uint16_t  aFirstBits 
) [static]

Definition at line 344 of file SiStripSpyUtilities.cc.

References edm::DetSet< T >::begin(), prof2calltree::count, edm::DetSet< T >::end(), sistrip::SPY_SAMPLES_PER_CHANNEL, and threshold().

Referenced by extractFrameInfo().

  {
  
    // Loop over digis looking for firstHeader+6+16
    uint16_t count = aFirstBits+22;

    std::pair<bool,bool> lPair = std::pair<bool,bool>(false,false);

    //if header invalid: we don't know what apverr is....
    if (count >= sistrip::SPY_SAMPLES_PER_CHANNEL-1) return lPair;

    edm::DetSetVector<SiStripRawDigi>::detset::const_iterator iDigi = channelDigis.begin()+count;
    const edm::DetSetVector<SiStripRawDigi>::detset::const_iterator endChannelDigis = channelDigis.end();

    //double check....
    if (iDigi == endChannelDigis) return lPair;

    if ( iDigi->adc() <= threshold) lPair.first = true;
    ++iDigi;

    //triple check...
    if (iDigi == endChannelDigis) return std::pair<bool,bool>(false,false);

    if ( iDigi->adc() <= threshold) lPair.second = true;

    return lPair; 
  }
const uint16_t sistrip::SpyUtilities::findHeaderBits ( const edm::DetSetVector< SiStripRawDigi >::detset &  channelDigis,
const uint16_t  threshold 
) [static]

Definition at line 275 of file SiStripSpyUtilities.cc.

References edm::DetSet< T >::begin(), prof2calltree::count, edm::DetSet< T >::end(), sistrip::SPY_SAMPLES_PER_CHANNEL, and threshold().

Referenced by extractFrameInfo().

  {

    // Loop over digis looking for first above threshold
    uint8_t aboveThreshold = 0;
    bool foundHeader = false;
    uint16_t count = 0;

    edm::DetSetVector<SiStripRawDigi>::detset::const_iterator iDigi = channelDigis.begin();
    const edm::DetSetVector<SiStripRawDigi>::detset::const_iterator endChannelDigis = channelDigis.end();

    for (; iDigi != endChannelDigis; ++iDigi) {
      if ( iDigi->adc() > threshold) {
        aboveThreshold++;
      }
      else {
        aboveThreshold = 0;
      }
      if (aboveThreshold == 6) {foundHeader = true; break; }
      count++;
    }//end of loop over digis

    //break before incrementing the last time... so count-5 is the first header sample.
    if (foundHeader && count < 5) return 0;
    if (foundHeader) return count-5;
    return sistrip::SPY_SAMPLES_PER_CHANNEL;
 
  }
std::pair< uint16_t, uint32_t > sistrip::SpyUtilities::findMajorityValue ( std::vector< uint16_t > &  values,
const uint16_t  aFedId = 0 
) [static]

Definition at line 450 of file SiStripSpyUtilities.cc.

References prof2calltree::count, and python::multivaluedict::sort().

Referenced by fillFEDMajorities(), getMajorityHeader(), and sistrip::SpyDigiConverter::processFED().

  {

    uint32_t lTot = values.size();
    if (!lTot) return std::pair<uint16_t,uint32_t>(0,0);

    std::sort(values.begin(),values.end());
    uint32_t lMajorityCounter = 0;
    uint16_t lMaj = 0;

    std::vector<uint16_t>::iterator lIter = values.begin();
    for ( ; lIter != values.end(); ) {
      uint32_t lCounter = std::count(lIter,values.end(),*lIter);
      if (lCounter > lMajorityCounter) {
        lMajorityCounter = lCounter;
        lMaj = *lIter;
      }
      lIter += lCounter;
    }
    
    //std::cout << " -- Found majority value " << lMaj << " for " << lMajorityCounter << " elements out of " << values.size() << "." << std::endl;

    if (static_cast<float>(lMajorityCounter)/lTot < 0.5) {
      LogError("SiStripSpyUtilities") << " -- Found majority position for index "
                                      << aFedId
                                      << ": " << lMaj
                                      << " for less than half the values : " << lMajorityCounter << " out of " << lTot << " values."
                                      << std::endl;
    }

    return std::pair<uint16_t,uint32_t>(lMaj,lMajorityCounter);
    
  }
const uint16_t sistrip::SpyUtilities::findTrailerBits ( const edm::DetSetVector< SiStripRawDigi >::detset &  channelDigis,
const uint16_t  threshold 
) [static]

Definition at line 305 of file SiStripSpyUtilities.cc.

References edm::DetSet< T >::begin(), prof2calltree::count, edm::DetSet< T >::end(), sistrip::SPY_SAMPLES_PER_CHANNEL, sistrip::STRIPS_PER_FEDCH, and threshold().

Referenced by extractFrameInfo().

  {

    // Loop over digis looking for last above threshold
    uint8_t aboveThreshold = 0;
    bool foundTrailer = false;

    //discard the first 30 values, which will have some digital high in them...
    //start searching from the expected position : sometimes after 24+256 samples,
    //normally at 6+24+256 if 6-bit low before tickmark header bits...
    uint16_t count = 24+sistrip::STRIPS_PER_FEDCH;

    if (count >= sistrip::SPY_SAMPLES_PER_CHANNEL) return sistrip::SPY_SAMPLES_PER_CHANNEL;

    edm::DetSetVector<SiStripRawDigi>::detset::const_iterator iDigi = channelDigis.begin()+count;
    const edm::DetSetVector<SiStripRawDigi>::detset::const_iterator endChannelDigis = channelDigis.end();

    for (; iDigi != endChannelDigis; ++iDigi) {
      if ( iDigi->adc() > threshold) {
        aboveThreshold++;
      }
      else {
        aboveThreshold = 0;
      }
      if (aboveThreshold == 2) {foundTrailer = true; break; }
      count++;
    }//end of loop over digis

    //break before incrementing the last time... so count-1 is the first trailer sample.
    if (foundTrailer && count < 1) return 0;
    if (foundTrailer) return count-1;
    return sistrip::SPY_SAMPLES_PER_CHANNEL;
 
  }
const SiStripFedCabling * sistrip::SpyUtilities::getCabling ( const edm::EventSetup setup)

Updates the cabling object from the DB.

Definition at line 40 of file SiStripSpyUtilities.cc.

References trackerHits::c, cabling_, cacheId_, edm::EventSetup::get(), and edm::ESHandle< T >::product().

Referenced by SiStripSpyMonitorModule::analyze(), sistrip::FEDEmulatorModule::produce(), sistrip::SpyDigiConverterModule::produce(), and sistrip::SpyUnpackerModule::produce().

  {
    
    uint32_t cache_id = setup.get<SiStripFedCablingRcd>().cacheIdentifier();
   
    if ( cacheId_ != cache_id ) { // If the cache ID has changed since the last update...
      // Update the cabling object
      edm::ESHandle<SiStripFedCabling> c;
      setup.get<SiStripFedCablingRcd>().get( c );
      cabling_ = c.product();
      
//                if ( edm::isDebugEnabled() ) {
//          if ( !cacheId_ ) { // First time cabling has been retrieved - print it out in full.
//            std::stringstream ss;
//            ss << "[sistrip::SpyChannelUnpackerModule::" << __func__ << "]"
//               << " Updating cabling for first time..." << std::endl
//               << " Terse print out of FED cabling:" << std::endl;
//            //cabling_->terse(ss);
//            //LogTrace("SiStripMonitorHardwareUnpacker") << ss.str();
//          } // end of cacheId_ check
//        } // end of debugEnabled check
      
//       if ( edm::isDebugEnabled() ) {
//      std::stringstream sss;
//      sss << "[sistrip::SpyUtilities::" << __func__ << "]"
//          << " Summary of FED cabling:" << std::endl;
//      cabling_->summary(sss);
//      LogTrace("SiStripSpyUtilities") << sss.str();
//       }

      // Update the cache ID with the new value.
      cacheId_ = cache_id;

    } // end of new cache ID check
        
    return cabling_;
  }
const SiStripDetCabling * sistrip::SpyUtilities::getDetCabling ( const edm::EventSetup setup)

Updates the det cabling object from the DB.

Definition at line 78 of file SiStripSpyUtilities.cc.

References trackerHits::c, cacheIdDet_, detCabling_, edm::EventSetup::get(), and edm::ESHandle< T >::product().

Referenced by SiStripSpyDisplayModule::analyze().

  {
    
    uint32_t cache_id = setup.get<SiStripDetCablingRcd>().cacheIdentifier();//.get( cabling_ );
   
    if ( cacheIdDet_ != cache_id ) { // If the cache ID has changed since the last update...
      // Update the cabling object
      edm::ESHandle<SiStripDetCabling> c;
      setup.get<SiStripDetCablingRcd>().get( c );
      detCabling_ = c.product();
      cacheIdDet_ = cache_id;
    } // end of new cache ID check
        
    return detCabling_;
  }
void sistrip::SpyUtilities::getMajorityHeader ( const edm::DetSetVector< SiStripRawDigi > *  aInputDigis,
uint16_t &  firstHeaderBit,
bool  printResult = true 
) [static]

Definition at line 209 of file SiStripSpyUtilities.cc.

References edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::end(), extractFrameInfo(), findMajorityValue(), sistrip::SpyUtilities::Frame::firstHeaderBit, edm::DetSetVector< T >::size(), and sistrip::STRIPS_PER_FEDCH.

Referenced by SiStripSpyMonitorModule::analyze(), and sistrip::SpyDigiConverterModule::produce().

  {

    std::vector<uint16_t> lFirstBitVec;
    lFirstBitVec.reserve(aInputDigis->size());
    aFirstHeaderBit = 0;
    edm::DetSetVector<SiStripRawDigi>::const_iterator lDigis = aInputDigis->begin();
    
    for ( ; lDigis != aInputDigis->end(); lDigis++){
      sistrip::SpyUtilities::Frame lFrame = sistrip::SpyUtilities::extractFrameInfo(*lDigis);
      lFirstBitVec.push_back(lFrame.firstHeaderBit);
    }

    std::pair<uint16_t,uint32_t> lMaj = sistrip::SpyUtilities::findMajorityValue(lFirstBitVec);
    aFirstHeaderBit = lMaj.first;
    uint32_t lMajorityCounter = lMaj.second;
    
    //header is 24-sample long (2*8+2+6)
    uint16_t lFirstTrailerBit = aFirstHeaderBit+24+sistrip::STRIPS_PER_FEDCH;
    
    if (printResult)
      {
        LogInfo("SiStripSpyUtilities") << " -- Found majority position of first header (trailer) bit: " 
                                       << aFirstHeaderBit
                                       << " (" << lFirstTrailerBit 
                                       << ") for " << lMajorityCounter << " out of " << lFirstBitVec.size() << " channels."
                                       << std::endl;
      }
  }
edm::ESHandle< SiStripNoises > sistrip::SpyUtilities::getNoiseHandle ( const edm::EventSetup eventSetup)

Definition at line 107 of file SiStripSpyUtilities.cc.

References edm::EventSetup::get(), noiseCacheId_, and noiseHandle_.

Referenced by sistrip::FEDEmulatorModule::produce().

  {
    //check if new noise values are available
    uint32_t lCacheId = eventSetup.get<SiStripNoisesRcd>().cacheIdentifier();
    if (lCacheId != noiseCacheId_) {
      eventSetup.get<SiStripNoisesRcd>().get(noiseHandle_);
      noiseCacheId_ = lCacheId;
    }

    return noiseHandle_;
  }
edm::ESHandle< SiStripPedestals > sistrip::SpyUtilities::getPedestalHandle ( const edm::EventSetup eventSetup)

Definition at line 94 of file SiStripSpyUtilities.cc.

References edm::EventSetup::get(), pedsCacheId_, and pedsHandle_.

Referenced by sistrip::FEDEmulatorModule::produce().

  {
    //check if new pedestal values are available
    uint32_t lCacheId = eventSetup.get<SiStripPedestalsRcd>().cacheIdentifier();
    if (lCacheId != pedsCacheId_) {
      eventSetup.get<SiStripPedestalsRcd>().get(pedsHandle_);
      pedsCacheId_ = lCacheId;
    }

    return pedsHandle_;
  }
const bool sistrip::SpyUtilities::isValid ( const Frame aFrame,
const FrameQuality aQuality,
const uint16_t  aExpectedPos 
) [static]

Definition at line 242 of file SiStripSpyUtilities.cc.

References sistrip::SpyUtilities::Frame::apvErrorBit, sistrip::SpyUtilities::Frame::digitalHigh, sistrip::SpyUtilities::Frame::digitalLow, sistrip::SpyUtilities::Frame::firstHeaderBit, sistrip::SpyUtilities::Frame::firstTrailerBit, sistrip::SpyUtilities::FrameQuality::maxDigiRange, sistrip::SpyUtilities::FrameQuality::maxTickHeight, sistrip::SpyUtilities::FrameQuality::maxZeroLight, sistrip::SpyUtilities::FrameQuality::minTickHeight, sistrip::SpyUtilities::FrameQuality::minZeroLight, range(), and sistrip::STRIPS_PER_FEDCH.

Referenced by sistrip::SpyDigiConverter::extractPayloadDigis().

  {

    uint16_t lRange = sistrip::SpyUtilities::range(aFrame);

    if (lRange < aQuality.minDigiRange || lRange > aQuality.maxDigiRange) {
      return false;
    }
    else if (aFrame.digitalLow < aQuality.minZeroLight || aFrame.digitalLow > aQuality.maxZeroLight) {
      return false;
    }
    else if (aFrame.digitalHigh < aQuality.minTickHeight || aFrame.digitalHigh > aQuality.maxTickHeight){
      return false;
    }
    //if expectedPos=0: return true whatever the position of header is...
    else if ( aExpectedPos > 0 && 
              (
               !(aFrame.firstHeaderBit == aExpectedPos && 
                 aFrame.firstTrailerBit == aExpectedPos+24+sistrip::STRIPS_PER_FEDCH)
               )
              ) {
      return false;
    }
    else if (aFrame.apvErrorBit.first && aFrame.apvErrorBit.second) {
      return false;
    }
    
    return true;
  }
std::string sistrip::SpyUtilities::print ( const Frame aFrame,
std::string  aErr 
) [static]

Definition at line 410 of file SiStripSpyUtilities.cc.

References sistrip::SpyUtilities::Frame::apvAddress, sistrip::SpyUtilities::Frame::apvErrorBit, sistrip::SpyUtilities::Frame::baseline, sistrip::SpyUtilities::Frame::detId, sistrip::SpyUtilities::Frame::digitalHigh, sistrip::SpyUtilities::Frame::digitalLow, sistrip::SpyUtilities::Frame::firstHeaderBit, and sistrip::SpyUtilities::Frame::firstTrailerBit.

  {

    std::ostringstream lOs;
    lOs << " ------------------------------------------------------" << std::endl
        << " -- Error: " << aErr << std::endl
        << " ------- Printing Frame for detId " << aFrame.detId << " --------" << std::endl
        << " -- firstHeaderBit = " << aFrame.firstHeaderBit << std::endl
        << " -- firstTrailerBit = " << aFrame.firstTrailerBit << std::endl
        << " -- digitalLow = " << aFrame.digitalLow << std::endl
        << " -- digitalHigh = " << aFrame.digitalHigh << std::endl
        << " -- baseline = " << aFrame.baseline << std::endl
        << " -- apvErrorBits = " << aFrame.apvErrorBit.first
        << " " << aFrame.apvErrorBit.second << std::endl
        << " -- apvAddresses = " << static_cast<uint16_t>(aFrame.apvAddress.first)
        << " " << static_cast<uint16_t>(aFrame.apvAddress.second) << std::endl
        << " ------------------------------------------------------" << std::endl;
    return lOs.str();

  }
const uint16_t sistrip::SpyUtilities::range ( const Frame aFrame) [static]

Definition at line 185 of file SiStripSpyUtilities.cc.

References sistrip::SpyUtilities::Frame::digitalHigh, and sistrip::SpyUtilities::Frame::digitalLow.

Referenced by SiStripSpyMonitorModule::analyze(), SPYHistograms::fillDetailedHistograms(), isValid(), and threshold().

  {
    if (aFrame.digitalHigh < aFrame.digitalLow) return 0;
    else return aFrame.digitalHigh-aFrame.digitalLow;
  }
const uint16_t sistrip::SpyUtilities::threshold ( const Frame aFrame) [static]

Definition at line 191 of file SiStripSpyUtilities.cc.

References range().

Referenced by extractFrameInfo(), findAPVAddresses(), findAPVErrorBits(), findHeaderBits(), and findTrailerBits().

  {
    return static_cast<uint16_t>( (2.0 * static_cast<double>(range(aFrame))) / 3.0 );
  }

Member Data Documentation

The cabling object.

Definition at line 112 of file SiStripSpyUtilities.h.

Referenced by getCabling(), and ~SpyUtilities().

uint32_t sistrip::SpyUtilities::cacheId_ [private]

DB cache ID used to establish if the cabling has changed during the run.

Definition at line 113 of file SiStripSpyUtilities.h.

Referenced by getCabling().

DB cache ID used to establish if the cabling has changed during the run.

Definition at line 117 of file SiStripSpyUtilities.h.

Referenced by getDetCabling().

The cabling object.

Definition at line 116 of file SiStripSpyUtilities.h.

Referenced by getDetCabling(), and ~SpyUtilities().

Definition at line 124 of file SiStripSpyUtilities.h.

Referenced by getNoiseHandle().

Definition at line 125 of file SiStripSpyUtilities.h.

Referenced by getNoiseHandle().

Definition at line 120 of file SiStripSpyUtilities.h.

Referenced by getPedestalHandle().

Definition at line 121 of file SiStripSpyUtilities.h.

Referenced by getPedestalHandle().