CMS 3D CMS Logo

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

#include <DetSetVector.h>

Inheritance diagram for edm::DetSetVector< T >:

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. More...
 
const_iterator begin () const
 
 DetSetVector ()
 Create an empty DetSetVector. More...
 
 DetSetVector (std::vector< DetSet< T > > &input, bool alreadySorted=false)
 
bool empty () const
 Return true if we contain no DetSets. More...
 
iterator end ()
 Return the off-the-end iterator. More...
 
const_iterator end () const
 
void fillView (ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &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. More...
 
DetSetVectoroperator= (DetSetVector const &other)
 
reference operator[] (det_id_type i)
 
const_reference operator[] (det_id_type i) const
 
void post_insert ()
 
void reserve (size_t s)
 
size_type size () const
 Return the number of contained DetSets. More...
 
void swap (DetSetVector &other)
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

void _sort ()
 Sort the DetSet in order of increasing DetId. More...
 
 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 61 of file DetSetVector.h.

Member Typedef Documentation

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

Definition at line 96 of file DetSetVector.h.

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

Definition at line 102 of file DetSetVector.h.

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

Definition at line 99 of file DetSetVector.h.

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

Definition at line 94 of file DetSetVector.h.

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

Definition at line 101 of file DetSetVector.h.

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

Definition at line 98 of file DetSetVector.h.

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

Definition at line 103 of file DetSetVector.h.

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

Definition at line 95 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 194 of file DetSetVector.h.

194 : _sets() {}
collection_type _sets
Definition: DetSetVector.h:186
template<class T>
edm::DetSetVector< T >::DetSetVector ( std::vector< DetSet< T > > &  input,
bool  alreadySorted = false 
)
inlineexplicit

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 197 of file DetSetVector.h.

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

198  : _sets(), _alreadySorted(alreadySorted) {
199  _sets.swap(input);
200  if (!alreadySorted)
201  _sort();
202  }
collection_type _sets
Definition: DetSetVector.h:186
static std::string const input
Definition: EdmProvDump.cc:47
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:187
void _sort()
Sort the DetSet in order of increasing DetId.
Definition: DetSetVector.h:357

Member Function Documentation

template<class T >
void edm::DetSetVector< T >::_sort ( )
inlineprivate

Sort the DetSet in order of increasing DetId.

Definition at line 357 of file DetSetVector.h.

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

357  {
358  std::sort(_sets.begin(), _sets.end());
359  }
collection_type _sets
Definition: DetSetVector.h:186
template<class T >
DetSetVector< T >::iterator edm::DetSetVector< T >::begin ( void  )
inline

Return an iterator to the first DetSet.

Definition at line 314 of file DetSetVector.h.

Referenced by edm::DataMixingSiPixelWorker::addSiPixelPileups(), edm::DataMixingSiStripWorker::addSiStripPileups(), SiStripDigiValid::analyze(), SiPixelDigiValid::analyze(), SiStripBaselineValidator::analyze(), SiPixelHLTSource::analyze(), FWSiStripDigiProxyBuilder::build(), FWSiPixelDigiProxyBuilder::build(), SiStripFineDelayHit::closestCluster(), APVShotFinder::computeShots(), sistrip::SpyDigiConverter::extractPayloadDigis(), SiPixelRawDataErrorModule::fill(), SiPixelDigiModule::fill(), SiPixelCalibDigiProducer::fill(), LaserAlignment::fillDataProfiles(), SiPixelRawDataErrorModule::fillFED(), LaserAlignmentT0ProducerDQM::FillFromProcessedDigis(), LaserAlignmentT0ProducerDQM::FillFromRawDigis(), Phase2TrackerValidateDigi::fillITPixelBXInfo(), Phase2TrackerMonitorDigi::fillITPixelDigiHistos(), sistrip::FEDEmulator::fillNoises(), Phase2TrackerValidateDigi::fillOTBXInfo(), Phase2TrackerMonitorDigi::fillOTDigiHistos(), sistrip::FEDEmulator::fillPeds(), GlobalDigisProducer::fillTrk(), GlobalDigisAnalyzer::fillTrk(), cms::MTCCHLTrigger::filter(), Phase2TrackerValidateDigi::findITPixelDigi(), Phase2TrackerValidateDigi::findOTDigi(), RPCHitAssociator::findRPCDigiSimLink(), RawDataConverter::GetDigis(), sistrip::SpyUtilities::getMajorityHeader(), SiPixelTrackResidualSource::getrococcupancy(), SiPixelClusterSource::getrococcupancy(), GEMDigiMatcher::matchDigisSLToSimTrack(), SiStripProcessedRawDigiProducer::pr_process(), sistrip::FEDEmulatorModule::produce(), edm::DataMixingSiStripRawWorker::putSiStrip(), sistrip::SpyDigiConverter::reorderDigis(), TTClusterBuilder< T >::RetrieveRawHits(), sistrip::FEDEmulator::subtractPedestals(), SiStripProcessedRawDigiProducer::vr_process(), and SiStripProcessedRawDigiProducer::zs_process().

314  {
315  _alreadySorted = false; // it's non const
316  return _sets.begin();
317  }
collection_type _sets
Definition: DetSetVector.h:186
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:187
template<class T >
DetSetVector< T >::const_iterator edm::DetSetVector< T >::begin ( void  ) const
inline

Definition at line 320 of file DetSetVector.h.

320  {
321  return _sets.begin();
322  }
collection_type _sets
Definition: DetSetVector.h:186
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>
static short edm::DetSetVector< T >::Class_Version ( )
inlinestatic

Definition at line 183 of file DetSetVector.h.

185 :
collection_type _sets
Definition: DetSetVector.h:186
std::vector< detset > collection_type
Definition: DetSetVector.h:96
template<class T >
bool edm::DetSetVector< T >::empty ( ) const
inline

Return true if we contain no DetSets.

Definition at line 254 of file DetSetVector.h.

Referenced by SiStripCommissioningSource::fillHistos().

254  {
255  return _sets.empty();
256  }
collection_type _sets
Definition: DetSetVector.h:186
template<class T >
DetSetVector< T >::iterator edm::DetSetVector< T >::end ( void  )
inline

Return the off-the-end iterator.

Definition at line 325 of file DetSetVector.h.

Referenced by edm::DataMixingSiPixelWorker::addSiPixelPileups(), edm::DataMixingSiStripWorker::addSiStripPileups(), SiStripDigiValid::analyze(), SiPixelDigiValid::analyze(), SiStripBaselineValidator::analyze(), MuonTruth::analyze(), SiPixelHLTSource::analyze(), SiStripSpyMonitorModule::analyze(), HitEff::analyze(), CSCHitAssociator::associateCSCHitId(), CSCHitAssociator::associateHitId(), TrackerHitAssociator::associatePhase2TrackerRecHit(), TrackerHitAssociator::associatePixelRecHit(), GEMHitAssociator::associateRecHit(), FWSiStripDigiProxyBuilder::build(), FWSiPixelDigiProxyBuilder::build(), SiStripFineDelayHit::closestCluster(), SiStripMonitorTrack::clusterInfos(), APVShotFinder::computeShots(), Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), sistrip::SpyDigiConverter::extractPayloadDigis(), SiPixelRawDataErrorModule::fill(), SiPixelDigiModule::fill(), SiPixelCalibDigiProducer::fill(), SiStripCommissioningSource::fillCablingHistos(), LaserAlignment::fillDataProfiles(), SiPixelRawDataErrorModule::fillFED(), LaserAlignmentT0ProducerDQM::FillFromProcessedDigis(), LaserAlignmentT0ProducerDQM::FillFromRawDigis(), SiStripCommissioningSource::fillHistos(), Phase2TrackerValidateDigi::fillITPixelBXInfo(), Phase2TrackerMonitorDigi::fillITPixelDigiHistos(), sistrip::FEDEmulator::fillNoises(), Phase2TrackerValidateDigi::fillOTBXInfo(), Phase2TrackerMonitorDigi::fillOTDigiHistos(), sistrip::FEDEmulator::fillPeds(), GlobalDigisProducer::fillTrk(), GlobalDigisAnalyzer::fillTrk(), Phase2TrackerValidateDigi::findITPixelDigi(), Phase2TrackerValidateDigi::findOTDigi(), RPCHitAssociator::findRPCDigiSimLink(), RawDataConverter::GetDigis(), sistrip::SpyUtilities::getMajorityHeader(), SiPixelTrackResidualSource::getrococcupancy(), SiPixelClusterSource::getrococcupancy(), Phase2TrackerValidateDigi::getSimTrackId(), GEMDigiMatcher::matchDigisSLToSimTrack(), sistrip::SpyEventMatcher::mergeMatchingData(), sistrip::SpyDigiConverter::mergeModuleChannels(), ShallowClustersProducer::NearDigis::NearDigis(), SiStripProcessedRawDigiProducer::pr_process(), sistrip::FEDEmulatorModule::produce(), edm::DataMixingSiStripRawWorker::putSiStrip(), sistrip::SpyDigiConverter::reorderDigis(), TTClusterBuilder< T >::RetrieveRawHits(), sistrip::FEDEmulator::subtractPedestals(), SiStripProcessedRawDigiProducer::vr_process(), and SiStripProcessedRawDigiProducer::zs_process().

325  {
326  _alreadySorted = false; // it's non const
327  return _sets.end();
328  }
collection_type _sets
Definition: DetSetVector.h:186
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:187
template<class T >
DetSetVector< T >::const_iterator edm::DetSetVector< T >::end ( void  ) const
inline

Definition at line 331 of file DetSetVector.h.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

331  {
332  return _sets.end();
333  }
collection_type _sets
Definition: DetSetVector.h:186
template<class T >
void edm::DetSetVector< T >::fillView ( ProductID const &  id,
std::vector< void const * > &  pointers,
FillViewHelperVector helpers 
) const

Definition at line 362 of file DetSetVector.h.

References edm::detail::reallyFillView().

364  {
365  detail::reallyFillView(*this, id, pointers, helpers);
366  }
void reallyFillView(COLLECTION const &coll, ProductID const &id, std::vector< void const * > &ptrs, FillViewHelperVector &helpers)
Definition: FillView.h:25
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 264 of file DetSetVector.h.

References cms::cuda::assert(), HLT_FULL_cff::distance, gpuClustering::id, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by BeautifulSoup.Tag::__getattr__(), MuonTruth::analyze(), SiStripSpyMonitorModule::analyze(), CSCHitAssociator::associateCSCHitId(), CSCHitAssociator::associateHitId(), TrackerHitAssociator::associatePhase2TrackerRecHit(), TrackerHitAssociator::associatePixelRecHit(), GEMHitAssociator::associateRecHit(), SiStripMonitorTrack::clusterInfos(), SiPixelRawDataErrorModule::fill(), SiPixelDigiModule::fill(), SiStripCommissioningSource::fillCablingHistos(), SiPixelRawDataErrorModule::fillFED(), LaserAlignmentT0ProducerDQM::FillFromProcessedDigis(), LaserAlignmentT0ProducerDQM::FillFromRawDigis(), SiStripCommissioningSource::fillHistos(), Phase2TrackerValidateDigi::findITPixelDigi(), Phase2TrackerValidateDigi::findOTDigi(), BeautifulSoup.Tag::firstText(), SiPixelTrackResidualSource::getrococcupancy(), SiPixelClusterSource::getrococcupancy(), Phase2TrackerValidateDigi::getSimTrackId(), sistrip::SpyEventMatcher::mergeMatchingData(), sistrip::SpyDigiConverter::mergeModuleChannels(), ShallowClustersProducer::NearDigis::NearDigis(), and edm::refhelper::FindForDetSetVector< T >::operator()().

264  {
265  _alreadySorted = false; // it's non const
266  std::pair<iterator, iterator> p = std::equal_range(_sets.begin(), _sets.end(), id);
267  if (p.first == p.second)
268  return _sets.end();
269 
270 // The range indicated by [p.first, p.second) should be exactly of
271 // length 1. It seems likely we don't want to take the time hit of
272 // checking this, but here is the appropriate test... We can turn
273 // it on if we need the debugging aid.
274 #if 0
275  assert(std::distance(p.first, p.second) == 1);
276 #endif
277 
278  return p.first;
279  }
collection_type _sets
Definition: DetSetVector.h:186
uint16_t *__restrict__ id
assert(be >=bs)
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:187
template<class T >
DetSetVector< T >::const_iterator edm::DetSetVector< T >::find ( det_id_type  id) const
inline

Definition at line 282 of file DetSetVector.h.

References cms::cuda::assert(), HLT_FULL_cff::distance, gpuClustering::id, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by BeautifulSoup.Tag::__getattr__(), and BeautifulSoup.Tag::firstText().

282  {
283  std::pair<const_iterator, const_iterator> p = std::equal_range(_sets.begin(), _sets.end(), id);
284  if (p.first == p.second)
285  return _sets.end();
286  // The range indicated by [p.first, p.second) should be exactly of
287  // length 1.
288  assert(std::distance(p.first, p.second) == 1);
289  return p.first;
290  }
collection_type _sets
Definition: DetSetVector.h:186
uint16_t *__restrict__ id
assert(be >=bs)
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 234 of file DetSetVector.h.

References gpuClustering::id, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by TotemRPUVPattern::addHit(), CTPPSPixelLocalTrack::addHit(), CTPPSDiamondRecHitProducerAlgorithm::build(), TotemTimingRecHitProducerAlgorithm::build(), CTPPSPixelDataFormatter::interpretRawData(), PixelDataFormatter::interpretRawData(), CTPPSDirectProtonSimulation::processProton(), TotemRPRecHitProducer::produce(), TotemRPLocalTrackFitter::produce(), TotemRPUVPatternFinder::produce(), CTPPSPixelLocalTrackProducer::produce(), SiPixelRawToDigi::produce(), RawToDigiConverter::run(), TotemRPClusterProducer::run(), CTPPSPixelRecHitProducer::run(), CTPPSPixelClusterProducer::run(), and PixelDataFormatter::unpackFEDErrors().

234  {
235  // NOTE: we don't have to clear _alreadySorted: the new DS is empty,
236  // and gets inserted in the correct place
237  std::pair<iterator, iterator> p = std::equal_range(_sets.begin(), _sets.end(), id);
238 
239  // If the range isn't empty, we already have the right thing;
240  // return a reference to it...
241  if (p.first != p.second)
242  return *p.first;
243 
244  // Insert the right thing, in the right place, and return a
245  // reference to the newly inserted thing.
246 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
247  return *(_sets.emplace(p.first, id));
248 #else
249  return *(_sets.insert(p.first, detset(id)));
250 #endif
251  }
collection_type _sets
Definition: DetSetVector.h:186
uint16_t *__restrict__ id
DetSet< T > detset
Definition: DetSetVector.h:94
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 336 of file DetSetVector.h.

References SplitLinear::begin, dataset::end, and HcalDetIdTransform::transform().

336  {
338  this->begin(), this->end(), std::back_inserter(result), std::bind(&DetSet<T>::id, std::placeholders::_1));
339  }
uint16_t *__restrict__ id
tuple result
Definition: mps_fire.py:311
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
unsigned transform(const HcalDetId &id, unsigned transformCode)
template<class T >
void edm::DetSetVector< T >::insert ( detset const &  s)
inline

Insert the given DetSet.

Definition at line 220 of file DetSetVector.h.

References cuda_std::lower_bound(), and submitPVValidationJobs::t.

Referenced by BeautifulSoup.PageElement::_invert(), SequenceTypes.Schedule::_replaceIfHeldDirectly(), edm::DataMixingSiStripWorker::addSiStripPileups(), SiStripProcessedRawDigiProducer::common_process(), IRPCDigitizer::doAction(), RPCDigitizer::doAction(), and CSCDigitizer::doAction().

220  {
221  _alreadySorted = false; // we don't know if the DetSet we're adding is already sorted
222  // Implementation provided by the Performance Task Force.
223  _sets.insert(std::lower_bound(_sets.begin(), _sets.end(), t), t);
224 #if 0
225  // It seems we have to sort on each insertion, because we may
226  // perform lookups during construction.
227  _sets.push_back(t);
228 
229  _sort();
230 #endif
231  }
collection_type _sets
Definition: DetSetVector.h:186
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:187
void _sort()
Sort the DetSet in order of increasing DetId.
Definition: DetSetVector.h:357
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
template<class T>
DetSetVector& edm::DetSetVector< T >::operator= ( DetSetVector< T > const &  other)
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 293 of file DetSetVector.h.

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

293  {
294  _alreadySorted = false; // it's non const
295  // Find the right DetSet, and return a reference to it. Throw if
296  // there is none.
297  iterator it = this->find(i);
298  if (it == this->end())
300  return *it;
301  }
void _throw_range(det_id_type i)
Definition: DetSetVector.h:69
iterator find(det_id_type id)
Definition: DetSetVector.h:264
collection_type::iterator iterator
Definition: DetSetVector.h:101
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:187
template<class T >
DetSetVector< T >::const_reference edm::DetSetVector< T >::operator[] ( det_id_type  i) const
inline

Definition at line 304 of file DetSetVector.h.

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

304  {
305  // Find the right DetSet, and return a reference to it. Throw if
306  // there is none.
307  const_iterator it = this->find(i);
308  if (it == this->end())
310  return *it;
311  }
void _throw_range(det_id_type i)
Definition: DetSetVector.h:69
iterator find(det_id_type id)
Definition: DetSetVector.h:264
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
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 342 of file DetSetVector.h.

References alignCSCRings::e, and mps_fire::i.

342  {
343  _sets.shrink_to_fit();
344  if (_alreadySorted)
345  return;
346  typename collection_type::iterator i = _sets.begin();
347  typename collection_type::iterator e = _sets.end();
348  // For each DetSet...
349  for (; i != e; ++i) {
350  i->data.shrink_to_fit();
351  // sort the Detset pointed to by
352  std::sort(i->data.begin(), i->data.end());
353  }
354  }
collection_type _sets
Definition: DetSetVector.h:186
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:187
template<class T>
void edm::DetSetVector< T >::reserve ( size_t  s)
inline
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 187 of file DetSetVector.h.

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