Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:33

0001 /*----------------------------------------------------------------------
0002   
0003 ProductIDToBranchID: Free functions to map between ProductIDs and BranchIDs
0004 
0005 ----------------------------------------------------------------------*/
0006 
0007 #include "DataFormats/Provenance/interface/ProductIDToBranchID.h"
0008 
0009 namespace edm {
0010 
0011   BranchID productIDToBranchID(ProductID const& pid, BranchIDLists const& lists, BranchListIndexes const& indexes) {
0012     if (pid.isValid()) {
0013       size_t procIndex = pid.processIndex() - 1;
0014       if (procIndex < indexes.size()) {
0015         BranchListIndex blix = indexes[procIndex];
0016         if (blix < lists.size()) {
0017           BranchIDList const& blist = lists[blix];
0018           size_t prodIndex = pid.productIndex() - 1;
0019           if (prodIndex < blist.size()) {
0020             BranchID::value_type bid = blist[prodIndex];
0021             return BranchID(bid);
0022           }
0023         }
0024       }
0025     }
0026     return BranchID();
0027   }
0028 }  // namespace edm