-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
117 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Gripe | ||
description: Describe a bug, problem, or annoyance that doesn't have a simple reproducer | ||
labels: ["best effort"] | ||
title: "[Gripe]: " | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
* **If you are able to define a minimal reproducer for the issue, please use a different issue type.** | ||
* **Gripes will be dealt with on a "best effort" basis only, and cannot be high priority.** | ||
* **Multiple iterations may be necessary to understand your issue well enough to posit a remedy.** | ||
- type: textarea | ||
id: gripe-details | ||
attributes: | ||
label: Details | ||
placeholder: Please describe your issue in as much detail as possible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,14 +131,14 @@ art::operator<<(std::ostream& os, MixHelper::Mode const mode) | |
switch (mode) { | ||
case MixHelper::Mode::SEQUENTIAL: | ||
return os << "SEQUENTIAL"; | ||
case MixHelper::Mode::RANDOM_OFFSET: | ||
return os << "RANDOM_OFFSET"; | ||
case MixHelper::Mode::RANDOM_REPLACE: | ||
return os << "RANDOM_REPLACE"; | ||
case MixHelper::Mode::RANDOM_LIM_REPLACE: | ||
return os << "RANDOM_LIM_REPLACE"; | ||
case MixHelper::Mode::RANDOM_NO_REPLACE: | ||
return os << "RANDOM_NO_REPLACE"; | ||
case MixHelper::Mode::UNKNOWN: | ||
return os << "UNKNOWN"; | ||
// No default so compiler can warn. | ||
} | ||
return os; | ||
|
@@ -189,6 +189,27 @@ art::MixHelper::createEngine(seed_t const seed, | |
seed, kind_of_engine_to_make, engine_label); | ||
} | ||
|
||
bool | ||
art::MixHelper::overThreshold_(size_t const nSecondaries, | ||
size_t const nEventsInFile) const | ||
{ | ||
switch (readMode_) { | ||
case Mode::SEQUENTIAL: | ||
[[fallthrough]]; | ||
case Mode::RANDOM_OFFSET: | ||
[[fallthrough]]; | ||
case Mode::RANDOM_NO_REPLACE: | ||
return nEventsReadThisFile_ + nSecondaries > nEventsInFile; | ||
case Mode::RANDOM_REPLACE: | ||
[[fallthrough]]; | ||
case Mode::RANDOM_LIM_REPLACE: | ||
return nEventsReadThisFile_ + nSecondaries > | ||
nEventsInFile * coverageFraction_; | ||
} | ||
assert(false); // unreachable | ||
return false; | ||
} | ||
|
||
bool | ||
art::MixHelper::generateEventSequence(size_t const nSecondaries, | ||
EntryNumberSequence& enSeq, | ||
|
@@ -201,12 +222,7 @@ art::MixHelper::generateEventSequence(size_t const nSecondaries, | |
} | ||
|
||
auto const nEventsInFile = ioHandle_->nEventsInFile(); | ||
bool const over_threshold = | ||
(readMode_ == Mode::SEQUENTIAL || readMode_ == Mode::RANDOM_NO_REPLACE) ? | ||
((nEventsReadThisFile_ + nSecondaries) > nEventsInFile) : | ||
((nEventsReadThisFile_ + nSecondaries) > | ||
(nEventsInFile * coverageFraction_)); | ||
if (over_threshold) { | ||
if (overThreshold_(nSecondaries, nEventsInFile)) { | ||
if (!providerFunc_) { | ||
++nOpensOverThreshold_; | ||
if (nOpensOverThreshold_ > filenames_.size()) { | ||
|
@@ -215,11 +231,13 @@ art::MixHelper::generateEventSequence(size_t const nSecondaries, | |
"the current event.\n"} | ||
<< "The number of requested secondaries (" << nSecondaries | ||
<< ") exceeds the number of events in any\n" | ||
<< "of the files specified for product mixing. For a read mode of '" | ||
<< "of the files specified for product mixing. For a read mode of " | ||
"'" | ||
<< readMode_ << "',\n" | ||
<< "the framework does not currently allow product-mixing to span " | ||
"multiple secondary\n" | ||
<< "input files for a given event. Please contact [email protected] " | ||
<< "input files for a given event. Please contact " | ||
"[email protected] " | ||
"for more information.\n"; | ||
} | ||
} | ||
|
@@ -233,13 +251,15 @@ art::MixHelper::generateEventSequence(size_t const nSecondaries, | |
nOpensOverThreshold_ = {}; | ||
switch (readMode_) { | ||
case Mode::SEQUENTIAL: | ||
[[fallthrough]]; | ||
case Mode::RANDOM_OFFSET: | ||
enSeq.resize(nSecondaries); | ||
std::iota(begin(enSeq), end(enSeq), nEventsReadThisFile_); | ||
break; | ||
case Mode::RANDOM_REPLACE: | ||
std::generate_n( | ||
std::back_inserter(enSeq), nSecondaries, [this, nEventsInFile] { | ||
return dist_.get()->fireInt(nEventsInFile); | ||
return dist_->fireInt(nEventsInFile); | ||
}); | ||
std::sort(enSeq.begin(), enSeq.end()); | ||
break; | ||
|
@@ -250,7 +270,7 @@ art::MixHelper::generateEventSequence(size_t const nSecondaries, | |
std::generate_n( | ||
std::inserter(entries, entries.begin()), | ||
nSecondaries - entries.size(), | ||
[this, nEventsInFile] { return dist_.get()->fireInt(nEventsInFile); }); | ||
[this, nEventsInFile] { return dist_->fireInt(nEventsInFile); }); | ||
} | ||
enSeq.assign(cbegin(entries), cend(entries)); | ||
std::sort(begin(enSeq), end(enSeq)); | ||
|
@@ -367,8 +387,9 @@ art::MixHelper::initReadMode_(std::string const& mode) const -> Mode | |
{ | ||
// These regexes must correspond by index to the valid Mode enumerator | ||
// values. | ||
static std::regex const robjs[4]{ | ||
static std::regex const robjs[5]{ | ||
std::regex("^seq", std::regex_constants::icase), | ||
std::regex("^randomoffset$", std::regex_constants::icase), | ||
std::regex("^random(replace)?$", std::regex_constants::icase), | ||
std::regex("^randomlimreplace$", std::regex_constants::icase), | ||
std::regex("^randomnoreplace$", std::regex_constants::icase)}; | ||
|
@@ -384,11 +405,25 @@ art::MixHelper::initReadMode_(std::string const& mode) const -> Mode | |
<< "Unrecognized value of readMode parameter: \"" << mode | ||
<< "\". Valid values are:\n" | ||
<< " sequential,\n" | ||
<< " randomOffset,\n" | ||
<< " randomReplace (random is accepted for reasons of legacy),\n" | ||
<< " randomLimReplace,\n" | ||
<< " randomNoReplace.\n"; | ||
} | ||
|
||
size_t | ||
art::MixHelper::eventOffset_(size_t nEventsInFile) | ||
{ | ||
if (readMode_ == Mode::SEQUENTIAL && eventsToSkip_) { | ||
return eventsToSkip_(); | ||
} | ||
if (readMode_ == Mode::RANDOM_OFFSET and not randomOffsetUsed_) { | ||
randomOffsetUsed_ = true; | ||
return dist_->fireInt(nEventsInFile); | ||
} | ||
return 0; | ||
} | ||
|
||
bool | ||
art::MixHelper::openNextFile_() | ||
{ | ||
|
@@ -416,10 +451,8 @@ art::MixHelper::openNextFile_() | |
} | ||
filename = *fileIter_; | ||
} | ||
nEventsReadThisFile_ = (readMode_ == Mode::SEQUENTIAL && eventsToSkip_) ? | ||
eventsToSkip_() : | ||
0; // Reset for this file. | ||
ioHandle_->openAndReadMetaData(filename, mixOps_); | ||
nEventsReadThisFile_ = eventOffset_(ioHandle_->nEventsInFile()); | ||
|
||
eventIDIndex_ = buildEventIDIndex(ioHandle_->fileIndex()); | ||
auto transMap = buildProductIDTransMap(mixOps_); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.