26 assert (pHistMap.empty() != pHistVector.empty());
27 for (ProcessHistoryVector::const_iterator
i = pHistVector.begin(),
e = pHistVector.end();
i !=
e; ++
i) {
28 pHistMap.insert(std::make_pair(
i->id(), *
i));
31 for (ProcessHistoryMap::const_iterator
i = pHistMap.begin(),
e = pHistMap.end();
i !=
e; ++
i) {
36 newHist.
emplace_back(it->processName(), newPsetID, it->releaseVersion(), it->passID());
38 assert(newHist.
size() ==
i->second.size());
40 pHistVector.push_back(
std::move(newHist));
41 if (newphID != oldphID) {
45 assert(pHistVector.size() == pHistMap.size());
50 typedef std::set<OneHistory> Histories;
51 typedef std::pair<std::string, BranchID> Product;
52 typedef std::vector<Product> OrderedProducts;
54 explicit Sorter(Histories
const& histories) : histories_(histories) {}
55 bool operator()(Product
const&
a, Product
const&
b)
const;
56 Histories
const histories_;
58 bool Sorter::operator()(Product
const&
a, Product
const&
b)
const {
60 if (a.first == b.first)
return false;
61 bool mayBeTrue =
false;
62 for (Histories::const_iterator it = histories_.begin(), itEnd = histories_.end(); it != itEnd; ++it) {
63 OneHistory::const_iterator itA =
find_in_all(*it, a.first);
64 if (itA == it->end())
continue;
65 OneHistory::const_iterator itB =
find_in_all(*it, b.first);
66 if (itB == it->end())
continue;
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);
96 OrderedProducts orderedProducts;
97 std::set<std::string> processNamesThatProduced;
99 for (
auto& item : prodList) {
103 processNamesThatProduced.insert(prod.
processName());
107 assert (!orderedProducts.empty());
108 Histories processHistories;
110 for(ProcessHistoryMap::const_iterator it = pHistMap.begin(), itEnd = pHistMap.end(); it != itEnd; ++it) {
112 OneHistory processHistory;
114 if (processNamesThatProduced.find(
i->processName()) != processNamesThatProduced.end()) {
118 max = (processHistory.size() > max ? processHistory.size() :
max);
119 assert(max <= processNamesThatProduced.size());
120 if (processHistory.size() > 1) {
121 processHistories.insert(processHistory);
126 auto pv = std::make_unique<BranchIDLists>();
127 auto p = std::make_unique<BranchIDList>();
130 for (OrderedProducts::const_iterator it = orderedProducts.begin(), itEnd = orderedProducts.end(); it != itEnd; ++it) {
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());
154 bool fullConversion) :
160 fillProcessConfiguration(pHistVector, procConfigVector);
161 if (fullConversion) {
186 std::shared_ptr<BranchIDLists const>
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