#include <SiStripRawToClustersLazyUnpacker.h>
Public Types | |
typedef edm::DetSet < SiStripCluster > | DetSet |
Public Member Functions | |
void | doAPVEmulatorCheck (bool do_APVEmulator_check) |
virtual void | fill (const uint32_t &, record_type &) |
RawToClustersLazyUnpacker (const SiStripRegionCabling &, StripClusterizerAlgorithm &, SiStripRawProcessingAlgorithms &, const FEDRawDataCollection &, bool=false) | |
virtual | ~RawToClustersLazyUnpacker () |
Private Member Functions | |
RawToClustersLazyUnpacker () | |
private default constructor | |
Private Attributes | |
std::vector< sistrip::FEDBuffer * > | buffers_ |
FED event cache. | |
StripClusterizerAlgorithm *const | clusterizer_ |
clusterizer algorithm | |
bool | doAPVEmulatorCheck_ |
bool | dump_ |
dump frequency | |
const FEDRawDataCollection * | raw_ |
raw data | |
SiStripRawProcessingAlgorithms *const | rawAlgos_ |
raw processing algorithms | |
RawToDigiUnpacker | rawToDigi_ |
raw-to-digi | |
const SiStripRegionCabling::Cabling * | regions_ |
cabling |
Definition at line 20 of file SiStripRawToClustersLazyUnpacker.h.
Definition at line 24 of file SiStripRawToClustersLazyUnpacker.h.
sistrip::RawToClustersLazyUnpacker::RawToClustersLazyUnpacker | ( | const SiStripRegionCabling & | regioncabling, |
StripClusterizerAlgorithm & | clustalgo, | ||
SiStripRawProcessingAlgorithms & | rpAlgos, | ||
const FEDRawDataCollection & | data, | ||
bool | dump = false |
||
) |
Definition at line 8 of file SiStripRawToClustersLazyUnpacker.cc.
References buffers_.
: raw_(&data), regions_(&(regioncabling.getRegionCabling())), clusterizer_(&clustalgo), rawAlgos_(&rpAlgos), buffers_(), rawToDigi_(0,0,0,0,0,0,0,0), dump_(dump), doAPVEmulatorCheck_(true) { buffers_.assign(1024,static_cast<sistrip::FEDBuffer*>(0)); }
sistrip::RawToClustersLazyUnpacker::~RawToClustersLazyUnpacker | ( | ) | [virtual] |
Definition at line 22 of file SiStripRawToClustersLazyUnpacker.cc.
References buffers_.
sistrip::RawToClustersLazyUnpacker::RawToClustersLazyUnpacker | ( | ) | [private] |
private default constructor
void sistrip::RawToClustersLazyUnpacker::doAPVEmulatorCheck | ( | bool | do_APVEmulator_check | ) | [inline] |
Definition at line 32 of file SiStripRawToClustersLazyUnpacker.h.
References doAPVEmulatorCheck_.
{ doAPVEmulatorCheck_ = do_APVEmulator_check; };
void sistrip::RawToClustersLazyUnpacker::fill | ( | const uint32_t & | index, |
record_type & | record | ||
) | [virtual] |
Implements edm::LazyUnpacker< SiStripCluster >.
Definition at line 30 of file SiStripRawToClustersLazyUnpacker.cc.
References sistrip::FEDZSChannelUnpacker::adc(), sistrip::FEDRawChannelUnpacker::adc(), edm::DetSet< T >::begin(), buffers_, sistrip::FEDBufferBase::channel(), sistrip::FEDBuffer::channelGood(), clusterizer_, FEDRawData::data(), doAPVEmulatorCheck_, sistrip::FEDBuffer::doChecks(), dump_, sistrip::RawToDigiUnpacker::dumpRawData(), alignCSCRings::e, edm::DetSet< T >::end(), FEDRawDataCollection::FEDData(), sistrip::FEDRawChannelUnpacker::hasData(), sistrip::FEDZSChannelUnpacker::hasData(), sistrip::invalid32_, edm::isDebugEnabled(), SiStripRegionCabling::layer(), LogTrace, sistrip::mlRawToCluster_, sistrip::mlRawToDigi_, alignBH_cfg::mode, sistrip::FEDRawChannelUnpacker::procRawModeUnpacker(), raw_, rawAlgos_, rawToDigi_, sistrip::READOUT_MODE_PROC_RAW, sistrip::READOUT_MODE_VIRGIN_RAW, sistrip::READOUT_MODE_ZERO_SUPPRESSED, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE, sistrip::FEDBufferBase::readoutMode(), record, SiStripRegionCabling::region(), sistrip::FEDZSChannelUnpacker::sampleNumber(), FEDRawData::size(), StripClusterizerAlgorithm::stripByStripAdd(), StripClusterizerAlgorithm::stripByStripBegin(), StripClusterizerAlgorithm::stripByStripEnd(), SiStripRegionCabling::subdet(), SiStripRawProcessingAlgorithms::SuppressProcessedRawData(), SiStripRawProcessingAlgorithms::SuppressVirginRawData(), sistrip::FEDRawChannelUnpacker::virginRawModeUnpacker(), cms::Exception::what(), sistrip::FEDZSChannelUnpacker::zeroSuppressedLiteModeUnpacker(), and sistrip::FEDZSChannelUnpacker::zeroSuppressedModeUnpacker().
{ // Get region, subdet and layer from element-index uint32_t region = SiStripRegionCabling::region(index); uint32_t subdet = static_cast<uint32_t>(SiStripRegionCabling::subdet(index)); uint32_t layer = SiStripRegionCabling::layer(index); // Retrieve cabling for element const SiStripRegionCabling::ElementCabling& element = (*regions_)[region][subdet][layer]; // Loop dets SiStripRegionCabling::ElementCabling::const_iterator idet = element.begin(); for (;idet!=element.end();idet++) { // If det id is null or invalid continue. if ( !(idet->first) || (idet->first == sistrip::invalid32_) || !clusterizer_->stripByStripBegin(idet->first)) { continue; } // Loop over apv-pairs of det std::vector<FedChannelConnection>::const_iterator iconn = idet->second.begin(); for (;iconn!=idet->second.end();iconn++) { const uint16_t fedId = iconn->fedId(); // If fed id is null or connection is invalid continue if ( !fedId || !iconn->isConnected() ) { continue; } // If Fed hasnt already been initialised, extract data and initialise FEDBuffer* buffer = buffers_[fedId]; if (!buffer) { // Retrieve FED raw data for given FED const FEDRawData& rawData = raw_->FEDData( static_cast<int>(fedId) ); // Check on FEDRawData pointer if ( !rawData.data() ) { if (edm::isDebugEnabled()) { edm::LogWarning(sistrip::mlRawToCluster_) << "[sistrip::RawToClustersLazyGetter::" << __func__ << "]" << " NULL pointer to FEDRawData for FED id " << fedId; } continue; } // Check on FEDRawData size if ( !rawData.size() ) { if (edm::isDebugEnabled()) { edm::LogWarning(sistrip::mlRawToCluster_) << "[sistrip::RawToClustersLazyGetter::" << __func__ << "]" << " FEDRawData has zero size for FED id " << fedId; } continue; } // construct FEDBuffer try { buffers_[fedId] = buffer = new sistrip::FEDBuffer(rawData.data(),rawData.size()); if (!buffer->doChecks()) throw cms::Exception("FEDBuffer") << "FED Buffer check fails for FED ID" << fedId << "."; } catch (const cms::Exception& e) { if (edm::isDebugEnabled()) { edm::LogWarning(sistrip::mlRawToCluster_) << "Exception caught when creating FEDBuffer object for FED " << fedId << ": " << e.what(); } if ( buffer ) { delete buffer; } buffers_[fedId] = 0; continue; } // dump of FEDRawData to stdout if ( dump_ ) { std::stringstream ss; rawToDigi_.dumpRawData( fedId, rawData, ss ); LogTrace(mlRawToDigi_) << ss.str(); } } // check channel const uint8_t fedCh = iconn->fedCh(); if (!buffer->channelGood(fedCh,doAPVEmulatorCheck_)) { if (edm::isDebugEnabled()) { std::ostringstream ss; ss << "Problem unpacking channel " << fedCh << " on FED " << fedId; edm::LogWarning(sistrip::mlRawToCluster_) << ss.str(); } continue; } // Determine APV std::pair number uint16_t ipair = iconn->apvPairNumber(); const sistrip::FEDReadoutMode mode = buffer->readoutMode(); if (mode == sistrip::READOUT_MODE_ZERO_SUPPRESSED ) { try { // create unpacker sistrip::FEDZSChannelUnpacker unpacker = sistrip::FEDZSChannelUnpacker::zeroSuppressedModeUnpacker(buffer->channel(fedCh)); // unpack while (unpacker.hasData()) { clusterizer_->stripByStripAdd(unpacker.sampleNumber()+ipair*256,unpacker.adc(),record); unpacker++; } } catch (const cms::Exception& e) { if (edm::isDebugEnabled()) { std::ostringstream ss; ss << "Unordered clusters for channel " << fedCh << " on FED " << fedId << ": " << e.what(); edm::LogWarning(sistrip::mlRawToCluster_) << ss.str(); } continue; } } else if (mode == sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE ) { try { // create unpacker sistrip::FEDZSChannelUnpacker unpacker = sistrip::FEDZSChannelUnpacker::zeroSuppressedLiteModeUnpacker(buffer->channel(fedCh)); // unpack while (unpacker.hasData()) { clusterizer_->stripByStripAdd(unpacker.sampleNumber()+ipair*256,unpacker.adc(),record); unpacker++; } } catch (const cms::Exception& e) { if (edm::isDebugEnabled()) { std::ostringstream ss; ss << "Unordered clusters for channel " << fedCh << " on FED " << fedId << ": " << e.what(); edm::LogWarning(sistrip::mlRawToCluster_) << ss.str(); } continue; } } else if (mode == sistrip::READOUT_MODE_VIRGIN_RAW ) { // create unpacker sistrip::FEDRawChannelUnpacker unpacker = sistrip::FEDRawChannelUnpacker::virginRawModeUnpacker(buffer->channel(fedCh)); // unpack std::vector<int16_t> digis; while (unpacker.hasData()) { digis.push_back(unpacker.adc()); unpacker++; } //process raw uint32_t id = iconn->detId(); edm::DetSet<SiStripDigi> zsdigis(id); //rawAlgos_->subtractorPed->subtract( id, ipair*256, digis); //rawAlgos_->subtractorCMN->subtract( id, digis); //rawAlgos_->suppressor->suppress( digis, zsdigis); uint16_t firstAPV = ipair*2; rawAlgos_->SuppressVirginRawData(id, firstAPV,digis, zsdigis); for( edm::DetSet<SiStripDigi>::const_iterator it = zsdigis.begin(); it!=zsdigis.end(); it++) { clusterizer_->stripByStripAdd( it->strip(), it->adc(), record); } } else if (mode == sistrip::READOUT_MODE_PROC_RAW ) { // create unpacker sistrip::FEDRawChannelUnpacker unpacker = sistrip::FEDRawChannelUnpacker::procRawModeUnpacker(buffer->channel(fedCh)); // unpack std::vector<int16_t> digis; while (unpacker.hasData()) { digis.push_back(unpacker.adc()); unpacker++; } //process raw uint32_t id = iconn->detId(); edm::DetSet<SiStripDigi> zsdigis(id); //rawAlgos_->subtractorCMN->subtract( id, digis); //rawAlgos_->suppressor->suppress( digis, zsdigis); uint16_t firstAPV = ipair*2; rawAlgos_->SuppressProcessedRawData(id, firstAPV,digis, zsdigis); for( edm::DetSet<SiStripDigi>::const_iterator it = zsdigis.begin(); it!=zsdigis.end(); it++) { clusterizer_->stripByStripAdd( it->strip(), it->adc(), record); } } else { edm::LogWarning(sistrip::mlRawToCluster_) << "[sistrip::RawToClustersLazyGetter::" << __func__ << "]" << " FEDRawData readout mode " << mode << " from FED id " << fedId << " not supported."; continue; } } clusterizer_->stripByStripEnd(record); } }
std::vector< sistrip::FEDBuffer* > sistrip::RawToClustersLazyUnpacker::buffers_ [private] |
FED event cache.
Definition at line 54 of file SiStripRawToClustersLazyUnpacker.h.
Referenced by fill(), RawToClustersLazyUnpacker(), and ~RawToClustersLazyUnpacker().
clusterizer algorithm
Definition at line 48 of file SiStripRawToClustersLazyUnpacker.h.
Referenced by fill().
bool sistrip::RawToClustersLazyUnpacker::doAPVEmulatorCheck_ [private] |
Definition at line 63 of file SiStripRawToClustersLazyUnpacker.h.
Referenced by doAPVEmulatorCheck(), and fill().
bool sistrip::RawToClustersLazyUnpacker::dump_ [private] |
dump frequency
Definition at line 60 of file SiStripRawToClustersLazyUnpacker.h.
Referenced by fill().
const FEDRawDataCollection* sistrip::RawToClustersLazyUnpacker::raw_ [private] |
raw processing algorithms
Definition at line 51 of file SiStripRawToClustersLazyUnpacker.h.
Referenced by fill().
cabling
Definition at line 45 of file SiStripRawToClustersLazyUnpacker.h.