40 int lastDigit = count % 10;
41 if(lastDigit >= 4 || lastDigit == 0)
return th;
43 if(count % 100 - lastDigit == 10)
return th;
44 return (lastDigit == 1 ? st : (lastDigit == 2 ? nd : rd));
47 std::shared_ptr<T> createSharedPtrToStatic(
T* ptr) {
48 return std::shared_ptr<T>(ptr, do_nothing_deleter());
54 actReg_(desc.actReg_),
55 maxEvents_(desc.maxEvents_),
56 remainingEvents_(maxEvents_),
57 maxLumis_(desc.maxLumis_),
58 remainingLumis_(maxLumis_),
60 maxSecondsUntilRampdown_(desc.maxSecondsUntilRampdown_),
61 processingMode_(RunsLumisAndEvents),
62 moduleDescription_(desc.moduleDescription_),
63 productRegistry_(createSharedPtrToStatic<
ProductRegistry>(desc.productRegistry_)),
65 branchIDListHelper_(desc.branchIDListHelper_),
66 thinnedAssociationsHelper_(desc.thinnedAssociationsHelper_),
67 primary_(pset.getParameter<std::
string>(
"@module_label") == std::
string(
"@main_input")),
78 numberOfEventsBeforeBigSkip_(0) {
81 std::ostringstream statusfilename;
82 statusfilename <<
"source_" << getpid();
93 std::string const defaultMode(
"RunsLumisAndEvents");
103 if(processingMode == runMode) {
105 }
else if(processingMode == runLumiMode) {
107 }
else if(processingMode != defaultMode) {
109 <<
"InputSource::InputSource()\n"
110 <<
"The 'processingMode' parameter for sources has an illegal value '" << processingMode <<
"'\n"
111 <<
"Legal values are '" << defaultMode <<
"', '" << runLumiMode <<
"', or '" << runMode <<
"'.\n";
140 "'RunsLumisAndEvents': process runs, lumis, and events.\n"
141 "'RunsAndLumis': process runs and lumis (not events).\n"
142 "'Runs': process runs (not lumis or events).");
143 desc.
addUntracked<
bool>(
"writeStatusFile",
false)->setComment(
"Write a status file. Intended for use by workflow management.");
153 unsigned long toSkip =
receiver_->numberToSkip();
176 ItemType itemType = callWithTryCatchAndPrint<ItemType>( [
this](){
return getNextItemType(); },
"Calling InputSource::getNextItemType" );
217 }
else if(newState ==
IsRun || oldState ==
IsFile) {
220 }
else if(newState ==
IsLumi || oldState ==
IsRun) {
236 std::shared_ptr<LuminosityBlockAuxiliary>
239 "Calling InputSource::readLuminosityBlockAuxiliary_" );
242 std::shared_ptr<RunAuxiliary>
244 return callWithTryCatchAndPrint<std::shared_ptr<RunAuxiliary> >( [
this](){
return readRunAuxiliary_(); },
245 "Calling InputSource::readRunAuxiliary_" );
276 std::unique_ptr<FileBlock>
280 return callWithTryCatchAndPrint<std::unique_ptr<FileBlock> >( [
this](){
return readFile_(); },
281 "Calling InputSource::readFile_" );
286 if(fb !=
nullptr) fb->
close();
287 callWithTryCatchAndPrint<void>( [
this](){
closeFile_(); },
288 "Calling InputSource::closeFile_",
289 cleaningUpAfterException );
296 std::unique_ptr<FileBlock>
298 return std::unique_ptr<FileBlock>(
new FileBlock);
304 callWithTryCatchAndPrint<void>( [
this,&
runPrincipal](){
readRun_(runPrincipal); },
"Calling InputSource::readRun_" );
310 callWithTryCatchAndPrint<void>( [
this,&rp](){
readRun_(rp); },
"Calling InputSource::readRun_" );
316 callWithTryCatchAndPrint<void>( [
this,&lumiPrincipal](){
readLuminosityBlock_(lumiPrincipal); },
"Calling InputSource::readLuminosityBlock_" );
325 callWithTryCatchAndPrint<void>( [
this,&lbp](){
readLuminosityBlock_(lbp); },
"Calling InputSource::readLuminosityBlock_" );
352 callWithTryCatchAndPrint<void>( [
this,&ep](){
readEvent_(ep); },
"Calling InputSource::readEvent_" );
373 result =
readIt(eventID, ep, streamContext);
386 callWithTryCatchAndPrint<void>( [
this,&
offset](){
skip(offset); },
"Calling InputSource::skip" );
391 return callWithTryCatchAndPrint<bool>( [
this,&eventID](){
return goToEvent_(eventID); },
"Calling InputSource::goToEvent_" );
401 callWithTryCatchAndPrint<void>( [
this](){
rewind_(); },
"Calling InputSource::rewind_" );
403 unsigned int numberToSkip =
receiver_->numberToSkip();
414 <<
", Event " << eventID.
event()
416 <<
" at " << std::setprecision(3) <<
TimeOfDay();
420 statusFile << eventID <<
" time: " << std::setprecision(3) <<
TimeOfDay() <<
'\n';
430 <<
"InputSource::readIt()\n"
431 <<
"Random access is not implemented for this type of Input Source\n"
432 <<
"Contact a Framework Developer\n";
438 <<
"InputSource::setRun()\n"
439 <<
"Run number cannot be modified for this type of Input Source\n"
440 <<
"Contact a Framework Developer\n";
446 <<
"InputSource::setLumi()\n"
447 <<
"Luminosity Block ID cannot be modified for this type of Input Source\n"
448 <<
"Contact a Framework Developer\n";
454 <<
"InputSource::skip()\n"
455 <<
"Forking and random access are not implemented for this type of Input Source\n"
456 <<
"Contact a Framework Developer\n";
462 <<
"InputSource::goToEvent_()\n"
463 <<
"Random access is not implemented for this type of Input Source\n"
464 <<
"Contact a Framework Developer\n";
471 <<
"InputSource::rewind()\n"
472 <<
"Forking and random access are not implemented for this type of Input Source\n"
473 <<
"Contact a Framework Developer\n";
491 callWithTryCatchAndPrint<void>( [
this,&
run](){
beginRun(run); },
"Calling InputSource::beginRun" );
500 callWithTryCatchAndPrint<void>( [
this,&
run](){
endRun(run); },
"Calling InputSource::endRun", cleaningUpAfterException );
507 callWithTryCatchAndPrint<void>( [
this,&lb](){
beginLuminosityBlock(lb); },
"Calling InputSource::beginLuminosityBlock" );
516 callWithTryCatchAndPrint<void>( [
this,&lb](){
endLuminosityBlock(lb); },
"Calling InputSource::endLuminosityBlock", cleaningUpAfterException );
522 callWithTryCatchAndPrint<void>( [
this](){
preForkReleaseResources(); },
"Calling InputSource::preForkReleaseResources" );
528 "Calling InputSource::postForkReacquireResources" );
533 return callWithTryCatchAndPrint<bool>( [
this](){
return randomAccess_(); },
534 "Calling InputSource::randomAccess_" );
539 return callWithTryCatchAndPrint<ProcessingController::ForwardState>( [
this](){
return forwardState_(); },
540 "Calling InputSource::forwardState_" );
545 return callWithTryCatchAndPrint<ProcessingController::ReverseState>( [
this](){
return reverseState_(); },
546 "Calling InputSource::reverseState__" );
627 source_.actReg()->postSourceSignal_(sc_.streamID());
631 sentry_(source.
actReg()->preSourceLumiSignal_, source.
actReg()->postSourceLumiSignal_) {
635 sentry_(source.
actReg()->preSourceRunSignal_, source.
actReg()->postSourceRunSignal_) {
641 post_(source.
actReg()->postOpenFileSignal_),
643 usedFallback_(usedFallback) {
644 source.
actReg()->preOpenFileSignal_(lfn, usedFallback);
648 post_(lfn_, usedFallback_);
654 post_(source.
actReg()->postCloseFileSignal_),
656 usedFallback_(usedFallback) {
657 source.
actReg()->preCloseFileSignal_(lfn, usedFallback);
661 post_(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)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
RunSourceSentry(InputSource const &source)
EventID const & id() const
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
LuminosityBlockNumber_t luminosityBlock() const
unsigned int LuminosityBlockNumber_t
void setEndTime(Timestamp const &time)
Timestamp const & time() const
FileCloseSentry(InputSource const &source, std::string const &lfn, bool usedFallback)
TypeLabelList & typeLabelList()
used by the fwk to register the list of products of this module
EventSourceSentry(InputSource const &source, StreamContext &sc)
void fillLuminosityBlockPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
void addDefault(ParameterSetDescription const &psetDescription)
void setEndTime(Timestamp const &time)
SourceSentry(Sig &pre, Sig &post)
StreamID const & streamID() const
static const std::string kBaseType("EDAnalyzer")
volatile std::atomic< bool > shutdown_flag false
FileOpenSentry(InputSource const &source, std::string const &lfn, bool usedFallback)
static void addToRegistry(TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, bool iIsListener=false)
LumiSourceSentry(InputSource const &source)
std::string createGlobalIdentifier()