CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
edmNew::DetSetVector< T > Class Template Reference

#include <DetSetNew.h>

Inheritance diagram for edmNew::DetSetVector< T >:
edmNew::dstvdetails::DetSetVectorTrans

Classes

class  FastFiller
 
class  FindForDetSetVector
 
struct  IterHelp
 

Public Types

typedef std::vector< data_type >
::const_iterator 
const_DataIter
 
typedef IdContainer::const_iterator const_IdIter
 
typedef
boost::transform_iterator
< IterHelp, const_IdIter
const_iterator
 
typedef std::pair
< const_IdIter, const_DataIter
const_IterPair
 
typedef T data_type
 
typedef std::vector< data_typeDataContainer
 
typedef std::vector< data_type >
::iterator 
DataIter
 
typedef edmNew::DetSet< T > DetSet
 
typedef dslv::LazyGetter< T > Getter
 
typedef unsigned int id_type
 
typedef std::vector< ItemIdContainer
 
typedef IdContainer::iterator IdIter
 
typedef Trans::Item Item
 
typedef std::pair< IdIter,
DataIter
IterPair
 
typedef id_type key_type
 
typedef std::pair
< const_iterator,
const_iterator
Range
 
typedef
edm::refhelper::FindForNewDetSetVector
< data_type
RefFinder
 
typedef edmNew::DetSetVector< T > self
 
typedef unsigned int size_type
 
typedef
dstvdetails::DetSetVectorTrans 
Trans
 
typedef DetSet value_type
 

Public Member Functions

const_iterator begin () const
 
data_type const * data (size_t cell) const
 
DataContainer const & data () const
 
size_type dataSize () const
 
size_type detsetSize (size_t cell) const
 
 DetSetVector (int isubdet=0)
 
 DetSetVector (boost::shared_ptr< dslv::LazyGetter< T > > iGetter, const std::vector< det_id_type > &iDets, int isubdet=0)
 
bool empty () const
 
const_iterator end () const
 
template<typename CMP >
Range equal_range (id_type i, CMP cmp) const
 
bool exists (id_type i) const
 
const_iterator find (id_type i) const
 
const_IdIter findItem (id_type i) const
 
id_type id (size_t cell) const
 
DetSet insert (id_type iid, data_type const *idata, size_type isize)
 
DetSet insert (id_type iid, size_type isize)
 
bool isValid (id_type i) const
 
Item const & item (size_t cell) const
 
data_type operator() (size_t cell, size_t frame) const
 
DetSet operator[] (id_type i) const
 
void pop_back (id_type iid)
 
Itempush_back (id_type iid)
 
void reserve (size_t isize, size_t dsize)
 
void resize (size_t isize, size_t dsize)
 
size_type size () const
 
int subdetId () const
 
void swap (DetSetVector &rh)
 
void swap (IdContainer &iic, DataContainer &idc)
 
void update (Item const &item) const
 
 ~DetSetVector ()
 

Private Member Functions

ItemaddItem (id_type iid, size_type isize)
 
void updateImpl (Item &item)
 
- Private Member Functions inherited from edmNew::dstvdetails::DetSetVectorTrans
 DetSetVectorTrans ()
 

Private Attributes

DataContainer m_data
 
IdContainer m_ids
 
int m_subdetId
 
- Private Attributes inherited from edmNew::dstvdetails::DetSetVectorTrans
bool filling
 
boost::any getter
 

Friends

class FastFiller
 
class FindForDetSetVector
 

Additional Inherited Members

- Private Types inherited from edmNew::dstvdetails::DetSetVectorTrans
typedef unsigned int id_type
 
typedef unsigned int size_type
 

Detailed Description

template<typename T>
class edmNew::DetSetVector< T >

an optitimized container that linearized a "map of vector". It corresponds to a set of variable size array of T each belonging to a "Det" identified by an 32bit id

FIXME interface to be finalized once use-cases fully identified

although it is sorted internally it is strongly adviced to fill it already sorted....

Definition at line 8 of file DetSetNew.h.

Member Typedef Documentation

template<typename T>
typedef std::vector<data_type>::const_iterator edmNew::DetSetVector< T >::const_DataIter

Definition at line 86 of file DetSetVectorNew.h.

template<typename T>
typedef IdContainer::const_iterator edmNew::DetSetVector< T >::const_IdIter

Definition at line 85 of file DetSetVectorNew.h.

template<typename T>
typedef boost::transform_iterator<IterHelp,const_IdIter> edmNew::DetSetVector< T >::const_iterator

Definition at line 104 of file DetSetVectorNew.h.

template<typename T>
typedef std::pair<const_IdIter,const_DataIter> edmNew::DetSetVector< T >::const_IterPair

Definition at line 87 of file DetSetVectorNew.h.

template<typename T>
typedef T edmNew::DetSetVector< T >::data_type

Definition at line 71 of file DetSetVectorNew.h.

template<typename T>
typedef std::vector<data_type> edmNew::DetSetVector< T >::DataContainer

Definition at line 81 of file DetSetVectorNew.h.

template<typename T>
typedef std::vector<data_type>::iterator edmNew::DetSetVector< T >::DataIter

Definition at line 83 of file DetSetVectorNew.h.

template<typename T>
typedef edmNew::DetSet<T> edmNew::DetSetVector< T >::DetSet

Definition at line 73 of file DetSetVectorNew.h.

template<typename T>
typedef dslv::LazyGetter<T> edmNew::DetSetVector< T >::Getter

Definition at line 74 of file DetSetVectorNew.h.

template<typename T>
typedef unsigned int edmNew::DetSetVector< T >::id_type

Definition at line 70 of file DetSetVectorNew.h.

template<typename T>
typedef std::vector<Item> edmNew::DetSetVector< T >::IdContainer

Definition at line 80 of file DetSetVectorNew.h.

template<typename T>
typedef IdContainer::iterator edmNew::DetSetVector< T >::IdIter

Definition at line 82 of file DetSetVectorNew.h.

template<typename T>
typedef Trans::Item edmNew::DetSetVector< T >::Item

Definition at line 68 of file DetSetVectorNew.h.

template<typename T>
typedef std::pair<IdIter,DataIter> edmNew::DetSetVector< T >::IterPair

Definition at line 84 of file DetSetVectorNew.h.

template<typename T>
typedef id_type edmNew::DetSetVector< T >::key_type

Definition at line 77 of file DetSetVectorNew.h.

template<typename T>
typedef std::pair<const_iterator,const_iterator> edmNew::DetSetVector< T >::Range

Definition at line 105 of file DetSetVectorNew.h.

Definition at line 89 of file DetSetVectorNew.h.

template<typename T>
typedef edmNew::DetSetVector<T> edmNew::DetSetVector< T >::self

Definition at line 72 of file DetSetVectorNew.h.

template<typename T>
typedef unsigned int edmNew::DetSetVector< T >::size_type

Definition at line 69 of file DetSetVectorNew.h.

template<typename T>
typedef dstvdetails::DetSetVectorTrans edmNew::DetSetVector< T >::Trans

Definition at line 67 of file DetSetVectorNew.h.

template<typename T>
typedef DetSet edmNew::DetSetVector< T >::value_type

Definition at line 76 of file DetSetVectorNew.h.

Constructor & Destructor Documentation

template<typename T>
edmNew::DetSetVector< T >::DetSetVector ( int  isubdet = 0)
inlineexplicit

Definition at line 178 of file DetSetVectorNew.h.

178  :
179  m_subdetId(isubdet) {}
template<typename T >
edmNew::DetSetVector< T >::DetSetVector ( boost::shared_ptr< dslv::LazyGetter< T > >  iGetter,
const std::vector< det_id_type > &  iDets,
int  isubdet = 0 
)
inline

Definition at line 383 of file DetSetVectorNew.h.

References edmNew::dstvdetails::DetSetVectorTrans::getter, and edmNew::DetSetVector< T >::m_ids.

385  :
386  m_subdetId(isubdet) {
387  getter=iGetter;
388 
389  m_ids.reserve(iDets.size());
390  det_id_type sanityCheck = 0;
391  for(std::vector<det_id_type>::const_iterator itDetId = iDets.begin(), itDetIdEnd = iDets.end();
392  itDetId != itDetIdEnd;
393  ++itDetId) {
394  assert(sanityCheck < *itDetId && "vector of det_id_type was not ordered");
395  sanityCheck = *itDetId;
396  m_ids.push_back(*itDetId);
397  }
398  }
unsigned int det_id_type
Definition: DetSetNew.h:6
template<typename T>
edmNew::DetSetVector< T >::~DetSetVector ( )
inline

Definition at line 185 of file DetSetVectorNew.h.

185  {
186  // delete content if T is pointer...
187  }

Member Function Documentation

template<typename T>
Item& edmNew::DetSetVector< T >::addItem ( id_type  iid,
size_type  isize 
)
inlineprivate

Definition at line 242 of file DetSetVectorNew.h.

References edmNew::dstvdetails::errorIdExists(), edmNew::DetSetVector< T >::m_data, edmNew::DetSetVector< T >::m_ids, and L1TEmulatorMonitor_cff::p.

Referenced by edmNew::DetSetVector< T >::insert(), and edmNew::DetSetVector< T >::push_back().

242  {
243  Item it(iid,size_type(m_data.size()),isize);
244  IdIter p = std::lower_bound(m_ids.begin(),
245  m_ids.end(),
246  it);
247  if (p!=m_ids.end() && !(it<*p)) dstvdetails::errorIdExists(iid);
248  return *m_ids.insert(p,it);
249  }
IdContainer::iterator IdIter
void errorIdExists(det_id_type iid)
unsigned int size_type
template<typename T>
const_iterator edmNew::DetSetVector< T >::begin ( void  ) const
inline
template<typename T>
data_type const* edmNew::DetSetVector< T >::data ( size_t  cell) const
inline
template<typename T>
DataContainer const& edmNew::DetSetVector< T >::data ( ) const
inline

Definition at line 350 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_data.

350 { return m_data;}
template<typename T>
size_type edmNew::DetSetVector< T >::dataSize ( ) const
inline

Definition at line 323 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_data.

Referenced by TrackClusterRemover::cleanup(), and ClusterChecker::tooManyClusters().

323 { return m_data.size(); }
template<typename T>
size_type edmNew::DetSetVector< T >::detsetSize ( size_t  cell) const
inline

Definition at line 337 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_ids.

337 { return m_ids[cell].size; }
template<typename T>
bool edmNew::DetSetVector< T >::empty ( ) const
inline
template<typename T>
const_iterator edmNew::DetSetVector< T >::end ( void  ) const
inline
template<typename T>
template<typename CMP >
Range edmNew::DetSetVector< T >::equal_range ( id_type  i,
CMP  cmp 
) const
inline

Definition at line 310 of file DetSetVectorNew.h.

References i, edmNew::DetSetVector< T >::m_ids, and L1TEmulatorMonitor_cff::p.

310  {
311  std::pair<const_IdIter,const_IdIter> p =
312  std::equal_range(m_ids.begin(),m_ids.end(),i,cmp);
313  return Range(boost::make_transform_iterator(p.first,IterHelp(*this)),
314  boost::make_transform_iterator(p.second,IterHelp(*this))
315  );
316  }
int i
Definition: DBlmapReader.cc:9
std::pair< const_iterator, const_iterator > Range
template<typename T>
bool edmNew::DetSetVector< T >::exists ( id_type  i) const
inline

Definition at line 258 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::findItem(), and edmNew::DetSetVector< T >::m_ids.

258  {
259  return findItem(i)!=m_ids.end();
260  }
int i
Definition: DBlmapReader.cc:9
const_IdIter findItem(id_type i) const
template<typename T>
const_iterator edmNew::DetSetVector< T >::find ( id_type  i) const
inline
template<typename T>
const_IdIter edmNew::DetSetVector< T >::findItem ( id_type  i) const
inline

Definition at line 291 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_ids, and L1TEmulatorMonitor_cff::p.

Referenced by edmNew::DetSetVector< T >::exists(), edmNew::DetSetVector< T >::find(), edmNew::DetSetVector< T >::isValid(), edmNew::DetSetVector< T >::operator[](), and edmNew::DetSetVector< T >::pop_back().

291  {
292  std::pair<const_IdIter,const_IdIter> p =
293  std::equal_range(m_ids.begin(),m_ids.end(),Item(i));
294  return (p.first!=p.second) ? p.first : m_ids.end();
295  }
int i
Definition: DBlmapReader.cc:9
template<typename T>
id_type edmNew::DetSetVector< T >::id ( size_t  cell) const
inline

Definition at line 339 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_ids.

Referenced by MeasurementTracker::updateStrips().

339  {
340  return m_ids[cell].id;
341  }
template<typename T>
DetSet edmNew::DetSetVector< T >::insert ( id_type  iid,
data_type const *  idata,
size_type  isize 
)
inline

Definition at line 211 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::addItem(), filterCSVwithJSON::copy, edmNew::DetSetVector< T >::item(), edmNew::DetSetVector< T >::m_data, and edmNew::dstvdetails::DetSetVectorTrans::Item::offset.

Referenced by BeautifulSoup.PageElement::append().

211  {
212  Item & item = addItem(iid,isize);
213  m_data.resize(m_data.size()+isize);
214  std::copy(idata,idata+isize,m_data.begin()+item.offset);
215  return DetSet(*this,item);
216  }
Item const & item(size_t cell) const
Item & addItem(id_type iid, size_type isize)
edmNew::DetSet< T > DetSet
template<typename T>
DetSet edmNew::DetSetVector< T >::insert ( id_type  iid,
size_type  isize 
)
inline

Definition at line 218 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::addItem(), edmNew::DetSetVector< T >::item(), and edmNew::DetSetVector< T >::m_data.

Referenced by BeautifulSoup.PageElement::append().

218  {
219  Item & item = addItem(iid,isize);
220  m_data.resize(m_data.size()+isize);
221  return DetSet(*this,item);
222  }
Item const & item(size_t cell) const
Item & addItem(id_type iid, size_type isize)
edmNew::DetSet< T > DetSet
template<typename T>
bool edmNew::DetSetVector< T >::isValid ( id_type  i) const
inline

Definition at line 262 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::findItem(), edmNew::DetSetVector< T >::m_ids, and L1TEmulatorMonitor_cff::p.

262  {
264  return p!=m_ids.end() && (*p).offset!=-1;
265  }
int i
Definition: DBlmapReader.cc:9
const_IdIter findItem(id_type i) const
IdContainer::const_iterator const_IdIter
template<typename T>
Item const& edmNew::DetSetVector< T >::item ( size_t  cell) const
inline
template<typename T>
data_type edmNew::DetSetVector< T >::operator() ( size_t  cell,
size_t  frame 
) const
inline

Definition at line 329 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_data, and edmNew::DetSetVector< T >::m_ids.

329  {
330  return m_data[m_ids[cell].offset+frame];
331  }
template<typename T>
DetSet edmNew::DetSetVector< T >::operator[] ( id_type  i) const
inline

Definition at line 276 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::findItem(), edmNew::DetSetVector< T >::m_ids, L1TEmulatorMonitor_cff::p, and edmNew::dstvdetails::throw_range().

276  {
278  if (p==m_ids.end()) dstvdetails::throw_range(i);
279  return DetSet(*this,*p);
280  }
int i
Definition: DBlmapReader.cc:9
const_IdIter findItem(id_type i) const
void throw_range(det_id_type iid)
IdContainer::const_iterator const_IdIter
edmNew::DetSet< T > DetSet
template<typename T>
void edmNew::DetSetVector< T >::pop_back ( id_type  iid)
inline

Definition at line 230 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::findItem(), edmNew::DetSetVector< T >::m_data, edmNew::DetSetVector< T >::m_ids, and L1TEmulatorMonitor_cff::p.

230  {
231  const_IdIter p = findItem(iid);
232  if (p==m_ids.end()) return; //bha!
233  // sanity checks... (shall we throw or assert?)
234  if ((*p).size>0&& (*p).offset>-1 &&
235  m_data.size()==(*p).offset+(*p).size)
236  m_data.resize((*p).offset);
237  m_ids.erase( m_ids.begin()+(p-m_ids.begin()));
238  }
const_IdIter findItem(id_type i) const
IdContainer::const_iterator const_IdIter
template<typename T>
Item& edmNew::DetSetVector< T >::push_back ( id_type  iid)
inline

Definition at line 225 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::addItem().

Referenced by TopBottomClusterInfoProducer::produce().

225  {
226  return addItem(iid,0);
227  }
Item & addItem(id_type iid, size_type isize)
template<typename T>
void edmNew::DetSetVector< T >::reserve ( size_t  isize,
size_t  dsize 
)
inline

Definition at line 200 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_data, and edmNew::DetSetVector< T >::m_ids.

200  {
201  m_ids.reserve(isize);
202  m_data.reserve(dsize);
203  }
template<typename T>
void edmNew::DetSetVector< T >::resize ( size_t  isize,
size_t  dsize 
)
inline
template<typename T>
size_type edmNew::DetSetVector< T >::size ( void  ) const
inline
template<typename T>
int edmNew::DetSetVector< T >::subdetId ( ) const
inline

Definition at line 318 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_subdetId.

318 { return m_subdetId; }
template<typename T>
void edmNew::DetSetVector< T >::swap ( DetSetVector< T > &  rh)
inline

Definition at line 189 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_data, edmNew::DetSetVector< T >::m_ids, edmNew::DetSetVector< T >::m_subdetId, and std::swap().

Referenced by cms::SiPixelClusterProducer::run().

189  {
190  std::swap(m_subdetId,rh.m_subdetId);
191  std::swap(m_ids,rh.m_ids);
192  std::swap(m_data,rh.m_data);
193  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
template<typename T>
void edmNew::DetSetVector< T >::swap ( IdContainer iic,
DataContainer idc 
)
inline

Definition at line 195 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::m_data, edmNew::DetSetVector< T >::m_ids, and std::swap().

195  {
196  std::swap(m_ids,iic);
197  std::swap(m_data,idc);
198  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
template<typename T>
void edmNew::DetSetVector< T >::update ( Item const &  item) const
inline

Definition at line 353 of file DetSetVectorNew.h.

References edmNew::DetSetVector< T >::updateImpl().

Referenced by python.Vispa.Gui.VispaWidget.VispaWidget::autosize(), python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), python.Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), python.Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), python.Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), python.Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), python.Vispa.Gui.FindDialog.FindDialog::reset(), python.Vispa.Gui.PortConnection.PointToPointConnection::select(), python.Vispa.Gui.VispaWidget.VispaWidget::select(), python.Vispa.Views.LineDecayView.LineDecayContainer::select(), python.Vispa.Gui.VispaWidget.VispaWidget::setText(), python.Vispa.Gui.VispaWidget.VispaWidget::setTitle(), python.Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), python.Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and python.Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

353  {
354  const_cast<self*>(this)->updateImpl(const_cast<Item&>(item));
355  }
edmNew::DetSetVector< T > self
Item const & item(size_t cell) const
void updateImpl(Item &item)
template<typename T >
void edmNew::DetSetVector< T >::updateImpl ( Item item)
inlineprivate

Definition at line 401 of file DetSetVectorNew.h.

References createTree::ff, and edmNew::dstvdetails::DetSetVectorTrans::Item::offset.

Referenced by edmNew::DetSetVector< T >::update().

401  {
402  // no getter or already updated
403  if (getter.empty() || item.offset!=-1) return;
404  item.offset = int(m_data.size());
405  FastFiller ff(*this,item);
406  (*boost::any_cast<boost::shared_ptr<Getter> >(&getter))->fill(ff);
407  }
Item const & item(size_t cell) const
tuple ff
Definition: createTree.py:204

Friends And Related Function Documentation

template<typename T>
friend class FastFiller
friend

Definition at line 167 of file DetSetVectorNew.h.

template<typename T>
friend class FindForDetSetVector
friend

Definition at line 176 of file DetSetVectorNew.h.

Member Data Documentation

template<typename T>
DataContainer edmNew::DetSetVector< T >::m_data
private
template<typename T>
IdContainer edmNew::DetSetVector< T >::m_ids
private
template<typename T>
int edmNew::DetSetVector< T >::m_subdetId
private