1 #ifndef DataFormats_Common_OneToManyWithQualityGeneric_h
2 #define DataFormats_Common_OneToManyWithQualityGeneric_h
6 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
9 #include "boost/bind.hpp"
18 template<
typename CKey,
typename CVal,
typename Q,
typename index =
unsigned int,
19 typename KeyRefProd =
typename helper::MapRefViewTrait<CKey>::refprod_type,
20 typename ValRefProd =
typename helper::MapRefViewTrait<CVal>::refprod_type,
21 typename KeyRef =
typename helper::MapRefViewTrait<CKey>::ref_type,
22 typename ValRef =
typename helper::MapRefViewTrait<CVal>::ref_type >
29 typedef std::vector<std::pair<index, Q> >
map_assoc;
33 typedef std::vector<std::pair<ValRef, Q> >
val_type;
41 typedef std::map<index_type, map_assoc>
map_type;
46 std::vector<std::pair<const typename CVal::value_type *, Q > >
51 typedef std::vector<std::vector<std::pair<const typename CVal::value_type *, Q > >
56 const ValRef & vref = v.first;
57 if (k.isNull() || vref.isNull())
59 "can't insert null references in AssociationMap");
60 if (ref.
key.isNull()) {
66 m[ik].push_back(std::make_pair(iv, v.second));
69 for(
typename val_type::const_iterator
i = v.begin(), iEnd = v.end();
i != iEnd; ++
i)
75 for(
typename map_assoc::const_iterator
idx = iv.begin(), idxEnd = iv.end();
idx != idxEnd; ++
idx)
76 v.push_back(std::make_pair(ValRef(ref.
val,
idx->first),
idx->second));
84 for(
typename map_type::iterator
i = m.begin(), iEnd = m.end();
i != iEnd; ++
i) {
85 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
86 using std::placeholders::_1;
87 using std::placeholders::_2;
94 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
95 std::bind(std::less<Q>(),
98 boost::bind(std::less<Q>(),
109 const CKey & ckey = * ref.
key;
110 const CVal & cval = * ref.
val;
111 for(
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i) {
114 std::vector<std::pair<const typename CVal::value_type *, Q> >
v;
115 for(
typename map_assoc::const_iterator
j = a.begin();
j != a.end(); ++
j) {
117 v.push_back(std::make_pair(val,
j->second));
119 m.insert(std::make_pair(k, v));
126 const CKey & ckey = * ref.
key;
127 for(
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i)
128 m.push_back(& ckey[
i->first]);
134 const CVal & cval = * ref.
val;
135 for(
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i) {
137 std::vector<std::pair<const typename CVal::value_type *, Q> >
v;
139 for(
typename map_assoc::const_iterator
j = a.begin();
j != a.end(); ++
j)
140 m.back().push_back(std::make_pair(& cval[
j->first ],
j->second));
static map_type::size_type size(const map_assoc &v)
size of data_type
KeyRefProd keyrefprod_type
reference to "key" collection
static void sort(map_type &m)
sort
static transient_val_vector transientValVector(const ref_type &ref, const map_type &map)
fill transient val vector
static val_type val(const ref_type &ref, const map_assoc &iv)
return values collection
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
std::vector< std::pair< ValRef, Q > > val_type
values reference collection type
U second(std::pair< T, U > const &p)
KeyRef key_type
insert key type
static transient_key_vector transientKeyVector(const ref_type &ref, const map_type &map)
fill transient key vector
static void insert(ref_type &ref, map_type &m, const key_type &k, const val_type &v)
Container::value_type value_type
helpers::KeyVal< keyrefprod_type, valrefprod_type > ref_type
reference set type
index index_type
index type
std::vector< std::pair< index, Q > > map_assoc
internal map associated data
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
static transient_map_type transientMap(const ref_type &ref, const map_type &map)
fill transient map
std::pair< ValRef, Q > data_type
insert val type
std::vector< std::vector< std::pair< const typename CVal::value_type *, Q > > > transient_val_vector
transient val vector
std::vector< const typename CKey::value_type * > transient_key_vector
transient key vector
void checkRef(const RP &rp, const R &r)
throw if r hasn't the same id as rp
static void insert(ref_type &ref, map_type &m, const key_type &k, const data_type &v)
insert in the map
std::map< index_type, map_assoc > map_type
map type
ValRefProd valrefprod_type
reference to "value" collection
std::map< const typename CKey::value_type *, std::vector< std::pair< const typename CVal::value_type *, Q > > > transient_map_type
transient map type