#include <SiStripDetSetVectorFiller.h>
Classes | |
struct | ChannelRegistryItem |
Public Member Functions | |
void | addItem (const T &item) |
std::auto_ptr < edm::DetSetVector< T > > | createDetSetVector () |
DetSetVectorFiller (const size_t registrySize, const size_t dataSize) | |
void | newChannel (const uint32_t key, const uint16_t firstItem=0) |
~DetSetVectorFiller () | |
Private Types | |
typedef std::vector< T > | Data |
typedef std::vector < ChannelRegistryItem > | Registry |
Private Attributes | |
Data | data_ |
Registry | registry_ |
Definition at line 17 of file SiStripDetSetVectorFiller.h.
typedef std::vector<T> sistrip::DetSetVectorFiller< T, dsvIsSparse >::Data [private] |
Definition at line 39 of file SiStripDetSetVectorFiller.h.
typedef std::vector<ChannelRegistryItem> sistrip::DetSetVectorFiller< T, dsvIsSparse >::Registry [private] |
Definition at line 38 of file SiStripDetSetVectorFiller.h.
sistrip::DetSetVectorFiller< T, dsvIsSparse >::DetSetVectorFiller | ( | const size_t | registrySize, |
const size_t | dataSize | ||
) | [inline] |
Definition at line 45 of file SiStripDetSetVectorFiller.h.
sistrip::DetSetVectorFiller< T, dsvIsSparse >::~DetSetVectorFiller | ( | ) | [inline] |
Definition at line 51 of file SiStripDetSetVectorFiller.h.
{}
void sistrip::DetSetVectorFiller< T, dsvIsSparse >::addItem | ( | const T & | item | ) | [inline] |
Definition at line 59 of file SiStripDetSetVectorFiller.h.
Referenced by sistrip::SpyUnpacker::createDigis(), and sistrip::SpyDigiConverter::mergeModuleChannels().
std::auto_ptr< edm::DetSetVector< T > > sistrip::DetSetVectorFiller< T, dsvIsSparse >::createDetSetVector | ( | ) |
Definition at line 65 of file SiStripDetSetVectorFiller.h.
References filterCSVwithJSON::copy, Exception, and python::multivaluedict::sort().
Referenced by sistrip::SpyUnpacker::createDigis(), and sistrip::SpyDigiConverter::mergeModuleChannels().
{ std::sort(registry_.begin(),registry_.end()); std::vector< edm::DetSet<T> > sorted_and_merged; sorted_and_merged.reserve(registry_.size()); typename Registry::const_iterator iReg = registry_.begin(); const typename Registry::const_iterator endReg = registry_.end(); while (iReg != endReg) { sorted_and_merged.push_back( edm::DetSet<T>(iReg->key) ); std::vector<T>& detSetData = sorted_and_merged.back().data; typename Registry::const_iterator jReg; if (dsvIsSparse) { uint16_t length = 0; for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg) length += jReg->length; detSetData.reserve(length); for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg) { detSetData.insert(detSetData.end(), data_.begin()+jReg->startIndex, data_.begin()+jReg->startIndex+jReg->length); } } else { uint16_t detLength = 0; uint16_t firstItemOfLastChannel = 0; for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg) { if (!detLength) detLength = jReg->length; else if (detLength != jReg->length) throw cms::Exception("DetSetVectorFiller") << "Cannot fill non-sparse DetSet if channels are not unformly sized."; firstItemOfLastChannel = jReg->firstItem; } detSetData.resize(firstItemOfLastChannel+detLength); for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg) { std::copy(data_.begin()+jReg->startIndex, data_.begin()+jReg->startIndex+jReg->length, detSetData.begin()+jReg->firstItem); } } iReg = jReg; } return typename std::auto_ptr< edm::DetSetVector<T> >( new edm::DetSetVector<T>(sorted_and_merged, true) ); }
void sistrip::DetSetVectorFiller< T, dsvIsSparse >::newChannel | ( | const uint32_t | key, |
const uint16_t | firstItem = 0 |
||
) | [inline] |
Definition at line 54 of file SiStripDetSetVectorFiller.h.
Referenced by sistrip::SpyUnpacker::createDigis(), and sistrip::SpyDigiConverter::mergeModuleChannels().
Data sistrip::DetSetVectorFiller< T, dsvIsSparse >::data_ [private] |
Definition at line 42 of file SiStripDetSetVectorFiller.h.
Registry sistrip::DetSetVectorFiller< T, dsvIsSparse >::registry_ [private] |
Definition at line 41 of file SiStripDetSetVectorFiller.h.