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.42 2011/11/16 22:33:15 wmtan 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 70 of file AssociationMap.h.

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

default constructor

Definition at line 73 of file AssociationMap.h.

73 : 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 79 of file AssociationMap.h.

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

79 { 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 97 of file AssociationMap.h.

97  {
98  index_type i = k.key();
99  transientMap_.erase(i);
100  return map_.erase(i);
101  }
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 158 of file AssociationMap.h.

Referenced by BeautifulSoup.Tag::_invert(), and BeautifulSoup.PageElement::insert().

158  {
159  typename map_type::const_iterator f = map_.find(i);
160  if (f == map_.end()) return end();
161  return const_iterator(this, f);
162  }
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 81 of file AssociationMap.h.

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

81  {
82  Tag::insert(ref_, map_, k, v);
83  }
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 84 of file AssociationMap.h.

Referenced by BeautifulSoup.PageElement::append().

84  {
85  Tag::insert(ref_, map_, kv.key, kv.val);
86  }
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 124 of file AssociationMap.h.

124  {
125  return Tag::transientKeyVector( ref_, map_ );
126  }
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 119 of file AssociationMap.h.

119  {
120  return Tag::transientMap( ref_, map_ );
121  }
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 108 of file AssociationMap.h.

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

108  {
109  if (ref_.key.id() != k.id()) return 0;
110  typename map_type::const_iterator f = map_.find(k.key());
111  if (f == map_.end()) return 0;
112  return Tag::size(f->second);
113  }
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 103 of file AssociationMap.h.

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

103  {
104  helpers::checkRef(ref_.key, k);
105  return operator[](k.key()).val;
106  }
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 164 of file AssociationMap.h.

164  {
165  typename internal_transient_map_type::const_iterator tf = transientMap_.find(i);
166  if (tf == transientMap_.end()) {
167  typename map_type::const_iterator f = map_.find(i);
168  if (f == map_.end())
169  Exception::throwThis(edm::errors::InvalidReference, "can't find reference in AssociationMap at position ", i);
170  value_type v(key_type(ref_.key, i), Tag::val(ref_, f->second));
171  std::pair<typename internal_transient_map_type::const_iterator, bool> ins =
172  transientMap_.insert(std::make_pair(i, v));
173  return ins.first->second;
174  } else {
175  return tf->second;
176  }
177  }
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="")
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 115 of file AssociationMap.h.

115 { 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 129 of file AssociationMap.h.

129  {
130  return Tag::transientValVector( ref_, map_ );
131  }
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 179 of file AssociationMap.h.

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

Definition at line 183 of file AssociationMap.h.

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

Definition at line 184 of file AssociationMap.h.

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

Definition at line 182 of file AssociationMap.h.

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

Definition at line 181 of file AssociationMap.h.

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

Definition at line 180 of file AssociationMap.h.

Member Data Documentation

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

index map

Definition at line 154 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