1 #ifndef DataFormats_Common_DetSetVector_h 2 #define DataFormats_Common_DetSetVector_h 42 #include <type_traits> 43 #include "boost/concept_check.hpp" 71 "DetSetVector::operator[] called with index not in collection;\nindex value: ", i);
87 public std::conditional_t<std::is_base_of<edm::DoNotSortUponInsertion, T>::value,
88 edm::DoNotSortUponInsertion,
93 BOOST_CLASS_REQUIRE(
T,
boost, LessThanComparableConcept);
103 typedef typename collection_type::iterator
iterator;
147 size_type
size()
const;
169 const_iterator
begin()
const;
173 const_iterator
end()
const;
177 void getIds(std::vector<det_id_type> &
result)
const;
184 std::vector<void const*>& pointers,
191 collection_type _sets;
208 _sets(), _alreadySorted(alreadySorted)
211 if (!alreadySorted)
_sort();
257 std::pair<iterator,iterator>
p =
262 if (p.first != p.second)
return *p.first;
266 #if defined( __GXX_EXPERIMENTAL_CXX0X__) 267 return *(
_sets.emplace(p.first,
id));
269 return *(
_sets.insert(p.first, detset(
id)));
277 return _sets.empty();
292 std::pair<iterator,iterator>
p =
294 if (p.first == p.second)
return _sets.end();
311 std::pair<const_iterator,const_iterator>
p =
313 if (p.first == p.second)
return _sets.end();
327 iterator it = this->
find(i);
338 const_iterator it = this->
find(i);
348 return _sets.begin();
355 return _sets.begin();
380 std::back_inserter(result),
388 _sets.shrink_to_fit();
390 typename collection_type::iterator i =
_sets.begin();
391 typename collection_type::iterator
e =
_sets.end();
393 for (; i !=
e; ++
i) {
394 i->data.shrink_to_fit();
396 std::sort(i->data.begin(), i->data.end());
409 std::vector<void const*>& pointers,
424 std::vector<void const*>& pointers,
427 obj.
fillView(
id, pointers, helpers);
452 namespace refhelper {
461 return &(*(iContainer.
find(iIndex.first)->data.begin()+iIndex.second));
473 template<
class HandleT>
478 typename HandleT::element_type::value_type::const_iterator itIter) {
479 typedef typename HandleT::element_type Vec;
481 typename Vec::const_iterator itFound = iHandle->find(iDetID);
482 if(itFound == iHandle->end()) {
484 "an edm::Ref to an edm::DetSetVector was given a DetId, ", iDetID,
", that is not in the DetSetVector");
486 index += (itIter- itFound->data.begin());
487 if(index >= itFound->data.size()) {
489 "an edm::Ref to a edm::DetSetVector is being made with an interator that is not part of the edm::DetSet itself");
491 return Ref<
typename HandleT::element_type,
493 (iHandle,std::make_pair(iDetID,index));
496 template<
class HandleT>
501 typename HandleT::element_type::value_type::iterator itIter) {
502 typedef typename HandleT::element_type Vec;
503 typename Vec::detset::const_iterator itIter2 = itIter;
504 return makeRefTo(iHandle,iDetID,itIter2);
void _throw_range(det_id_type i)
detset const & const_reference
iterator find(det_id_type id)
DetSetVector & operator=(DetSetVector const &other)
void reallyFillView(COLLECTION const &coll, ProductID const &id, std::vector< void const * > &ptrs, FillViewHelperVector &helpers)
#define CMS_CLASS_VERSION(_version_)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefToDetSetVector(const HandleT &iHandle, det_id_type iDetID, typename HandleT::element_type::value_type::iterator itIter)
void swap(DetSetVector &other)
void swap(Association< C > &lhs, Association< C > &rhs)
std::pair< det_id_type, typename DetSet< T >::collection_type::size_type > second_argument_type
static std::string const input
reference find_or_insert(det_id_type id)
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
FindForDetSetVector< T > value
Container::value_type value_type
Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, det_id_type iDetID, typename HandleT::element_type::value_type::const_iterator itIter)
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers)
T operator[](int i) const
def template(fileName, svg, replaceme="REPLACEME")
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
std::vector< detset > collection_type
collection_type::iterator iterator
iterator end()
Return the off-the-end iterator.
size_type size() const
Return the number of contained DetSets.
DetSetVector()
Create an empty DetSetVector.
edm::BoolCache _alreadySorted
result_type operator()(first_argument_type iContainer, second_argument_type iIndex)
bool empty() const
Return true if we contain no DetSets.
void getIds(std::vector< det_id_type > &result) const
void _sort()
Sort the DetSet in order of increasing DetId.
void fillView(ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers) const
std::vector< std::vector< double > > tmp
void insert(detset const &s)
Insert the given DetSet.
reference operator[](det_id_type i)
collection_type::size_type size_type
iterator begin()
Return an iterator to the first DetSet.
collection_type::const_iterator const_iterator
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector