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 
413  class FindForDetSetVector : public std::binary_function<const edmNew::DetSetVector<T>&, unsigned int, const T*> {
414  public:
415  typedef FindForDetSetVector self;
416  typename self::result_type operator()(typename self::first_argument_type iContainer, typename self::second_argument_type iIndex)
417 #ifdef DSVN_USE_ATOMIC
418  {
419  bool expected=false;
420  while (!iContainer.m_filling.compare_exchange_weak(expected,true,std::memory_order_acq_rel)) { expected=false; nanosleep(nullptr,nullptr);}
421  typename self::result_type item = &(iContainer.m_data[iIndex]);
422  assert(iContainer.m_filling==true);
423  iContainer.m_filling = false;
424  return item;
425  }
426 #else
427  ;
428 #endif
429  };
430  friend class FindForDetSetVector;
431 
432  explicit DetSetVector(int isubdet=0) :
433  m_subdetId(isubdet) {}
434 
435  DetSetVector(std::shared_ptr<dslv::LazyGetter<T> > iGetter, const std::vector<det_id_type>& iDets,
436  int isubdet=0);
437 
438 
440  // delete content if T is pointer...
441  }
442 
443  // default or delete is the same...
444  DetSetVector& operator=(const DetSetVector&) = delete;
445  // Implement copy constructor because of a (possibly temporary)
446  // need in heterogeneous framework prototyping. In general this
447  // class is still supposed to be non-copyable, so to prevent
448  // accidental copying the assignment operator is left deleted.
449  DetSetVector(const DetSetVector&) = default;
450  DetSetVector(DetSetVector&&) = default;
451  DetSetVector& operator=(DetSetVector&&) = default;
452 
453  bool onDemand() const { return !m_getter.empty();}
454 
455 
456 
457  void swap(DetSetVector & rh) {
459  std::swap(m_subdetId,rh.m_subdetId);
460  std::swap(m_ids,rh.m_ids);
461  std::swap(m_data,rh.m_data);
462  }
463 
464  void swap(IdContainer & iic, DataContainer & idc) {
465  std::swap(m_ids,iic);
466  std::swap(m_data,idc);
467  }
468 
469  void reserve(size_t isize, size_t dsize) {
470  m_ids.reserve(isize);
471  m_data.reserve(dsize);
472  }
473 
474  void shrink_to_fit() {
475  clean();
476  m_ids.shrink_to_fit();
477  m_data.shrink_to_fit();
478  }
479 
480  void resize(size_t isize, size_t dsize) {
481  m_ids.resize(isize);
482  m_data.resize(dsize);
483  m_dataSize = m_data.size();
484  }
485 
486  void clean() {
487  m_ids.erase(std::remove_if(m_ids.begin(),m_ids.end(),[](Item const& m){ return 0==m.size;}),m_ids.end());
488  }
489 
490  // FIXME not sure what the best way to add one cell to cont
491  DetSet insert(id_type iid, data_type const * idata, size_type isize) {
492  Item & item = addItem(iid,isize);
493  m_data.resize(m_data.size()+isize);
494  std::copy(idata,idata+isize,m_data.begin()+item.offset);
495  m_dataSize = m_data.size();
496  return DetSet(*this,item,false);
497  }
498  //make space for it
499  DetSet insert(id_type iid, size_type isize) {
500  Item & item = addItem(iid,isize);
501  m_data.resize(m_data.size()+isize);
502  m_dataSize = m_data.size();
503  return DetSet(*this,item,false);
504  }
505 
506  // to be used with a FastFiller
507  Item & push_back(id_type iid) {
508  return addItem(iid,0);
509  }
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()) return; //bha!
515  // sanity checks... (shall we throw or assert?)
516  if ( (*p).isValid() && (*p).size>0 &&
517  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 
526  Item & addItem(id_type iid, size_type isize) {
527  Item it(iid,size_type(m_data.size()),isize);
528  IdIter p = std::lower_bound(m_ids.begin(),
529  m_ids.end(),
530  it);
531  if (p!=m_ids.end() && !(it<*p)) dstvdetails::errorIdExists(iid);
532  return *m_ids.insert(p,std::move(it));
533  }
534 
535 
536 
537  public:
538 
539 
540  //---------------------------------------------------------
541 
542  bool exists(id_type i) const {
543  return findItem(i)!=m_ids.end();
544  }
545 
546  bool isValid(id_type i) const {
547  const_IdIter p = findItem(i);
548  return p!=m_ids.end() && (*p).isValid();
549  }
550 
551  /*
552  DetSet operator[](id_type i) {
553  const_IdIter p = findItem(i);
554  if (p==m_ids.end()) what???
555  return DetSet(*this,p-m_ids.begin());
556  }
557  */
558 
559 
560  DetSet operator[](id_type i) const {
561  const_IdIter p = findItem(i);
562  if (p==m_ids.end()) dstvdetails::throw_range(i);
563  return DetSet(*this,*p,true);
564  }
565 
566  // slow interface
567  // const_iterator find(id_type i, bool update=true) const {
568  const_iterator find(id_type i, bool update=false) const {
569  const_IdIter p = findItem(i);
570  return (p==m_ids.end()) ? end() :
571  boost::make_transform_iterator(p,
572  IterHelp(*this,update));
573  }
574 
575  // slow interface
576  const_IdIter findItem(id_type i) const {
577  std::pair<const_IdIter,const_IdIter> p =
578  std::equal_range(m_ids.begin(),m_ids.end(),Item(i));
579  return (p.first!=p.second) ? p.first : m_ids.end();
580  }
581 
582  // const_iterator begin(bool update=true) const {
583  const_iterator begin(bool update=false) const {
584  return boost::make_transform_iterator(m_ids.begin(),
585  IterHelp(*this,update));
586  }
587 
588  // const_iterator end(bool update=true) const {
589  const_iterator end(bool update=false) const {
590  return boost::make_transform_iterator(m_ids.end(),
591  IterHelp(*this,update));
592  }
593 
594 
595  // return an iterator range (implemented here to avoid dereference of detset)
596  template<typename CMP>
597  // Range equal_range(id_type i, CMP cmp, bool update=true) const {
598  Range equal_range(id_type i, CMP cmp, bool update=false) const {
599  std::pair<const_IdIter,const_IdIter> p =
600  std::equal_range(m_ids.begin(),m_ids.end(),i,cmp);
601  return Range(boost::make_transform_iterator(p.first,IterHelp(*this,update)),
602  boost::make_transform_iterator(p.second,IterHelp(*this,update))
603  );
604  }
605 
606  int subdetId() const { return m_subdetId; }
607 
608  bool empty() const { return m_ids.empty();}
609 
610 
611  size_type dataSize() const { return onDemand()? size_type(m_dataSize) : size_type(m_data.size()); }
612 
613  size_type size() const { return m_ids.size();}
614 
615  //FIXME fast interfaces, not consistent with associative nature of container....
616 
617  data_type operator()(size_t cell, size_t frame) const {
618  return m_data[m_ids[cell].offset+frame];
619  }
620 
621  data_type const * data(size_t cell) const {
622  return &m_data[m_ids[cell].offset];
623  }
624 
625  size_type detsetSize(size_t cell) const { return m_ids[cell].size; }
626 
627  id_type id(size_t cell) const {
628  return m_ids[cell].id;
629  }
630 
631  Item const & item(size_t cell) const {
632  return m_ids[cell];
633  }
634 
635  //------------------------------
636 
637  IdContainer const & ids() const { return m_ids;}
638  DataContainer const & data() const { return m_data;}
639 
640 
641  //Used by ROOT storage
643 
644  private:
645  //for testing
646  friend class ::TestDetSet;
647 
648  void update(Item const & item) const;
649 
650  // subdetector id (as returned by DetId::subdetId())
651  int m_subdetId;
652 
653  // Workaround for ROOT 6 bug.
654  // ROOT6 has a problem with this IdContainer typedef
655  //IdContainer m_ids;
656  std::vector<Trans::Item> m_ids;
657  CMS_THREAD_GUARD(dstvdetails::DetSetVectorTrans::m_filling) mutable DataContainer m_data;
658 
659  };
660 
661  namespace dslv {
662  template< typename T>
663  class LazyGetter {
664  public:
665  virtual ~LazyGetter() {}
666  virtual void fill(typename DetSetVector<T>::TSFastFiller&) = 0;
667  };
668  }
669 
670 
671  template<typename T>
672  inline DetSetVector<T>::DetSetVector(std::shared_ptr<Getter> iGetter,
673  const std::vector<det_id_type>& iDets,
674  int isubdet):
675  m_subdetId(isubdet) {
676  m_getter=iGetter;
677 
678  m_ids.reserve(iDets.size());
679  det_id_type sanityCheck = 0;
680  for(std::vector<det_id_type>::const_iterator itDetId = iDets.begin(), itDetIdEnd = iDets.end();
681  itDetId != itDetIdEnd;
682  ++itDetId) {
683  assert(sanityCheck < *itDetId && "vector of det_id_type was not ordered");
684  sanityCheck = *itDetId;
685  m_ids.push_back(*itDetId);
686  }
687  }
688 
689 #ifdef DSVN_USE_ATOMIC
690  template<typename T>
691  inline void DetSetVector<T>::update(const Item & item) const {
692  // no m_getter or already updated
693  if (m_getter.empty()) { assert(item.isValid()); return;}
694  if (item.initialize() ){
695  assert(item.initializing());
696  {
697  TSFastFiller ff(*this,item);
698  (*boost::any_cast<std::shared_ptr<Getter> >(&m_getter))->fill(ff);
699  }
700  assert(item.isValid());
701  }
702  }
703 #endif
704 
705 
706 #ifdef DSVN_USE_ATOMIC
707  template<typename T>
708  inline void DetSet<T>::set(DetSetVector<T> const & icont,
709  typename Container::Item const & item, bool update) {
710  // if an item is being updated we wait
711  if (update) icont.update(item);
712  while(item.initializing()) nanosleep(nullptr,nullptr);
713  m_data=&icont.data();
714  m_id=item.id;
715  m_offset = item.offset;
716  m_size=item.size;
717  }
718 #endif
719 }
720 
722 #include <type_traits>
723 
724 //specialize behavior of edm::Ref to get access to the 'Det'
725 namespace edm {
726  /* Reference to an item inside a new DetSetVector ... */
727  namespace refhelper {
728  template<typename T>
729  struct FindTrait<typename edmNew::DetSetVector<T>,T> {
731  };
732  }
733  /* ... as there was one for the original DetSetVector*/
734 
735  /* Probably this one is not that useful .... */
736  namespace refhelper {
737  template<typename T>
738  struct FindSetForNewDetSetVector : public std::binary_function<const edmNew::DetSetVector<T>&, unsigned int, edmNew::DetSet<T> > {
740  typename self::result_type operator()(typename self::first_argument_type iContainer, typename self::second_argument_type iIndex) {
741  return &(iContainer[iIndex]);
742  }
743  };
744 
745  template<typename T>
748  };
749  }
750  /* ... implementation is provided, just in case it's needed */
751 }
752 
753 namespace edmNew {
754  //helper function to make it easier to create a edm::Ref to a new DSV
755  template<class HandleT>
756  // inline
758  makeRefTo(const HandleT& iHandle,
759  typename HandleT::element_type::value_type::const_iterator itIter) {
760  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.");
761  auto index = itIter - &iHandle->data().front();
762  return edm::Ref<typename HandleT::element_type,
764  (iHandle.id(), &(*itIter), index);
765  }
766 }
767 
768 
769 
771 
772 namespace edm {
773  template<typename T>
775  public:
776  typedef T value_type;
777 
778  static size_t size(const edmNew::DetSetVector<T>* iContainer) { return iContainer->dataSize();}
779  static unsigned int indexFor(const value_type* iElement, const edmNew::DetSetVector<T>* iContainer) {
780  return iElement-&(iContainer->data().front());
781  }
782  };
783 }
784 
785 #ifdef DSVN_USE_ATOMIC
786 #undef DSVN_USE_ATOMIC
787 #endif
788 
789 #endif
790 
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
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
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:511
const_iterator begin(bool update=false) const