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 <<
" on stream "<<streamID.
value()
371 <<
" at " << std::setprecision(3) <<
TimeOfDay();
375 statusFile << eventID <<
" time: " << std::setprecision(3) <<
TimeOfDay() <<
'\n';
385 <<
"InputSource::readIt()\n" 386 <<
"Random access is not implemented for this type of Input Source\n" 387 <<
"Contact a Framework Developer\n";
393 <<
"InputSource::setRun()\n" 394 <<
"Run number cannot be modified for this type of Input Source\n" 395 <<
"Contact a Framework Developer\n";
401 <<
"InputSource::setLumi()\n" 402 <<
"Luminosity Block ID cannot be modified for this type of Input Source\n" 403 <<
"Contact a Framework Developer\n";
409 <<
"InputSource::skip()\n" 410 <<
"Random access are not implemented for this type of Input Source\n" 411 <<
"Contact a Framework Developer\n";
417 <<
"InputSource::goToEvent_()\n" 418 <<
"Random access is not implemented for this type of Input Source\n" 419 <<
"Contact a Framework Developer\n";
426 <<
"InputSource::rewind()\n" 427 <<
"Random access are not implemented for this type of Input Source\n" 428 <<
"Contact a Framework Developer\n";
453 return callWithTryCatchAndPrint<bool>( [
this](){
return randomAccess_(); },
454 "Calling InputSource::randomAccess_" );
459 return callWithTryCatchAndPrint<ProcessingController::ForwardState>( [
this](){
return forwardState_(); },
460 "Calling InputSource::forwardState_" );
465 return callWithTryCatchAndPrint<ProcessingController::ReverseState>( [
this](){
return reverseState_(); },
466 "Calling InputSource::reverseState__" );
544 post_(source.
actReg()->postOpenFileSignal_),
546 usedFallback_(usedFallback) {
547 source.
actReg()->preOpenFileSignal_(lfn, usedFallback);
560 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)
EventID const & id() const
LuminosityBlockIndex index() 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)
LuminosityBlockIndex index_
void fillLuminosityBlockPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
void addDefault(ParameterSetDescription const &psetDescription)
StreamID streamID() const
InputSource const & source_
StreamID const & streamID() const
unsigned int value() const
LumiSourceSentry(InputSource const &source, LuminosityBlockIndex id)
InputSource const & source_
static const std::string kBaseType("EDAnalyzer")
FileOpenSentry(InputSource const &source, std::string const &lfn, bool usedFallback)
RunSourceSentry(InputSource const &source, RunIndex id)
InputSource const & source_
std::string createGlobalIdentifier()