00001 /*---------------------------------------------------------------------- 00002 00003 ProductIDToBranchID: Free functions to map between ProductIDs and BranchIDs 00004 00005 ----------------------------------------------------------------------*/ 00006 00007 #include "DataFormats/Provenance/interface/ProductIDToBranchID.h" 00008 00009 namespace edm { 00010 00011 BranchID 00012 productIDToBranchID(ProductID const& pid, BranchIDLists const& lists, BranchListIndexes const& indexes) { 00013 if (!pid.isValid()) { 00014 return BranchID(); 00015 } 00016 BranchID::value_type bid = 0; 00017 try { 00018 BranchListIndex blix = indexes.at(pid.processIndex()-1); 00019 BranchIDList const& blist = lists.at(blix); 00020 bid = blist.at(pid.productIndex()-1); 00021 } 00022 catch (std::exception) { 00023 return BranchID(); 00024 } 00025 return BranchID(bid); 00026 } 00027 }