37 int lastDigit =
count % 10;
38 if (lastDigit >= 4 || lastDigit == 0)
41 if (
count % 100 - lastDigit == 10)
43 return (lastDigit == 1 ? st : (lastDigit == 2 ? nd : rd));
48 : actReg_(
desc.actReg_),
49 maxEvents_(
desc.maxEvents_),
50 remainingEvents_(maxEvents_),
51 maxLumis_(
desc.maxLumis_),
52 remainingLumis_(maxLumis_),
54 maxSecondsUntilRampdown_(
desc.maxSecondsUntilRampdown_),
55 processingMode_(RunsLumisAndEvents),
56 moduleDescription_(
desc.moduleDescription_),
57 productRegistry_(
desc.productRegistry_),
59 branchIDListHelper_(
desc.branchIDListHelper_),
60 processBlockHelper_(
desc.processBlockHelper_),
61 thinnedAssociationsHelper_(
desc.thinnedAssociationsHelper_),
71 numberOfEventsBeforeBigSkip_(0) {
72 if (
pset.getUntrackedParameter<
bool>(
"writeStatusFile",
false)) {
73 std::ostringstream statusfilename;
74 statusfilename <<
"source_" << getpid();
81 std::string const defaultMode(
"RunsLumisAndEvents");
97 <<
"InputSource::InputSource()\n" 98 <<
"The 'processingMode' parameter for sources has an illegal value '" <<
processingMode <<
"'\n" 99 <<
"Legal values are '" << defaultMode <<
"', '" << runLumiMode <<
"', or '" <<
runMode <<
"'.\n";
121 "'RunsLumisAndEvents': process runs, lumis, and events.\n" 122 "'RunsAndLumis': process runs and lumis (not events).\n" 123 "'Runs': process runs (not lumis or events).");
124 desc.addUntracked<
bool>(
"writeStatusFile",
false)
125 ->setComment(
"Write a status file. Intended for use by workflow management.");
138 "Calling InputSource::getNextItemType");
178 }
else if (newState ==
IsRun || oldState ==
IsFile) {
181 }
else if (newState ==
IsLumi || oldState ==
IsRun) {
198 return callWithTryCatchAndPrint<std::shared_ptr<LuminosityBlockAuxiliary> >(
203 return callWithTryCatchAndPrint<std::shared_ptr<RunAuxiliary> >([
this]() {
return readRunAuxiliary_(); },
204 "Calling InputSource::readRunAuxiliary_");
216 return std::pair<SharedResourcesAcquirer*, std::recursive_mutex*>(
nullptr,
nullptr);
225 return callWithTryCatchAndPrint<std::shared_ptr<FileBlock> >([
this]() {
return readFile_(); },
226 "Calling InputSource::readFile_");
232 callWithTryCatchAndPrint<void>(
233 [
this]() {
closeFile_(); },
"Calling InputSource::closeFile_", cleaningUpAfterException);
244 callWithTryCatchAndPrint<void>([
this, &runPrincipal]() {
readRun_(runPrincipal); },
245 "Calling InputSource::readRun_");
250 callWithTryCatchAndPrint<void>([
this, &rp]() {
readRun_(rp); },
"Calling InputSource::readRun_");
255 callWithTryCatchAndPrint<void>([
this, &lumiPrincipal]() {
readLuminosityBlock_(lumiPrincipal); },
256 "Calling InputSource::readLuminosityBlock_");
265 "Calling InputSource::readLuminosityBlock_");
279 callWithTryCatchAndPrint<void>([
this, &processBlockPrincipal]() {
readProcessBlock_(processBlockPrincipal); },
280 "Calling InputSource::readProcessBlock_");
308 callWithTryCatchAndPrint<void>([
this, &
ep]() {
readEvent_(
ep); },
"Calling InputSource::readEvent_");
339 callWithTryCatchAndPrint<void>([
this, &
offset]() {
skip(
offset); },
"Calling InputSource::skip");
343 return callWithTryCatchAndPrint<bool>([
this, &eventID]() {
return goToEvent_(eventID); },
344 "Calling InputSource::goToEvent_");
353 callWithTryCatchAndPrint<void>([
this]() {
rewind_(); },
"Calling InputSource::rewind_");
359 << eventID.
run() <<
", Event " << eventID.
event() <<
", LumiSection " 365 statusFile << eventID <<
" time: " << std::setprecision(3) <<
TimeOfDay() <<
'\n';
374 <<
"Random access is not implemented for this type of Input Source\n" 375 <<
"Contact a Framework Developer\n";
380 <<
"Run number cannot be modified for this type of Input Source\n" 381 <<
"Contact a Framework Developer\n";
386 <<
"Luminosity Block ID cannot be modified for this type of Input Source\n" 387 <<
"Contact a Framework Developer\n";
392 <<
"Random access are not implemented for this type of Input Source\n" 393 <<
"Contact a Framework Developer\n";
398 <<
"Random access is not implemented for this type of Input Source\n" 399 <<
"Contact a Framework Developer\n";
405 <<
"Random access are not implemented for this type of Input Source\n" 406 <<
"Contact a Framework Developer\n";
425 return callWithTryCatchAndPrint<bool>([
this]() {
return randomAccess_(); },
"Calling InputSource::randomAccess_");
429 return callWithTryCatchAndPrint<ProcessingController::ForwardState>([
this]() {
return forwardState_(); },
430 "Calling InputSource::forwardState_");
434 return callWithTryCatchAndPrint<ProcessingController::ReverseState>([
this]() {
return reverseState_(); },
435 "Calling InputSource::reverseState__");
468 : source_(
source), sc_(sc) {
495 source_.actReg()->postSourceProcessBlockSignal_(processName_);
499 : post_(
source.
actReg()->postOpenFileSignal_), lfn_(lfn) {
500 source.actReg()->preOpenFileSignal_(lfn);
506 : post_(
source.
actReg()->postCloseFileSignal_), lfn_(lfn) {
507 source.actReg()->preCloseFileSignal_(lfn);
static std::string const source("source")
InputSource const & source_
void fillLuminosityBlockPrincipal(ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
ProcessHistoryID const & processHistoryID() const
Guid const & processGUID()
unsigned int LuminosityBlockNumber_t
LuminosityBlockNumber_t luminosityBlock() const
EventSourceSentry(InputSource const &source, StreamContext &sc)
LuminosityBlockIndex index_
void addDefault(ParameterSetDescription const &psetDescription)
StreamID const & streamID() const
FileOpenSentry(InputSource const &source, std::string const &lfn)
Log< level::FwkInfo, true > LogFwkVerbatim
std::string const & processName() const
LumiSourceSentry(InputSource const &source, LuminosityBlockIndex id)
InputSource const & source_
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
~ProcessBlockSourceSentry()
ProcessBlockSourceSentry(InputSource const &, std::string const &)
LuminosityBlockIndex index() const
static std::string const kBaseType("Source")
LuminosityBlockAuxiliary const & aux() const
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
unsigned int value() const
RunSourceSentry(InputSource const &source, RunIndex id)
InputSource const & source_
EventNumber_t event() const
FileCloseSentry(InputSource const &source, std::string const &lfn)