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 | Static 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 ()
 

Static Public Member Functions

static short Class_Version ()
 

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

Definition at line 20 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 31 of file AssociationMap.h.

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

index type

Definition at line 27 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 43 of file AssociationMap.h.

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

insert key type

Definition at line 22 of file AssociationMap.h.

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

insert key type

Definition at line 29 of file AssociationMap.h.

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

map type

Definition at line 35 of file AssociationMap.h.

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

reference set type

Definition at line 33 of file AssociationMap.h.

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

result type

Definition at line 41 of file AssociationMap.h.

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

self type

Definition at line 25 of file AssociationMap.h.

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

size type

Definition at line 37 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 39 of file AssociationMap.h.

Constructor & Destructor Documentation

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

default constructor

Definition at line 69 of file AssociationMap.h.

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

default constructor

Definition at line 72 of file AssociationMap.h.

72 : 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>
static short edm::AssociationMap< Tag >::Class_Version ( )
inlinestatic

Definition at line 147 of file AssociationMap.h.

149 :
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 78 of file AssociationMap.h.

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

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

last iterator over the map (read only)

Definition at line 89 of file AssociationMap.h.

Referenced by SiStripGainFromData::algoAnalyze(), reco::JetTrackMatch< reco::GenJetCollection >::allJets(), MultiTrackValidatorGenPs::analyze(), MultiTrackValidator::analyze(), TrackerSeedValidator::analyze(), ValidationMisalignedTracker::analyze(), SiPixelHitEfficiencySource::analyze(), SiPixelTrackResidualSource::analyze(), TkConvValidator::analyze(), TestTrackHits::analyze(), PhotonValidator::analyze(), MuonTrackValidator::analyze(), PrimaryVertexAnalyzer4PU::analyzeVertexCollectionTP(), FWTrackProxyBuilderFullFramework::build(), Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), edm::AssociationMap< edm::OneToMany< reco::BasicJetCollection, reco::TrackCollection > >::find(), PrimaryVertexAnalyzer4PUSlimmed::getSimPVs(), muon::getTevRefitTrack(), noPuUtils::isVertexAssociated(), noPuUtils::isVertexAssociated_fast(), HLTEgammaCaloIsolFilterPairs::PassCaloIsolation(), MCTrackMatcher::produce(), ShallowSimTracksProducer::produce(), NuclearInteractionEDProducer::produce(), TrackAlgoCompareUtil::produce(), noPuUtils::reversePFCandToVertexAssociation(), PF_PU_AssoMapAlgos::SortAssociationMap(), PFCand_AssoMapAlgos::SortPFCandAssociationMap(), and tevOptimizedTMR().

89 { return const_iterator(this, map_.end()); }
friend struct const_iterator
map_type map_
index map
template<typename Tag>
size_type edm::AssociationMap< Tag >::erase ( const key_type k)
inline

erase the element whose key is k

Definition at line 96 of file AssociationMap.h.

96  {
97  index_type i = k.key();
98  transientMap_.erase(i);
99  return map_.erase(i);
100  }
int i
Definition: DBlmapReader.cc:9
Tag::index_type index_type
index type
internal_transient_map_type transientMap_
transient reference map
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 157 of file AssociationMap.h.

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

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

Referenced by BeautifulSoup.PageElement::_invert(), TrackGenAssociatorByChi2Impl::associateGenToReco(), TrackGenAssociatorByChi2::associateGenToReco(), TrackGenAssociatorByChi2Impl::associateRecoToGen(), TrackGenAssociatorByChi2::associateRecoToGen(), VertexAssociatorByTracks::associateRecoToSim(), MuonAssociatorByHits::associateRecoToSim(), TrackAssociatorByHitsImpl::associateRecoToSim(), TrackAssociatorByPositionImpl::associateRecoToSim(), TrackAssociatorByChi2::associateRecoToSim(), TrackAssociatorByPosition::associateRecoToSim(), TrackAssociatorByChi2Impl::associateRecoToSim(), QuickTrackAssociatorByHits::associateRecoToSim(), QuickTrackAssociatorByHitsImpl::associateRecoToSim(), QuickTrackAssociatorByHitsImpl::associateRecoToSimImplementation(), QuickTrackAssociatorByHits::associateRecoToSimImplementation(), VertexAssociatorByTracks::associateSimToReco(), MuonAssociatorByHits::associateSimToReco(), TrackAssociatorByHitsImpl::associateSimToReco(), TrackAssociatorByPositionImpl::associateSimToReco(), TrackAssociatorByChi2::associateSimToReco(), TrackAssociatorByPosition::associateSimToReco(), TrackAssociatorByChi2Impl::associateSimToReco(), QuickTrackAssociatorByHitsImpl::associateSimToReco(), QuickTrackAssociatorByHits::associateSimToReco(), QuickTrackAssociatorByHitsImpl::associateSimToRecoImplementation(), QuickTrackAssociatorByHits::associateSimToRecoImplementation(), reco::JetTrackMatch< reco::GenJetCollection >::insert(), CosmicMuonLinksProducer::mapTracks(), EgammaHLTCombinedIsolationProducer::produce(), EgammaHLTPFChargedIsolationProducer::produce(), EgammaHLTClusterShapeProducer::produce(), EgammaHLTPFPhotonIsolationProducer::produce(), EgammaHLTElectronCombinedIsolationProducer::produce(), EgammaHLTPFNeutralIsolationProducer::produce(), HLTEcalPFClusterIsolationProducer< T1 >::produce(), EgammaHLTEcalRecIsolationProducer::produce(), HLTHcalPFClusterIsolationProducer< T1 >::produce(), EgammaHLTElectronDetaDphiProducer::produce(), EgammaHLTElectronTrackIsolationProducers::produce(), EgammaHLTHcalIsolationDoubleConeProducers::produce(), EgammaHLTHcalIsolationProducersRegional::produce(), EgammaHLTBcHcalIsolationProducersRegional::produce(), EgammaHLTR9IDProducer::produce(), EgammaHLTPhotonTrackIsolationProducersRegional::produce(), EgammaHLTR9Producer::produce(), EgammaHLTEcalIsolationProducersRegional::produce(), EgammaHLTGsfTrackVarProducer::produce(), NuclearTrackCorrector::produce(), and noPuUtils::reversePFCandToVertexAssociation().

80  {
81  Tag::insert(ref_, map_, k, v);
82  }
ref_type ref_
reference set
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
map_type map_
index map
template<typename Tag>
void edm::AssociationMap< Tag >::insert ( const value_type kv)
inline

Definition at line 83 of file AssociationMap.h.

Referenced by BeautifulSoup.PageElement::_invert().

83  {
84  Tag::insert(ref_, map_, kv.key, kv.val);
85  }
ref_type ref_
reference set
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
map_type map_
index map
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 123 of file AssociationMap.h.

Referenced by psClasses.queueList::__init__(), psClasses.queueList::smallestQueue(), and psClasses.queueList::thinerQueue().

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

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

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

107  {
108  if (ref_.key.id() != k.id()) return 0;
109  typename map_type::const_iterator f = map_.find(k.key());
110  if (f == map_.end()) return 0;
111  return Tag::size(f->second);
112  }
ref_type ref_
reference set
double f[11][100]
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 102 of file AssociationMap.h.

Referenced by edm::AssociationMap< edm::OneToMany< reco::BasicJetCollection, reco::TrackCollection > >::operator[]().

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

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

114 { 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 128 of file AssociationMap.h.

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

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

Definition at line 182 of file AssociationMap.h.

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

Definition at line 183 of file AssociationMap.h.

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

Definition at line 181 of file AssociationMap.h.

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

Definition at line 180 of file AssociationMap.h.

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

Definition at line 179 of file AssociationMap.h.

Member Data Documentation

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