10 typedef IndexRangeAssociation::id_offset_vector::const_iterator iter;
12 if ((pos ==
id_offsets_.end()) || (pos->first !=
id)) {
13 throw cms::Exception(
"Bad Key") <<
"Product ID " <<
id <<
" not found in this IndexRangeAssociation\n";
16 if ((pos + 1 !=
id_offsets_.end()) && (pos->second + key >= (pos + 1)->second)) {
17 throw cms::Exception(
"Bad Offset") <<
"Key " << key <<
" goes beyond bounds " << ((pos + 1)->
second - pos->second)
18 <<
" of this key collection within IndexRangeAssociation\n";
21 offset_vector::const_iterator offs =
ref_offsets_.begin() + pos->second +
key;
24 <<
" of this IndexRangeAssociation\n";
26 return range(*offs, *(offs + 1));
30 typedef IndexRangeAssociation::id_offset_vector::const_iterator iter;
32 return (pos !=
id_offsets_.end()) && (pos->first ==
id);
37 throw cms::Exception(
"Busy") <<
"Can't swap an IndexRangeAssociation while it's being filled!\n";
45 start_(assoc.ref_offsets_.
empty() ? 0 : assoc.ref_offsets_.size() - 1),
50 <<
"IndexRangeAssociation::FastFiller: you already have one active filler for this map.\n";
53 typedef IndexRangeAssociation::id_offset_vector::iterator iter;
60 <<
"IndexRangeAssociation::FastFiller: there is already an entry for ProductID " <<
id <<
" in this map.\n";
76 typedef IndexRangeAssociation::offset_vector::iterator
IT;
79 IT top = assoc_.ref_offsets_.begin() + start_;
80 IT it = assoc_.ref_offsets_.begin() + end_;
82 for (--it; it >= top; --it) {
91 assoc_.isFilling_ =
false;
98 unsigned int startingOffset,
102 if (
int(key) <= lastKey_)
103 throw cms::Exception(
"Bad Key") <<
"IndexRangeAssociation::FastFiller: you must fill this in strict key order\n"
104 <<
"\tLast key = " << lastKey_ <<
", this key = " << key <<
"\n";
107 <<
"IndexRangeAssociation::FastFiller: key index out of bounds for this collection\n"
108 <<
"\tKey = " << key <<
", bound = " << end_ <<
"\n";
109 if ((assoc_.ref_offsets_.back() != 0) && (
int(startingOffset) != assoc_.ref_offsets_.back()))
111 <<
"IndexRangeAssociation::FastFiller: The start for this key is not the end of the preceding key.\n"
112 <<
"\tThis offset = " << startingOffset <<
", last key = " << lastKey_
113 <<
", last end offset = " << assoc_.ref_offsets_.back() <<
"\n";
114 assoc_.ref_offsets_[start_ +
key] = startingOffset;
116 assoc_.ref_offsets_.back() +=
size;
121 << where <<
": found product id " << found <<
", while expecting " << expected <<
".\n"
122 <<
"Make sure you're not mismatching references from different collections.\n";
static void throwUnexpectedProductID(ProductID found, ProductID expected, const char *where)
offset_vector ref_offsets_
uint16_t *__restrict__ id
U second(std::pair< T, U > const &p)
void swap(IndexRangeAssociation &other)
unsigned int size() const
Size of this collection (number of keys)
~FastFiller()
When the FastFiller goes out of scope, it unlocks the map so you can make a new one.
IndexRangeAssociation & assoc_
tuple key
prepare the HTCondor submission files and eventually submit them
FastFiller(const FastFiller &)=delete
bool contains(ProductID id) const
True if this IndexRangeAssociation has info for this product id.
std::vector< LinkConnSpec >::const_iterator IT
std::pair< unsigned int, unsigned int > range
void insert(const RefKey &r, unsigned int startingOffset, unsigned int size)
Sets the starting offset for this key.
std::pair< edm::ProductID, unsigned int > id_off_pair
id_offset_vector id_offsets_
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
tuple size
Write out results.