CMS 3D CMS Logo

DetSetVectorNew.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_DetSetVectorNew_h
2 #define DataFormats_Common_DetSetVectorNew_h
3 
7 
8 #include <boost/iterator/transform_iterator.hpp>
9 #include <boost/any.hpp>
12 
13 #if !defined(__ROOTCLING__)
14 #define DSVN_USE_ATOMIC
15 // #warning using atomic
16 #endif
17 
18 #include <atomic>
19 #include <memory>
20 #include <vector>
21 #include <cassert>
22 
23 #include <algorithm>
24 #include <functional>
25 #include <iterator>
26 #include <utility>
27 
28 class TestDetSet;
29 
30 namespace edm {
31  namespace refhelper {
32  template <typename T>
34  }
35 } // namespace edm
36 
37 //FIXME remove New when ready
38 namespace edmNew {
39  typedef uint32_t det_id_type;
40 
42  CapacityExaustedException() : cms::Exception("Capacity exausted in DetSetVectorNew") {}
43  };
44 
45  namespace dslv {
46  template <typename T>
47  class LazyGetter;
48 
49  }
50 
51  /* transient component of DetSetVector
52  * for pure conviniency of dictionary declaration
53  */
54  namespace dstvdetails {
55 
56  void errorFilling();
57  void notSafe();
58  void errorIdExists(det_id_type iid);
59  void throw_range(det_id_type iid);
60 
62  typedef unsigned int size_type; // for persistency
63  typedef unsigned int id_type;
64 
65  DetSetVectorTrans() : m_filling(false), m_dataSize(0) {}
66  DetSetVectorTrans& operator=(const DetSetVectorTrans&) = delete;
67 
69  : // can't be default because of atomics
70  m_filling(false) {
71  // better no one is filling...
72  assert(rh.m_filling == false);
73  m_getter = rh.m_getter;
74 #ifdef DSVN_USE_ATOMIC
75  m_dataSize.store(rh.m_dataSize.load());
76 #else
77  m_dataSize = rh.m_dataSize;
78 #endif
79  }
80 
82  : // can't be default because of atomics
83  m_filling(false) {
84  // better no one is filling...
85  assert(rh.m_filling == false);
86  m_getter = std::move(rh.m_getter);
87 #ifdef DSVN_USE_ATOMIC
88  m_dataSize.store(rh.m_dataSize.exchange(m_dataSize.load()));
89 #else
90  m_dataSize = std::move(rh.m_dataSize);
91 #endif
92  }
93  DetSetVectorTrans& operator=(DetSetVectorTrans&& rh) { // can't be default because of atomics
94  // better no one is filling...
95  assert(m_filling == false);
96  assert(rh.m_filling == false);
97  m_getter = std::move(rh.m_getter);
98 #ifdef DSVN_USE_ATOMIC
99  m_dataSize.store(rh.m_dataSize.exchange(m_dataSize.load()));
100 #else
101  m_dataSize = std::move(rh.m_dataSize);
102 #endif
103  return *this;
104  }
105  mutable std::atomic<bool> m_filling;
107 #ifdef DSVN_USE_ATOMIC
108  mutable std::atomic<size_type> m_dataSize;
109 #else
110  mutable size_type m_dataSize;
111 #endif
112 
114  // better no one is filling...
115  assert(m_filling == false);
116  assert(rh.m_filling == false);
117  // std::swap(m_filling,rh.m_filling);
118  std::swap(m_getter, rh.m_getter);
119 #ifdef DSVN_USE_ATOMIC
120  m_dataSize.store(rh.m_dataSize.exchange(m_dataSize.load()));
121 #else
122  std::swap(m_dataSize, rh.m_dataSize);
123 #endif
124  }
125 
126  struct Item {
127  Item(id_type i = 0, int io = -1, size_type is = 0) : id(i), offset(io), size(is) {}
128 
129  Item(Item const& rh) noexcept : id(rh.id), offset(int(rh.offset)), size(rh.size) {}
130  Item& operator=(Item const& rh) noexcept {
131  id = rh.id;
132  offset = int(rh.offset);
133  size = rh.size;
134  return *this;
135  }
136  Item(Item&& rh) noexcept : id(std::move(rh.id)), offset(int(rh.offset)), size(std::move(rh.size)) {}
138  id = std::move(rh.id);
139  offset = int(rh.offset);
140  size = std::move(rh.size);
141  return *this;
142  }
143 
144  id_type id;
145 #ifdef DSVN_USE_ATOMIC
146  mutable std::atomic<int> offset;
147  bool initialize() const {
148  int expected = -1;
149  return offset.compare_exchange_strong(expected, -2);
150  }
151 #else
152  mutable int offset;
153 #endif
154  CMS_THREAD_GUARD(offset) mutable size_type size;
155 
156  bool uninitialized() const { return (-1) == offset; }
157  bool initializing() const { return (-2) == offset; }
158  bool isValid() const { return offset >= 0; }
159  bool operator<(Item const& rh) const { return id < rh.id; }
160  operator id_type() const { return id; }
161  };
162 
163 #ifdef DSVN_USE_ATOMIC
164  bool ready() const {
165  bool expected = false;
166  if (!m_filling.compare_exchange_strong(expected, true))
167  errorFilling();
168  return true;
169  }
170 #else
171  bool ready() const { return true; }
172 #endif
173  };
174 
176  } // namespace dstvdetails
177 
188  template <typename T>
190  public:
192  typedef Trans::Item Item;
193  typedef unsigned int size_type; // for persistency
194  typedef unsigned int id_type;
195  typedef T data_type;
199  // FIXME not sure make sense....
200  typedef DetSet value_type;
201  typedef id_type key_type;
202 
203  typedef std::vector<Item> IdContainer;
204  typedef std::vector<data_type> DataContainer;
205  typedef typename IdContainer::iterator IdIter;
206  typedef typename std::vector<data_type>::iterator DataIter;
207  typedef std::pair<IdIter, DataIter> IterPair;
208  typedef typename IdContainer::const_iterator const_IdIter;
209  typedef typename std::vector<data_type>::const_iterator const_DataIter;
210  typedef std::pair<const_IdIter, const_DataIter> const_IterPair;
211 
213 
214  struct IterHelp {
215  typedef DetSet result_type;
216  // IterHelp() : v(0),update(true){}
217  IterHelp() : m_v(nullptr), m_update(false) {}
218  IterHelp(DetSetVector<T> const& iv, bool iup) : m_v(&iv), m_update(iup) {}
219 
220  result_type& operator()(Item const& item) const {
221  m_detset.set(*m_v, item, m_update);
222  return m_detset;
223  }
224 
225  private:
227  mutable result_type m_detset;
228  bool m_update;
229  };
230 
231  typedef boost::transform_iterator<IterHelp, const_IdIter> const_iterator;
232  typedef std::pair<const_iterator, const_iterator> Range;
233 
234  /* fill the lastest inserted DetSet
235  */
236  class FastFiller {
237  public:
242 
243  // here just to make the compiler happy
245  assert(false);
246  static DetSetVector<T>::Item d;
247  return d;
248  }
249  FastFiller(DetSetVector<T>& iv, id_type id, bool isaveEmpty = false)
250  : m_v(iv), m_item(m_v.ready() ? m_v.push_back(id) : dummy()), m_saveEmpty(isaveEmpty) {
251  if (m_v.onDemand())
253  }
254 
255  FastFiller(DetSetVector<T>& iv, typename DetSetVector<T>::Item& it, bool isaveEmpty = false)
256  : m_v(iv), m_item(it), m_saveEmpty(isaveEmpty) {
257  if (m_v.onDemand())
259  if (m_v.ready())
260  m_item.offset = int(m_v.m_data.size());
261  }
263  if (!m_saveEmpty && m_item.size == 0) {
264  m_v.pop_back(m_item.id);
265  }
266  assert(m_v.m_filling == true);
267  m_v.m_filling = false;
268  }
269 
270  void abort() {
271  m_v.pop_back(m_item.id);
272  m_saveEmpty = true; // avoid mess in destructor
273  }
274 
275  void checkCapacityExausted() const {
276  if (m_v.onDemand() && m_v.m_data.size() == m_v.m_data.capacity())
278  }
279 
280  void checkCapacityExausted(size_type s) const {
281  if (m_v.onDemand() && m_v.m_data.size() + s > m_v.m_data.capacity())
283  }
284 
285  void reserve(size_type s) {
286  if (m_item.offset + s <= m_v.m_data.capacity())
287  return;
288  if (m_v.onDemand())
290  m_v.m_data.reserve(m_item.offset + s);
291  }
292 
293  void resize(size_type s) {
294  checkCapacityExausted(s);
295  m_v.m_data.resize(m_item.offset + s);
296  m_v.m_dataSize = m_v.m_data.size();
297  m_item.size = s;
298  }
299 
300  id_type id() const { return m_item.id; }
301  size_type size() const { return m_item.size; }
302  bool empty() const { return m_item.size == 0; }
303 
304  data_type& operator[](size_type i) { return m_v.m_data[m_item.offset + i]; }
305  DataIter begin() { return m_v.m_data.begin() + m_item.offset; }
306  DataIter end() { return begin() + size(); }
307 
308  void push_back(data_type const& d) {
309  checkCapacityExausted();
310  m_v.m_data.push_back(d);
311  ++m_v.m_dataSize;
312  m_item.size++;
313  }
314  void push_back(data_type&& d) {
315  checkCapacityExausted();
316  m_v.m_data.push_back(std::move(d));
317  ++m_v.m_dataSize;
318  m_item.size++;
319  }
320 
321  data_type& back() { return m_v.m_data.back(); }
322 
323  private:
324  //for testing
325  friend class ::TestDetSet;
326 
330  };
331 
332  /* fill on demand a given DetSet
333  */
334  class TSFastFiller {
335  public:
340 
341 #ifdef DSVN_USE_ATOMIC
342  // here just to make the compiler happy
343  static DetSetVector<T>::Item const& dummy() {
344  assert(false);
345  static DetSetVector<T>::Item const d;
346  return d;
347  }
348  // this constructor is not supposed to be used in Concurrent mode
349  TSFastFiller(DetSetVector<T>& iv, id_type id) : m_v(iv), m_item(m_v.ready() ? iv.push_back(id) : dummy()) {
350  assert(m_v.m_filling == true);
351  m_v.m_filling = false;
352  }
353 
354  TSFastFiller(DetSetVector<T> const& iv, typename DetSetVector<T>::Item const& it) : m_v(iv), m_item(it) {}
356  bool expected = false;
357  while (!m_v.m_filling.compare_exchange_weak(expected, true)) {
358  expected = false;
359  nanosleep(nullptr, nullptr);
360  }
361  int offset = m_v.m_data.size();
362  if (m_v.onDemand() && full()) {
363  m_v.m_filling = false;
365  }
366  std::move(m_lv.begin(), m_lv.end(), std::back_inserter(m_v.m_data));
367  m_item.size = m_lv.size();
368  m_item.offset = offset;
369 
370  m_v.m_dataSize = m_v.m_data.size();
371  assert(m_v.m_filling == true);
372  m_v.m_filling = false;
373  }
374 
375 #endif
376 
377  bool full() const {
378  int offset = m_v.m_dataSize;
379  return m_v.m_data.capacity() < offset + m_lv.size();
380  }
381 
382  void abort() { m_lv.clear(); }
383 
384  void reserve(size_type s) { m_lv.reserve(s); }
385 
386  void resize(size_type s) { m_lv.resize(s); }
387 
388  id_type id() const { return m_item.id; }
389  size_type size() const { return m_lv.size(); }
390  bool empty() const { return m_lv.empty(); }
391 
392  data_type& operator[](size_type i) { return m_lv[i]; }
393  DataIter begin() { return m_lv.begin(); }
394  DataIter end() { return m_lv.end(); }
395 
396  void push_back(data_type const& d) { m_lv.push_back(d); }
397  void push_back(data_type&& d) { m_lv.push_back(std::move(d)); }
398 
399  data_type& back() { return m_lv.back(); }
400 
401  private:
402  //for testing
403  friend class ::TestDetSet;
404 
405  std::vector<T> m_lv;
407  typename DetSetVector<T>::Item const& m_item;
408  };
409 
410  friend class FastFiller;
411  friend class TSFastFiller;
412  friend class edmNew::DetSet<T>;
413 
415  public:
416  using first_argument_type = const edmNew::DetSetVector<T>&;
417  using second_argument_type = unsigned int;
418  using result_type = const T*;
419 
421 #ifdef DSVN_USE_ATOMIC
422  {
423  bool expected = false;
424  while (!iContainer.m_filling.compare_exchange_weak(expected, true, std::memory_order_acq_rel)) {
425  expected = false;
426  nanosleep(nullptr, nullptr);
427  }
428  result_type item = &(iContainer.m_data[iIndex]);
429  assert(iContainer.m_filling == true);
430  iContainer.m_filling = false;
431  return item;
432  }
433 #else
434  ;
435 #endif
436  };
437  friend class FindForDetSetVector;
438 
439  explicit DetSetVector(int isubdet = 0) : m_subdetId(isubdet) {}
440 
441  DetSetVector(std::shared_ptr<dslv::LazyGetter<T> > iGetter, const std::vector<det_id_type>& iDets, int isubdet = 0);
442 
444  // delete content if T is pointer...
445  }
446 
447  // default or delete is the same...
448  DetSetVector& operator=(const DetSetVector&) = delete;
449  // Implement copy constructor because of a (possibly temporary)
450  // need in heterogeneous framework prototyping. In general this
451  // class is still supposed to be non-copyable, so to prevent
452  // accidental copying the assignment operator is left deleted.
453  DetSetVector(const DetSetVector&) = default;
454  DetSetVector(DetSetVector&&) = default;
455  DetSetVector& operator=(DetSetVector&&) = default;
456 
457  bool onDemand() const { return !m_getter.empty(); }
458 
459  void swap(DetSetVector& rh) {
461  std::swap(m_subdetId, rh.m_subdetId);
462  std::swap(m_ids, rh.m_ids);
463  std::swap(m_data, rh.m_data);
464  }
465 
466  void swap(IdContainer& iic, DataContainer& idc) {
467  std::swap(m_ids, iic);
468  std::swap(m_data, idc);
469  }
470 
471  void reserve(size_t isize, size_t dsize) {
472  m_ids.reserve(isize);
473  m_data.reserve(dsize);
474  }
475 
476  void shrink_to_fit() {
477  clean();
478  m_ids.shrink_to_fit();
479  m_data.shrink_to_fit();
480  }
481 
482  void resize(size_t isize, size_t dsize) {
483  m_ids.resize(isize);
484  m_data.resize(dsize);
485  m_dataSize = m_data.size();
486  }
487 
488  void clean() {
489  m_ids.erase(std::remove_if(m_ids.begin(), m_ids.end(), [](Item const& m) { return 0 == m.size; }), m_ids.end());
490  }
491 
492  // FIXME not sure what the best way to add one cell to cont
493  DetSet insert(id_type iid, data_type const* idata, size_type isize) {
494  Item& item = addItem(iid, isize);
495  m_data.resize(m_data.size() + isize);
496  std::copy(idata, idata + isize, m_data.begin() + item.offset);
497  m_dataSize = m_data.size();
498  return DetSet(*this, item, false);
499  }
500  //make space for it
501  DetSet insert(id_type iid, size_type isize) {
502  Item& item = addItem(iid, isize);
503  m_data.resize(m_data.size() + isize);
504  m_dataSize = m_data.size();
505  return DetSet(*this, item, false);
506  }
507 
508  // to be used with a FastFiller
509  Item& push_back(id_type iid) { return addItem(iid, 0); }
510 
511  // remove last entry (usually only if empty...)
512  void pop_back(id_type iid) {
513  const_IdIter p = findItem(iid);
514  if (p == m_ids.end())
515  return; //bha!
516  // sanity checks... (shall we throw or assert?)
517  if ((*p).isValid() && (*p).size > 0 && m_data.size() == (*p).offset + (*p).size) {
518  m_data.resize((*p).offset);
519  m_dataSize = m_data.size();
520  }
521  m_ids.erase(m_ids.begin() + (p - m_ids.begin()));
522  }
523 
524  private:
525  Item& addItem(id_type iid, size_type isize) {
526  Item it(iid, size_type(m_data.size()), isize);
527  IdIter p = std::lower_bound(m_ids.begin(), m_ids.end(), it);
528  if (p != m_ids.end() && !(it < *p))
530  return *m_ids.insert(p, std::move(it));
531  }
532 
533  public:
534  //---------------------------------------------------------
535 
536  bool exists(id_type i) const { return findItem(i) != m_ids.end(); }
537 
538  bool isValid(id_type i) const {
539  const_IdIter p = findItem(i);
540  return p != m_ids.end() && (*p).isValid();
541  }
542 
543  /*
544  DetSet operator[](id_type i) {
545  const_IdIter p = findItem(i);
546  if (p==m_ids.end()) what???
547  return DetSet(*this,p-m_ids.begin());
548  }
549  */
550 
551  DetSet operator[](id_type i) const {
552  const_IdIter p = findItem(i);
553  if (p == m_ids.end())
555  return DetSet(*this, *p, true);
556  }
557 
558  // slow interface
559  // const_iterator find(id_type i, bool update=true) const {
560  const_iterator find(id_type i, bool update = false) const {
561  const_IdIter p = findItem(i);
562  return (p == m_ids.end()) ? end() : boost::make_transform_iterator(p, IterHelp(*this, update));
563  }
564 
565  // slow interface
566  const_IdIter findItem(id_type i) const {
567  std::pair<const_IdIter, const_IdIter> p = std::equal_range(m_ids.begin(), m_ids.end(), Item(i));
568  return (p.first != p.second) ? p.first : m_ids.end();
569  }
570 
571  // const_iterator begin(bool update=true) const {
572  const_iterator begin(bool update = false) const {
573  return boost::make_transform_iterator(m_ids.begin(), IterHelp(*this, update));
574  }
575 
576  // const_iterator end(bool update=true) const {
577  const_iterator end(bool update = false) const {
578  return boost::make_transform_iterator(m_ids.end(), IterHelp(*this, update));
579  }
580 
581  // return an iterator range (implemented here to avoid dereference of detset)
582  template <typename CMP>
583  // Range equal_range(id_type i, CMP cmp, bool update=true) const {
584  Range equal_range(id_type i, CMP cmp, bool update = false) const {
585  std::pair<const_IdIter, const_IdIter> p = std::equal_range(m_ids.begin(), m_ids.end(), i, cmp);
586  return Range(boost::make_transform_iterator(p.first, IterHelp(*this, update)),
587  boost::make_transform_iterator(p.second, IterHelp(*this, update)));
588  }
589 
590  int subdetId() const { return m_subdetId; }
591 
592  bool empty() const { return m_ids.empty(); }
593 
594  size_type dataSize() const { return onDemand() ? size_type(m_dataSize) : size_type(m_data.size()); }
595 
596  size_type size() const { return m_ids.size(); }
597 
598  //FIXME fast interfaces, not consistent with associative nature of container....
599 
600  data_type operator()(size_t cell, size_t frame) const { return m_data[m_ids[cell].offset + frame]; }
601 
602  data_type const* data(size_t cell) const { return &m_data[m_ids[cell].offset]; }
603 
604  size_type detsetSize(size_t cell) const { return m_ids[cell].size; }
605 
606  id_type id(size_t cell) const { return m_ids[cell].id; }
607 
608  Item const& item(size_t cell) const { return m_ids[cell]; }
609 
610  //------------------------------
611 
612  IdContainer const& ids() const { return m_ids; }
613  DataContainer const& data() const { return m_data; }
614 
615  //Used by ROOT storage
617 
618  private:
619  //for testing
620  friend class ::TestDetSet;
621 
622  void update(Item const& item) const;
623 
624  // subdetector id (as returned by DetId::subdetId())
625  int m_subdetId;
626 
627  // Workaround for ROOT 6 bug.
628  // ROOT6 has a problem with this IdContainer typedef
629  //IdContainer m_ids;
630  std::vector<Trans::Item> m_ids;
631  CMS_THREAD_GUARD(dstvdetails::DetSetVectorTrans::m_filling) mutable DataContainer m_data;
632  };
633 
634  namespace dslv {
635  template <typename T>
636  class LazyGetter {
637  public:
638  virtual ~LazyGetter() {}
639  virtual void fill(typename DetSetVector<T>::TSFastFiller&) = 0;
640  };
641  } // namespace dslv
642 
643  template <typename T>
644  inline DetSetVector<T>::DetSetVector(std::shared_ptr<Getter> iGetter,
645  const std::vector<det_id_type>& iDets,
646  int isubdet)
647  : m_subdetId(isubdet) {
648  m_getter = iGetter;
649 
650  m_ids.reserve(iDets.size());
651  det_id_type sanityCheck = 0;
652  for (std::vector<det_id_type>::const_iterator itDetId = iDets.begin(), itDetIdEnd = iDets.end();
653  itDetId != itDetIdEnd;
654  ++itDetId) {
655  assert(sanityCheck < *itDetId && "vector of det_id_type was not ordered");
656  sanityCheck = *itDetId;
657  m_ids.push_back(*itDetId);
658  }
659  }
660 
661 #ifdef DSVN_USE_ATOMIC
662  template <typename T>
663  inline void DetSetVector<T>::update(const Item& item) const {
664  // no m_getter or already updated
665  if (m_getter.empty()) {
666  assert(item.isValid());
667  return;
668  }
669  if (item.initialize()) {
670  assert(item.initializing());
671  {
672  TSFastFiller ff(*this, item);
673  (*boost::any_cast<std::shared_ptr<Getter> >(&m_getter))->fill(ff);
674  }
675  assert(item.isValid());
676  }
677  }
678 #endif
679 
680 #ifdef DSVN_USE_ATOMIC
681  template <typename T>
682  inline void DetSet<T>::set(DetSetVector<T> const& icont, typename Container::Item const& item, bool update) {
683  // if an item is being updated we wait
684  if (update)
685  icont.update(item);
686  while (item.initializing())
687  nanosleep(nullptr, nullptr);
688  m_data = &icont.data();
689  m_id = item.id;
690  m_offset = item.offset;
691  m_size = item.size;
692  }
693 #endif
694 } // namespace edmNew
695 
697 #include <type_traits>
698 
699 //specialize behavior of edm::Ref to get access to the 'Det'
700 namespace edm {
701  /* Reference to an item inside a new DetSetVector ... */
702  namespace refhelper {
703  template <typename T>
704  struct FindTrait<typename edmNew::DetSetVector<T>, T> {
706  };
707  } // namespace refhelper
708  /* ... as there was one for the original DetSetVector*/
709 
710  /* Probably this one is not that useful .... */
711  namespace refhelper {
712  template <typename T>
714  using first_argument_type = const edmNew::DetSetVector<T>&;
715  using second_argument_type = unsigned int;
717 
719  return &(iContainer[iIndex]);
720  }
721  };
722 
723  template <typename T>
726  };
727  } // namespace refhelper
728  /* ... implementation is provided, just in case it's needed */
729 } // namespace edm
730 
731 namespace edmNew {
732  //helper function to make it easier to create a edm::Ref to a new DSV
733  template <class HandleT>
734  // inline
736  const HandleT& iHandle, typename HandleT::element_type::value_type::const_iterator itIter) {
737  static_assert(std::is_same<typename HandleT::element_type,
739  "Handle and DetSetVector do not have compatible types.");
740  auto index = itIter - &iHandle->data().front();
742  iHandle.id(), &(*itIter), index);
743  }
744 } // namespace edmNew
745 
747 
748 namespace edm {
749  template <typename T>
751  public:
752  typedef T value_type;
753 
754  static size_t size(const edmNew::DetSetVector<T>* iContainer) { return iContainer->dataSize(); }
755  static unsigned int indexFor(const value_type* iElement, const edmNew::DetSetVector<T>* iContainer) {
756  return iElement - &(iContainer->data().front());
757  }
758  };
759 } // namespace edm
760 
761 #ifdef DSVN_USE_ATOMIC
762 #undef DSVN_USE_ATOMIC
763 #endif
764 
765 #endif
size
Write out results.
bool isValid(id_type i) const
DataContainer const & data() const
static unsigned int indexFor(const value_type *iElement, const edmNew::DetSetVector< T > *iContainer)
void swap(DetSetVectorTrans &rh)
void push_back(data_type const &d)
void update(Item const &item) const
const_iterator end(bool update=false) const
static DetSetVector< T >::Item & dummy()
size_type dataSize() const
DetSetVector< T >::id_type id_type
result_type operator()(first_argument_type iContainer, second_argument_type iIndex)
Range equal_range(id_type i, CMP cmp, bool update=false) const
std::vector< data_type > DataContainer
std::pair< const_iterator, const_iterator > Range
Item & push_back(id_type iid)
const_IdIter findItem(id_type i) const
std::vector< Trans::Item > m_ids
PixelRecoRange< float > Range
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:40
IdContainer::iterator IdIter
void checkCapacityExausted(size_type s) const
void set(Container const &icont, typename Container::Item const &item, bool update=true)
#define nullptr
edmNew::DetSetVector< T >::FindForDetSetVector value
std::vector< data_type >::const_iterator const_DataIter
void swap(DetSetVector &rh)
void throw_range(det_id_type iid)
DetSetVector(int isubdet=0)
TSFastFiller(DetSetVector< T > const &iv, typename DetSetVector< T >::Item const &it)
void pop_back(id_type iid)
#define CMS_CLASS_VERSION(_version_)
id_type id(size_t cell) const
uint16_t size_type
DetSetVectorTrans(const DetSetVectorTrans &rh)
DetSetVector< T > const & m_v
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
DetSetVector< T > const * m_v
dstvdetails::DetSetVectorTrans Trans
static void clean(char *s)
Item const & item(size_t cell) const
bool onDemand() const
IterHelp(DetSetVector< T > const &iv, bool iup)
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)
Definition: DetSetVector.h:418
Item & addItem(id_type iid, size_type isize)
DetSetVector< T >::data_type value_type
static DetSetVector< T >::Item const & dummy()
DetSetVectorTrans & operator=(DetSetVectorTrans &&rh)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
DetSetVector< T >::Item & m_item
bool exists(id_type i) const
void push_back(data_type const &d)
IdContainer const & ids() const
Definition: GenABIO.cc:168
data_type const * data(size_t cell) const
FastFiller(DetSetVector< T > &iv, id_type id, bool isaveEmpty=false)
#define CMS_THREAD_GUARD(_var_)
DetSetVector< T >::size_type size_type
Item(id_type i=0, int io=-1, size_type is=0)
DetSetVector< T >::Item const & m_item
void swap(IdContainer &iic, DataContainer &idc)
#define end
Definition: vmac.h:39
Definition: value.py:1
DetSetVector< T >::id_type key_type
static size_t size(const edmNew::DetSetVector< T > *iContainer)
void resize(size_t isize, size_t dsize)
d
Definition: ztail.py:151
TSFastFiller(DetSetVector< T > &iv, id_type id)
size_type detsetSize(size_t cell) const
DetSetVector()
Create an empty DetSetVector.
Definition: DetSetVector.h:194
DetSet insert(id_type iid, data_type const *idata, size_type isize)
std::pair< IdIter, DataIter > IterPair
Namespace of DDCMS conversion namespace.
std::vector< Item > IdContainer
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
#define noexcept
uint32_t det_id_type
Definition: DetSet.h:21
dslv::LazyGetter< T > Getter
DetSetVector< T >::id_type key_type
void errorIdExists(det_id_type iid)
result_type operator()(first_argument_type iContainer, second_argument_type iIndex)
void reserve(size_t isize, size_t dsize)
data_type & operator[](size_type i)
std::vector< data_type >::iterator DataIter
result_type & operator()(Item const &item) const
const_iterator find(id_type i, bool update=false) const
DetSet insert(id_type iid, size_type isize)
size_type size() const
#define begin
Definition: vmac.h:32
HLT enums.
#define update(a, b)
IdContainer::const_iterator const_IdIter
data_type operator()(size_t cell, size_t frame) const
edmNew::DetSet< T > DetSet
std::pair< const_IdIter, const_DataIter > const_IterPair
FastFiller(DetSetVector< T > &iv, typename DetSetVector< T >::Item &it, bool isaveEmpty=false)
data_type & operator[](size_type i)
edm::refhelper::FindForNewDetSetVector< data_type > RefFinder
DetSetVectorTrans(DetSetVectorTrans &&rh)
long double T
DetSetVector< T >::size_type size_type
DetSetVector< T >::id_type id_type
DetSet operator[](id_type i) const
DetSetVector< T >::data_type value_type
def move(src, dest)
Definition: eostools.py:511
const_iterator begin(bool update=false) const