39 int lastDigit = count % 10;
40 if(lastDigit >= 4 || lastDigit == 0)
return th;
42 if(count % 100 - lastDigit == 10)
return th;
43 return (lastDigit == 1 ? st : (lastDigit == 2 ? nd : rd));
49 actReg_(desc.actReg_),
50 maxEvents_(desc.maxEvents_),
51 remainingEvents_(maxEvents_),
52 maxLumis_(desc.maxLumis_),
53 remainingLumis_(maxLumis_),
55 maxSecondsUntilRampdown_(desc.maxSecondsUntilRampdown_),
56 processingMode_(RunsLumisAndEvents),
57 moduleDescription_(desc.moduleDescription_),
58 productRegistry_(desc.productRegistry_),
60 branchIDListHelper_(desc.branchIDListHelper_),
61 thinnedAssociationsHelper_(desc.thinnedAssociationsHelper_),
72 numberOfEventsBeforeBigSkip_(0) {
75 std::ostringstream statusfilename;
76 statusfilename <<
"source_" << getpid();
83 std::string const defaultMode(
"RunsLumisAndEvents");
93 if(processingMode == runMode) {
95 }
else if(processingMode == runLumiMode) {
97 }
else if(processingMode != defaultMode) {
99 <<
"InputSource::InputSource()\n"
100 <<
"The 'processingMode' parameter for sources has an illegal value '" << processingMode <<
"'\n"
101 <<
"Legal values are '" << defaultMode <<
"', '" << runLumiMode <<
"', or '" << runMode <<
"'.\n";
130 "'RunsLumisAndEvents': process runs, lumis, and events.\n"
131 "'RunsAndLumis': process runs and lumis (not events).\n"
132 "'Runs': process runs (not lumis or events).");
133 desc.
addUntracked<
bool>(
"writeStatusFile",
false)->setComment(
"Write a status file. Intended for use by workflow management.");
143 unsigned long toSkip =
receiver_->numberToSkip();
166 ItemType itemType = callWithTryCatchAndPrint<ItemType>( [
this](){
return getNextItemType(); },
"Calling InputSource::getNextItemType" );
207 }
else if(newState ==
IsRun || oldState ==
IsFile) {
210 }
else if(newState ==
IsLumi || oldState ==
IsRun) {
226 std::shared_ptr<LuminosityBlockAuxiliary>
229 "Calling InputSource::readLuminosityBlockAuxiliary_" );
232 std::shared_ptr<RunAuxiliary>
234 return callWithTryCatchAndPrint<std::shared_ptr<RunAuxiliary> >( [
this](){
return readRunAuxiliary_(); },
235 "Calling InputSource::readRunAuxiliary_" );
266 std::unique_ptr<FileBlock>
270 return callWithTryCatchAndPrint<std::unique_ptr<FileBlock> >( [
this](){
return readFile_(); },
271 "Calling InputSource::readFile_" );
276 if(fb !=
nullptr) fb->
close();
277 callWithTryCatchAndPrint<void>( [
this](){
closeFile_(); },
278 "Calling InputSource::closeFile_",
279 cleaningUpAfterException );
286 std::unique_ptr<FileBlock>
288 return std::unique_ptr<FileBlock>(
new FileBlock);
294 callWithTryCatchAndPrint<void>( [
this,&runPrincipal](){
readRun_(runPrincipal); },
"Calling InputSource::readRun_" );
300 callWithTryCatchAndPrint<void>( [
this,&rp](){
readRun_(rp); },
"Calling InputSource::readRun_" );
306 callWithTryCatchAndPrint<void>( [
this,&lumiPrincipal](){
readLuminosityBlock_(lumiPrincipal); },
"Calling InputSource::readLuminosityBlock_" );
315 callWithTryCatchAndPrint<void>( [
this,&lbp](){
readLuminosityBlock_(lbp); },
"Calling InputSource::readLuminosityBlock_" );
342 callWithTryCatchAndPrint<void>( [
this,&ep](){
readEvent_(ep); },
"Calling InputSource::readEvent_" );
363 result =
readIt(eventID, ep, streamContext);
376 callWithTryCatchAndPrint<void>( [
this,&
offset](){
skip(offset); },
"Calling InputSource::skip" );
381 return callWithTryCatchAndPrint<bool>( [
this,&eventID](){
return goToEvent_(eventID); },
"Calling InputSource::goToEvent_" );
391 callWithTryCatchAndPrint<void>( [
this](){
rewind_(); },
"Calling InputSource::rewind_" );
393 unsigned int numberToSkip =
receiver_->numberToSkip();
404 <<
", Event " << eventID.
event()
406 <<
" at " << std::setprecision(3) <<
TimeOfDay();
410 statusFile << eventID <<
" time: " << std::setprecision(3) <<
TimeOfDay() <<
'\n';
420 <<
"InputSource::readIt()\n"
421 <<
"Random access is not implemented for this type of Input Source\n"
422 <<
"Contact a Framework Developer\n";
428 <<
"InputSource::setRun()\n"
429 <<
"Run number cannot be modified for this type of Input Source\n"
430 <<
"Contact a Framework Developer\n";
436 <<
"InputSource::setLumi()\n"
437 <<
"Luminosity Block ID cannot be modified for this type of Input Source\n"
438 <<
"Contact a Framework Developer\n";
444 <<
"InputSource::skip()\n"
445 <<
"Forking and random access are not implemented for this type of Input Source\n"
446 <<
"Contact a Framework Developer\n";
452 <<
"InputSource::goToEvent_()\n"
453 <<
"Random access is not implemented for this type of Input Source\n"
454 <<
"Contact a Framework Developer\n";
461 <<
"InputSource::rewind()\n"
462 <<
"Forking and random access are not implemented for this type of Input Source\n"
463 <<
"Contact a Framework Developer\n";
481 callWithTryCatchAndPrint<void>( [
this,&
run](){
beginRun(run); },
"Calling InputSource::beginRun" );
490 callWithTryCatchAndPrint<void>( [
this,&
run](){
endRun(run); },
"Calling InputSource::endRun", cleaningUpAfterException );
497 callWithTryCatchAndPrint<void>( [
this,&lb](){
beginLuminosityBlock(lb); },
"Calling InputSource::beginLuminosityBlock" );
506 callWithTryCatchAndPrint<void>( [
this,&lb](){
endLuminosityBlock(lb); },
"Calling InputSource::endLuminosityBlock", cleaningUpAfterException );
512 callWithTryCatchAndPrint<void>( [
this](){
preForkReleaseResources(); },
"Calling InputSource::preForkReleaseResources" );
518 "Calling InputSource::postForkReacquireResources" );
523 return callWithTryCatchAndPrint<bool>( [
this](){
return randomAccess_(); },
524 "Calling InputSource::randomAccess_" );
529 return callWithTryCatchAndPrint<ProcessingController::ForwardState>( [
this](){
return forwardState_(); },
530 "Calling InputSource::forwardState_" );
535 return callWithTryCatchAndPrint<ProcessingController::ReverseState>( [
this](){
return reverseState_(); },
536 "Calling InputSource::reverseState__" );
617 source_.actReg()->postSourceSignal_(sc_.streamID());
621 sentry_(source.
actReg()->preSourceLumiSignal_, source.
actReg()->postSourceLumiSignal_) {
625 sentry_(source.
actReg()->preSourceRunSignal_, source.
actReg()->postSourceRunSignal_) {
631 post_(source.
actReg()->postOpenFileSignal_),
633 usedFallback_(usedFallback) {
634 source.
actReg()->preOpenFileSignal_(lfn, usedFallback);
638 post_(lfn_, usedFallback_);
644 post_(source.
actReg()->postCloseFileSignal_),
646 usedFallback_(usedFallback) {
647 source.
actReg()->preCloseFileSignal_(lfn, usedFallback);
651 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()