27 assert (pHistMap.empty() != pHistVector.empty());
28 for (ProcessHistoryVector::const_iterator
i = pHistVector.begin(), e = pHistVector.end();
i != e; ++
i) {
29 pHistMap.insert(std::make_pair(
i->id(), *
i));
32 for (ProcessHistoryMap::const_iterator
i = pHistMap.begin(), e = pHistMap.end();
i != e; ++
i) {
39 assert(newHist.
size() ==
i->second.size());
41 pHistVector.push_back(newHist);
42 if (newphID != oldphID) {
46 assert(pHistVector.size() == pHistMap.size());
51 typedef std::set<OneHistory> Histories;
52 typedef std::pair<std::string, BranchID> Product;
53 typedef std::vector<Product> OrderedProducts;
55 explicit Sorter(Histories
const& histories) : histories_(histories) {}
56 bool operator()(Product
const&
a, Product
const&
b)
const;
57 Histories
const histories_;
59 bool Sorter::operator()(Product
const&
a, Product
const&
b)
const {
61 if (a.first == b.first)
return false;
62 bool mayBeTrue =
false;
63 for (Histories::const_iterator it = histories_.begin(), itEnd = histories_.end(); it != itEnd; ++it) {
64 OneHistory::const_iterator itA =
find_in_all(*it, a.first);
65 if (itA == it->end())
continue;
66 OneHistory::const_iterator itB =
find_in_all(*it, b.first);
67 if (itB == it->end())
continue;
81 procConfigVector.clear();
82 std::set<ProcessConfiguration> pcset;
83 for (ProcessHistoryVector::const_iterator it = pHistVec.begin(), itEnd = pHistVec.end();
85 for (ProcessConfigurationVector::const_iterator
i = it->begin(), iEnd = it->end();
87 if (pcset.insert(*i).second) {
88 procConfigVector.push_back(*
i);
95 fillListsAndIndexes(ProductRegistry
const& productRegistry,
97 boost::shared_ptr<BranchIDLists const>& branchIDLists,
98 std::vector<BranchListIndex>& branchListIndexes) {
99 OrderedProducts orderedProducts;
100 std::set<std::string> processNamesThatProduced;
102 for (ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end();
104 if (it->second.branchType() ==
InEvent) {
106 processNamesThatProduced.insert(it->second.processName());
107 orderedProducts.push_back(std::make_pair(it->second.processName(), it->second.branchID()));
110 assert (!orderedProducts.empty());
111 Histories processHistories;
113 for(ProcessHistoryMap::const_iterator it = pHistMap.begin(), itEnd = pHistMap.end(); it != itEnd; ++it) {
114 ProcessHistory
const& pHist = it->second;
115 OneHistory processHistory;
117 if (processNamesThatProduced.find(
i->processName()) != processNamesThatProduced.end()) {
118 processHistory.push_back(
i->processName());
121 max = (processHistory.size() > max ? processHistory.size() :
max);
122 assert(max <= processNamesThatProduced.size());
123 if (processHistory.size() > 1) {
124 processHistories.insert(processHistory);
131 std::string processName;
133 for (OrderedProducts::const_iterator it = orderedProducts.begin(), itEnd = orderedProducts.end(); it != itEnd; ++it) {
134 if (it->first != processName) {
135 if (!processName.empty()) {
137 branchListIndexes.push_back(blix);
141 processName = it->first;
143 p->push_back(it->second.id());
146 branchListIndexes.push_back(blix);
147 branchIDLists.reset(pv.release());
157 bool fullConversion) :
158 parameterSetIdConverter_(parameterSetIdConverter),
159 processHistoryIdConverter_(),
161 branchListIndexes_() {
163 fillProcessConfiguration(pHistVector, procConfigVector);
164 if (fullConversion) {
189 boost::shared_ptr<BranchIDLists const>
collection_type::const_iterator const_iterator
boost::shared_ptr< BranchIDLists const > branchIDLists_
unsigned short BranchListIndex
ProcessHistoryIdConverter processHistoryIdConverter_
boost::shared_ptr< BranchIDLists const > branchIDLists() const
std::vector< BranchIDList > BranchIDLists
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
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
void push_back(const_reference t)
ParameterSetConverter::ParameterSetIdConverter ParameterSetIdConverter
void fixProcessHistory(ProcessHistoryMap &pHistMap, ProcessHistoryVector &pHistVector)
std::vector< BranchID::value_type > BranchIDList
author Stefano ARGIRO author Bill Tanenbaum
ParameterSetID const & convertID(ParameterSetID const &oldID) const
ProcessHistoryID id() const
EventID const & max(EventID const &lh, EventID const &rh)
void branchListIndexes(BranchListIndexes &indexes) const