CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Private Member Functions | Private Attributes
ClusterTPAssociation Class Reference

#include <ClusterTPAssociation.h>

Public Types

using const_iterator = typename map_type::const_iterator
 
using key_type = OmniClusterRef
 
using map_type = std::vector< value_type >
 
using mapped_type = TrackingParticleRef
 
using range = std::pair< const_iterator, const_iterator >
 
using value_type = std::pair< key_type, mapped_type >
 

Public Member Functions

const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void checkMappedProductID (const edm::HandleBase &mappedHandle) const
 
void checkMappedProductID (const TrackingParticleRef &tp) const
 
void checkMappedProductID (const edm::ProductID &id) const
 
 ClusterTPAssociation ()
 
 ClusterTPAssociation (const edm::HandleBase &mappedHandle)
 
 ClusterTPAssociation (const edm::ProductID &mappedProductId)
 
void emplace_back (const OmniClusterRef &cluster, const TrackingParticleRef &tp)
 
bool empty () const
 
const_iterator end () const
 
range equal_range (const OmniClusterRef &key) const
 
const map_typemap () const
 
size_t size () const
 
void sort ()
 
void swap (ClusterTPAssociation &other)
 

Static Private Member Functions

static bool compare (const value_type &i, const value_type &j)
 

Private Attributes

map_type map_
 
edm::ProductID mappedProductId_
 

Detailed Description

Maps OmniClusterRefs to TrackingParticleRefs

Assumes that the TrackingParticleRefs point to a single TrackingParticle collection.

Definition at line 20 of file ClusterTPAssociation.h.

Member Typedef Documentation

using ClusterTPAssociation::const_iterator = typename map_type::const_iterator

Definition at line 26 of file ClusterTPAssociation.h.

Definition at line 22 of file ClusterTPAssociation.h.

Definition at line 25 of file ClusterTPAssociation.h.

Definition at line 23 of file ClusterTPAssociation.h.

Definition at line 27 of file ClusterTPAssociation.h.

Definition at line 24 of file ClusterTPAssociation.h.

Constructor & Destructor Documentation

ClusterTPAssociation::ClusterTPAssociation ( )
inline

Definition at line 29 of file ClusterTPAssociation.h.

29 {}
ClusterTPAssociation::ClusterTPAssociation ( const edm::HandleBase mappedHandle)
inlineexplicit

Definition at line 30 of file ClusterTPAssociation.h.

30 : ClusterTPAssociation(mappedHandle.id()) {}
ProductID id() const
Definition: HandleBase.cc:15
ClusterTPAssociation::ClusterTPAssociation ( const edm::ProductID mappedProductId)
inlineexplicit

Definition at line 31 of file ClusterTPAssociation.h.

31 : mappedProductId_(mappedProductId) {}
edm::ProductID mappedProductId_

Member Function Documentation

const_iterator ClusterTPAssociation::begin ( void  ) const
inline

Definition at line 46 of file ClusterTPAssociation.h.

References map_.

46 { return map_.begin(); }
const_iterator ClusterTPAssociation::cbegin ( ) const
inline

Definition at line 47 of file ClusterTPAssociation.h.

References map_.

47 { return map_.cbegin(); }
const_iterator ClusterTPAssociation::cend ( ) const
inline

Definition at line 49 of file ClusterTPAssociation.h.

References map_.

49 { return map_.end(); }
void ClusterTPAssociation::checkMappedProductID ( const edm::HandleBase mappedHandle) const
inline

Definition at line 57 of file ClusterTPAssociation.h.

References checkMappedProductID(), and edm::HandleBase::id().

Referenced by checkMappedProductID(), and emplace_back().

57 { checkMappedProductID(mappedHandle.id()); }
ProductID id() const
Definition: HandleBase.cc:15
void checkMappedProductID(const edm::HandleBase &mappedHandle) const
void ClusterTPAssociation::checkMappedProductID ( const TrackingParticleRef tp) const
inline

Definition at line 58 of file ClusterTPAssociation.h.

References checkMappedProductID(), and edm::Ref< C, T, F >::id().

Referenced by checkMappedProductID().

58 { checkMappedProductID(tp.id()); }
ProductID id() const
Accessor for product ID.
Definition: Ref.h:258
void checkMappedProductID(const edm::HandleBase &mappedHandle) const
void ClusterTPAssociation::checkMappedProductID ( const edm::ProductID id) const

Definition at line 4 of file ClusterTPAssociation.cc.

References Exception, and mappedProductId_.

4  {
5  if(id != mappedProductId_) {
6  throw cms::Exception("InvalidReference") << "ClusterTPAssociation has TrackingParticles with ProductID " << mappedProductId_ << ", but got TrackingParticleRef/Handle/ProductID with ID " << id << ". This is typically caused by a configuration error.";
7  }
8 }
edm::ProductID mappedProductId_
static bool ClusterTPAssociation::compare ( const value_type i,
const value_type j 
)
inlinestaticprivate

Definition at line 62 of file ClusterTPAssociation.h.

Referenced by equal_range(), and sort().

62  {
63  return i.first.rawIndex() > j.first.rawIndex();
64  }
void ClusterTPAssociation::emplace_back ( const OmniClusterRef cluster,
const TrackingParticleRef tp 
)
inline

Definition at line 33 of file ClusterTPAssociation.h.

References checkMappedProductID(), and map_.

33  {
35  map_.emplace_back(cluster, tp);
36  }
void checkMappedProductID(const edm::HandleBase &mappedHandle) const
bool ClusterTPAssociation::empty ( void  ) const
inline

Definition at line 43 of file ClusterTPAssociation.h.

References map_.

Referenced by QuickTrackAssociatorByHitsImpl::associateTrack().

43 { return map_.empty(); }
const_iterator ClusterTPAssociation::end ( void  ) const
inline

Definition at line 48 of file ClusterTPAssociation.h.

References map_.

48 { return map_.end(); }
range ClusterTPAssociation::equal_range ( const OmniClusterRef key) const
inline

Definition at line 51 of file ClusterTPAssociation.h.

References compare(), and map_.

Referenced by QuickTrackAssociatorByHitsImpl::associateTrack(), QuickTrackAssociatorByHitsImpl::getDoubleCount(), and TrackingNtuple::matchCluster().

51  {
52  return std::equal_range(map_.begin(), map_.end(), value_type(key, TrackingParticleRef()), compare);
53  }
static bool compare(const value_type &i, const value_type &j)
std::pair< key_type, mapped_type > value_type
edm::Ref< TrackingParticleCollection > TrackingParticleRef
const map_type& ClusterTPAssociation::map ( ) const
inline

Definition at line 55 of file ClusterTPAssociation.h.

References map_.

Referenced by BDHadronTrackMonitoringAnalyzer::analyze().

55 { return map_; }
size_t ClusterTPAssociation::size ( void  ) const
inline

Definition at line 44 of file ClusterTPAssociation.h.

References map_.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

44 { return map_.size(); }
void ClusterTPAssociation::sort ( )
inline

Definition at line 37 of file ClusterTPAssociation.h.

References compare(), and map_.

37 { std::sort(map_.begin(), map_.end(), compare); }
static bool compare(const value_type &i, const value_type &j)
void ClusterTPAssociation::swap ( ClusterTPAssociation other)
inline

Definition at line 38 of file ClusterTPAssociation.h.

References map_, mappedProductId_, and edm::ProductID::swap().

38  {
39  map_.swap(other.map_);
41  }
void swap(ProductID &other)
Definition: ProductID.cc:17
edm::ProductID mappedProductId_

Member Data Documentation

map_type ClusterTPAssociation::map_
private
edm::ProductID ClusterTPAssociation::mappedProductId_
private

Definition at line 67 of file ClusterTPAssociation.h.

Referenced by checkMappedProductID(), and swap().