CMS 3D CMS Logo

BranchChildren.cc
Go to the documentation of this file.
2 
4 
5 namespace edm {
6  void BranchChildren::append_(map_t const& lookup,
8  BranchIDSet& itemSet,
9  std::map<BranchID, BranchID> const& droppedToKeptAlias) const {
10  auto const iter = lookup.find(item);
11  if (iter != lookup.end()) {
12  BranchIDSet const& branchIDs = iter->second;
13  for (BranchID const& branchID : branchIDs) {
14  auto it = droppedToKeptAlias.find(branchID);
15  // Insert the BranchID of the children into the set of descendants.
16  // If the insert succeeds, append recursively.
17  if (it == droppedToKeptAlias.end()) {
18  // Normal case. Not an EDAlias.
19  if (itemSet.insert(branchID).second) {
20  append_(lookup, branchID, itemSet, droppedToKeptAlias);
21  }
22  } else {
23  // In this case, we want to put the EDAlias in the
24  // set of things to drop because that is what really
25  // needs to be dropped, but the recursive search in
26  // the lookup map must continue with the original BranchID
27  // because that is what the lookup map contains.
28  if (itemSet.insert(it->second).second) {
29  append_(lookup, branchID, itemSet, droppedToKeptAlias);
30  }
31  }
32  }
33  }
34  }
35 
36  void BranchChildren::clear() { childLookup_.clear(); }
37 
39 
41 
43  BranchIDSet& descendants,
44  std::map<BranchID, BranchID> const& droppedToKeptAlias) const {
45  descendants.insert(parent.branchID());
46  // A little tricky here. The child lookup map is filled with the
47  // BranchID of the original product even if there was an EDAlias
48  // and the EDAlias was saved and the original branch dropped.
49  append_(childLookup_, parent.originalBranchID(), descendants, droppedToKeptAlias);
50  }
51 } // namespace edm
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::BranchChildren::clear
void clear()
Definition: BranchChildren.cc:36
edm::BranchChildren::append_
void append_(map_t const &lookup, BranchID item, BranchIDSet &itemSet, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
Definition: BranchChildren.cc:6
edm::BranchID
Definition: BranchID.h:14
edm::BranchChildren::insertEmpty
void insertEmpty(BranchID parent)
Definition: BranchChildren.cc:38
BranchDescription.h
edm::BranchChildren::appendToDescendants
void appendToDescendants(BranchDescription const &parent, BranchIDSet &descendants, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
Definition: BranchChildren.cc:42
edm::BranchChildren::BranchIDSet
std::set< BranchID > BranchIDSet
Definition: BranchChildren.h:20
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::BranchDescription
Definition: BranchDescription.h:32
edm::BranchChildren::map_t
std::map< BranchID, BranchIDSet > map_t
Definition: BranchChildren.h:21
child
Definition: simpleInheritance.h:11
class-composition.parent
parent
Definition: class-composition.py:98
edm::BranchChildren::childLookup_
map_t childLookup_
Definition: BranchChildren.h:44
edm::BranchChildren::insertChild
void insertChild(BranchID parent, BranchID child)
Definition: BranchChildren.cc:40
BranchChildren.h