CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

edm::DetSetVector< T > Class Template Reference

#include <DetSetVector.h>

Inheritance diagram for edm::DetSetVector< T >:
type

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< Tdetset
typedef collection_type::iterator iterator
typedef detsetreference
typedef collection_type::size_type size_type
typedef detset value_type

Public Member Functions

iterator begin ()
 Return an iterator to the first DetSet.
const_iterator begin () const
 DetSetVector (std::vector< DetSet< T > > &input, bool alreadySorted=false)
 DetSetVector ()
 Create an empty DetSetVector.
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
iterator find (det_id_type id)
const_iterator find (det_id_type id) const
reference find_or_insert (det_id_type id)
void getIds (std::vector< det_id_type > &result) const
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)
void post_insert ()
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)

Private Attributes

edm::BoolCache _alreadySorted
collection_type _sets

Detailed Description

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

Definition at line 88 of file DetSetVector.h.


Member Typedef Documentation

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

Definition at line 100 of file DetSetVector.h.

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

Definition at line 106 of file DetSetVector.h.

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

Definition at line 103 of file DetSetVector.h.

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

Definition at line 98 of file DetSetVector.h.

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

Definition at line 105 of file DetSetVector.h.

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

Definition at line 102 of file DetSetVector.h.

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

Definition at line 107 of file DetSetVector.h.

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

Definition at line 99 of file DetSetVector.h.


Constructor & Destructor Documentation

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

Create an empty DetSetVector.

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

Definition at line 200 of file DetSetVector.h.

                                :
    _sets()
  { }
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 206 of file DetSetVector.h.

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

                                                                                 :
    _sets(), _alreadySorted(alreadySorted)
  {
    _sets.swap(input);
    if (!alreadySorted) _sort();
  }

Member Function Documentation

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

Sort the DetSet in order of increasing DetId.

Definition at line 396 of file DetSetVector.h.

References python::multivaluedict::sort().

Referenced by edm::DetSetVector< T >::DetSetVector().

                         {
    std::sort(_sets.begin(), _sets.end());
  }
template<class T >
DetSetVector< T >::iterator edm::DetSetVector< T >::begin ( void  ) [inline]

Return an iterator to the first DetSet.

Definition at line 341 of file DetSetVector.h.

Referenced by edm::DataMixingSiPixelWorker::addSiPixelPileups(), edm::DataMixingSiStripWorker::addSiStripPileups(), SiStripQualityHotStripIdentifier::algoAnalyze(), SiPixelDigiValid::analyze(), SiPixelHLTSource::analyze(), SiStripDigiValid::analyze(), SiStripBaselineValidator::analyze(), SiStripBaselineAnalyzer::analyze(), FWSiStripDigiProxyBuilder::build(), FWSiPixelDigiProxyBuilder::build(), SiStripFineDelayHit::closestCluster(), SiStripMeanCMExtractor::CMExtractorFromPedestals(), APVShotFinder::computeShots(), SiStripAPVRestorer::CreateCMMapCMstored(), SiStripAPVRestorer::CreateCMMapRealPed(), sistrip::SpyDigiConverter::extractPayloadDigis(), SiPixelDigiModule::fill(), SiPixelRawDataErrorModule::fill(), SiPixelCalibDigiProducer::fill(), LaserAlignment::fillDataProfiles(), SiPixelRawDataErrorModule::fillFED(), LaserAlignmentT0ProducerDQM::FillFromProcessedDigis(), LaserAlignmentT0ProducerDQM::FillFromRawDigis(), sistrip::FEDEmulator::fillNoises(), sistrip::FEDEmulator::fillPeds(), GlobalDigisAnalyzer::fillTrk(), GlobalDigisProducer::fillTrk(), ClusterMultiplicityFilter::filter(), cms::MTCCHLTrigger::filter(), SiStripZeroSuppression::formatRawDigis(), RawDataConverter::GetDigis(), sistrip::SpyUtilities::getMajorityHeader(), RBCProcessRPCSimDigis::next(), SiStripProcessedRawDigiProducer::pr_process(), SiStripZeroSuppression::processRaw(), sistrip::FEDEmulatorModule::produce(), edm::DataMixingSiStripRawWorker::putSiStrip(), sistrip::SpyDigiConverter::reorderDigis(), cms::SiPixelClusterProducer::run(), SiStripMeanCMExtractor::StoreMean(), sistrip::FEDEmulator::subtractPedestals(), SiStripProcessedRawDigiProducer::vr_process(), and SiStripProcessedRawDigiProducer::zs_process().

                         {
    _alreadySorted = false; // it's non const 
    return _sets.begin();
  }
template<class T >
DetSetVector< T >::const_iterator edm::DetSetVector< T >::begin ( void  ) const [inline]

Definition at line 349 of file DetSetVector.h.

                               {
    return _sets.begin();
  }
template<class T>
edm::DetSetVector< T >::BOOST_CLASS_REQUIRE ( T  ,
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 271 of file DetSetVector.h.

                               {
    return _sets.empty();
  }
template<class T >
DetSetVector< T >::iterator edm::DetSetVector< T >::end ( void  ) [inline]

Return the off-the-end iterator.

Definition at line 356 of file DetSetVector.h.

Referenced by edm::DataMixingSiPixelWorker::addSiPixelPileups(), edm::DataMixingSiStripWorker::addSiStripPileups(), SiStripQualityHotStripIdentifier::algoAnalyze(), SiPixelDigiValid::analyze(), SiPixelHLTSource::analyze(), MuonTruth::analyze(), SiStripDigiValid::analyze(), SiStripBaselineValidator::analyze(), SiStripBaselineAnalyzer::analyze(), SiStripSpyMonitorModule::analyze(), MuonTruth::associateCSCHitId(), MuonTruth::associateHitId(), FWSiStripDigiProxyBuilder::build(), FWSiPixelDigiProxyBuilder::build(), SiStripFineDelayHit::closestCluster(), SiStripMeanCMExtractor::CMExtractorFromPedestals(), APVShotFinder::computeShots(), SiStripAPVRestorer::CreateCMMapCMstored(), SiStripAPVRestorer::CreateCMMapRealPed(), sistrip::SpyDigiConverter::extractPayloadDigis(), SiPixelDigiModule::fill(), SiPixelRawDataErrorModule::fill(), SiPixelCalibDigiProducer::fill(), SiStripCommissioningSource::fillCablingHistos(), LaserAlignment::fillDataProfiles(), SiPixelRawDataErrorModule::fillFED(), LaserAlignmentT0ProducerDQM::FillFromProcessedDigis(), LaserAlignmentT0ProducerDQM::FillFromRawDigis(), SiStripCommissioningSource::fillHistos(), sistrip::FEDEmulator::fillNoises(), sistrip::FEDEmulator::fillPeds(), GlobalDigisProducer::fillTrk(), GlobalDigisAnalyzer::fillTrk(), ClusterMultiplicityFilter::filter(), SiStripZeroSuppression::formatRawDigis(), RawDataConverter::GetDigis(), sistrip::SpyUtilities::getMajorityHeader(), sistrip::SpyDigiConverter::mergeModuleChannels(), ShallowClustersProducer::NearDigis::NearDigis(), RBCProcessRPCSimDigis::next(), SiStripProcessedRawDigiProducer::pr_process(), SiStripZeroSuppression::processRaw(), sistrip::FEDEmulatorModule::produce(), edm::DataMixingSiStripRawWorker::putSiStrip(), sistrip::SpyDigiConverter::reorderDigis(), cms::SiPixelClusterProducer::run(), SiStripMeanCMExtractor::StoreMean(), sistrip::FEDEmulator::subtractPedestals(), SiStripProcessedRawDigiProducer::vr_process(), and SiStripProcessedRawDigiProducer::zs_process().

                       {
    _alreadySorted = false; // it's non const 
    return _sets.end();
  }
template<class T >
DetSetVector< T >::const_iterator edm::DetSetVector< T >::end ( void  ) const [inline]

Definition at line 364 of file DetSetVector.h.

                             {
    return _sets.end();
  }
template<class T >
void edm::DetSetVector< T >::fillView ( ProductID const &  id,
std::vector< void const * > &  pointers,
helper_vector helpers 
) const

Definition at line 401 of file DetSetVector.h.

References edm::detail::reallyFillView().

Referenced by edm::fillView().

  {
    detail::reallyFillView(*this, id, pointers, helpers);
  }
template<class T >
DetSetVector< T >::const_iterator edm::DetSetVector< T >::find ( det_id_type  id) const [inline]

Definition at line 305 of file DetSetVector.h.

References AlCaHLTBitMon_ParallelJobs::p.

                                            {
    std::pair<const_iterator,const_iterator> p =
      std::equal_range(_sets.begin(), _sets.end(), id);
    if (p.first == p.second) return _sets.end();
    // The range indicated by [p.first, p.second) should be exactly of
    // length 1.
    assert(std::distance(p.first, p.second) == 1);
    return p.first;
  }
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 285 of file DetSetVector.h.

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by MuonTruth::analyze(), SiStripSpyMonitorModule::analyze(), MuonTruth::associateCSCHitId(), MuonTruth::associateHitId(), SiPixelDigiModule::fill(), SiPixelRawDataErrorModule::fill(), SiStripCommissioningSource::fillCablingHistos(), SiPixelRawDataErrorModule::fillFED(), LaserAlignmentT0ProducerDQM::FillFromProcessedDigis(), LaserAlignmentT0ProducerDQM::FillFromRawDigis(), SiStripCommissioningSource::fillHistos(), sistrip::SpyDigiConverter::mergeModuleChannels(), and ShallowClustersProducer::NearDigis::NearDigis().

                                      {
    _alreadySorted = false; // it's non const 
    std::pair<iterator,iterator> p =
      std::equal_range(_sets.begin(), _sets.end(), id);
    if (p.first == p.second) return _sets.end();

    // The range indicated by [p.first, p.second) should be exactly of
    // length 1. It seems likely we don't want to take the time hit of
    // checking this, but here is the appropriate test... We can turn
    // it on if we need the debugging aid.
    #if 0
    assert(std::distance(p.first, p.second) == 1);
    #endif

    return p.first;
  }
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 253 of file DetSetVector.h.

References AlCaHLTBitMon_ParallelJobs::p.

                                                {
    // NOTE: we don't have to clear _alreadySorted: the new DS is empty, 
    //       and gets inserted in the correct place
    std::pair<iterator,iterator> p =
      std::equal_range(_sets.begin(), _sets.end(), id);

    // If the range isn't empty, we already have the right thing;
    // return a reference to it...
    if (p.first != p.second) return *p.first;

    // Insert the right thing, in the right place, and return a
    // reference to the newly inserted thing.
    return *(_sets.insert(p.first, detset(id)));
  }
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 372 of file DetSetVector.h.

References begin, and end.

  {
    std::transform(this->begin(), this->end(),
                   std::back_inserter(result),
                   boost::bind(&DetSet<T>::id,_1));
  }
template<class T >
void edm::DetSetVector< T >::insert ( detset const &  s) [inline]

Insert the given DetSet.

Definition at line 234 of file DetSetVector.h.

References lumiQTWidget::t.

Referenced by edm::DataMixingSiStripWorker::addSiStripPileups(), edm::DataMixingSiStripWorker::addSiStripSignals(), SiStripProcessedRawDigiProducer::common_process(), CSCDigitizer::doAction(), RPCDigitizer::doAction(), and edm::DataMixingSiStripRawWorker::putSiStrip().

                                         {
    _alreadySorted = false; // we don't know if the DetSet we're adding is already sorted
    // Implementation provided by the Performance Task Force.
    _sets.insert(std::lower_bound(_sets.begin(),
                                  _sets.end(),
                                  t),
                 t);
#if 0
    // It seems we have to sort on each insertion, because we may
    // perform lookups during construction.
    _sets.push_back(t);

    _sort();
#endif
  }
template<class T>
DetSetVector& edm::DetSetVector< T >::operator= ( DetSetVector< T > const &  other)
template<class T >
DetSetVector< T >::const_reference edm::DetSetVector< T >::operator[] ( det_id_type  i) const [inline]

Definition at line 330 of file DetSetVector.h.

References edm::detail::_throw_range(), end, and spr::find().

                                                 {
    // Find the right DetSet, and return a reference to it.  Throw if
    // there is none.
    const_iterator it = this->find(i);
    if (it == this->end()) detail::_throw_range(i);
    return *it;
  }
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 318 of file DetSetVector.h.

References edm::detail::_throw_range(), end, and spr::find().

                                           {
    _alreadySorted = false; // it's non const 
    // Find the right DetSet, and return a reference to it.  Throw if
    // there is none.
    iterator it = this->find(i);
    if (it == this->end()) detail::_throw_range(i);
    return *it;
  }
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 382 of file DetSetVector.h.

References alignCSCRings::e, i, and python::multivaluedict::sort().

                               {
    if (_alreadySorted) return; 
    typename collection_type::iterator i = _sets.begin();
    typename collection_type::iterator e = _sets.end();
    // For each DetSet...
    for (; i != e; ++i) {
      // sort the Detset pointed to by
      std::sort(i->data.begin(), i->data.end());
    }
  }
template<class T >
DetSetVector< T >::size_type edm::DetSetVector< T >::size ( void  ) const [inline]
template<class T>
void edm::DetSetVector< T >::swap ( DetSetVector< T > &  other)

Member Data Documentation

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

Definition at line 191 of file DetSetVector.h.

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

Definition at line 190 of file DetSetVector.h.

Referenced by edm::DetSetVector< T >::DetSetVector().