72 std::vector<edm::DetSet<T> > sorted_and_merged;
73 sorted_and_merged.reserve(
registry_.size());
74 typename Registry::const_iterator iReg =
registry_.begin();
75 const typename Registry::const_iterator endReg =
registry_.end();
76 while (iReg != endReg) {
78 std::vector<T>& detSetData = sorted_and_merged.back().data;
79 typename Registry::const_iterator jReg;
82 for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg)
83 length += jReg->length;
84 detSetData.reserve(length);
85 for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg) {
87 detSetData.end(),
data_.begin() + jReg->startIndex,
data_.begin() + jReg->startIndex + jReg->length);
90 uint16_t detLength = 0;
91 uint16_t firstItemOfLastChannel = 0;
92 for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg) {
94 detLength = jReg->length;
95 else if (detLength != jReg->length)
97 <<
"Cannot fill non-sparse DetSet if channels are not unformly sized.";
98 firstItemOfLastChannel = jReg->firstItem;
100 detSetData.resize(firstItemOfLastChannel + detLength);
101 for (jReg = iReg; (jReg != endReg) && (jReg->key == iReg->key); ++jReg) {
103 data_.begin() + jReg->startIndex + jReg->length,
104 detSetData.begin() + jReg->firstItem);
109 return typename std::unique_ptr<edm::DetSetVector<T> >(
new edm::DetSetVector<T>(sorted_and_merged,
true));