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