24 assert(pHistMap.empty() != pHistVector.empty());
25 for (ProcessHistoryVector::const_iterator
i = pHistVector.begin(),
e = pHistVector.end();
i !=
e; ++
i) {
26 pHistMap.insert(std::make_pair(
i->id(), *
i));
29 for (ProcessHistoryMap::const_iterator
i = pHistMap.begin(),
e = pHistMap.end();
i !=
e; ++
i) {
34 newHist.
emplace_back(it->processName(), newPsetID, it->releaseVersion(), it->passID());
36 assert(newHist.
size() ==
i->second.size());
38 pHistVector.push_back(
std::move(newHist));
39 if (newphID != oldphID) {
43 assert(pHistVector.size() == pHistMap.size());
48 typedef std::set<OneHistory> Histories;
49 typedef std::pair<std::string, BranchID> Product;
50 typedef std::vector<Product> OrderedProducts;
52 explicit Sorter(Histories
const& histories) : histories_(histories) {}
53 bool operator()(Product
const&
a, Product
const&
b)
const;
54 Histories
const histories_;
56 bool Sorter::operator()(Product
const&
a, Product
const&
b)
const {
58 if (a.first == b.first)
60 bool mayBeTrue =
false;
61 for (Histories::const_iterator it = histories_.begin(), itEnd = histories_.end(); it != itEnd; ++it) {
62 OneHistory::const_iterator itA =
find_in_all(*it, a.first);
65 OneHistory::const_iterator itB =
find_in_all(*it, b.first);
80 procConfigVector.clear();
81 std::set<ProcessConfiguration> pcset;
82 for (
auto const& history : pHistVec) {
83 for (
auto const&
process : history) {
84 if (pcset.insert(
process).second) {
85 procConfigVector.push_back(
process);
95 OrderedProducts orderedProducts;
96 std::set<std::string> processNamesThatProduced;
98 for (
auto& item : prodList) {
102 processNamesThatProduced.insert(prod.
processName());
106 assert(!orderedProducts.empty());
107 Histories processHistories;
109 for (ProcessHistoryMap::const_iterator it = pHistMap.begin(), itEnd = pHistMap.end(); it != itEnd; ++it) {
111 OneHistory processHistory;
113 if (processNamesThatProduced.find(
i->processName()) != processNamesThatProduced.end()) {
117 max = (processHistory.size() > max ? processHistory.size() :
max);
118 assert(max <= processNamesThatProduced.size());
119 if (processHistory.size() > 1) {
120 processHistories.insert(processHistory);
125 auto pv = std::make_unique<BranchIDLists>();
126 auto p = std::make_unique<BranchIDList>();
129 for (OrderedProducts::const_iterator it = orderedProducts.begin(), itEnd = orderedProducts.end(); it != itEnd;
131 if (it->first != processName) {
132 if (!processName.empty()) {
133 branchListIndexes.push_back(blix);
138 processName = it->first;
140 p->push_back(it->second.id());
142 branchListIndexes.push_back(blix);
144 branchIDLists.reset(
pv.release());
159 fillProcessConfiguration(pHistVector, procConfigVector);
160 if (fullConversion) {
std::vector< ProcessHistory > ProcessHistoryVector
collection_type::const_iterator const_iterator
const_iterator begin() const
std::vector< ProcessConfiguration > ProcessConfigurationVector
unsigned short BranchListIndex
ProcessHistoryIdConverter processHistoryIdConverter_
BranchType const & branchType() const
std::shared_ptr< BranchIDLists const > branchIDLists_
std::map< BranchKey, BranchDescription > ProductList
std::vector< std::string > StringVector
std::string const & processName() const
ProvenanceAdaptor(ProductRegistry &productRegistry, ProcessHistoryMap &pHistMap, ProcessHistoryVector &pHistVector, ProcessConfigurationVector &procConfigVector, ParameterSetIdConverter const ¶meterSetIdConverter, bool fullConversion)
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
void emplace_back(Args &&...args)
ParameterSetIdConverter parameterSetIdConverter_
std::vector< BranchListIndex > BranchListIndexes
BranchID const & branchID() const
std::vector< BranchListIndex > branchListIndexes_
std::shared_ptr< BranchIDLists const > branchIDLists() const
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
void push_back(const_reference t)
ParameterSetConverter::ParameterSetIdConverter ParameterSetIdConverter
void fixProcessHistory(ProcessHistoryMap &pHistMap, ProcessHistoryVector &pHistVector)
ProductList & productListUpdator()
et
define resolution functions of each parameter
const_iterator end() const
std::vector< BranchID::value_type > BranchIDList
ParameterSetID const & convertID(ParameterSetID const &oldID) const
ProcessHistoryID id() const
std::map< ProcessHistoryID, ProcessHistory > ProcessHistoryMap
EventID const & max(EventID const &lh, EventID const &rh)
void branchListIndexes(BranchListIndexes &indexes) const