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 (ProcessHistoryVector::const_iterator it = pHistVec.begin(), itEnd = pHistVec.end();
84 for (ProcessConfigurationVector::const_iterator
i = it->begin(), iEnd = it->end();
86 if (pcset.insert(*i).second) {
87 procConfigVector.push_back(*
i);
94 fillListsAndIndexes(ProductRegistry
const& productRegistry,
96 boost::shared_ptr<BranchIDLists const>& branchIDLists,
97 std::vector<BranchListIndex>& branchListIndexes) {
98 OrderedProducts orderedProducts;
99 std::set<std::string> processNamesThatProduced;
101 for (ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end();
103 if (it->second.branchType() ==
InEvent) {
105 processNamesThatProduced.insert(it->second.processName());
106 orderedProducts.emplace_back(it->second.processName(), it->second.branchID());
109 assert (!orderedProducts.empty());
110 Histories processHistories;
112 for(ProcessHistoryMap::const_iterator it = pHistMap.begin(), itEnd = pHistMap.end(); it != itEnd; ++it) {
113 ProcessHistory
const& pHist = it->second;
114 OneHistory processHistory;
116 if (processNamesThatProduced.find(
i->processName()) != processNamesThatProduced.end()) {
117 processHistory.push_back(
i->processName());
120 max = (processHistory.size() > max ? processHistory.size() :
max);
121 assert(max <= processNamesThatProduced.size());
122 if (processHistory.size() > 1) {
123 processHistories.insert(processHistory);
132 for (OrderedProducts::const_iterator it = orderedProducts.begin(), itEnd = orderedProducts.end(); it != itEnd; ++it) {
133 if (it->first != processName) {
134 if (!processName.empty()) {
135 branchListIndexes.push_back(blix);
137 pv->push_back(std::move(*
p));
140 processName = it->first;
142 p->push_back(it->second.id());
144 branchListIndexes.push_back(blix);
145 pv->push_back(std::move(*
p));
146 branchIDLists.reset(pv.release());
156 bool fullConversion) :
157 parameterSetIdConverter_(parameterSetIdConverter),
158 processHistoryIdConverter_(),
160 branchListIndexes_() {
162 fillProcessConfiguration(pHistVector, procConfigVector);
163 if (fullConversion) {
188 boost::shared_ptr<BranchIDLists const>
collection_type::const_iterator const_iterator
boost::shared_ptr< BranchIDLists const > branchIDLists_
unsigned short BranchListIndex
ProcessHistoryIdConverter processHistoryIdConverter_
std::vector< BranchIDList > BranchIDLists
boost::shared_ptr< BranchIDLists const > branchIDLists() const
std::map< BranchKey, BranchDescription > ProductList
std::vector< std::string > StringVector
ProcessHistoryRegistry::collection_type ProcessHistoryMap
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)
ProcessConfigurationRegistry::vector_type ProcessConfigurationVector
ParameterSetIdConverter parameterSetIdConverter_
std::vector< BranchListIndex > BranchListIndexes
ProcessHistoryRegistry::vector_type ProcessHistoryVector
std::vector< BranchListIndex > branchListIndexes_
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
ParameterSetConverter::ParameterSetIdConverter ParameterSetIdConverter
void fixProcessHistory(ProcessHistoryMap &pHistMap, ProcessHistoryVector &pHistVector)
std::vector< BranchID::value_type > BranchIDList
ParameterSetID const & convertID(ParameterSetID const &oldID) const
ProcessHistoryID id() const
EventID const & max(EventID const &lh, EventID const &rh)
void branchListIndexes(BranchListIndexes &indexes) const