CMS 3D CMS Logo

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...
 
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

◆ collection_type

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

Definition at line 96 of file DetSetVector.h.

◆ const_iterator

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

Definition at line 102 of file DetSetVector.h.

◆ const_reference

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

Definition at line 99 of file DetSetVector.h.

◆ detset

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

Definition at line 94 of file DetSetVector.h.

◆ iterator

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

Definition at line 101 of file DetSetVector.h.

◆ reference

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

Definition at line 98 of file DetSetVector.h.

◆ size_type

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

Definition at line 103 of file DetSetVector.h.

◆ value_type

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

Definition at line 95 of file DetSetVector.h.

Constructor & Destructor Documentation

◆ DetSetVector() [1/2]

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

192 : _sets() {}
collection_type _sets
Definition: DetSetVector.h:184

◆ DetSetVector() [2/2]

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

196  : _sets(), _alreadySorted(alreadySorted) {
197  _sets.swap(input);
198  if (!alreadySorted)
199  _sort();
200  }
collection_type _sets
Definition: DetSetVector.h:184
static std::string const input
Definition: EdmProvDump.cc:50
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:185
void _sort()
Sort the DetSet in order of increasing DetId.
Definition: DetSetVector.h:348

Member Function Documentation

◆ _sort()

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

Sort the DetSet in order of increasing DetId.

Definition at line 348 of file DetSetVector.h.

348  {
349  std::sort(_sets.begin(), _sets.end());
350  }
collection_type _sets
Definition: DetSetVector.h:184

◆ begin() [1/2]

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

Return an iterator to the first DetSet.

Definition at line 305 of file DetSetVector.h.

Referenced by PreMixingSiPixelWorker::addPileups(), edm::DataMixingSiStripWorker::addSiStripPileups(), SiStripDigiValid::analyze(), SiPixelDigiValid::analyze(), SiStripBaselineValidator::analyze(), SiPixelHLTSource::analyze(), ClusterCount::analyze(), SiPixelErrorsDigisToCalibDigis::analyze(), SiPixelOfflineCalibAnalysisBase::analyze(), edm::DetSetVector< TotemRPLocalTrack::FittedRecHit >::begin(), FWSiStripDigiProxyBuilder::build(), FWSiPixelDigiProxyBuilder::build(), APVShotFinder::computeShots(), sistrip::SpyDigiConverter::extractPayloadDigis(), SiPixelRawDataErrorModule::fill(), SiPixelDigiModule::fill(), SiPixelCalibDigiProducer::fill(), LaserAlignment::fillDataProfiles(), SiPixelRawDataErrorModule::fillFED(), LaserAlignmentT0ProducerDQM::FillFromProcessedDigis(), LaserAlignmentT0ProducerDQM::FillFromRawDigis(), Phase2TrackerValidateDigi::fillITPixelBXInfo(), Phase2TrackerMonitorDigi::fillITPixelDigiHistos(), 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(), GEMDigiMatcher::matchDigisSLToSimTrack(), sistrip::FEDEmulatorModule::produce(), edm::DataMixingSiStripRawWorker::putSiStrip(), sistrip::SpyDigiConverter::reorderDigis(), TTClusterBuilder< T >::RetrieveRawHits(), and sistrip::FEDEmulator::subtractPedestals().

305  {
306  _alreadySorted = false; // it's non const
307  return _sets.begin();
308  }
collection_type _sets
Definition: DetSetVector.h:184
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:185

◆ begin() [2/2]

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

Definition at line 311 of file DetSetVector.h.

311  {
312  return _sets.begin();
313  }
collection_type _sets
Definition: DetSetVector.h:184

◆ BOOST_CLASS_REQUIRE()

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

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

◆ Class_Version()

template<class T>
static short edm::DetSetVector< T >::Class_Version ( )
inlinestatic

Definition at line 181 of file DetSetVector.h.

183 :
collection_type _sets
Definition: DetSetVector.h:184
std::vector< detset > collection_type
Definition: DetSetVector.h:96

◆ empty()

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

Return true if we contain no DetSets.

Definition at line 245 of file DetSetVector.h.

Referenced by SiStripCommissioningSource::fillHistos().

245  {
246  return _sets.empty();
247  }
collection_type _sets
Definition: DetSetVector.h:184

◆ end() [1/2]

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

Return the off-the-end iterator.

Definition at line 316 of file DetSetVector.h.

Referenced by PreMixingSiPixelWorker::addPileups(), edm::DataMixingSiStripWorker::addSiStripPileups(), SiStripDigiValid::analyze(), SiPixelDigiValid::analyze(), SiStripBaselineValidator::analyze(), MuonTruth::analyze(), SiPixelHLTSource::analyze(), ClusterCount::analyze(), SiStripSpyMonitorModule::analyze(), SiPixelErrorsDigisToCalibDigis::analyze(), SiPixelOfflineCalibAnalysisBase::analyze(), CSCHitAssociator::associateCSCHitId(), CSCHitAssociator::associateHitId(), TrackerHitAssociator::associatePhase2TrackerRecHit(), TrackerHitAssociator::associatePixelRecHit(), GEMHitAssociator::associateRecHit(), FWSiStripDigiProxyBuilder::build(), FWSiPixelDigiProxyBuilder::build(), 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(), 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(), sistrip::FEDEmulatorModule::produce(), edm::DataMixingSiStripRawWorker::putSiStrip(), sistrip::SpyDigiConverter::reorderDigis(), TTClusterBuilder< T >::RetrieveRawHits(), and sistrip::FEDEmulator::subtractPedestals().

316  {
317  _alreadySorted = false; // it's non const
318  return _sets.end();
319  }
collection_type _sets
Definition: DetSetVector.h:184
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:185

◆ end() [2/2]

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

Definition at line 322 of file DetSetVector.h.

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

322  {
323  return _sets.end();
324  }
collection_type _sets
Definition: DetSetVector.h:184

◆ fillView()

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

Definition at line 353 of file DetSetVector.h.

355  {
356  detail::reallyFillView(*this, id, pointers, helpers);
357  }
void reallyFillView(COLLECTION const &coll, ProductID const &id, std::vector< void const *> &ptrs, FillViewHelperVector &helpers)
Definition: FillView.h:25

◆ find() [1/2]

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

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

255  {
256  _alreadySorted = false; // it's non const
257  std::pair<iterator, iterator> p = std::equal_range(_sets.begin(), _sets.end(), id);
258  if (p.first == p.second)
259  return _sets.end();
260 
261 // The range indicated by [p.first, p.second) should be exactly of
262 // length 1. It seems likely we don't want to take the time hit of
263 // checking this, but here is the appropriate test... We can turn
264 // it on if we need the debugging aid.
265 #if 0
266  assert(std::distance(p.first, p.second) == 1);
267 #endif
268 
269  return p.first;
270  }
collection_type _sets
Definition: DetSetVector.h:184
assert(be >=bs)
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:185

◆ find() [2/2]

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

Definition at line 273 of file DetSetVector.h.

273  {
274  std::pair<const_iterator, const_iterator> p = std::equal_range(_sets.begin(), _sets.end(), id);
275  if (p.first == p.second)
276  return _sets.end();
277  // The range indicated by [p.first, p.second) should be exactly of
278  // length 1.
279  assert(std::distance(p.first, p.second) == 1);
280  return p.first;
281  }
collection_type _sets
Definition: DetSetVector.h:184
assert(be >=bs)

◆ find_or_insert()

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

Referenced by TotemRPUVPattern::addHit(), CTPPSPixelLocalTrack::addHit(), CTPPSPixelDataFormatter::interpretRawData(), PixelDataFormatter::interpretRawData(), PPSDirectProtonSimulation::processProton(), TotemRPUVPatternFinder::produce(), CTPPSPixelLocalTrackProducer::produce(), SiPixelRawToDigi::produce(), RawToDigiConverter::run(), and PixelDataFormatter::unpackFEDErrors().

225  {
226  // NOTE: we don't have to clear _alreadySorted: the new DS is empty,
227  // and gets inserted in the correct place
228  std::pair<iterator, iterator> p = std::equal_range(_sets.begin(), _sets.end(), id);
229 
230  // If the range isn't empty, we already have the right thing;
231  // return a reference to it...
232  if (p.first != p.second)
233  return *p.first;
234 
235  // Insert the right thing, in the right place, and return a
236  // reference to the newly inserted thing.
237 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
238  return *(_sets.emplace(p.first, id));
239 #else
240  return *(_sets.insert(p.first, detset(id)));
241 #endif
242  }
collection_type _sets
Definition: DetSetVector.h:184
DetSet< T > detset
Definition: DetSetVector.h:94

◆ getIds()

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

327  {
329  this->begin(), this->end(), std::back_inserter(result), std::bind(&DetSet<T>::id, std::placeholders::_1));
330  }
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:316
det_id_type id
Definition: DetSet.h:79
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:305
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ insert()

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

Insert the given DetSet.

Definition at line 211 of file DetSetVector.h.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly(), PreMixingSiPixelWorker::addPileups(), edm::DataMixingSiStripWorker::addSiStripPileups(), IRPCDigitizer::doAction(), RPCDigitizer::doAction(), and CSCDigitizer::doAction().

211  {
212  _alreadySorted = false; // we don't know if the DetSet we're adding is already sorted
213  // Implementation provided by the Performance Task Force.
214  _sets.insert(std::lower_bound(_sets.begin(), _sets.end(), t), t);
215 #if 0
216  // It seems we have to sort on each insertion, because we may
217  // perform lookups during construction.
218  _sets.push_back(t);
219 
220  _sort();
221 #endif
222  }
collection_type _sets
Definition: DetSetVector.h:184
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:185
void _sort()
Sort the DetSet in order of increasing DetId.
Definition: DetSetVector.h:348

◆ operator[]() [1/2]

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

284  {
285  _alreadySorted = false; // it's non const
286  // Find the right DetSet, and return a reference to it. Throw if
287  // there is none.
288  iterator it = this->find(i);
289  if (it == this->end())
291  return *it;
292  }
void _throw_range(det_id_type i)
Definition: DetSetVector.h:69
iterator find(det_id_type id)
Definition: DetSetVector.h:255
collection_type::iterator iterator
Definition: DetSetVector.h:101
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:316
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:185

◆ operator[]() [2/2]

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

Definition at line 295 of file DetSetVector.h.

295  {
296  // Find the right DetSet, and return a reference to it. Throw if
297  // there is none.
298  const_iterator it = this->find(i);
299  if (it == this->end())
301  return *it;
302  }
void _throw_range(det_id_type i)
Definition: DetSetVector.h:69
iterator find(det_id_type id)
Definition: DetSetVector.h:255
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:316
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102

◆ post_insert()

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

333  {
334  _sets.shrink_to_fit();
335  if (_alreadySorted)
336  return;
337  typename collection_type::iterator i = _sets.begin();
338  typename collection_type::iterator e = _sets.end();
339  // For each DetSet...
340  for (; i != e; ++i) {
341  i->data.shrink_to_fit();
342  // sort the Detset pointed to by
343  std::sort(i->data.begin(), i->data.end());
344  }
345  }
collection_type _sets
Definition: DetSetVector.h:184
edm::BoolCache _alreadySorted
Definition: DetSetVector.h:185

◆ reserve()

template<class T>
void edm::DetSetVector< T >::reserve ( size_t  s)
inline

◆ size()

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

◆ swap()

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

Member Data Documentation

◆ _alreadySorted

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

Definition at line 185 of file DetSetVector.h.

◆ _sets

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