1 #ifndef DataFormats_Common_OneToMany_h
2 #define DataFormats_Common_OneToMany_h
11 template<
typename CKey,
typename CVal,
typename index =
unsigned int>
29 typedef std::map<index_type, map_assoc >
map_type;
34 std::vector<const typename CVal::value_type *>
45 "can't insert null references in AssociationMap");
46 if(ref.
key.isNull()) {
49 "can't insert transient references in uninitialized AssociationMap");
53 if(getter ==
nullptr) {
55 "Can't insert into AssociationMap unless it was properly initialized.\n"
56 "The most common fix for this is to add arguments to the call to the\n"
57 "AssociationMap constructor that are valid Handle's to the containers.\n"
58 "If you don't have valid handles or either template parameter to the\n"
59 "AssociationMap is a View, then see the comments in AssociationMap.h.\n"
60 "(note this was a new requirement added in the 7_5_X release series)\n");
67 m[ ik ].push_back(iv);
76 for(
typename map_assoc::const_iterator
idx = iv.begin(), idxEnd = iv.end();
idx != idxEnd; ++
idx)
88 const CKey & ckey = * ref.
key;
89 const CVal & cval = * ref.
val;
90 for(
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i) {
93 std::vector<const typename CVal::value_type *>
v;
94 for(
typename map_assoc::const_iterator
j = a.begin();
j != a.end(); ++
j) {
98 m.insert(std::make_pair(k, v));
107 const CKey & ckey = * ref.
key;
108 for(
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i)
109 m.push_back(& ckey[
i->first]);
117 const CVal & cval = * ref.
val;
118 for(
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i) {
120 std::vector<const typename CVal::value_type *>
v;
122 for(
typename map_assoc::const_iterator
j = a.begin();
j != a.end(); ++
j)
123 m.back().push_back(& cval[ *
j ]);
std::map< const typename CKey::value_type *, std::vector< const typename CVal::value_type * > > transient_map_type
transient map type
static void sort(map_type &)
sort
helpers::KeyVal< KeyRefProd, ValRefProd > ref_type
reference set type
static val_type val(const ref_type &ref, const map_assoc &iv)
return values collection
edm::Ref< CKey > key_type
insert key type
static void insert(ref_type &ref, map_type &m, const key_type &k, const data_type &v)
insert in the map
bool isTransient() const
Checks if this ref is transient (i.e. not persistable).
static void insert(ref_type &ref, map_type &m, const key_type &k, const val_type &v)
key_type key() const
Accessor for product key.
const_iterator end() const
Termination of iteration.
edm::Ref< CVal > data_type
insert val type
static map_type::size_type size(const map_assoc &v)
size of data_type
ProductID id() const
Accessor for product ID.
const_iterator begin() const
Initialize an iterator over the RefVector.
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
std::map< index_type, map_assoc > map_type
map type
index index_type
index type
edm::RefProd< CKey > KeyRefProd
reference to "key" collection
Container::value_type value_type
edm::RefProd< CVal > ValRefProd
reference to "value" collection
static transient_map_type transientMap(const ref_type &ref, const map_type &map)
fill transient map
bool isNull() const
Checks for null.
std::vector< const typename CKey::value_type * > transient_key_vector
transient key vector
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
edm::RefVector< CVal > val_type
values reference collection type
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
static transient_val_vector transientValVector(const ref_type &ref, const map_type &map)
fill transient val vector
static transient_key_vector transientKeyVector(const ref_type &ref, const map_type &map)
fill transient key vector
void checkRef(const RP &rp, const R &r)
throw if r hasn't the same id as rp
std::vector< std::vector< const typename CVal::value_type * > > transient_val_vector
transient val vector
std::vector< index > map_assoc
internal map associated data