CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ProductIDToBranchID.cc
Go to the documentation of this file.
1 /*----------------------------------------------------------------------
2 
3 ProductIDToBranchID: Free functions to map between ProductIDs and BranchIDs
4 
5 ----------------------------------------------------------------------*/
6 
8 
9 namespace edm {
10 
11  BranchID
12  productIDToBranchID(ProductID const& pid, BranchIDLists const& lists, BranchListIndexes const& indexes) {
13 
14  if (pid.isValid()) {
15  size_t procIndex = pid.processIndex()-1;
16  if (procIndex < indexes.size()) {
17  BranchListIndex blix = indexes[procIndex];
18  if (blix < lists.size()) {
19  BranchIDList const& blist = lists[blix];
20  size_t prodIndex =pid.productIndex()-1;
21  if (prodIndex<blist.size()) {
22  BranchID::value_type bid = blist[prodIndex];
23  return BranchID(bid);
24  }
25  }
26  }
27  }
28  return BranchID();
29  }
30 }
unsigned short BranchListIndex
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
ProcessIndex productIndex() const
Definition: ProductID.h:37
std::vector< BranchListIndex > BranchListIndexes
BranchID productIDToBranchID(ProductID const &pid, BranchIDLists const &lists, BranchListIndexes const &indexes)
unsigned int value_type
Definition: BranchID.h:16
tuple pid
Definition: sysUtil.py:22
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
bool isValid() const
Definition: ProductID.h:35
ProcessIndex processIndex() const
Definition: ProductID.h:36