CMS 3D CMS Logo

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 productIDToBranchID(ProductID const& pid, BranchIDLists const& lists, BranchListIndexes const& indexes) {
12  if (pid.isValid()) {
13  size_t procIndex = pid.processIndex() - 1;
14  if (procIndex < indexes.size()) {
15  BranchListIndex blix = indexes[procIndex];
16  if (blix < lists.size()) {
17  BranchIDList const& blist = lists[blix];
18  size_t prodIndex = pid.productIndex() - 1;
19  if (prodIndex < blist.size()) {
20  BranchID::value_type bid = blist[prodIndex];
21  return BranchID(bid);
22  }
23  }
24  }
25  }
26  return BranchID();
27  }
28 } // namespace edm
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::BranchListIndexes
std::vector< BranchListIndex > BranchListIndexes
Definition: BranchListIndex.h:18
edm::ProductID::processIndex
ProcessIndex processIndex() const
Definition: ProductID.h:33
edm::ProductID::productIndex
ProcessIndex productIndex() const
Definition: ProductID.h:34
edm::BranchIDList
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
edm::BranchID
Definition: BranchID.h:14
edm::BranchListIndex
unsigned short BranchListIndex
Definition: BranchListIndex.h:17
edm::BranchIDLists
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
edm::BranchID::value_type
unsigned int value_type
Definition: BranchID.h:16
ProductIDToBranchID.h
edm::ProductID::isValid
bool isValid() const
Definition: ProductID.h:32
edm::productIDToBranchID
BranchID productIDToBranchID(ProductID const &pid, BranchIDLists const &lists, BranchListIndexes const &indexes)
Definition: ProductIDToBranchID.cc:11
edm::ProductID
Definition: ProductID.h:27