16 : mergeableRunProductProcesses_(&mergeableRunProductProcesses),
17 metadataForProcesses_(mergeableRunProductProcesses.
size()) {}
24 long long inputRunEntry,
27 unsigned int processIndex{0};
30 std::vector<LuminosityBlockNumber_t>::const_iterator lumisInRunBeingReadBegin;
31 std::vector<LuminosityBlockNumber_t>::const_iterator lumisInRunBeingReadEnd;
36 inputRunEntry, processName, valid, lumisInRunBeingReadBegin, lumisInRunBeingReadEnd)) {
41 std::vector<LuminosityBlockNumber_t>&
lumis = metadataForProcess.lumis();
46 bool elementsIn2NotIn1 =
false;
47 bool elementsIn1NotIn2 =
false;
48 bool sharedElements =
false;
50 std::vector<LuminosityBlockNumber_t>
temp;
51 temp.reserve(lumis.size() + (lumisInRunBeingReadEnd - lumisInRunBeingReadBegin));
52 std::vector<LuminosityBlockNumber_t>::const_iterator end1 = lumis.end();
53 std::vector<LuminosityBlockNumber_t>::const_iterator end2 = lumisInRunBeingReadEnd;
54 for (std::vector<LuminosityBlockNumber_t>::const_iterator iter1 = lumis.begin(),
55 iter2 = lumisInRunBeingReadBegin;
56 iter1 != end1 || iter2 != end2;) {
58 temp.push_back(*iter2);
60 elementsIn2NotIn1 =
true;
62 }
else if (iter2 == end2) {
63 temp.push_back(*iter1);
65 elementsIn1NotIn2 =
true;
67 }
else if (*iter1 < *iter2) {
68 temp.push_back(*iter1);
70 elementsIn1NotIn2 =
true;
71 }
else if (*iter1 > *iter2) {
72 temp.push_back(*iter2);
74 elementsIn2NotIn1 =
true;
77 sharedElements =
true;
78 temp.push_back(*iter1);
84 if (!sharedElements && elementsIn2NotIn1 && elementsIn1NotIn2) {
85 metadataForProcess.setMergeDecision(
MERGE);
87 metadataForProcess.setValid(
false);
89 }
else if (!elementsIn2NotIn1) {
90 metadataForProcess.setMergeDecision(
IGNORE);
91 }
else if (!elementsIn1NotIn2) {
92 metadataForProcess.setMergeDecision(
REPLACE);
94 metadataForProcess.setValid(
false);
99 metadataForProcess.setMergeDecision(
MERGE);
100 metadataForProcess.setValid(
false);
104 metadataForProcess.setMergeDecision(
MERGE);
106 metadataForProcess.setValid(
false);
108 metadataForProcess.setUseIndexIntoFile(
true);
141 lumisProcessed.push_back(
lumi);
144 std::sort(lumisProcessed.begin(), lumisProcessed.end());
145 auto uniqueEnd =
std::unique(lumisProcessed.begin(), lumisProcessed.end());
151 lumisProcessed.begin(), uniqueEnd, metadataForProcess.lumis().begin(), metadataForProcess.lumis().end()));
158 metadataForProcess.reset();
168 if (storedProcesses.empty()) {
173 unsigned long long endProcess = beginProcess;
175 std::vector<std::string>
const& processesWithMergeableRunProducts =
178 for (
unsigned int storedProcessIndex = 0; storedProcessIndex < storedProcesses.size(); ++storedProcessIndex) {
187 for (
unsigned int transientProcessIndex = 0; transientProcessIndex < processesWithMergeableRunProducts.size();
188 ++transientProcessIndex) {
192 if (processesWithMergeableRunProducts[transientProcessIndex] == storedProcesses[storedProcessIndex]) {
209 unsigned int storedProcessIndex,
210 unsigned long long beginProcess,
211 unsigned long long endProcess)
const {
218 unsigned long long iBeginLumi = 0;
219 unsigned long long iEndLumi = 0;
235 for (
unsigned long long kProcess = beginProcess; kProcess < endProcess; ++kProcess) {
239 if (metadataForProcess.
lumis().size() ==
240 (storedSingleRunEntryAndProcess.
endLumi() - storedSingleRunEntryAndProcess.
beginLumi())) {
241 iBeginLumi = storedSingleRunEntryAndProcess.
beginLumi();
242 iEndLumi = storedSingleRunEntryAndProcess.
endLumi();
248 std::vector<LuminosityBlockNumber_t>& storedLumis = storedMetadata.
lumis();
249 std::vector<LuminosityBlockNumber_t>
const& metdataLumis = metadataForProcess.
lumis();
250 iBeginLumi = storedLumis.size();
251 storedLumis.insert(storedLumis.end(), metdataLumis.begin(), metdataLumis.end());
252 iEndLumi = storedLumis.size();
256 iBeginLumi, iEndLumi, storedProcessIndex, metadataForProcess.
valid(), metadataForProcess.
allLumisProcessed());
261 std::string const& processThatCreatedProduct)
const {
263 if (metadataForProcess) {
267 <<
"It should not be possible for this error to occur.\n" 268 <<
"Contact a Framework developer\n";
274 if (metadataForProcess) {
275 return !metadataForProcess->
valid();
282 mergeDecision_ =
MERGE;
283 useIndexIntoFile_ =
false;
285 allLumisProcessed_ =
false;
290 unsigned int processIndex = 0;
295 return &metadataForProcess;
304 if (metadataForProcess.useIndexIntoFile()) {
305 metadataForProcess.setUseIndexIntoFile(
false);
307 std::vector<LuminosityBlockNumber_t>
temp;
309 std::vector<LuminosityBlockNumber_t>::const_iterator end1 = metadataForProcess.lumis().end();
311 for (std::vector<LuminosityBlockNumber_t>::const_iterator iter1 = metadataForProcess.lumis().begin(),
313 iter1 != end1 || iter2 != end2;) {
315 temp.push_back(*iter2);
318 }
else if (iter2 == end2) {
319 temp.push_back(*iter1);
322 }
else if (*iter1 < *iter2) {
323 temp.push_back(*iter1);
325 }
else if (*iter1 > *iter2) {
326 temp.push_back(*iter2);
330 temp.push_back(*iter1);
335 metadataForProcess.lumis().swap(temp);
tbb::concurrent_vector< xml::Document > includes
static const uint16_t valid_
unsigned int LuminosityBlockNumber_t
unsigned long long beginLumi() const
unsigned long long endLumi() const
def unique(seq, keepstr=True)
std::vector< std::string > const & processesWithMergeableRunProducts() const
void getLumisInRun(std::vector< LuminosityBlockNumber_t > &lumis) const