CMS 3D CMS Logo

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

#include <AssociationMap.h>

Classes

struct  const_iterator
 const iterator More...
 
struct  Find
 find helper More...
 

Public Types

typedef Tag::data_type data_type
 insert data type More...
 
typedef Tag::index_type index_type
 index type More...
 
typedef std::map< index_type,
value_type
internal_transient_map_type
 transient map type More...
 
typedef Tag::key_type key_type
 insert key type More...
 
typedef Tag::map_type map_type
 map type More...
 
typedef Tag::ref_type ref_type
 reference set type More...
 
typedef value_type::value_type result_type
 result type More...
 
typedef AssociationMap< Tag > self
 self type More...
 
typedef map_type::size_type size_type
 size type More...
 
typedef helpers::KeyVal
< key_type, internal_val_type
value_type
 value type More...
 

Public Member Functions

 AssociationMap ()
 default constructor More...
 
 AssociationMap (const ref_type &ref)
 default constructor More...
 
const_iterator begin () const
 first iterator over the map (read only) More...
 
void clear ()
 clear map More...
 
bool empty () const
 return true if empty More...
 
const_iterator end () const
 last iterator over the map (read only) More...
 
size_type erase (const key_type &k)
 erase the element whose key is k More...
 
const_iterator find (const key_type &k) const
 find element with specified reference key More...
 
void insert (const key_type &k, const data_type &v)
 insert an association More...
 
void insert (const value_type &kv)
 
Tag::transient_key_vector keys ()
 
Tag::transient_map_type map ()
 
size_type numberOfAssociations (const key_type &k) const
 number of associations to a key More...
 
const result_typeoperator[] (const key_type &k) const
 find element with specified reference key More...
 
void post_insert ()
 post insert action More...
 
const ref_typerefProd () const
 return ref-prod structure More...
 
size_type size () const
 map size More...
 
Tag::transient_val_vector values ()
 

Private Types

typedef Tag::val_type internal_val_type
 insert key type More...
 

Private Member Functions

const_iterator find (size_type i) const
 find element with index i More...
 
const value_typeoperator[] (size_type i) const
 return value_typeelement with key i More...
 

Private Attributes

map_type map_
 index map More...
 
ref_type ref_
 reference set More...
 
internal_transient_map_type transientMap_
 transient reference map More...
 

Friends

struct const_iterator
 
struct Find
 
template<typename , typename , typename >
class OneToMany
 
template<typename , typename , typename , typename >
class OneToManyWithQuality
 
template<typename , typename , typename >
class OneToOne
 
template<typename , typename , typename >
class OneToValue
 
struct refhelper::FindTrait< self, value_type >
 

Detailed Description

template<typename Tag>
class edm::AssociationMap< Tag >

one-to-many or one-to-one associative map using EDM references

Author
Luca Lista, INFN
Id:
AssociationMap.h,v 1.40 2010/09/01 19:48:30 chrjones Exp

Definition at line 21 of file AssociationMap.h.

Member Typedef Documentation

template<typename Tag>
typedef Tag::data_type edm::AssociationMap< Tag >::data_type

insert data type

Definition at line 32 of file AssociationMap.h.

template<typename Tag>
typedef Tag::index_type edm::AssociationMap< Tag >::index_type

index type

Definition at line 28 of file AssociationMap.h.

template<typename Tag>
typedef std::map<index_type, value_type> edm::AssociationMap< Tag >::internal_transient_map_type

transient map type

Definition at line 44 of file AssociationMap.h.

template<typename Tag>
typedef Tag::val_type edm::AssociationMap< Tag >::internal_val_type
private

insert key type

Definition at line 23 of file AssociationMap.h.

template<typename Tag>
typedef Tag::key_type edm::AssociationMap< Tag >::key_type

insert key type

Definition at line 30 of file AssociationMap.h.

template<typename Tag>
typedef Tag::map_type edm::AssociationMap< Tag >::map_type

map type

Definition at line 36 of file AssociationMap.h.

template<typename Tag>
typedef Tag::ref_type edm::AssociationMap< Tag >::ref_type

reference set type

Definition at line 34 of file AssociationMap.h.

template<typename Tag>
typedef value_type::value_type edm::AssociationMap< Tag >::result_type

result type

Definition at line 42 of file AssociationMap.h.

template<typename Tag>
typedef AssociationMap<Tag> edm::AssociationMap< Tag >::self

self type

Definition at line 26 of file AssociationMap.h.

template<typename Tag>
typedef map_type::size_type edm::AssociationMap< Tag >::size_type

size type

Definition at line 38 of file AssociationMap.h.

template<typename Tag>
typedef helpers::KeyVal<key_type, internal_val_type> edm::AssociationMap< Tag >::value_type

value type

Definition at line 40 of file AssociationMap.h.

Constructor & Destructor Documentation

template<typename Tag>
edm::AssociationMap< Tag >::AssociationMap ( )
inline

default constructor

Definition at line 73 of file AssociationMap.h.

73 { }
template<typename Tag>
edm::AssociationMap< Tag >::AssociationMap ( const ref_type ref)
inlineexplicit

default constructor

Definition at line 76 of file AssociationMap.h.

76 : ref_(ref) { }
ref_type ref_
reference set

Member Function Documentation

template<typename Tag>
const_iterator edm::AssociationMap< Tag >::begin ( void  ) const
inline
template<typename Tag>
void edm::AssociationMap< Tag >::clear ( void  )
inline
template<typename Tag>
bool edm::AssociationMap< Tag >::empty ( ) const
inline

return true if empty

Definition at line 82 of file AssociationMap.h.

Referenced by python.Vispa.Gui.VispaWidget.TextField::setAutosizeFont(), and python.Vispa.Gui.VispaWidget.TextField::setAutotruncate().

82 { return map_.empty(); }
map_type map_
index map
template<typename Tag>
const_iterator edm::AssociationMap< Tag >::end ( void  ) const
inline
template<typename Tag>
size_type edm::AssociationMap< Tag >::erase ( const key_type k)
inline

erase the element whose key is k

Definition at line 100 of file AssociationMap.h.

100  {
101  index_type i = k.key();
102  transientMap_.erase(i);
103  return map_.erase(i);
104  }
int i
Definition: DBlmapReader.cc:9
Tag::index_type index_type
index type
internal_transient_map_type transientMap_
transient reference map
int k[5][pyjets_maxn]
map_type map_
index map
template<typename Tag>
const_iterator edm::AssociationMap< Tag >::find ( const key_type k) const
inline
template<typename Tag>
const_iterator edm::AssociationMap< Tag >::find ( size_type  i) const
inlineprivate

find element with index i

Definition at line 161 of file AssociationMap.h.

161  {
162  typename map_type::const_iterator f = map_.find(i);
163  if (f == map_.end()) return end();
164  return const_iterator(this, f);
165  }
int i
Definition: DBlmapReader.cc:9
friend struct const_iterator
const_iterator end() const
last iterator over the map (read only)
double f[11][100]
map_type map_
index map
template<typename Tag>
void edm::AssociationMap< Tag >::insert ( const key_type k,
const data_type v 
)
inline

insert an association

Definition at line 84 of file AssociationMap.h.

Referenced by VertexAssociatorByTracks::associateRecoToSim(), TrackAssociatorByHits::associateRecoToSim(), MuonAssociatorByHits::associateRecoToSim(), TrackAssociatorByPosition::associateRecoToSim(), TrackAssociatorByChi2::associateRecoToSim(), VertexAssociatorByTracks::associateSimToReco(), TrackAssociatorByHits::associateSimToReco(), MuonAssociatorByHits::associateSimToReco(), TrackAssociatorByPosition::associateSimToReco(), TrackAssociatorByChi2::associateSimToReco(), reco::JetTrackMatch< JetC >::insert(), CosmicMuonLinksProducer::mapTracks(), EgammaHLTCombinedIsolationProducer::produce(), EgammaHLTClusterShapeProducer::produce(), EgammaHLTR9Producer::produce(), EgammaHLTElectronDetaDphiProducer::produce(), EgammaHLTR9IDProducer::produce(), EgammaHLTEcalRecIsolationProducer::produce(), EgammaHLTElectronTrackIsolationProducers::produce(), EgammaHLTPhotonTrackIsolationProducersRegional::produce(), EgammaHLTHcalIsolationDoubleConeProducers::produce(), EgammaHLTEcalIsolationProducersRegional::produce(), EgammaHLTHcalIsolationProducersRegional::produce(), and NuclearTrackCorrector::produce().

84  {
85  Tag::insert(ref_, map_, k, v);
86  }
ref_type ref_
reference set
int k[5][pyjets_maxn]
map_type map_
index map
bool insert(Storage &, ItemType *, const IdTag &)
mathSSE::Vec4< T > v
template<typename Tag>
void edm::AssociationMap< Tag >::insert ( const value_type kv)
inline

Definition at line 87 of file AssociationMap.h.

87  {
88  Tag::insert(ref_, map_, kv.key, kv.val);
89  }
ref_type ref_
reference set
map_type map_
index map
bool insert(Storage &, ItemType *, const IdTag &)
template<typename Tag>
Tag::transient_key_vector edm::AssociationMap< Tag >::keys ( )
inline

fill and return a transient key vector required for ROOT interactive usage

Definition at line 127 of file AssociationMap.h.

127  {
128  return Tag::transientKeyVector( ref_, map_ );
129  }
ref_type ref_
reference set
map_type map_
index map
template<typename Tag>
Tag::transient_map_type edm::AssociationMap< Tag >::map ( )
inline

fill and return a transient map required for ROOT interactive usage

Definition at line 122 of file AssociationMap.h.

122  {
123  return Tag::transientMap( ref_, map_ );
124  }
ref_type ref_
reference set
map_type map_
index map
template<typename Tag>
size_type edm::AssociationMap< Tag >::numberOfAssociations ( const key_type k) const
inline

number of associations to a key

Definition at line 111 of file AssociationMap.h.

Referenced by VertexAssociatorByTracks::associateRecoToSim(), and VertexAssociatorByTracks::associateSimToReco().

111  {
112  if (ref_.key.id() != k.id()) return 0;
113  typename map_type::const_iterator f = map_.find(k.key());
114  if (f == map_.end()) return 0;
115  return Tag::size(f->second);
116  }
ref_type ref_
reference set
double f[11][100]
int k[5][pyjets_maxn]
map_type map_
index map
tuple size
Write out results.
template<typename Tag>
const result_type& edm::AssociationMap< Tag >::operator[] ( const key_type k) const
inline

find element with specified reference key

Definition at line 106 of file AssociationMap.h.

Referenced by edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::operator[]().

106  {
107  helpers::checkRef(ref_.key, k);
108  return operator[](k.key()).val;
109  }
ref_type ref_
reference set
int k[5][pyjets_maxn]
const result_type & operator[](const key_type &k) const
find element with specified reference key
void checkRef(const RP &rp, const R &r)
throw if r hasn&#39;t the same id as rp
template<typename Tag>
const value_type& edm::AssociationMap< Tag >::operator[] ( size_type  i) const
inlineprivate

return value_typeelement with key i

Definition at line 167 of file AssociationMap.h.

167  {
168  typename internal_transient_map_type::const_iterator tf = transientMap_.find(i);
169  if (tf == transientMap_.end()) {
170  typename map_type::const_iterator f = map_.find(i);
171  if (f == map_.end())
172  Exception::throwThis(edm::errors::InvalidReference, "can't find reference in AssociationMap at position ", i);
173  value_type v(key_type(ref_.key, i), Tag::val(ref_, f->second));
174  std::pair<typename internal_transient_map_type::const_iterator, bool> ins =
175  transientMap_.insert(std::make_pair(i, v));
176  return ins.first->second;
177  } else {
178  return tf->second;
179  }
180  }
int i
Definition: DBlmapReader.cc:9
internal_transient_map_type transientMap_
transient reference map
helpers::KeyVal< key_type, internal_val_type > value_type
value type
Tag::key_type key_type
insert key type
ref_type ref_
reference set
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:81
double f[11][100]
map_type map_
index map
mathSSE::Vec4< T > v
template<typename Tag>
void edm::AssociationMap< Tag >::post_insert ( )
inline
template<typename Tag>
const ref_type& edm::AssociationMap< Tag >::refProd ( ) const
inline

return ref-prod structure

Definition at line 118 of file AssociationMap.h.

118 { return ref_; }
ref_type ref_
reference set
template<typename Tag>
size_type edm::AssociationMap< Tag >::size ( void  ) const
inline
template<typename Tag>
Tag::transient_val_vector edm::AssociationMap< Tag >::values ( )
inline

fill and return a transient key vector required for ROOT interactive usage

Definition at line 132 of file AssociationMap.h.

132  {
133  return Tag::transientValVector( ref_, map_ );
134  }
ref_type ref_
reference set
map_type map_
index map

Friends And Related Function Documentation

template<typename Tag>
friend struct const_iterator
friend
template<typename Tag>
friend struct Find
friend

Definition at line 182 of file AssociationMap.h.

template<typename Tag>
template<typename , typename , typename >
friend class OneToMany
friend

Definition at line 186 of file AssociationMap.h.

template<typename Tag>
template<typename , typename , typename , typename >
friend class OneToManyWithQuality
friend

Definition at line 187 of file AssociationMap.h.

template<typename Tag>
template<typename , typename , typename >
friend class OneToOne
friend

Definition at line 185 of file AssociationMap.h.

template<typename Tag>
template<typename , typename , typename >
friend class OneToValue
friend

Definition at line 184 of file AssociationMap.h.

template<typename Tag>
friend struct refhelper::FindTrait< self, value_type >
friend

Definition at line 183 of file AssociationMap.h.

Member Data Documentation

template<typename Tag>
map_type edm::AssociationMap< Tag >::map_
private

index map

Definition at line 157 of file AssociationMap.h.

Referenced by edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::begin(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::clear(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::empty(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::end(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::erase(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::insert(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::keys(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::map(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::numberOfAssociations(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::operator[](), edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::post_insert(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::size(), and edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > >::values().

template<typename Tag>
ref_type edm::AssociationMap< Tag >::ref_
private
template<typename Tag>
internal_transient_map_type edm::AssociationMap< Tag >::transientMap_
mutableprivate