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