CMS 3D CMS Logo

edm::DetSetVector< T > Class Template Reference

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

List of all members.

Public Types

typedef std::vector< detsetcollection_type
typedef
collection_type::const_iterator 
const_iterator
typedef detset const & const_reference
typedef DetSet< T > detset
typedef collection_type::iterator iterator
typedef detsetreference
typedef collection_type::size_type size_type
typedef detset value_type

Public Member Functions

const_iterator begin () const
iterator begin ()
 Return an iterator to the first DetSet.
 DetSetVector (std::vector< DetSet< T > > &input, bool alreadySorted=false)
 Create a DetSetVector by copying swapping in the given vector, and then sorting the contents.
 DetSetVector ()
 Compiler-generated copy c'tor, d'tor and assignment are correct.
bool empty () const
 Return true if we contain no DetSets.
const_iterator end () const
iterator end ()
 Return the off-the-end iterator.
void fillView (ProductID const &id, std::vector< void const * > &pointers, helper_vector &helpers) const
const_iterator find (det_id_type id) const
iterator find (det_id_type id)
 Return an iterator to the DetSet with the given id, or end() if there is no such DetSet.
reference find_or_insert (det_id_type id)
 Find the DetSet with the given DetId, and return a reference to it.
void getIds (std::vector< det_id_type > &result) const
 Push all the id for each DetSet stored in this DetSetVector into the given vector 'result'.
void insert (detset const &s)
 Insert the given DetSet.
DetSetVectoroperator= (DetSetVector const &other)
const_reference operator[] (det_id_type i) const
reference operator[] (det_id_type i)
 Return a reference to the DetSet with the given detector ID.
void post_insert ()
 This function will be called by the edm::Event after the DetSetVector has been inserted into the Event.
size_type size () const
 Return the number of contained DetSets.
void swap (DetSetVector &other)

Private Member Functions

void _sort ()
 Sort the DetSet in order of increasing DetId.
 BOOST_CLASS_REQUIRE (T, boost, LessThanComparableConcept)
 DetSetVector requires that T objects can be compared with operator<.

Private Attributes

edm::BoolCache _alreadySorted
collection_type _sets


Detailed Description

template<class T>
class edm::DetSetVector< T >

Definition at line 93 of file DetSetVector.h.


Member Typedef Documentation

template<class T>
typedef std::vector<detset> edm::DetSetVector< T >::collection_type

Definition at line 105 of file DetSetVector.h.

template<class T>
typedef collection_type::const_iterator edm::DetSetVector< T >::const_iterator

Definition at line 111 of file DetSetVector.h.

template<class T>
typedef detset const& edm::DetSetVector< T >::const_reference

Definition at line 108 of file DetSetVector.h.

template<class T>
typedef DetSet<T> edm::DetSetVector< T >::detset

Definition at line 103 of file DetSetVector.h.

template<class T>
typedef collection_type::iterator edm::DetSetVector< T >::iterator

Definition at line 110 of file DetSetVector.h.

template<class T>
typedef detset& edm::DetSetVector< T >::reference

Definition at line 107 of file DetSetVector.h.

template<class T>
typedef collection_type::size_type edm::DetSetVector< T >::size_type

Definition at line 112 of file DetSetVector.h.

template<class T>
typedef detset edm::DetSetVector< T >::value_type

Definition at line 104 of file DetSetVector.h.


Constructor & Destructor Documentation

template<class T>
edm::DetSetVector< T >::DetSetVector (  )  [inline]

Compiler-generated copy c'tor, d'tor and assignment are correct.

Create an empty DetSetVector

Definition at line 202 of file DetSetVector.h.

00202                                 :
00203     _sets()
00204   { }

template<class T>
edm::DetSetVector< T >::DetSetVector ( std::vector< DetSet< T > > &  input,
bool  alreadySorted = false 
) [inline, explicit]

Create a DetSetVector by copying swapping in the given vector, and then sorting the contents.

N.B.: Swapping in the vector *destructively modifies the input*. Using swap here allows us to avoid copying the data. N.B. 2: if you set alreadySorted to true, data *must* be sorted, (the vector<DetSet<T>> must be ordered by detid, and each DetSet must be ordered according to the natural "strict weak ordering" of Ts. You *must not* modify the contents after this DSV after creation, or you might get an undefined behavior / a core dump. (there are some checks to assure alreadySorted is resetted if you try to modify the DSV, but you should not count on them)

Definition at line 208 of file DetSetVector.h.

References edm::DetSetVector< T >::_sets, edm::DetSetVector< T >::_sort(), and iggi_31X_cfg::input.

00208                                                                                  :
00209     _sets(), _alreadySorted(alreadySorted)
00210   {
00211     _sets.swap(input);
00212     if (!alreadySorted) _sort();
00213   }


Member Function Documentation

template<class T>
void edm::DetSetVector< T >::_sort (  )  [inline, private]

Sort the DetSet in order of increasing DetId.

Definition at line 399 of file DetSetVector.h.

References edm::DetSetVector< T >::_sets, and python::multivaluedict::sort().

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

00399                          {
00400     std::sort(_sets.begin(), _sets.end());
00401   }

template<class T>
DetSetVector< T >::const_iterator edm::DetSetVector< T >::begin (  )  const [inline]

Definition at line 351 of file DetSetVector.h.

References edm::DetSetVector< T >::_sets.

00351                                {
00352     return _sets.begin();
00353   }

template<class T>
DetSetVector< T >::iterator edm::DetSetVector< T >::begin (  )  [inline]

Return an iterator to the first DetSet.

Definition at line 343 of file DetSetVector.h.

References edm::DetSetVector< T >::_alreadySorted, and edm::DetSetVector< T >::_sets.

Referenced by SiStripQualityHotStripIdentifier::algoAnalyze(), cms::ClusterAnalysis::AllClusters(), SiPixelDigiValid::analyze(), SiPixelHLTSource::analyze(), SiStripDigiValid::analyze(), ClusterCount::analyze(), SiStripFineDelayHit::closestCluster(), cms::ClusterAnalysisFilter::ClusterInModuleSelector(), SiStripClusterizerFactory::clusterize(), SiPixelDigiModule::fill(), SiPixelRawDataErrorModule::fill(), SiPixelCalibDigiProducer::fill(), SiPixelRawDataErrorModule::fillFED(), GlobalDigisAnalyzer::fillTrk(), GlobalDigisProducer::fillTrk(), ClusterMultiplicityFilter::filter(), VisTrackerPiDigiTwig::onNewEvent(), VisTrackerDigiTwig::onNewEvent(), LaserClusterizerAlgorithm::run(), cms::SiPixelClusterProducer::run(), SiStripClusterizerAlgorithm::run(), SiStripZeroSuppressionAlgorithm::run(), and VisCuTrackerDigi::setEvent().

00343                          {
00344     _alreadySorted = false; // it's non const 
00345     return _sets.begin();
00346   }

template<class T>
edm::DetSetVector< T >::BOOST_CLASS_REQUIRE ( ,
boost  ,
LessThanComparableConcept   
) [private]

DetSetVector requires that T objects can be compared with operator<.

template<class T>
bool edm::DetSetVector< T >::empty (  )  const [inline]

Return true if we contain no DetSets.

Definition at line 273 of file DetSetVector.h.

References edm::DetSetVector< T >::_sets.

Referenced by SiStripClusterizerAlgorithm::run().

00273                                {
00274     return _sets.empty();
00275   }

template<class T>
DetSetVector< T >::const_iterator edm::DetSetVector< T >::end (  )  const [inline]

Definition at line 366 of file DetSetVector.h.

References edm::DetSetVector< T >::_sets.

00366                              {
00367     return _sets.end();
00368   }

template<class T>
DetSetVector< T >::iterator edm::DetSetVector< T >::end (  )  [inline]

Return the off-the-end iterator.

Definition at line 358 of file DetSetVector.h.

References edm::DetSetVector< T >::_alreadySorted, and edm::DetSetVector< T >::_sets.

Referenced by SiStripQualityHotStripIdentifier::algoAnalyze(), cms::ClusterAnalysis::AllClusters(), SiPixelDigiValid::analyze(), SiPixelHLTSource::analyze(), MuonTruth::analyze(), SiStripDigiValid::analyze(), ClusterCount::analyze(), SiStripFineDelayHit::closestCluster(), cms::ClusterAnalysisFilter::ClusterInModuleSelector(), SiStripClusterizerFactory::clusterize(), SiPixelDigiModule::fill(), SiPixelRawDataErrorModule::fill(), SiPixelCalibDigiProducer::fill(), SiStripCommissioningSource::fillCablingHistos(), SiPixelRawDataErrorModule::fillFED(), SiStripCommissioningSource::fillHistos(), GlobalDigisAnalyzer::fillTrk(), GlobalDigisProducer::fillTrk(), ClusterMultiplicityFilter::filter(), SiStripClusterInfo::getDigiAmplitudesLR(), edm::DetSetVector< T >::getIds(), SiStripClusterInfo::getRawDigiAmplitudesLR(), VisTrackerPiDigiTwig::onNewEvent(), VisTrackerDigiTwig::onNewEvent(), RemainingClusterProducer::produce(), LaserClusterizerAlgorithm::run(), cms::SiPixelClusterProducer::run(), SiStripClusterizerAlgorithm::run(), SiStripZeroSuppressionAlgorithm::run(), and VisCuTrackerDigi::setEvent().

00358                        {
00359     _alreadySorted = false; // it's non const 
00360     return _sets.end();
00361   }

template<class T>
void edm::DetSetVector< T >::fillView ( ProductID const &  id,
std::vector< void const * > &  pointers,
helper_vector helpers 
) const [inline]

Definition at line 404 of file DetSetVector.h.

References edm::detail::reallyFillView().

Referenced by edm::fillView().

00407   {
00408     detail::reallyFillView(*this, id, pointers, helpers);
00409   }

template<class T>
DetSetVector< T >::const_iterator edm::DetSetVector< T >::find ( det_id_type  id  )  const [inline]

Definition at line 307 of file DetSetVector.h.

References edm::DetSetVector< T >::_sets, and p.

00307                                             {
00308     std::pair<const_iterator,const_iterator> p =
00309       std::equal_range(_sets.begin(), _sets.end(), id);
00310     if (p.first == p.second) return _sets.end();
00311     // The range indicated by [p.first, p.second) should be exactly of
00312     // length 1.
00313     assert(std::distance(p.first, p.second) == 1);
00314     return p.first;
00315   }

template<class T>
DetSetVector< T >::iterator edm::DetSetVector< T >::find ( det_id_type  id  )  [inline]

Return an iterator to the DetSet with the given id, or end() if there is no such DetSet.

Definition at line 287 of file DetSetVector.h.

References edm::DetSetVector< T >::_alreadySorted, edm::DetSetVector< T >::_sets, and p.

Referenced by edm::DataMixingSiStripWorker::addSiStripPileups(), MuonTruth::analyze(), SiPixelDigiModule::fill(), SiPixelRawDataErrorModule::fill(), SiStripCommissioningSource::fillCablingHistos(), SiPixelRawDataErrorModule::fillFED(), SiStripCommissioningSource::fillHistos(), SiStripClusterInfo::getDigiAmplitudesLR(), SiStripClusterInfo::getRawDigiAmplitudesLR(), edm::DetSetVector< T >::operator[](), and RemainingClusterProducer::produce().

00287                                       {
00288     _alreadySorted = false; // it's non const 
00289     std::pair<iterator,iterator> p =
00290       std::equal_range(_sets.begin(), _sets.end(), id);
00291     if (p.first == p.second) return _sets.end();
00292 
00293     // The range indicated by [p.first, p.second) should be exactly of
00294     // length 1. It seems likely we don't want to take the time hit of
00295     // checking this, but here is the appropriate test... We can turn
00296     // it on if we need the debugging aid.
00297     #if 0
00298     assert(std::distance(p.first, p.second) == 1);
00299     #endif
00300 
00301     return p.first;
00302   }

template<class T>
DetSetVector< T >::reference edm::DetSetVector< T >::find_or_insert ( det_id_type  id  )  [inline]

Find the DetSet with the given DetId, and return a reference to it.

If there is none, create one with the right DetId, and an empty vector, and return a reference to the new one.

Definition at line 255 of file DetSetVector.h.

References edm::DetSetVector< T >::_sets, and p.

Referenced by SiStripThreeThresholdAlgo::clusterize().

00255                                                 {
00256     // NOTE: we don't have to clear _alreadySorted: the new DS is empty, 
00257     //       and gets inserted in the correct place
00258     std::pair<iterator,iterator> p =
00259       std::equal_range(_sets.begin(), _sets.end(), id);
00260 
00261     // If the range isn't empty, we already have the right thing;
00262     // return a reference to it...
00263     if (p.first != p.second) return *p.first;
00264 
00265     // Insert the right thing, in the right place, and return a
00266     // reference to the newly inserted thing.
00267     return *(_sets.insert(p.first, detset(id)));
00268   }

template<class T>
void edm::DetSetVector< T >::getIds ( std::vector< det_id_type > &  result  )  const [inline]

Push all the id for each DetSet stored in this DetSetVector into the given vector 'result'.

Definition at line 374 of file DetSetVector.h.

References edm::DetSetVector< T >::end().

00375   {
00376     std::transform(this->begin(), this->end(),
00377                    std::back_inserter(result),
00378                    boost::lambda::bind(&DetSet<T>::id, 
00379                                        boost::lambda::_1));
00380   }

template<class T>
void edm::DetSetVector< T >::insert ( detset const &  s  )  [inline]

Insert the given DetSet.

Definition at line 236 of file DetSetVector.h.

References edm::DetSetVector< T >::_alreadySorted, edm::DetSetVector< T >::_sets, and edm::DetSetVector< T >::_sort().

Referenced by edm::DataMixingSiStripWorker::addSiStripSignals(), SiStripDummyAlgo::clusterize(), CSCDigitizer::doAction(), RPCDigitizer::doAction(), RemainingClusterProducer::produce(), and LaserClusterizerAlgorithm::run().

00236                                          {
00237     _alreadySorted = false; // we don't know if the DetSet we're adding is already sorted
00238     // Implementation provided by the Performance Task Force.
00239     _sets.insert(std::lower_bound(_sets.begin(),
00240                                   _sets.end(),
00241                                   t),
00242                  t);
00243 #if 0
00244     // It seems we have to sort on each insertion, because we may
00245     // perform lookups during construction.
00246     _sets.push_back(t);
00247 
00248     _sort();
00249 #endif
00250   }

template<class T>
DetSetVector< T > & edm::DetSetVector< T >::operator= ( DetSetVector< T > const &  other  )  [inline]

Definition at line 226 of file DetSetVector.h.

References edm::DetSetVector< T >::swap(), and pyDBSRunClass::temp.

00227   {
00228     DetSetVector<T> temp(other);
00229     swap(temp);
00230     return *this;
00231   }

template<class T>
DetSetVector< T >::const_reference edm::DetSetVector< T >::operator[] ( det_id_type  i  )  const [inline]

Definition at line 332 of file DetSetVector.h.

References edm::detail::_throw_range(), edm::DetSetVector< T >::find(), and it.

00332                                                  {
00333     // Find the right DetSet, and return a reference to it.  Throw if
00334     // there is none.
00335     const_iterator it = this->find(i);
00336     if (it == this->end()) detail::_throw_range(i);
00337     return *it;
00338   }

template<class T>
DetSetVector< T >::reference edm::DetSetVector< T >::operator[] ( det_id_type  i  )  [inline]

Return a reference to the DetSet with the given detector ID.

If there is no such DetSet, we throw an edm::Exception. DO NOT MODIFY THE id DATA MEMBER OF THE REFERENCED DetSet!**

Definition at line 320 of file DetSetVector.h.

References edm::DetSetVector< T >::_alreadySorted, edm::detail::_throw_range(), edm::DetSetVector< T >::find(), and it.

00320                                            {
00321     _alreadySorted = false; // it's non const 
00322     // Find the right DetSet, and return a reference to it.  Throw if
00323     // there is none.
00324     iterator it = this->find(i);
00325     if (it == this->end()) detail::_throw_range(i);
00326     return *it;
00327   }

template<class T>
void edm::DetSetVector< T >::post_insert (  )  [inline]

This function will be called by the edm::Event after the DetSetVector has been inserted into the Event.

Definition at line 385 of file DetSetVector.h.

References edm::DetSetVector< T >::_alreadySorted, edm::DetSetVector< T >::_sets, e, i, and python::multivaluedict::sort().

00385                                {
00386     if (_alreadySorted) return; 
00387     typename collection_type::iterator i = _sets.begin();
00388     typename collection_type::iterator e = _sets.end();
00389     // For each DetSet...
00390     for (; i != e; ++i) {
00391       // sort the Detset pointed to by
00392       std::sort(i->data.begin(), i->data.end());
00393     }
00394   }

template<class T>
DetSetVector< T >::size_type edm::DetSetVector< T >::size ( void   )  const [inline]

Return the number of contained DetSets.

Definition at line 280 of file DetSetVector.h.

References edm::DetSetVector< T >::_sets.

Referenced by cms::ClusterAnalysis::AllClusters(), cms::ClusterAnalysisFilter::ClusterNumberSelector(), ClusterMultiplicityFilter::filter(), VisTrackerPiDigiTwig::onNewEvent(), VisTrackerDigiTwig::onNewEvent(), and VisCuTrackerDigi::setEvent().

00280                               {
00281     return _sets.size();
00282   }

template<class T>
void edm::DetSetVector< T >::swap ( DetSetVector< T > &  other  )  [inline]

Definition at line 218 of file DetSetVector.h.

References edm::DetSetVector< T >::_alreadySorted, edm::DetSetVector< T >::_sets, and tmp.

Referenced by SiStripRawToDigiUnpacker::createDigis(), edm::DetSetVector< T >::operator=(), and edm::swap().

00218                                               {
00219     _sets.swap(other._sets);
00220     bool tmp = _alreadySorted; _alreadySorted = other._alreadySorted; other._alreadySorted = tmp;
00221   }


Member Data Documentation

template<class T>
edm::BoolCache edm::DetSetVector< T >::_alreadySorted [private]

Definition at line 193 of file DetSetVector.h.

Referenced by edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::end(), edm::DetSetVector< T >::find(), edm::DetSetVector< T >::insert(), edm::DetSetVector< T >::operator[](), edm::DetSetVector< T >::post_insert(), and edm::DetSetVector< T >::swap().

template<class T>
collection_type edm::DetSetVector< T >::_sets [private]

Definition at line 192 of file DetSetVector.h.

Referenced by edm::DetSetVector< T >::_sort(), edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::DetSetVector(), edm::DetSetVector< T >::empty(), edm::DetSetVector< T >::end(), edm::DetSetVector< T >::find(), edm::DetSetVector< T >::find_or_insert(), edm::DetSetVector< T >::insert(), edm::DetSetVector< T >::post_insert(), edm::DetSetVector< T >::size(), and edm::DetSetVector< T >::swap().


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