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