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 primary_(pset.getParameter<std::
string>(
"@module_label") == std::
string(
"@main_input")),
77 numberOfEventsBeforeBigSkip_(0) {
80 std::ostringstream statusfilename;
81 statusfilename <<
"source_" << getpid();
92 std::string const defaultMode(
"RunsLumisAndEvents");
102 if(processingMode == runMode) {
104 }
else if(processingMode == runLumiMode) {
106 }
else if(processingMode != defaultMode) {
108 <<
"InputSource::InputSource()\n"
109 <<
"The 'processingMode' parameter for sources has an illegal value '" << processingMode <<
"'\n"
110 <<
"Legal values are '" << defaultMode <<
"', '" << runLumiMode <<
"', or '" << runMode <<
"'.\n";
139 "'RunsLumisAndEvents': process runs, lumis, and events.\n"
140 "'RunsAndLumis': process runs and lumis (not events).\n"
141 "'Runs': process runs (not lumis or events).");
142 desc.
addUntracked<
bool>(
"writeStatusFile",
false)->setComment(
"Write a status file. Intended for use by workflow management.");
152 unsigned long toSkip =
receiver_->numberToSkip();
175 ItemType itemType = callWithTryCatchAndPrint<ItemType>( [
this](){
return getNextItemType(); },
"Calling InputSource::getNextItemType" );
216 }
else if(newState ==
IsRun || oldState ==
IsFile) {
219 }
else if(newState ==
IsLumi || oldState ==
IsRun) {
235 std::shared_ptr<LuminosityBlockAuxiliary>
238 "Calling InputSource::readLuminosityBlockAuxiliary_" );
241 std::shared_ptr<RunAuxiliary>
243 return callWithTryCatchAndPrint<std::shared_ptr<RunAuxiliary> >( [
this](){
return readRunAuxiliary_(); },
244 "Calling InputSource::readRunAuxiliary_" );
275 std::unique_ptr<FileBlock>
279 return callWithTryCatchAndPrint<std::unique_ptr<FileBlock> >( [
this](){
return readFile_(); },
280 "Calling InputSource::readFile_" );
285 if(fb !=
nullptr) fb->
close();
286 callWithTryCatchAndPrint<void>( [
this](){
closeFile_(); },
287 "Calling InputSource::closeFile_",
288 cleaningUpAfterException );
295 std::unique_ptr<FileBlock>
297 return std::unique_ptr<FileBlock>(
new FileBlock);
303 callWithTryCatchAndPrint<void>( [
this,&
runPrincipal](){
readRun_(runPrincipal); },
"Calling InputSource::readRun_" );
309 callWithTryCatchAndPrint<void>( [
this,&rp](){
readRun_(rp); },
"Calling InputSource::readRun_" );
315 callWithTryCatchAndPrint<void>( [
this,&lumiPrincipal](){
readLuminosityBlock_(lumiPrincipal); },
"Calling InputSource::readLuminosityBlock_" );
324 callWithTryCatchAndPrint<void>( [
this,&lbp](){
readLuminosityBlock_(lbp); },
"Calling InputSource::readLuminosityBlock_" );
351 callWithTryCatchAndPrint<void>( [
this,&ep](){
readEvent_(ep); },
"Calling InputSource::readEvent_" );
372 result =
readIt(eventID, ep, streamContext);
385 callWithTryCatchAndPrint<void>( [
this,&
offset](){
skip(offset); },
"Calling InputSource::skip" );
390 return callWithTryCatchAndPrint<bool>( [
this,&eventID](){
return goToEvent_(eventID); },
"Calling InputSource::goToEvent_" );
400 callWithTryCatchAndPrint<void>( [
this](){
rewind_(); },
"Calling InputSource::rewind_" );
402 unsigned int numberToSkip =
receiver_->numberToSkip();
413 <<
", Event " << eventID.
event()
415 <<
" at " << std::setprecision(3) <<
TimeOfDay();
419 statusFile << eventID <<
" time: " << std::setprecision(3) <<
TimeOfDay() <<
'\n';
429 <<
"InputSource::readIt()\n"
430 <<
"Random access is not implemented for this type of Input Source\n"
431 <<
"Contact a Framework Developer\n";
437 <<
"InputSource::setRun()\n"
438 <<
"Run number cannot be modified for this type of Input Source\n"
439 <<
"Contact a Framework Developer\n";
445 <<
"InputSource::setLumi()\n"
446 <<
"Luminosity Block ID cannot be modified for this type of Input Source\n"
447 <<
"Contact a Framework Developer\n";
453 <<
"InputSource::skip()\n"
454 <<
"Forking and random access are not implemented for this type of Input Source\n"
455 <<
"Contact a Framework Developer\n";
461 <<
"InputSource::goToEvent_()\n"
462 <<
"Random access is not implemented for this type of Input Source\n"
463 <<
"Contact a Framework Developer\n";
470 <<
"InputSource::rewind()\n"
471 <<
"Forking and random access are not implemented for this type of Input Source\n"
472 <<
"Contact a Framework Developer\n";
490 callWithTryCatchAndPrint<void>( [
this,&
run](){
beginRun(run); },
"Calling InputSource::beginRun" );
499 callWithTryCatchAndPrint<void>( [
this,&
run](){
endRun(run); },
"Calling InputSource::endRun", cleaningUpAfterException );
506 callWithTryCatchAndPrint<void>( [
this,&lb](){
beginLuminosityBlock(lb); },
"Calling InputSource::beginLuminosityBlock" );
515 callWithTryCatchAndPrint<void>( [
this,&lb](){
endLuminosityBlock(lb); },
"Calling InputSource::endLuminosityBlock", cleaningUpAfterException );
521 callWithTryCatchAndPrint<void>( [
this](){
preForkReleaseResources(); },
"Calling InputSource::preForkReleaseResources" );
527 "Calling InputSource::postForkReacquireResources" );
532 return callWithTryCatchAndPrint<bool>( [
this](){
return randomAccess_(); },
533 "Calling InputSource::randomAccess_" );
538 return callWithTryCatchAndPrint<ProcessingController::ForwardState>( [
this](){
return forwardState_(); },
539 "Calling InputSource::forwardState_" );
544 return callWithTryCatchAndPrint<ProcessingController::ReverseState>( [
this](){
return reverseState_(); },
545 "Calling InputSource::reverseState__" );
626 source_.actReg()->postSourceSignal_(sc_.streamID());
630 sentry_(source.
actReg()->preSourceLumiSignal_, source.
actReg()->postSourceLumiSignal_) {
634 sentry_(source.
actReg()->preSourceRunSignal_, source.
actReg()->postSourceRunSignal_) {
640 post_(source.
actReg()->postOpenFileSignal_),
642 usedFallback_(usedFallback) {
643 source.
actReg()->preOpenFileSignal_(lfn, usedFallback);
647 post_(lfn_, usedFallback_);
653 post_(source.
actReg()->postCloseFileSignal_),
655 usedFallback_(usedFallback) {
656 source.
actReg()->preCloseFileSignal_(lfn, usedFallback);
660 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)
unsigned int offset(bool)
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()