36 int lastDigit = count % 10;
37 if(lastDigit >= 4 || lastDigit == 0)
return th;
39 if(count % 100 - lastDigit == 10)
return th;
40 return (lastDigit == 1 ? st : (lastDigit == 2 ? nd : rd));
45 actReg_(desc.actReg_),
46 maxEvents_(desc.maxEvents_),
47 remainingEvents_(maxEvents_),
48 maxLumis_(desc.maxLumis_),
49 remainingLumis_(maxLumis_),
51 maxSecondsUntilRampdown_(desc.maxSecondsUntilRampdown_),
52 processingMode_(RunsLumisAndEvents),
53 moduleDescription_(desc.moduleDescription_),
54 productRegistry_(desc.productRegistry_),
56 branchIDListHelper_(desc.branchIDListHelper_),
57 thinnedAssociationsHelper_(desc.thinnedAssociationsHelper_),
67 numberOfEventsBeforeBigSkip_(0) {
70 std::ostringstream statusfilename;
71 statusfilename <<
"source_" << getpid();
78 std::string const defaultMode(
"RunsLumisAndEvents");
88 if(processingMode == runMode) {
90 }
else if(processingMode == runLumiMode) {
92 }
else if(processingMode != defaultMode) {
94 <<
"InputSource::InputSource()\n" 95 <<
"The 'processingMode' parameter for sources has an illegal value '" << processingMode <<
"'\n" 96 <<
"Legal values are '" << defaultMode <<
"', '" << runLumiMode <<
"', or '" << runMode <<
"'.\n";
125 "'RunsLumisAndEvents': process runs, lumis, and events.\n" 126 "'RunsAndLumis': process runs and lumis (not events).\n" 127 "'Runs': process runs (not lumis or events).");
128 desc.
addUntracked<
bool>(
"writeStatusFile",
false)->setComment(
"Write a status file. Intended for use by workflow management.");
141 ItemType itemType = callWithTryCatchAndPrint<ItemType>( [
this](){
return getNextItemType(); },
"Calling InputSource::getNextItemType" );
182 }
else if(newState ==
IsRun || oldState ==
IsFile) {
185 }
else if(newState ==
IsLumi || oldState ==
IsRun) {
201 std::shared_ptr<LuminosityBlockAuxiliary>
204 "Calling InputSource::readLuminosityBlockAuxiliary_" );
207 std::shared_ptr<RunAuxiliary>
209 return callWithTryCatchAndPrint<std::shared_ptr<RunAuxiliary> >( [
this](){
return readRunAuxiliary_(); },
210 "Calling InputSource::readRunAuxiliary_" );
223 std::pair<SharedResourcesAcquirer*,std::recursive_mutex*>
228 std::pair<SharedResourcesAcquirer*,std::recursive_mutex*>
230 return std::pair<SharedResourcesAcquirer*,std::recursive_mutex*>(
nullptr,
nullptr);
238 std::unique_ptr<FileBlock>
242 return callWithTryCatchAndPrint<std::unique_ptr<FileBlock> >( [
this](){
return readFile_(); },
243 "Calling InputSource::readFile_" );
248 if(fb !=
nullptr) fb->
close();
249 callWithTryCatchAndPrint<void>( [
this](){
closeFile_(); },
250 "Calling InputSource::closeFile_",
251 cleaningUpAfterException );
258 std::unique_ptr<FileBlock>
260 return std::make_unique<FileBlock>();
266 callWithTryCatchAndPrint<void>( [
this,&runPrincipal](){
readRun_(runPrincipal); },
"Calling InputSource::readRun_" );
272 callWithTryCatchAndPrint<void>( [
this,&rp](){
readRun_(rp); },
"Calling InputSource::readRun_" );
278 callWithTryCatchAndPrint<void>( [
this,&lumiPrincipal](){
readLuminosityBlock_(lumiPrincipal); },
"Calling InputSource::readLuminosityBlock_" );
287 callWithTryCatchAndPrint<void>( [
this,&lbp](){
readLuminosityBlock_(lbp); },
"Calling InputSource::readLuminosityBlock_" );
314 callWithTryCatchAndPrint<void>( [
this,&ep](){
readEvent_(ep); },
"Calling InputSource::readEvent_" );
332 result =
readIt(eventID, ep, streamContext);
345 callWithTryCatchAndPrint<void>( [
this,&
offset](){
skip(offset); },
"Calling InputSource::skip" );
350 return callWithTryCatchAndPrint<bool>( [
this,&eventID](){
return goToEvent_(eventID); },
"Calling InputSource::goToEvent_" );
360 callWithTryCatchAndPrint<void>( [
this](){
rewind_(); },
"Calling InputSource::rewind_" );
368 <<
", Event " << eventID.
event()
370 <<
" at " << std::setprecision(3) <<
TimeOfDay();
374 statusFile << eventID <<
" time: " << std::setprecision(3) <<
TimeOfDay() <<
'\n';
384 <<
"InputSource::readIt()\n" 385 <<
"Random access is not implemented for this type of Input Source\n" 386 <<
"Contact a Framework Developer\n";
392 <<
"InputSource::setRun()\n" 393 <<
"Run number cannot be modified for this type of Input Source\n" 394 <<
"Contact a Framework Developer\n";
400 <<
"InputSource::setLumi()\n" 401 <<
"Luminosity Block ID cannot be modified for this type of Input Source\n" 402 <<
"Contact a Framework Developer\n";
408 <<
"InputSource::skip()\n" 409 <<
"Random access are not implemented for this type of Input Source\n" 410 <<
"Contact a Framework Developer\n";
416 <<
"InputSource::goToEvent_()\n" 417 <<
"Random access is not implemented for this type of Input Source\n" 418 <<
"Contact a Framework Developer\n";
425 <<
"InputSource::rewind()\n" 426 <<
"Random access are not implemented for this type of Input Source\n" 427 <<
"Contact a Framework Developer\n";
460 return callWithTryCatchAndPrint<bool>( [
this](){
return randomAccess_(); },
461 "Calling InputSource::randomAccess_" );
466 return callWithTryCatchAndPrint<ProcessingController::ForwardState>( [
this](){
return forwardState_(); },
467 "Calling InputSource::forwardState_" );
472 return callWithTryCatchAndPrint<ProcessingController::ReverseState>( [
this](){
return reverseState_(); },
473 "Calling InputSource::reverseState__" );
535 sentry_(source.
actReg()->preSourceLumiSignal_, source.
actReg()->postSourceLumiSignal_) {
545 post_(source.
actReg()->postOpenFileSignal_),
547 usedFallback_(usedFallback) {
548 source.
actReg()->preOpenFileSignal_(lfn, usedFallback);
561 source.
actReg()->preCloseFileSignal_(lfn, usedFallback);
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
static std::string const source("source")
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
RunSourceSentry(InputSource const &source)
EventID const & id() const
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
LuminosityBlockNumber_t luminosityBlock() const
unsigned int LuminosityBlockNumber_t
Timestamp const & time() const
FileCloseSentry(InputSource const &source, std::string const &lfn, bool usedFallback)
EventSourceSentry(InputSource const &source, StreamContext &sc)
void fillLuminosityBlockPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
void addDefault(ParameterSetDescription const &psetDescription)
SourceSentry(Sig &pre, Sig &post)
InputSource const & source_
StreamID const & streamID() const
static const std::string kBaseType("EDAnalyzer")
FileOpenSentry(InputSource const &source, std::string const &lfn, bool usedFallback)
LumiSourceSentry(InputSource const &source)
std::string createGlobalIdentifier()