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());
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)
62 bool mayBeTrue =
false;
63 for (Histories::const_iterator
it = histories_.begin(), itEnd = histories_.end();
it != itEnd; ++
it) {
82 procConfigVector.clear();
83 std::set<ProcessConfiguration> pcset;
84 for (
auto const& history : pHistVec) {
85 for (
auto const&
process : history) {
86 if (pcset.insert(
process).second) {
87 procConfigVector.push_back(
process);
93 void fillListsAndIndexes(ProductRegistry& productRegistry,
95 std::shared_ptr<BranchIDLists const>& branchIDLists,
96 std::vector<BranchListIndex>& branchListIndexes) {
97 OrderedProducts orderedProducts;
98 std::set<std::string> processNamesThatProduced;
100 for (
auto&
item : prodList) {
101 BranchDescription&
prod =
item.second;
104 processNamesThatProduced.insert(
prod.processName());
105 orderedProducts.emplace_back(
prod.processName(),
prod.branchID());
108 assert(!orderedProducts.empty());
109 Histories processHistories;
111 for (ProcessHistoryMap::const_iterator
it = pHistMap.begin(), itEnd = pHistMap.end();
it != itEnd; ++
it) {
113 OneHistory processHistory;
115 if (processNamesThatProduced.find(
i->processName()) != processNamesThatProduced.end()) {
116 processHistory.push_back(
i->processName());
119 max = (processHistory.size() >
max ? processHistory.size() :
max);
120 assert(
max <= processNamesThatProduced.size());
121 if (processHistory.size() > 1) {
122 processHistories.insert(processHistory);
127 auto pv = std::make_unique<BranchIDLists>();
128 auto p = std::make_unique<BranchIDList>();
131 for (OrderedProducts::const_iterator
it = orderedProducts.begin(), itEnd = orderedProducts.end();
it != itEnd;
135 branchListIndexes.push_back(blix);
138 p = std::make_unique<BranchIDList>();
142 p->push_back(
it->second.id());
144 branchListIndexes.push_back(blix);
146 branchIDLists.reset(
pv.release());
156 : parameterSetIdConverter_(parameterSetIdConverter),
157 processHistoryIdConverter_(),
159 branchListIndexes_() {
161 fillProcessConfiguration(pHistVector, procConfigVector);
162 if (fullConversion) {
std::vector< ProcessHistory > ProcessHistoryVector
collection_type::const_iterator const_iterator
void branchListIndexes(BranchListIndexes &indexes) const
std::vector< ProcessConfiguration > ProcessConfigurationVector
unsigned short BranchListIndex
ProcessHistoryIdConverter processHistoryIdConverter_
ProcessHistoryID id() const
std::shared_ptr< BranchIDLists const > branchIDLists_
std::map< BranchKey, BranchDescription > ProductList
std::vector< std::string > StringVector
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
ParameterSetIdConverter parameterSetIdConverter_
std::vector< BranchListIndex > BranchListIndexes
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::shared_ptr< BranchIDLists const > branchIDLists() const
void emplace_back(Args &&... args)
ParameterSetID const & convertID(ParameterSetID const &oldID) const
std::map< ProcessHistoryID, ProcessHistory > ProcessHistoryMap
EventID const & max(EventID const &lh, EventID const &rh)