CMS 3D CMS Logo

List of all members | Public Types | Static Public Member Functions | Private Types
edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef > Class Template Reference

#include <OneToManyWithQualityGeneric.h>

Public Types

typedef std::pair< ValRef, Q > data_type
 insert val type More...
 
typedef index index_type
 index type More...
 
typedef KeyRef key_type
 insert key type More...
 
typedef std::map< index_type, map_assocmap_type
 map type More...
 
typedef Q quality_type
 quality type More...
 
typedef helpers::KeyVal< keyrefprod_type, valrefprod_typeref_type
 reference set type More...
 
typedef std::vector< const typename CKey::value_type * > transient_key_vector
 transient key vector More...
 
typedef std::map< const typename CKey::value_type *, std::vector< std::pair< const typename CVal::value_type *, Q > > > transient_map_type
 transient map type More...
 
typedef std::vector< std::vector< std::pair< const typename CVal::value_type *, Q > > > transient_val_vector
 transient val vector More...
 
typedef std::vector< std::pair< ValRef, Q > > val_type
 values reference collection type More...
 

Static Public Member Functions

static void insert (ref_type &ref, map_type &m, const key_type &k, const data_type &v)
 insert in the map More...
 
static void insert (ref_type &ref, map_type &m, const key_type &k, const val_type &v)
 
static map_type::size_type size (const map_assoc &v)
 size of data_type More...
 
static void sort (map_type &m)
 sort More...
 
static transient_key_vector transientKeyVector (const ref_type &ref, const map_type &map)
 fill transient key vector More...
 
static transient_map_type transientMap (const ref_type &ref, const map_type &map)
 fill transient map More...
 
static transient_val_vector transientValVector (const ref_type &ref, const map_type &map)
 fill transient val vector More...
 
static val_type val (const ref_type &ref, const map_assoc &iv)
 return values collection More...
 

Private Types

typedef KeyRefProd keyrefprod_type
 reference to "key" collection More...
 
typedef std::vector< std::pair< index, Q > > map_assoc
 internal map associated data More...
 
typedef ValRefProd valrefprod_type
 reference to "value" collection More...
 

Detailed Description

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
class edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >

Definition at line 21 of file OneToManyWithQualityGeneric.h.

Member Typedef Documentation

◆ data_type

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef std::pair<ValRef, Q> edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::data_type

insert val type

Definition at line 35 of file OneToManyWithQualityGeneric.h.

◆ index_type

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef index edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::index_type

index type

Definition at line 39 of file OneToManyWithQualityGeneric.h.

◆ key_type

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef KeyRef edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::key_type

insert key type

Definition at line 33 of file OneToManyWithQualityGeneric.h.

◆ keyrefprod_type

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef KeyRefProd edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::keyrefprod_type
private

reference to "key" collection

Definition at line 23 of file OneToManyWithQualityGeneric.h.

◆ map_assoc

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef std::vector<std::pair<index, Q> > edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::map_assoc
private

internal map associated data

Definition at line 27 of file OneToManyWithQualityGeneric.h.

◆ map_type

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef std::map<index_type, map_assoc> edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::map_type

map type

Definition at line 41 of file OneToManyWithQualityGeneric.h.

◆ quality_type

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef Q edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::quality_type

quality type

Definition at line 37 of file OneToManyWithQualityGeneric.h.

◆ ref_type

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef helpers::KeyVal<keyrefprod_type, valrefprod_type> edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::ref_type

reference set type

Definition at line 43 of file OneToManyWithQualityGeneric.h.

◆ transient_key_vector

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef std::vector<const typename CKey::value_type *> edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::transient_key_vector

transient key vector

Definition at line 48 of file OneToManyWithQualityGeneric.h.

◆ transient_map_type

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef std::map<const typename CKey::value_type *, std::vector<std::pair<const typename CVal::value_type *, Q> > > edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::transient_map_type

transient map type

Definition at line 46 of file OneToManyWithQualityGeneric.h.

◆ transient_val_vector

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef std::vector<std::vector<std::pair<const typename CVal::value_type *, Q> > > edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::transient_val_vector

transient val vector

Definition at line 50 of file OneToManyWithQualityGeneric.h.

◆ val_type

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef std::vector<std::pair<ValRef, Q> > edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::val_type

values reference collection type

Definition at line 31 of file OneToManyWithQualityGeneric.h.

◆ valrefprod_type

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
typedef ValRefProd edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::valrefprod_type
private

reference to "value" collection

Definition at line 25 of file OneToManyWithQualityGeneric.h.

Member Function Documentation

◆ insert() [1/2]

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
static void edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::insert ( ref_type ref,
map_type m,
const key_type k,
const data_type v 
)
inlinestatic

insert in the map

Definition at line 52 of file OneToManyWithQualityGeneric.h.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly(), and edm::OneToManyWithQualityGeneric< TrackingVertexCollection, edm::View< reco::Vertex >, double, unsigned int >::insert().

52  {
53  const ValRef &vref = v.first;
54  if (k.isNull() || vref.isNull())
55  Exception::throwThis(errors::InvalidReference, "can't insert null references in AssociationMap");
56  if (ref.key.isNull()) {
57  if (k.isTransient() || vref.isTransient()) {
59  "can't insert transient references in uninitialized AssociationMap");
60  }
61  //another thread might cause productGetter() to return a different value
62  EDProductGetter const *getter = ref.key.productGetter();
63  if (getter == nullptr) {
65  "Can't insert into AssociationMap unless it was properly initialized.\n"
66  "The most common fix for this is to add arguments to the call to the\n"
67  "AssociationMap constructor that are valid Handle's to the containers.\n"
68  "If you don't have valid handles or either template parameter to the\n"
69  "AssociationMap is a View, then see the comments in AssociationMap.h.\n"
70  "(note this was a new requirement added in the 7_5_X release series)\n");
71  }
72  ref.key = KeyRefProd(k.id(), getter);
73  ref.val = ValRefProd(vref.id(), ref.val.productGetter());
74  }
75  helpers::checkRef(ref.key, k);
76  helpers::checkRef(ref.val, vref);
77  index_type ik = index_type(k.key()), iv = index_type(vref.key());
78  m[ik].push_back(std::make_pair(iv, v.second));
79  }
int32_t *__restrict__ iv
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:86
void checkRef(const RP &rp, const R &r)
throw if r hasn&#39;t the same id as rp

◆ insert() [2/2]

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
static void edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::insert ( ref_type ref,
map_type m,
const key_type k,
const val_type v 
)
inlinestatic

Definition at line 80 of file OneToManyWithQualityGeneric.h.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly().

80  {
81  for (typename val_type::const_iterator i = v.begin(), iEnd = v.end(); i != iEnd; ++i)
82  insert(ref, m, k, *i);
83  }
static void insert(ref_type &ref, map_type &m, const key_type &k, const data_type &v)
insert in the map

◆ size()

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
static map_type::size_type edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::size ( const map_assoc v)
inlinestatic

size of data_type

Definition at line 92 of file OneToManyWithQualityGeneric.h.

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

92 { return v.size(); }

◆ sort()

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
static void edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::sort ( map_type m)
inlinestatic

sort

Definition at line 98 of file OneToManyWithQualityGeneric.h.

98  {
99  // using namespace boost::lambda;
100  for (typename map_type::iterator i = m.begin(), iEnd = m.end(); i != iEnd; ++i) {
101  using std::placeholders::_1;
102  using std::placeholders::_2;
103  map_assoc &v = i->second;
104  // Q std::pair<index, Q>::*quality = &std::pair<index, Q>::second;
105  // std::sort(v.begin(), v.end(),
106  // bind(quality, boost::lambda::_2) < bind(quality, boost::lambda::_1));
107  std::sort(v.begin(),
108  v.end(),
109  std::bind(std::less<Q>(),
110  std::bind(&std::pair<index, Q>::second, _2),
111  std::bind(&std::pair<index, Q>::second, _1)));
112  }
113  }
U second(std::pair< T, U > const &p)
std::vector< std::pair< index, Q > > map_assoc
internal map associated data

◆ transientKeyVector()

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
static transient_key_vector edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::transientKeyVector ( const ref_type ref,
const map_type map 
)
inlinestatic

fill transient key vector

Definition at line 134 of file OneToManyWithQualityGeneric.h.

134  {
136  if (!map.empty()) {
137  const CKey &ckey = *ref.key;
138  for (typename map_type::const_iterator i = map.begin(); i != map.end(); ++i)
139  m.push_back(&ckey[i->first]);
140  }
141  return m;
142  }
std::vector< const typename CKey::value_type * > transient_key_vector
transient key vector

◆ transientMap()

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
static transient_map_type edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::transientMap ( const ref_type ref,
const map_type map 
)
inlinestatic

fill transient map

Definition at line 115 of file OneToManyWithQualityGeneric.h.

115  {
117  if (!map.empty()) {
118  const CKey &ckey = *ref.key;
119  const CVal &cval = *ref.val;
120  for (typename map_type::const_iterator i = map.begin(); i != map.end(); ++i) {
121  const map_assoc &a = i->second;
122  const typename CKey::value_type *k = &ckey[i->first];
123  std::vector<std::pair<const typename CVal::value_type *, Q> > v;
124  for (typename map_assoc::const_iterator j = a.begin(); j != a.end(); ++j) {
125  const typename CVal::value_type *val = &cval[j->first];
126  v.push_back(std::make_pair(val, j->second));
127  }
128  m.insert(std::make_pair(k, v));
129  }
130  }
131  return m;
132  }
static val_type val(const ref_type &ref, const map_assoc &iv)
return values collection
std::map< const typename CKey::value_type *, std::vector< std::pair< const typename CVal::value_type *, Q > > > transient_map_type
transient map type
std::vector< std::pair< index, Q > > map_assoc
internal map associated data
double a
Definition: hdecay.h:121

◆ transientValVector()

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
static transient_val_vector edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::transientValVector ( const ref_type ref,
const map_type map 
)
inlinestatic

fill transient val vector

Definition at line 144 of file OneToManyWithQualityGeneric.h.

144  {
146  if (!map.empty()) {
147  const CVal &cval = *ref.val;
148  for (typename map_type::const_iterator i = map.begin(); i != map.end(); ++i) {
149  const map_assoc &a = i->second;
150  std::vector<std::pair<const typename CVal::value_type *, Q> > v;
151  m.push_back(v);
152  for (typename map_assoc::const_iterator j = a.begin(); j != a.end(); ++j)
153  m.back().push_back(std::make_pair(&cval[j->first], j->second));
154  }
155  }
156  return m;
157  }
std::vector< std::vector< std::pair< const typename CVal::value_type *, Q > > > transient_val_vector
transient val vector
std::vector< std::pair< index, Q > > map_assoc
internal map associated data
double a
Definition: hdecay.h:121

◆ val()

template<typename CKey, typename CVal, typename Q, typename index = unsigned int, typename KeyRefProd = typename helper::MapRefViewTrait<CKey>::refprod_type, typename ValRefProd = typename helper::MapRefViewTrait<CVal>::refprod_type, typename KeyRef = typename helper::MapRefViewTrait<CKey>::ref_type, typename ValRef = typename helper::MapRefViewTrait<CVal>::ref_type>
static val_type edm::OneToManyWithQualityGeneric< CKey, CVal, Q, index, KeyRefProd, ValRefProd, KeyRef, ValRef >::val ( const ref_type ref,
const map_assoc iv 
)
inlinestatic

return values collection

Definition at line 85 of file OneToManyWithQualityGeneric.h.

Referenced by edm::OneToManyWithQualityGeneric< TrackingVertexCollection, edm::View< reco::Vertex >, double, unsigned int >::transientMap().

85  {
86  val_type v;
87  for (typename map_assoc::const_iterator idx = iv.begin(), idxEnd = iv.end(); idx != idxEnd; ++idx)
88  v.push_back(std::make_pair(ValRef(ref.val, idx->first), idx->second));
89  return v;
90  }
int32_t *__restrict__ iv
std::vector< std::pair< ValRef, Q > > val_type
values reference collection type