68 std::vector< edm::DetSet<T> > sorted_and_merged;
69 sorted_and_merged.reserve(
registry_.size());
70 typename Registry::const_iterator iReg =
registry_.begin();
71 const typename Registry::const_iterator endReg =
registry_.end();
72 while (iReg != endReg) {
74 std::vector<T>& detSetData = sorted_and_merged.back().data;
75 typename Registry::const_iterator jReg;
78 for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg) length += jReg->length;
79 detSetData.reserve(length);
80 for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg) {
81 detSetData.insert(detSetData.end(),
data_.begin()+jReg->startIndex,
data_.begin()+jReg->startIndex+jReg->length);
84 uint16_t detLength = 0;
85 uint16_t firstItemOfLastChannel = 0;
86 for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg) {
87 if (!detLength) detLength = jReg->length;
88 else if (detLength != jReg->length)
throw cms::Exception(
"DetSetVectorFiller") <<
"Cannot fill non-sparse DetSet if channels are not unformly sized.";
89 firstItemOfLastChannel = jReg->firstItem;
91 detSetData.resize(firstItemOfLastChannel+detLength);
92 for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg) {
93 std::copy(
data_.begin()+jReg->startIndex,
data_.begin()+jReg->startIndex+jReg->length, detSetData.begin()+jReg->firstItem);
98 return typename std::auto_ptr< edm::DetSetVector<T> >(
new edm::DetSetVector<T>(sorted_and_merged,
true) );