CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BranchIDListHelper.cc
Go to the documentation of this file.
2 
5 
6 namespace edm {
7 
9  branchIDLists_(),
10  branchIDToIndexMap_(),
11  branchListIndexMapper_() {}
12 
13  bool
15  bool unchanged = true;
16  branchListIndexMapper_.clear();
17  typedef BranchIDLists::const_iterator Iter;
18  for(Iter it = bidlists.begin(), itEnd = bidlists.end(); it != itEnd; ++it) {
19  BranchListIndex oldBlix = it - bidlists.begin();
20  Iter j = find_in_all(branchIDLists_, *it);
21  BranchListIndex blix = j - branchIDLists_.begin();
22  if(j == branchIDLists_.end()) {
23  branchIDLists_.push_back(*it);
24  for(BranchIDList::const_iterator i = it->begin(), iEnd = it->end(); i != iEnd; ++i) {
25  ProductIndex pix = i - it->begin();
26  branchIDToIndexMap_.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
27  }
28  }
29  branchListIndexMapper_.insert(std::make_pair(oldBlix, blix));
30  if(oldBlix != blix) {
31  unchanged = false;
32  }
33  }
34  return unchanged;
35  }
36 
37  void
39  BranchIDList bidlist;
40  // Add entries for current process for ProductID to BranchID mapping.
41  for(ProductRegistry::ProductList::const_iterator it = preg.productList().begin(), itEnd = preg.productList().end();
42  it != itEnd; ++it) {
43  if(it->second.produced()) {
44  if(it->second.branchType() == InEvent) {
45  bidlist.push_back(it->second.branchID().id());
46  }
47  }
48  }
49  if(!bidlist.empty()) {
50  BranchListIndex blix = branchIDLists_.size();
51  preg.setProducedBranchListIndex(blix);
52  branchIDLists_.push_back(bidlist);
53  for(BranchIDList::const_iterator i = bidlist.begin(), iEnd = bidlist.end(); i != iEnd; ++i) {
54  ProductIndex pix = i - bidlist.begin();
55  branchIDToIndexMap_.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
56  }
57  }
58  }
59 
60  void
62  for(BranchListIndex& i : indexes) {
64  }
65  }
66 }
int i
Definition: DBlmapReader.cc:9
unsigned short BranchListIndex
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
void fixBranchListIndexes(BranchListIndexes &indexes)
ProductList const & productList() const
void setProducedBranchListIndex(BranchListIndex blix) const
std::vector< BranchListIndex > BranchListIndexes
int j
Definition: DBlmapReader.cc:9
BranchListIndexMapper branchListIndexMapper_
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
Definition: Algorithms.h:32
BranchIDToIndexMap branchIDToIndexMap_
bool updateFromInput(BranchIDLists const &bidlists)
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
void updateRegistries(ProductRegistry const &reg)
unsigned short ProductIndex
Definition: ProductID.h:26