CMS 3D CMS Logo

edmNew::DetSetVector< T > Class Template Reference

an optitimized container that linearized a "map of vector". More...

#include <DataFormats/Common/interface/DetSetVectorNew.h>

Inheritance diagram for edmNew::DetSetVector< T >:

edmNew::dstvdetails::DetSetVectorTrans

List of all members.

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 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 DetSetVector< T > self
typedef unsigned int size_type
typedef
dstvdetails::DetSetVectorTrans 
Trans
typedef DetSet value_type

Public Member Functions

const_iterator begin () const
DataContainer const & data () const
data_type const * data (size_t cell) const
size_type dataSize () const
size_type detsetSize (size_t cell) const
 DetSetVector (boost::shared_ptr< dslv::LazyGetter< T > > iGetter, const std::vector< det_id_type > &iDets, int isubdet=0)
 DetSetVector (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, size_type isize)
DetSet insert (id_type iid, data_type const *idata, 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 (IdContainer &iic, DataContainer &idc)
void swap (DetSetVector &rh)
void update (Item const &item) const
 ~DetSetVector ()

Private Member Functions

ItemaddItem (id_type iid, size_type isize)
void updateImpl (Item &item)

Private Attributes

DataContainer m_data
IdContainer m_ids
int m_subdetId

Friends

class FastFiller
class FindForDetSetVector

Classes

class  FastFiller
struct  FindForDetSetVector
struct  IterHelp


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 64 of file DetSetVectorNew.h.


Member Typedef Documentation

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

Definition at line 85 of file DetSetVectorNew.h.

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

Definition at line 84 of file DetSetVectorNew.h.

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

Definition at line 103 of file DetSetVectorNew.h.

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

Definition at line 86 of file DetSetVectorNew.h.

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

Definition at line 70 of file DetSetVectorNew.h.

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

Definition at line 80 of file DetSetVectorNew.h.

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

Definition at line 82 of file DetSetVectorNew.h.

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

Definition at line 72 of file DetSetVectorNew.h.

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

Definition at line 73 of file DetSetVectorNew.h.

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

Reimplemented from edmNew::dstvdetails::DetSetVectorTrans.

Definition at line 69 of file DetSetVectorNew.h.

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

Definition at line 79 of file DetSetVectorNew.h.

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

Definition at line 81 of file DetSetVectorNew.h.

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

Definition at line 67 of file DetSetVectorNew.h.

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

Definition at line 83 of file DetSetVectorNew.h.

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

Definition at line 76 of file DetSetVectorNew.h.

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

Definition at line 104 of file DetSetVectorNew.h.

template<typename T>
typedef edm::refhelper::FindForNewDetSetVector<data_type> edmNew::DetSetVector< T >::RefFinder

Definition at line 88 of file DetSetVectorNew.h.

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

Definition at line 71 of file DetSetVectorNew.h.

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

Reimplemented from edmNew::dstvdetails::DetSetVectorTrans.

Definition at line 68 of file DetSetVectorNew.h.

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

Definition at line 66 of file DetSetVectorNew.h.

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

Definition at line 75 of file DetSetVectorNew.h.


Constructor & Destructor Documentation

template<typename T>
edmNew::DetSetVector< T >::DetSetVector ( int  isubdet = 0  )  [inline, explicit]

Definition at line 176 of file DetSetVectorNew.h.

00176                                          :
00177       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 381 of file DetSetVectorNew.h.

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

00383                                                    :  
00384     m_subdetId(isubdet) {
00385     getter=iGetter;
00386 
00387     m_ids.reserve(iDets.size());
00388     det_id_type sanityCheck = 0;
00389     for(std::vector<det_id_type>::const_iterator itDetId = iDets.begin(), itDetIdEnd = iDets.end();
00390         itDetId != itDetIdEnd;
00391         ++itDetId) {
00392       assert(sanityCheck < *itDetId && "vector of det_id_type was not ordered");
00393       sanityCheck = *itDetId;
00394       m_ids.push_back(*itDetId);
00395     }
00396   }

template<typename T>
edmNew::DetSetVector< T >::~DetSetVector (  )  [inline]

Definition at line 183 of file DetSetVectorNew.h.

00183                     {
00184       // delete content if T is pointer...
00185     }


Member Function Documentation

template<typename T>
Item& edmNew::DetSetVector< T >::addItem ( id_type  iid,
size_type  isize 
) [inline, private]

Definition at line 240 of file DetSetVectorNew.h.

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

00240                                                   {
00241       Item it(iid,size_type(m_data.size()),isize);
00242       IdIter p = std::lower_bound(m_ids.begin(),
00243                                   m_ids.end(),
00244                                   it);
00245       if (p!=m_ids.end() && !(it<*p)) dstvdetails::errorIdExists(iid);
00246       return *m_ids.insert(p,it);
00247     }

template<typename T>
const_iterator edmNew::DetSetVector< T >::begin (  )  const [inline]

Definition at line 295 of file DetSetVectorNew.h.

Referenced by VisSiPixelCluster::analyze(), SiPixelTrackResidualSource::analyze(), VisSiStripCluster::analyze(), TrackClusterRemover::cleanup(), SiStripFineDelayHit::closestCluster(), RoadSearchSeedFinderAlgorithm::ClusterCounter(), edmNew::copy(), SiPixelClusterModule::fill(), VisTrackerClusterTwig::onNewEvent(), VisTrackerPiClusterTwig::onNewEvent(), cms::SiPixelRecHitConverter::run(), VisCuTrackerCluster::setEvent(), and ClusterChecker::tooManyClusters().

00295                                  {
00296       return  boost::make_transform_iterator(m_ids.begin(),
00297                                              IterHelp(*this));
00298     }

template<typename T>
DataContainer const& edmNew::DetSetVector< T >::data (  )  const [inline]

Definition at line 348 of file DetSetVectorNew.h.

00348 { return  m_data;}

template<typename T>
data_type const* edmNew::DetSetVector< T >::data ( size_t  cell  )  const [inline]

Definition at line 331 of file DetSetVectorNew.h.

Referenced by TrackClusterRemover::cleanup().

00331                                               {
00332       return &m_data[m_ids[cell].offset];
00333     }

template<typename T>
size_type edmNew::DetSetVector< T >::dataSize (  )  const [inline]

Definition at line 321 of file DetSetVectorNew.h.

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

00321 { return m_data.size(); }

template<typename T>
size_type edmNew::DetSetVector< T >::detsetSize ( size_t  cell  )  const [inline]

Definition at line 335 of file DetSetVectorNew.h.

00335 { return  m_ids[cell].size; }

template<typename T>
bool edmNew::DetSetVector< T >::empty (  )  const [inline]

Definition at line 318 of file DetSetVectorNew.h.

Referenced by SiStripClusterizerAlgorithm::run(), and MeasurementTracker::updatePixels().

00318 { return m_ids.empty();}

template<typename T>
const_iterator edmNew::DetSetVector< T >::end (  )  const [inline]

Definition at line 300 of file DetSetVectorNew.h.

Referenced by VisSiPixelCluster::analyze(), SiPixelTrackResidualSource::analyze(), SiStripMonitorCluster::analyze(), VisSiStripCluster::analyze(), TrackClusterRemover::cleanup(), SiStripFineDelayHit::closestCluster(), RoadSearchSeedFinderAlgorithm::ClusterCounter(), edmNew::copy(), SiPixelClusterModule::fill(), edmNew::DetSetVector< SiPixelCluster >::find(), VisTrackerClusterTwig::onNewEvent(), VisTrackerPiClusterTwig::onNewEvent(), cms::SiPixelRecHitConverter::run(), VisCuTrackerCluster::setEvent(), ClusterChecker::tooManyClusters(), MeasurementTracker::updatePixels(), and MeasurementTracker::updateStrips().

00300                                {
00301       return  boost::make_transform_iterator(m_ids.end(),
00302                                              IterHelp(*this));
00303     }

template<typename T>
template<typename CMP>
Range edmNew::DetSetVector< T >::equal_range ( id_type  i,
CMP  cmp 
) const [inline]

Definition at line 308 of file DetSetVectorNew.h.

00308                                                 {
00309       std::pair<const_IdIter,const_IdIter> p =
00310         std::equal_range(m_ids.begin(),m_ids.end(),i,cmp);
00311       return  Range(boost::make_transform_iterator(p.first,IterHelp(*this)),
00312                     boost::make_transform_iterator(p.second,IterHelp(*this))
00313                     );
00314     }

template<typename T>
bool edmNew::DetSetVector< T >::exists ( id_type  i  )  const [inline]

Definition at line 256 of file DetSetVectorNew.h.

00256                                   {
00257       return  findItem(i)!=m_ids.end(); 
00258     }

template<typename T>
const_iterator edmNew::DetSetVector< T >::find ( id_type  i  )  const [inline]

Definition at line 281 of file DetSetVectorNew.h.

Referenced by SiPixelTrackResidualSource::analyze(), SiPixelClusterModule::fill(), MeasurementTracker::updatePixels(), and MeasurementTracker::updateStrips().

00281                                          {
00282       const_IdIter p = findItem(i);
00283       return (p==m_ids.end()) ? end() :
00284         boost::make_transform_iterator(p,
00285                                        IterHelp(*this));
00286     }

template<typename T>
const_IdIter edmNew::DetSetVector< T >::findItem ( id_type  i  )  const [inline]

Definition at line 289 of file DetSetVectorNew.h.

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

00289                                            {
00290       std::pair<const_IdIter,const_IdIter> p =
00291         std::equal_range(m_ids.begin(),m_ids.end(),Item(i));
00292       return (p.first!=p.second) ? p.first : m_ids.end();
00293     }

template<typename T>
id_type edmNew::DetSetVector< T >::id ( size_t  cell  )  const [inline]

Definition at line 337 of file DetSetVectorNew.h.

00337                                   {
00338       return m_ids[cell].id;
00339     }

template<typename T>
DetSet edmNew::DetSetVector< T >::insert ( id_type  iid,
size_type  isize 
) [inline]

Definition at line 216 of file DetSetVectorNew.h.

00216                                                 {
00217       Item & item = addItem(iid,isize);
00218       m_data.resize(m_data.size()+isize);
00219       return DetSet(*this,item);
00220     }

template<typename T>
DetSet edmNew::DetSetVector< T >::insert ( id_type  iid,
data_type const *  idata,
size_type  isize 
) [inline]

Definition at line 209 of file DetSetVectorNew.h.

00209                                                                          {
00210       Item & item = addItem(iid,isize);
00211       m_data.resize(m_data.size()+isize);
00212       std::copy(idata,idata+isize,m_data.begin()+item.offset);
00213      return DetSet(*this,item);
00214     }

template<typename T>
bool edmNew::DetSetVector< T >::isValid ( id_type  i  )  const [inline]

Definition at line 260 of file DetSetVectorNew.h.

00260                                   {
00261       const_IdIter p = findItem(i);
00262       return p!=m_ids.end() && (*p).offset!=-1;
00263     }

template<typename T>
Item const& edmNew::DetSetVector< T >::item ( size_t  cell  )  const [inline]

Definition at line 341 of file DetSetVectorNew.h.

Referenced by edmNew::DetSetVector< SiPixelCluster >::insert().

00341                                          {
00342       return m_ids[cell];
00343     }

template<typename T>
data_type edmNew::DetSetVector< T >::operator() ( size_t  cell,
size_t  frame 
) const [inline]

Definition at line 327 of file DetSetVectorNew.h.

00327                                                           {
00328       return m_data[m_ids[cell].offset+frame];
00329     }

template<typename T>
DetSet edmNew::DetSetVector< T >::operator[] ( id_type  i  )  const [inline]

Definition at line 274 of file DetSetVectorNew.h.

00274                                        {
00275       const_IdIter p = findItem(i);
00276       if (p==m_ids.end()) dstvdetails::throw_range(i);
00277       return DetSet(*this,*p);
00278     }

template<typename T>
void edmNew::DetSetVector< T >::pop_back ( id_type  iid  )  [inline]

Definition at line 228 of file DetSetVectorNew.h.

00228                                {
00229       const_IdIter p = findItem(iid);
00230       if (p==m_ids.end()) return; //bha!
00231       // sanity checks...  (shall we throw or assert?)
00232       if ((*p).size>0&& (*p).offset>-1 && 
00233           m_data.size()==(*p).offset+(*p).size)
00234         m_data.resize((*p).offset);
00235       m_ids.erase( m_ids.begin()+(p-m_ids.begin()));
00236     }

template<typename T>
Item& edmNew::DetSetVector< T >::push_back ( id_type  iid  )  [inline]

Definition at line 223 of file DetSetVectorNew.h.

Referenced by PixelThresholdClusterizer::clusterizeDetUnit(), ThreeThresholdStripClusterizer::clusterizeDetUnit_(), helper::TrackCollectionStoreManager::processClusters(), and helper::MuonCollectionStoreManager::processClusters().

00223                                   {
00224       return addItem(iid,0);
00225     }

template<typename T>
void edmNew::DetSetVector< T >::reserve ( size_t  isize,
size_t  dsize 
) [inline]

Definition at line 198 of file DetSetVectorNew.h.

00198                                              {
00199       m_ids.reserve(isize);
00200       m_data.reserve(dsize);
00201     }

template<typename T>
void edmNew::DetSetVector< T >::resize ( size_t  isize,
size_t  dsize 
) [inline]

Definition at line 203 of file DetSetVectorNew.h.

00203                                             {
00204       m_ids.resize(isize);
00205       m_data.resize(dsize);
00206     }

template<typename T>
size_type edmNew::DetSetVector< T >::size ( void   )  const [inline]

Definition at line 323 of file DetSetVectorNew.h.

Referenced by SiPixelTrackResidualSource::analyze(), TrackClusterRemover::cleanup(), RoadSearchSeedFinderAlgorithm::ClusterCounter(), VisTrackerClusterTwig::onNewEvent(), VisTrackerPiClusterTwig::onNewEvent(), SiStripClusterizerAlgorithm::run(), VisCuTrackerCluster::setEvent(), and ClusterChecker::tooManyClusters().

00323 { return m_ids.size();}

template<typename T>
int edmNew::DetSetVector< T >::subdetId (  )  const [inline]

Definition at line 316 of file DetSetVectorNew.h.

00316 { return m_subdetId; }

template<typename T>
void edmNew::DetSetVector< T >::swap ( IdContainer iic,
DataContainer idc 
) [inline]

Definition at line 193 of file DetSetVectorNew.h.

00193                                                       {
00194       std::swap(m_ids,iic);
00195       std::swap(m_data,idc);
00196     }

template<typename T>
void edmNew::DetSetVector< T >::swap ( DetSetVector< T > &  rh  )  [inline]

Definition at line 187 of file DetSetVectorNew.h.

00187                                  {
00188       std::swap(m_subdetId,rh.m_subdetId);
00189       std::swap(m_ids,rh.m_ids);
00190       std::swap(m_data,rh.m_data);
00191     }

template<typename T>
void edmNew::DetSetVector< T >::update ( Item const &  item  )  const [inline]

Definition at line 351 of file DetSetVectorNew.h.

00351                                          {
00352       const_cast<self*>(this)->updateImpl(const_cast<Item&>(item));
00353     }

template<typename T>
void edmNew::DetSetVector< T >::updateImpl ( Item item  )  [inline, private]

Definition at line 399 of file DetSetVectorNew.h.

References getDQMSummary::ff, edmNew::dstvdetails::DetSetVectorTrans::getter, int, edmNew::DetSetVector< T >::m_data, and edmNew::dstvdetails::DetSetVectorTrans::Item::offset.

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

00399                                                       {
00400     // no getter or already updated
00401     if (getter.empty() || item.offset!=-1) return;
00402     item.offset = int(m_data.size());
00403     FastFiller ff(*this,item);
00404     (*boost::any_cast<boost::shared_ptr<Getter> >(&getter))->fill(ff);
00405   }


Friends And Related Function Documentation

template<typename T>
friend class FastFiller [friend]

Definition at line 166 of file DetSetVectorNew.h.

template<typename T>
friend class FindForDetSetVector [friend]

Definition at line 174 of file DetSetVectorNew.h.


Member Data Documentation

template<typename T>
DataContainer edmNew::DetSetVector< T >::m_data [private]

Definition at line 365 of file DetSetVectorNew.h.

Referenced by edmNew::DetSetVector< SiPixelCluster >::addItem(), edmNew::DetSetVector< SiPixelCluster >::data(), edmNew::DetSetVector< SiPixelCluster >::dataSize(), edmNew::DetSetVector< SiPixelCluster >::insert(), edmNew::DetSetVector< SiPixelCluster >::operator()(), edmNew::DetSetVector< SiPixelCluster >::pop_back(), edmNew::DetSetVector< SiPixelCluster >::reserve(), edmNew::DetSetVector< SiPixelCluster >::resize(), edmNew::DetSetVector< SiPixelCluster >::swap(), and edmNew::DetSetVector< T >::updateImpl().

template<typename T>
IdContainer edmNew::DetSetVector< T >::m_ids [private]

Definition at line 364 of file DetSetVectorNew.h.

Referenced by edmNew::DetSetVector< SiPixelCluster >::addItem(), edmNew::DetSetVector< SiPixelCluster >::begin(), edmNew::DetSetVector< SiPixelCluster >::data(), edmNew::DetSetVector< SiPixelCluster >::detsetSize(), edmNew::DetSetVector< T >::DetSetVector(), edmNew::DetSetVector< SiPixelCluster >::empty(), edmNew::DetSetVector< SiPixelCluster >::end(), edmNew::DetSetVector< SiPixelCluster >::equal_range(), edmNew::DetSetVector< SiPixelCluster >::exists(), edmNew::DetSetVector< SiPixelCluster >::find(), edmNew::DetSetVector< SiPixelCluster >::findItem(), edmNew::DetSetVector< SiPixelCluster >::id(), edmNew::DetSetVector< SiPixelCluster >::isValid(), edmNew::DetSetVector< SiPixelCluster >::item(), edmNew::DetSetVector< SiPixelCluster >::operator()(), edmNew::DetSetVector< SiPixelCluster >::operator[](), edmNew::DetSetVector< SiPixelCluster >::pop_back(), edmNew::DetSetVector< SiPixelCluster >::reserve(), edmNew::DetSetVector< SiPixelCluster >::resize(), edmNew::DetSetVector< SiPixelCluster >::size(), and edmNew::DetSetVector< SiPixelCluster >::swap().

template<typename T>
int edmNew::DetSetVector< T >::m_subdetId [private]

Definition at line 361 of file DetSetVectorNew.h.

Referenced by edmNew::DetSetVector< SiPixelCluster >::subdetId(), and edmNew::DetSetVector< SiPixelCluster >::swap().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:46:40 2009 for CMSSW by  doxygen 1.5.4