9 IndexRangeAssociation::range
11 typedef IndexRangeAssociation::id_offset_vector::const_iterator iter;
13 if ((pos ==
id_offsets_.end()) || (pos->first !=
id)) {
14 throw cms::Exception(
"Bad Key") <<
"Product ID " <<
id <<
" not found in this IndexRangeAssociation\n";
17 if ((pos + 1 !=
id_offsets_.end()) && (pos->second + key >= (pos+1)->second)) {
18 throw cms::Exception(
"Bad Offset") <<
"Key " << key <<
" goes beyond bounds " 19 << ((pos+1)->
second - pos->second)
20 <<
" of this key collection within IndexRangeAssociation\n";
23 offset_vector::const_iterator offs =
ref_offsets_.begin() + pos->second +
key;
25 throw cms::Exception(
"Bad Offset") <<
"Key " << key <<
" goes beyond bounds " <<
ref_offsets_.size()-1 <<
" of this IndexRangeAssociation\n";
27 return range(*offs,*(offs+1));
32 typedef IndexRangeAssociation::id_offset_vector::const_iterator iter;
34 return (pos !=
id_offsets_.end()) && (pos->first ==
id);
45 assoc_(assoc), id_(id),
51 "IndexRangeAssociation::FastFiller: you already have one active filler for this map.\n";
54 typedef IndexRangeAssociation::id_offset_vector::iterator iter;
59 "IndexRangeAssociation::FastFiller: there is already an entry for ProductID " <<
id <<
" in this map.\n";
75 typedef IndexRangeAssociation::offset_vector::iterator
IT;
81 for (--it; it >= top; --it) {
99 "IndexRangeAssociation::FastFiller: you must fill this in strict key order\n" <<
100 "\tLast key = " <<
lastKey_ <<
", this key = " << key <<
"\n";
102 "IndexRangeAssociation::FastFiller: key index out of bounds for this collection\n" <<
103 "\tKey = " << key <<
", bound = " <<
end_ <<
"\n";
106 "IndexRangeAssociation::FastFiller: The start for this key is not the end of the preceding key.\n" <<
107 "\tThis offset = " << startingOffset <<
", last key = " <<
lastKey_ <<
117 ": found product id " << found <<
", while expecting " << expected <<
".\n" <<
118 "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_
bool empty() const
True if it's empty (no keys)
std::vector< l1t::Jet >::iterator end_
FastFiller(IndexRangeAssociation &assoc, ProductID id, unsigned int size)
Make a filler for a collection with a given product id and size.
U second(std::pair< T, U > const &p)
void swap(IndexRangeAssociation &other)
std::vector< l1t::Jet >::iterator start_
unsigned int size() const
Size of this collection (number of keys)
int lastKey_
last key used to fill (to check that the new key must be strictly greater than lastKey_) ...
~FastFiller()
When the FastFiller goes out of scope, it unlocks the map so you can make a new one.
IndexRangeAssociation & assoc_
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.
id_offset_vector id_offsets_
std::pair< edm::ProductID, unsigned int > id_off_pair
T get(const Candidate &c)